@@ -60,10 +60,10 @@ const argv = yargs
6060 required : true ,
6161 } ) . argv ;
6262
63- async function main ( ) {
63+ async function main ( ) {
6464 /*
65- * see the test-local-e2e.js script for clean up process
66- */
65+ * see the test-local-e2e.js script for clean up process
66+ */
6767
6868 // command order: we ask the user to select if they want to test RN tester
6969 // or RNTestProject
@@ -73,19 +73,19 @@ async function main () {
7373
7474 // let's check if Metro is already running, if it is let's kill it and start fresh
7575 if ( isPackagerRunning ( ) === 'running' ) {
76- exec ( "lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill" ) ;
76+ exec (
77+ "lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill" ,
78+ ) ;
7779 }
7880
79- const branchName = "0.72-stable"
80- /*exec('git rev-parse --abbrev-ref HEAD', {
81- silent: true,
82- })
83- .stdout.trim();
84- */
81+ const branchName = exec ( 'git rev-parse --abbrev-ref HEAD' , {
82+ silent : true ,
83+ } ) . stdout . trim ( ) ;
84+
8585 const onReleaseBranch = branchName . endsWith ( '-stable' ) ;
8686
8787 const circleCIArtifacts = new CircleCIArtifacts ( argv . circleciToken ) ;
88- await circleCIArtifacts . initialize ( branchName )
88+ await circleCIArtifacts . initialize ( branchName ) ;
8989
9090 if ( argv . target === 'RNTester' ) {
9191 // FIXME: make sure that the commands retains colors
@@ -100,7 +100,6 @@ async function main () {
100100 } version of RNTester iOS with the new Architecture enabled`,
101101 ) ;
102102
103-
104103 // remember that for this to be successful
105104 // you should have run bundle install once
106105 // in your local setup
@@ -113,20 +112,23 @@ async function main () {
113112 // download hermes source code from manifold
114113 circleCIArtifacts . downloadArtifact ( hermesURL , hermesPath ) ;
115114 console . info ( `Downloaded Hermes in ${ hermesPath } ` ) ;
116- exec ( `HERMES_ENGINE_TARBALL_PATH=${ hermesPath } RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi` )
115+ exec (
116+ `HERMES_ENGINE_TARBALL_PATH=${ hermesPath } RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi` ,
117+ ) ;
117118 } else {
118119 exec (
119120 `USE_HERMES=0 CI=${ onReleaseBranch } RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi` ,
120121 ) ;
121122 }
122123
123-
124124 // if everything succeeded so far, we can launch Metro and the app
125125 // start the Metro server in a separate window
126126 launchPackagerInSeparateWindow ( pwd ( ) ) ;
127127
128128 // launch the app on iOS simulator
129- exec ( 'npx react-native run-ios --scheme RNTester --simulator "iPhone 14"' ) ;
129+ exec (
130+ 'npx react-native run-ios --scheme RNTester --simulator "iPhone 14"' ,
131+ ) ;
130132 } else {
131133 // we do the android path here
132134
@@ -138,16 +140,16 @@ async function main () {
138140 } version of RNTester Android with the new Architecture enabled`,
139141 ) ;
140142
141- const downloadPath = " /tmp/rntester.apk" ;
143+ const downloadPath = ' /tmp/rntester.apk' ;
142144
143- const rntesterAPKURL = argv . hermes ?
144- await circleCIArtifacts . artifactURLForHermesRNTesterAPK ( ) :
145- await circleCIArtifacts . artifactURLForJSCRNTesterAPK ( )
145+ const rntesterAPKURL = argv . hermes
146+ ? await circleCIArtifacts . artifactURLForHermesRNTesterAPK ( )
147+ : await circleCIArtifacts . artifactURLForJSCRNTesterAPK ( ) ;
146148
147- console . info ( " Start Downloading APK" ) ;
149+ console . info ( ' Start Downloading APK' ) ;
148150 circleCIArtifacts . downloadArtifact ( rntesterAPKURL , downloadPath ) ;
149151
150- exec ( `adb install ${ downloadPath } ` )
152+ exec ( `adb install ${ downloadPath } ` ) ;
151153
152154 // launch the app on Android simulator
153155 // TODO: we should find a way to make it work like for iOS, via npx react-native run-android
@@ -174,11 +176,12 @@ async function main () {
174176 // base setup required (specular to publish-npm.js)
175177
176178 // we need to add the unique timestamp to avoid npm/yarn to use some local caches
177- const baseVersion = require ( '../packages/react-native/package.json' ) . version ;
179+ const baseVersion =
180+ require ( '../packages/react-native/package.json' ) . version ;
178181
179- // in local testing, 1000.0.0 mean we are on main, every other case means we are
180- // working on a release version
181- const buildType = baseVersion !== '1000.0.0' ? 'release' : 'dry-run' ;
182+ // // in local testing, 1000.0.0 mean we are on main, every other case means we are
183+ // // working on a release version
184+ // const buildType = baseVersion !== '1000.0.0' ? 'release' : 'dry-run';
182185
183186 const dateIdentifier = new Date ( )
184187 . toISOString ( )
@@ -188,56 +191,33 @@ async function main () {
188191
189192 const releaseVersion = `${ baseVersion } -${ dateIdentifier } ` ;
190193
191- // this is needed to generate the Android artifacts correctly
192- const exitCode = exec (
193- `node scripts/set-rn-version.js --to-version ${ releaseVersion } --build-type ${ buildType } ` ,
194- ) . code ;
195-
196- if ( exitCode !== 0 ) {
197- console . error (
198- `Failed to set the RN version. Version ${ releaseVersion } is not valid for ${ buildType } ` ,
199- ) ;
200- process . exit ( exitCode ) ;
201- }
202-
203194 // Generate native files for Android
204- generateAndroidArtifacts ( releaseVersion ) ;
195+ // generateAndroidArtifacts(releaseVersion);
196+ const mavenLocalURL = await circleCIArtifacts . artifactURLForMavenLocal ( ) ;
197+ const packagedReactNativeURL =
198+ await circleCIArtifacts . artifactURLForPackagedReactNative ( ) ;
199+ const hermesURL = await circleCIArtifacts . artifactURLHermesDebug ( ) ;
200+
201+ const mavenLocalPath = '/tmp/maven-local.zip' ;
202+ const packagedReactNativePath = '/tmp/packaged-react-native.tar.gz' ;
203+ const hermesPath = '/tmp/hermes-ios-debug.tar.gz' ;
204+
205+ console . info ( '[Download] Maven Local Artifacts' ) ;
206+ circleCIArtifacts . downloadArtifact ( mavenLocalURL , mavenLocalPath ) ;
207+ console . info ( '[Download] Packaged React Native' ) ;
208+ circleCIArtifacts . downloadArtifact (
209+ packagedReactNativeURL ,
210+ packagedReactNativePath ,
211+ ) ;
212+ console . info ( '[Download] Hermes' ) ;
213+ circleCIArtifacts . downloadArtifact ( hermesURL , hermesPath ) ;
205214
206215 // Setting up generating native iOS (will be done later)
207216 const repoRoot = pwd ( ) ;
208217 const reactNativePackagePath = `${ repoRoot } /packages/react-native` ;
209- const jsiFolder = `${ reactNativePackagePath } /ReactCommon/jsi` ;
210- const hermesCoreSourceFolder = `${ reactNativePackagePath } /sdks/hermes` ;
211-
212- if ( ! fs . existsSync ( hermesCoreSourceFolder ) ) {
213- console . info ( 'The Hermes source folder is missing. Downloading...' ) ;
214- downloadHermesSourceTarball ( ) ;
215- expandHermesSourceTarball ( ) ;
216- }
217-
218- // need to move the scripts inside the local hermes cloned folder
219- // cp sdks/hermes-engine/utils/*.sh <your_hermes_checkout>/utils/.
220- cp (
221- `${ reactNativePackagePath } /sdks/hermes-engine/utils/*.sh` ,
222- `${ reactNativePackagePath } /sdks/hermes/utils/.` ,
223- ) ;
224-
225- // for this scenario, we only need to create the debug build
226- // (env variable PRODUCTION defines that podspec side)
227- const buildTypeiOSArtifacts = 'Debug' ;
228-
229- // the android ones get set into /private/tmp/maven-local
230- const localMavenPath = '/private/tmp/maven-local' ;
231-
232- // Generate native files for iOS
233- const tarballOutputPath = generateiOSArtifacts (
234- jsiFolder ,
235- hermesCoreSourceFolder ,
236- buildTypeiOSArtifacts ,
237- localMavenPath ,
238- ) ;
239218
240219 const localNodeTGZPath = `${ reactNativePackagePath } /react-native-${ releaseVersion } .tgz` ;
220+ exec ( `cp ${ packagedReactNativePath } ${ localNodeTGZPath } ` ) ;
241221 updateTemplatePackage ( {
242222 'react-native' : `file:${ localNodeTGZPath } ` ,
243223 } ) ;
@@ -252,18 +232,20 @@ async function main () {
252232 ) ;
253233
254234 cd ( 'RNTestProject' ) ;
235+
236+ // TODO: test whether that's works. On the local test it doesn't, but I'm forcing a version which is weird.
255237 exec ( 'yarn install' ) ;
256238
257239 // need to do this here so that Android will be properly setup either way
258240 exec (
259- ' echo "REACT_NATIVE_MAVEN_LOCAL_REPO=/private/tmp/maven-local " >> android/gradle.properties' ,
241+ ` echo "REACT_NATIVE_MAVEN_LOCAL_REPO=${ mavenLocalPath } " >> android/gradle.properties` ,
260242 ) ;
261243
262244 // doing the pod install here so that it's easier to play around RNTestProject
263245 cd ( 'ios' ) ;
264246 exec ( 'bundle install' ) ;
265247 exec (
266- `HERMES_ENGINE_TARBALL_PATH=${ tarballOutputPath } USE_HERMES=${
248+ `HERMES_ENGINE_TARBALL_PATH=${ hermesPath } USE_HERMES=${
267249 argv . hermes ? 1 : 0
268250 } bundle exec pod install --ansi`,
269251 ) ;
@@ -281,4 +263,3 @@ async function main () {
281263}
282264
283265main ( ) ;
284- // exit(0);
0 commit comments