diff --git a/ios/Classes/EnforceBinding.swift b/ios/Classes/EnforceBinding.swift new file mode 100644 index 0000000..fb7be0f --- /dev/null +++ b/ios/Classes/EnforceBinding.swift @@ -0,0 +1,3 @@ +public func dummyMethodToEnforceBundling() { + enforce_binding() // disable tree shaking +} diff --git a/ios/Classes/binding.h b/ios/Classes/binding.h new file mode 100644 index 0000000..e34d5a5 --- /dev/null +++ b/ios/Classes/binding.h @@ -0,0 +1 @@ +void enforce_binding(); \ No newline at end of file diff --git a/ios/Classes/readability.c b/ios/Classes/readability.c index 2744dc1..3d3be98 100644 --- a/ios/Classes/readability.c +++ b/ios/Classes/readability.c @@ -1,3 +1,3 @@ // Relative import to be able to reuse the C sources. // See the comment in ../{projectName}}.podspec for more information. -#include "../../src/readability.c" +// #include "../../src/readability.c" diff --git a/ios/libreadability.xcframework/Info.plist b/ios/libreadability.xcframework/Info.plist new file mode 100644 index 0000000..231f525 --- /dev/null +++ b/ios/libreadability.xcframework/Info.plist @@ -0,0 +1,48 @@ + + + + + AvailableLibraries + + + BinaryPath + libreadability.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64 + LibraryPath + libreadability.a + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + BinaryPath + libreadability.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + libreadability.a + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/ios/libreadability.xcframework/ios-arm64/Headers b/ios/libreadability.xcframework/ios-arm64/Headers new file mode 100644 index 0000000..cae0cf4 --- /dev/null +++ b/ios/libreadability.xcframework/ios-arm64/Headers @@ -0,0 +1,104 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package github.com/SphericalKat/readability-go */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" + +#include + +typedef struct { + char* title; + char* author; + int length; + char* excerpt; + char* site_name; + char* image_url; + char* favicon_url; + char* content; // HTML content + char* text_content; // text content + char* language; + char* published_time; + char* err; + int success; +} CArticle; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern CArticle Parse(char* url); +extern void FreeArticle(CArticle article); +extern void enforce_binding(); + +#ifdef __cplusplus +} +#endif diff --git a/ios/libreadability.xcframework/ios-arm64/libreadability.a b/ios/libreadability.xcframework/ios-arm64/libreadability.a new file mode 100644 index 0000000..7d5b218 Binary files /dev/null and b/ios/libreadability.xcframework/ios-arm64/libreadability.a differ diff --git a/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/Headers b/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/Headers new file mode 100644 index 0000000..cae0cf4 --- /dev/null +++ b/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/Headers @@ -0,0 +1,104 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package github.com/SphericalKat/readability-go */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" + +#include + +typedef struct { + char* title; + char* author; + int length; + char* excerpt; + char* site_name; + char* image_url; + char* favicon_url; + char* content; // HTML content + char* text_content; // text content + char* language; + char* published_time; + char* err; + int success; +} CArticle; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern CArticle Parse(char* url); +extern void FreeArticle(CArticle article); +extern void enforce_binding(); + +#ifdef __cplusplus +} +#endif diff --git a/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/libreadability.a b/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/libreadability.a new file mode 100644 index 0000000..8f96b03 Binary files /dev/null and b/ios/libreadability.xcframework/ios-arm64_x86_64-simulator/libreadability.a differ diff --git a/ios/readability.podspec b/ios/readability.podspec index 81af721..ee16768 100644 --- a/ios/readability.podspec +++ b/ios/readability.podspec @@ -22,6 +22,9 @@ A new Flutter FFI plugin project. s.dependency 'Flutter' s.platform = :ios, '12.0' + s.public_header_files = 'Classes/**/*.h' + s.vendored_frameworks = 'libreadability.xcframework' + # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0'