Skip to content

Commit

Permalink
Update iOS runner for RN61+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
belemaire committed Apr 10, 2020
1 parent 1755cf1 commit 3f117d7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ern-orchestrator/src/buildIosRunner.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { log } from 'ern-core'
import { spawn } from 'child_process'
import fs from 'fs-extra'
import path from 'path'

export async function buildIosRunner(pathToIosRunner: string, udid: string) {
return new Promise((resolve, reject) => {
const extraBuildOptions = fs.existsSync(
path.join(pathToIosRunner, 'ErnRunner.xcworkspace')
)
? [`-workspace`, `ErnRunner.xcworkspace`]
: []

const xcodebuildProc = spawn(
'xcodebuild',
[
...extraBuildOptions,
`-scheme`,
'ErnRunner',
'build',
Expand Down
18 changes: 14 additions & 4 deletions ern-runner-gen-ios/src/IosRunnerGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ export default class IosRunerGenerator implements RunnerGenerator {
const mustacheView = this.createMustacheView({ config })

shell.cp('-R', path.join(runnerHullPath, '*'), config.outDir)

const filesToMustache = [
path.join(config.outDir, 'ErnRunner/RunnerConfig.m'),
path.join(config.outDir, 'ErnRunner.xcodeproj/project.pbxproj'),
'ErnRunner/RunnerConfig.m',
'ErnRunner.xcodeproj/project.pbxproj',
]

if ((mustacheView as any).RN_VERSION_LT_61) {
// Delete ErnRunner.xcworkspace directory as it is only needed for RN61+
shell.rm('-rf', path.join(config.outDir, 'ErnRunner.xcworkspace'))
} else {
// Otherwise keep it and include the xcworkspaceedata file for mustached
// processing as it contains some mustache templace placeholders
filesToMustache.push('ErnRunner.xcworkspace/contents.xcworkspacedata')
}

for (const file of filesToMustache) {
await mustacheUtils.mustacheRenderToOutputFileUsingTemplateFile(
file,
path.join(config.outDir, file),
mustacheView,
file
path.join(config.outDir, file)
)
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3f117d7

Please sign in to comment.