-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Swift Support * Compiling Detox.framework on the user's machine, to better support swift. * fixed build script * Update APIRef.DetoxCLI.md
- Loading branch information
Showing
21 changed files
with
156 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 15,7 @@ Detox.framework/ | |
|
||
|
||
src/**/*.test.js | ||
ios_src | ||
|
||
################# | ||
# from .gitignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,28 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const os = require('os'); | ||
|
||
if (os.platform() === 'darwin') { | ||
const frameworkPath = path.join(os.homedir(), '/Library/Detox'); | ||
console.log(`Removing framework binaries from ${frameworkPath}`); | ||
deleteFolderRecursive(frameworkPath); | ||
} | ||
|
||
function deleteFolderRecursive(path) { | ||
let files = []; | ||
if (fs.existsSync(path)) { | ||
files = fs.readdirSync(path); | ||
files.forEach(function(file, index) { | ||
let curPath = path "/" file; | ||
if (fs.lstatSync(curPath).isDirectory()) { | ||
deleteFolderRecursive(curPath); | ||
} else { | ||
console.log(`Removing ${curPath}`); | ||
fs.unlinkSync(curPath); | ||
} | ||
}); | ||
fs.rmdirSync(path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 1,37 @@ | ||
const fs = require('fs'); | ||
const program = require('commander'); | ||
const mochaTemplates = require('./templates/mocha.js') | ||
const mochaTemplates = require('./templates/mocha.js'); | ||
|
||
program | ||
.option('-r, --runner [runner]', 'Test runner (currently supports mocha)', 'mocha') | ||
.parse(process.argv); | ||
|
||
function createFile(dir, content) { | ||
try { | ||
try { | ||
fs.writeFileSync(dir, content); | ||
console.log(`A file was created in "${dir}" `); | ||
} catch(err){ | ||
return err; | ||
} | ||
} catch (err) { | ||
return err; | ||
} | ||
} | ||
|
||
const dir = './e2e'; | ||
|
||
function createFolder(firstTestContent, runnerConfig, initjsContent) { | ||
if (!fs.existsSync(dir)){ | ||
fs.mkdirSync(dir); | ||
createFile("./e2e/mocha.opts", runnerConfig) | ||
createFile("./e2e/init.js", initjsContent) | ||
createFile("./e2e/firstTest.spec.js", firstTestContent) | ||
} else { | ||
return console.log('e2e folder already exists') | ||
} | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir); | ||
createFile("./e2e/mocha.opts", runnerConfig); | ||
createFile("./e2e/init.js", initjsContent); | ||
createFile("./e2e/firstTest.spec.js", firstTestContent) | ||
} else { | ||
return console.log('e2e folder already exists') | ||
} | ||
} | ||
|
||
switch (program.runner) { | ||
case 'mocha': | ||
createFolder(mochaTemplates.firstTest, mochaTemplates.runnerConfig, mochaTemplates.initjs) | ||
createFolder(mochaTemplates.firstTest, mochaTemplates.runnerConfig, mochaTemplates.initjs); | ||
break; | ||
default: | ||
createFolder(mochaTemplates.firstTest, mochaTemplates.runnerConfig, mochaTemplates.initjs) | ||
createFolder(mochaTemplates.firstTest, mochaTemplates.runnerConfig, mochaTemplates.initjs); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,29 @@ | ||
#!/bin/bash -e | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "usage: build_framework_ios.sh detoxIosSourceTarballDirPath detoxFrameworkDirPath" | ||
exit 1 | ||
fi | ||
|
||
detoxIosSourceTarballDirPath="${1}" | ||
detoxFrameworkDirPath="${2}" | ||
detoxSourcePath="${detoxIosSourceTarballDirPath}"/ios_src | ||
|
||
|
||
echo "###############################" | ||
echo "Extracting Detox sources..." | ||
|
||
mkdir -p "${detoxSourcePath}" | ||
tar -xjf "${detoxIosSourceTarballDirPath}"/Detox-ios-src.tbz -C "${detoxSourcePath}" | ||
|
||
echo "###############################" | ||
|
||
|
||
echo "###############################" | ||
echo "Extracting Detox sources..." | ||
|
||
xcodebuild build -project "${detoxSourcePath}"/Detox.xcodeproj -scheme DetoxFramework -configuration Release -derivedDataPath "${detoxFrameworkDirPath}"/DetoxBuild > /dev/null | ||
mv "${detoxFrameworkDirPath}"/DetoxBuild/Build/Products/Release-universal/Detox.framework "${detoxFrameworkDirPath}" | ||
rm -fr "${detoxFrameworkDirPath}"/DetoxBuild | ||
|
||
echo "###############################" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.