1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

改进ios生成build time

This commit is contained in:
sunnylqm 2019-10-06 22:20:57 +08:00
parent f9ff690157
commit eb67431567
5 changed files with 13 additions and 11 deletions

View File

@ -337,7 +337,7 @@ SPEC CHECKSUMS:
React-jsi: 32285a21b1b24c36060493ed3057a34677d58d09 React-jsi: 32285a21b1b24c36060493ed3057a34677d58d09
React-jsiexecutor: 8909917ff7d8f21a57e443a866fd8d4560e50c65 React-jsiexecutor: 8909917ff7d8f21a57e443a866fd8d4560e50c65
React-jsinspector: 111d7d342b07a904c400592e02a2b958f1098b60 React-jsinspector: 111d7d342b07a904c400592e02a2b958f1098b60
react-native-update: dd1ae7615b2281c9f2cd842ab672593074999549 react-native-update: 5efc26c6af746154a6b7f7c4c073b9ff3f418322
React-RCTActionSheet: 89b037c0fb7d2671607cb645760164e7e0c013f6 React-RCTActionSheet: 89b037c0fb7d2671607cb645760164e7e0c013f6
React-RCTAnimation: e3cefa93c38c004c318f7ec04b883eb14b8b8235 React-RCTAnimation: e3cefa93c38c004c318f7ec04b883eb14b8b8235
React-RCTBlob: d26ac0e313fbf14e7203473fd593ccaaeee8329e React-RCTBlob: d26ac0e313fbf14e7203473fd593ccaaeee8329e

View File

@ -470,9 +470,14 @@ RCT_EXPORT_METHOD(markSuccess)
#if DEBUG #if DEBUG
return @"0"; return @"0";
#else #else
// To be replaced by scripts/generateiOSBuildTime.sh static NSString *buildTime;
NSString *pushy_build_time = 1570370091 static dispatch_once_t onceToken;
return pushy_build_time; dispatch_once(&onceToken, ^{
NSString *buildTimePath = [[NSBundle mainBundle] pathForResource:@"pushy_build_time" ofType:@"txt"];
buildTime = [[NSString stringWithContentsOfFile:buildTimePath encoding:NSUTF8StringEncoding error:nil]
stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
});
return buildTime;
#endif #endif
} }

1
ios/pushy_build_time.txt Normal file
View File

@ -0,0 +1 @@
1570371472

View File

@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.libraries = 'bz2', 'z' s.libraries = 'bz2', 'z'
s.vendored_libraries = 'RCTHotUpdate/libRCTHotUpdate.a' s.vendored_libraries = 'RCTHotUpdate/libRCTHotUpdate.a'
s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '"$(SRCROOT)/../node_modules/react-native-update/ios"' } s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '"$(SRCROOT)/../node_modules/react-native-update/ios"' }
s.resource = 'ios/pushy_build_time.txt'
s.script_phase = { :name => 'Generate build time', :script => '../../node_modules/react-native-update/scripts/generateiOSBuildTime.sh', :execution_position => :before_compile } s.script_phase = { :name => 'Generate build time', :script => '../../node_modules/react-native-update/scripts/generateiOSBuildTime.sh', :execution_position => :before_compile }
s.dependency 'React' s.dependency 'React'

View File

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
set -x set -x
# DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH DEST="../../node_modules/react-native-update/ios"
# date +%s > "$DEST/pushy_build_time.txt" date +%s > "$DEST/pushy_build_time.txt"
OLD_TEXT="NSString \*pushy_build_time"
NEW_TEXT=" NSString \*pushy_build_time = @\"$(date +%s)\";"
TARGET_FILE="../../node_modules/react-native-update/ios/RCTHotUpdate/RCTHotUpdate.m"
sed -i '' -e "s/.*$OLD_TEXT.*/$NEW_TEXT/" "$TARGET_FILE"