DotNetWise created CB-8326:
------------------------------
Summary: Allow arguments to be sent to the build comand e.g.
xcodebuild
Key: CB-8326
URL: https://issues.apache.org/jira/browse/CB-8326
Project: Apache Cordova
Issue Type: Bug
Components: CLI, CordovaJS, CordovaLib
Affects Versions: 3.5.0, 4.0.0, 3.6.3, 3.7.1, 4.1.3
Environment: All
Reporter: DotNetWise
Currently if you do
cordova build ios --device CODE_SIGN_IDENTITY='iPhone Developer:
ABCD(1X23456789)'
PROVISIONING_PROFILE='/usr/local/provisions/ABC_Development.mobileprovision'
You'll get an error that CODE_SIGN_IDENTITY is not a known platform.
This is absolutely rubbish, as there is no real way to send arguments directly
to xcodebuild e.g. for directly build & sign an .ipa
We have tweaked locally the code, but every cordova release is making it a pain
in the ass to reapply the changes.
PLEASE Make sure you allow anyother parameters to be sent to the actual build
comand.
For the GOD sake only include KnownPlatforms as platforms and everything else
send it to the actual build command.
We have added this code to cli.js
var tokens = remain.slice(1);
tokens.forEach(function (option, index) {
console.log("option", option,
cordova_lib.cordova_platforms.hasOwnProperty(option));
if (cordova_lib.cordova_platforms.hasOwnProperty(option)) {
opts.platforms.push(option);
} else {
opts.options.push(option);
}
});
And commented this one out
//var badPlatforms = _.difference(opts.platforms, known_platforms);
//badPlatforms.forEach(function (option) {
// opts.options.push(option);
//});
//if( !_.isEmpty(badPlatforms) ) {
// msg = 'Unknown platforms: ' + badPlatforms.join(', ');
// throw new CordovaError(msg);
//}
Also commented this one
//opts.options = downstreamArgs.concat(unparsedArgs);
And works great.
Then in your project template you should forward the arguments in file
platforms/xxxx/cordova/build
e.g. for IOS
CONFIGURATION=Debug
EMULATOR=1
DEVICE=0
declare -a SCHEME
SCHEME=("-target" "$PROJECT_NAME")
i=0
args=
for a; do
((i++));
case "$a" in
--debug) echo "ARG --debug";;
--release) CONFIGURATION=Release;echo "ARG --release";;
--device) EMULATOR=0;echo "ARG --device";;
--emulator) echo "ARG --emulator";;
-scheme) ((i++)); SCHEME=("-scheme" $i);echo "ARG=-scheme $i";;
-target) ((i++)); SCHEME=("-target" $i);echo "ARG=-target $i";;
PROVISIONING_PROFILE*) echo "ARG=$a";mp=${a:21}; uuid=`grep
-aA1 UUID ${mp} | grep -o "[-A-Z0-9]\{36\}"`;args="$args
PROVISIONING_PROFILE=\"$uuid\"";echo " => extracted uuid=$uuid";;
*) echo "ARG=$a";args="$args \"$a\"";;
esac
shift
done
eval set -- $args
set +x;
if (( $EMULATOR )); then
exec xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target
"$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build
VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator"
SHARED_PRECOMPS_DIR="$PROJECT_PATH/build/sharedpch" "$@"
else
exec xcodebuild -xcconfig "$CORDOVA_PATH/build$(echo -$CONFIGURATION | tr
'[:upper:]' '[:lower:]').xcconfig" -project "$PROJECT_NAME.xcodeproj"
ARCHS="armv7 armv7s arm64" "${SCHEME[@]}" -configuration $CONFIGURATION -sdk
iphoneos build VALID_ARCHS="armv7 armv7s arm64"
CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device"
SHARED_PRECOMPS_DIR="$PROJECT_PATH/build/sharedpch" "$@"
fi
Notice the "$@" that was missing from your templates
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]