[TIMOB-23854] Hyperloop: iOS - Support creating of Run Script phases
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-12-02T15:08:27.000+0000 |
Affected Version/s | hyperloop 1.2.7 |
Fix Version/s | Hyperloop 2.2.0 |
Components | Hyperloop |
Labels | hyperloop, ios |
Reporter | Rodolfo Perottoni |
Assignee | Jan Vennemann |
Created | 2016-09-01T00:29:39.000+0000 |
Updated | 2017-10-19T18:16:31.000+0000 |
Description
Some native iOS libs / frameworks require the developer to call certain scripts during the build phase (see image attached). This could be done in the *appc.js* file:
hyperloop: {
ios: {
xcodebuild: {
scripts: [{
name: 'My script phase',
shellScript: '${APPC_PROJECT_DIR}/src/script.sh'
}]
}
}
}
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2016-09-01 at 10.23.37 AM.png | 2016-09-01T00:23:54.000+0000 | 19069 |
We can think about that. But you can actually do it today already using the Titanium plugin-hooks. Summarized, we have different hooks in our CLI that you can hook into (like we already do with our Hyperloop CLI that sits in
plugins/hyperloop
. So you could be notified when certain build phases are reached and inject your own scripts there (e.g. run shell-scripts using node-commands). Please check out how Hyperloop makes it and go from there for now. We schedule it anyway, might be a good appc.js addition. Thanks!Cool, I'll give it a go.
Here is how it's mapped in the .pbxproj file:
as well as the reference of the ID in the
buildPhases
list.[This page](http://www.monobjc.net/xcode-project-file-format.html) has a good summary, see the "PBXShellScriptBuildPhase" paragraph.
[~rdperottoni] Updated your proposal regarding the structure to have a more native data-structure. Where should we place scripts? Is
src/scripts/
cool?PR (master): https://github.com/appcelerator/hyperloop.next/pull/104 PR (2_0_X): https://github.com/appcelerator/hyperloop.next/pull/105 Usually I'm all in for convention over configuration but i felt the automatic mapping of a script name to a file in a folder we define is not quite fitting here. Instead, I introduced the env variable
${APPC_PROJECT_DIR}
which points to the app's project directory. This is closer to the native behavior in Xcode where${SRCROOT}
is used by default, which points to the Xcode project directory. The minimum configuration to add a Run Script phase:All other options are optional and default to the following: *
shellPath
:'/bin/sh'
*runOnlyWhenInstalling
:false
. I adopted the description from within Xcode for this field which is more clear than therunOnlyForDeploymentPostprocessing
used inside the pbproj file *inputPaths
:[]
*outputPaths
:[]
*showEnvVarsInLog
:false
Thanks for the input Jan. I get where you are coming from, but I'd really like to prevent the env-variable in there. First, because all Hyperloop-related assets should be stored in
src/
(which I still don't really like, since we already haveapp/assets
(Alloy) and/Resources
(Classic), and second, because it adds another level of confusion, because usingAPPC_SRCROOT
, I'd guess to be in/src
already. So either we normalize the names of it to match more existing ones (see the ones in _build.js), or get rid of them in there completely.Verified. Able to run scripts and inline shell commands in the appc.js. Run script phases correctly execute and show in the logs.