iOS bundle

This commit is contained in:
pengfei.zhou 2019-08-14 14:13:08 +08:00
parent b2057a088c
commit a8e93648b0
9 changed files with 18 additions and 10 deletions

View File

@ -31,11 +31,10 @@ TODO: Add long description of the pod here.
s.ios.deployment_target = '8.0'
s.source_files = 'Pod/Classes/**/*'
#s.resource = "../js-framework/bundle/*.js"
s.resource = "Pod/Assets/**/*"
# s.resource_bundles = {
# 'Doric' => ['Doric/Assets/*.png']
# }
s.resource = "Pod/Assets/*.js"
s.resource_bundles = {
'Doric' => ['Pod/Assets/**/*']
}
s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'

View File

@ -20,7 +20,7 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
Doric: 79268ea6e03e7dee56b072e532d9a29f50ccd72d
Doric: fffcb912bda6820db1165fc7919dce47f9aa0463
SDWebImage: 920f1a2ff1ca8296ad34f6e0510a1ef1d70ac965
SocketRocket: d57c7159b83c3c6655745cd15302aa24b6bae531

1
iOS/Pod/Assets/bundle Symbolic link
View File

@ -0,0 +1 @@
../../../js-framework/bundle

1
iOS/Pod/Assets/dist Symbolic link
View File

@ -0,0 +1 @@
../../../debugger/dist

View File

@ -1 +0,0 @@
../../../js-framework/bundle/doric-lib.js

View File

@ -1 +0,0 @@
../../../js-framework/bundle/doric-sandbox.js

View File

@ -87,14 +87,14 @@ - (void)initJSExecutor {
- (void)initDoricEnvironment {
[self loadBuiltinJS:DORIC_BUNDLE_SANDBOX];
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:DORIC_BUNDLE_LIB ofType:@"js"];
NSString *path = [DoricBundle() pathForResource:DORIC_BUNDLE_LIB ofType:@"js" inDirectory:@"bundle"];
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self.jsExecutor loadJSScript:[self packageModuleScript: DORIC_MODULE_LIB content:jsContent]
source: [@"Module://" stringByAppendingString:DORIC_MODULE_LIB]];
}
- (void)loadBuiltinJS:(NSString *)fileName {
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:DORIC_BUNDLE_SANDBOX ofType:@"js"];
NSString *path = [DoricBundle() pathForResource:DORIC_BUNDLE_SANDBOX ofType:@"js" inDirectory:@"bundle"];
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self.jsExecutor loadJSScript:jsContent source:[@"Assets://" stringByAppendingString:fileName]];
}

View File

@ -10,3 +10,5 @@
void DoricLog(NSString * _Nonnull format, ...);
UIColor* _Nonnull DoricColor(NSNumber * _Nonnull number);
NSBundle *DoricBundle();

View File

@ -6,6 +6,7 @@
//
#import "DoricUtil.h"
#import "DoricContext.h"
void DoricLog(NSString * _Nonnull format, ...) {
va_list args;
@ -23,3 +24,9 @@ void DoricLog(NSString * _Nonnull format, ...) {
b = ((colorValue >> 0) & 0xff)/255.0f;
return [UIColor colorWithRed:r green:g blue:b alpha:a];
}
NSBundle *DoricBundle() {
NSBundle *bundle = [NSBundle bundleForClass:[DoricContext class]];
NSURL *url = [bundle URLForResource:@"Doric" withExtension:@"bundle"];
return [NSBundle bundleWithURL:url];
}