[build][ios] generate iOS version file for Core

This commit is contained in:
Salakar
2019-08-09 02:06:56 +01:00
parent 4de262b63e
commit a6a5236fbc
7 changed files with 63 additions and 2 deletions

3
.gitignore vendored
View File

@@ -551,3 +551,6 @@ tests/ios/Firebase
google-services.json
GoogleService-Info.plist
# generated file
RNFBVersion.m

View File

@@ -64,3 +64,4 @@ android/.settings
.circleci
.eslintignore
type-test.ts
scripts

View File

@@ -15,6 +15,7 @@
2748D8172236429D00FC8DC8 /* RNFBSharedUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D8102236417700FC8DC8 /* RNFBSharedUtils.m */; };
2748D81C223674CD00FC8DC8 /* RNFBPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */; };
2748D8202237018600FC8DC8 /* RNFBMeta.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D81F2237018600FC8DC8 /* RNFBMeta.m */; };
DAA1F28522FCF6AD00F4DEC1 /* RNFBVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -47,6 +48,8 @@
2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBPreferences.m; sourceTree = "<group>"; };
2748D81E2237012B00FC8DC8 /* RNFBMeta.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNFBMeta.h; sourceTree = "<group>"; };
2748D81F2237018600FC8DC8 /* RNFBMeta.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBMeta.m; sourceTree = "<group>"; };
DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBVersion.m; sourceTree = "<group>"; };
DAA1F28622FCF6C200F4DEC1 /* RNFBVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNFBVersion.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -87,6 +90,8 @@
2748D8142236426300FC8DC8 /* RNFBJSON.m */,
2748D81A223674B600FC8DC8 /* RNFBPreferences.h */,
2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */,
DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */,
DAA1F28622FCF6C200F4DEC1 /* RNFBVersion.h */,
);
path = RNFBApp;
sourceTree = "<group>";
@@ -162,6 +167,7 @@
2744B9A721F57C2F004F8E3F /* RCTConvert+FIRApp.m in Sources */,
2748D8172236429D00FC8DC8 /* RNFBSharedUtils.m in Sources */,
2748D81C223674CD00FC8DC8 /* RNFBPreferences.m in Sources */,
DAA1F28522FCF6AD00F4DEC1 /* RNFBVersion.m in Sources */,
2748D8202237018600FC8DC8 /* RNFBMeta.m in Sources */,
2744B99121F46140004F8E3F /* RNFBRCTEventEmitter.m in Sources */,
2744B9A421F48A4F004F8E3F /* RCTConvert+FIROptions.m in Sources */,

View File

@@ -24,6 +24,7 @@
#import "RNFBPreferences.h"
#import "RNFBJSON.h"
#import "RNFBMeta.h"
#import "RNFBVersion.h"
#if __has_include(<FirebaseCore/FIRAppInternal.h>)
#import <FirebaseCore/FIRAppInternal.h>
@@ -54,7 +55,7 @@ RCT_EXPORT_MODULE();
#ifdef REGISTER_LIB
static dispatch_once_t once;
dispatch_once(&once, ^{
[FIRApp registerLibrary:@"react-native-firebase" withVersion:@"0.1.5"];
[FIRApp registerLibrary:@"react-native-firebase" withVersion:RNFBVersionString];
});
#endif
}

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) 2016-present Invertase Limited & Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this library except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <Foundation/Foundation.h>
extern const NSString * RNFBVersionString;

View File

@@ -6,7 +6,7 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "genversion --semi lib/version.js",
"build": "genversion --semi lib/version.js && node ./scripts/genversion-ios",
"build:clean": "rimraf android/build && rimraf ios/build",
"prepare": "npm run build"
},

View File

@@ -0,0 +1,30 @@
const fs = require('fs');
const path = require('path');
const version = require('../lib/version');
const outputPath = path.resolve(__dirname, '..', 'ios', 'RNFBApp', 'RNFBVersion.m');
const template = `/**
* Copyright (c) 2016-present Invertase Limited & Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this library except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import "RCTVersion.h"
// generated file - do not modify or commit
NSString* const RNFBVersionString = @"VERSION";
`;
fs.writeFileSync(outputPath, template.replace('@"VERSION"', `@"${version}"`), 'utf8');