Skip to content

Commit

Permalink
feat: apple silicon support (NativeScript#108)
Browse files Browse the repository at this point in the history
* feat: Add support for Apple silicon

* feat: Multi-arch metadata generator

* build: simplify build scripts

Co-authored-by: Darin Dimitrov <[email protected]>
  • Loading branch information
rigor789 and darind authored Apr 7, 2021
1 parent 6ec9335 commit 83982aa
Show file tree
Hide file tree
Showing 53 changed files with 597 additions and 92 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = libffi
url = https://github.com/NativeScript/libffi.git
branch = darind/v8-ios
[submodule "llvm"]
path = llvm
url = https://github.com/NativeScript/ios-llvm.git
branch = master
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ os: osx
osx_image: xcode11
language: objective-c
git:
submodules: false
submodules: true
depth: 1

before_install:
- curl https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz --output $HOME/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
- tar -xzf $HOME/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz --directory $HOME
- export PATH=$PATH:$HOME/clang+llvm-8.0.0-x86_64-apple-darwin/bin
- llvm-config --version
- cmake --version
- make --version
- brew install chargepoint/xcparse/xcparse
Expand Down
Binary file not shown.
40 changes: 40 additions & 0 deletions AppWithModules/Frameworks/TNSWidgets.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// NSData+Async.h
// TNSWidgets
//
// Created by Peter Staev on 7.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSData (Async)

+ (void)dataWithContentsOfFile:(nonnull NSString*)path
completion:(void (^) (NSData*))callback;

- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) ())callback;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// NSString+Async.h
// TNSWidgets
//
// Created by Peter Staev on 5.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (Async)

+ (void)stringWithContentsOfFile:(nonnull NSString*)path
encoding:(NSStringEncoding)enc
completion:(void (^) (NSString*, NSError*))callback;

- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
encoding:(NSStringEncoding)enc
completion:(void (^) (NSError*))callback;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
#import "UIView+PassThroughParent.h"
#import "TNSLabel.h"
#import "TNSProcess.h"
#import "NSString+Async.h"
#import "NSData+Async.h"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <objc/runtime.h>


@interface NSObject (Swizzling)

+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


@interface UIView (PropertyBag)

- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;

@end
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// NSData+Async.h
// TNSWidgets
//
// Created by Peter Staev on 7.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSData (Async)

+ (void)dataWithContentsOfFile:(nonnull NSString*)path
completion:(void (^) (NSData*))callback;

- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) ())callback;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// NSString+Async.h
// TNSWidgets
//
// Created by Peter Staev on 5.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (Async)

+ (void)stringWithContentsOfFile:(nonnull NSString*)path
encoding:(NSStringEncoding)enc
completion:(void (^) (NSString*, NSError*))callback;

- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
encoding:(NSStringEncoding)enc
completion:(void (^) (NSError*))callback;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// TNSLabel.h
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TNSLabel : UILabel

@property(nonatomic) UIEdgeInsets padding;
@property(nonatomic) UIEdgeInsets borderThickness;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// TNSProcess.h
// TNSWidgets
//
// Created by Panayot Cankov on 15/05/2017.
// Copyright © 2017 Telerik A D. All rights reserved.
//

#ifndef TNSProcess_h
#define TNSProcess_h

#import <Foundation/Foundation.h>

/**
* Get the milliseconds since the process started.
*/
double __tns_uptime();

/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.
* We rarely need to log in release but in cases such as when logging app startup times in release,
* this will be convenient shortcut to NSLog, NSLog is not exposed.
*
* Please note the {N} CLI may be filtering app output, prefixing the message with "CONSOLE LOG"
* will make the logs visible in "tns run ios --release" builds.
*/
void __nslog(NSString* message);

#endif /* TNSProcess_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// TNSWidgets.h
// TNSWidgets
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for TNSWidgets.
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;

//! Project version string for TNSWidgets.
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>

#import "UIImage+TNSBlocks.h"
#import "UIView+PassThroughParent.h"
#import "TNSLabel.h"
#import "TNSProcess.h"
#import "NSString+Async.h"
#import "NSData+Async.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// UIImage+UIImage_Async.h
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//

@interface UIImage (TNSBlocks)

/**
* Similar to imageNamed: however it runs on a separate queue so the UI thread is not blocked.
* It also draws the UIImage in a small thumb to force decoding potentially avoiding UI hicckups when displayed.
*/
+ (void) tns_safeDecodeImageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;

/**
* Same as imageNamed, however calls to this method are sinchronized to be thread safe in iOS8 along with calls to tns_safeImageNamed and tns_safeDecodeImageNamed:completion:
* imageNamed is thread safe in iOS 9 and later so in later versions this methods simply fallbacks to imageNamed:
*/
+ (UIImage*) tns_safeImageNamed: (NSString*) name;

+ (void) tns_decodeImageWithData: (NSData*) data completion: (void (^) (UIImage*))callback;
+ (void) tns_decodeImageWidthContentsOfFile: (NSString*) file completion: (void (^) (UIImage*))callback;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// UIView+PassThroughParent.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface UIView (PassThroughParent)

- (BOOL) passThroughParent;
- (void) setPassThroughParent:(BOOL) passThroughParent;

@end
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module TNSWidgets {
umbrella header "TNSWidgets.h"

export *
module * { export * }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <objc/runtime.h>


@interface NSObject (Swizzling)

+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


@interface UIView (PropertyBag)

- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;

@end
Binary file not shown.
Loading

0 comments on commit 83982aa

Please sign in to comment.