Cordova buildFlags for Outsystems

I couldn't find it explicitly stated anywhere, but I think the Outsystems environment is using Cordova-ios version 4.3.1 and Xcode 10.

I've written a plugin that works well when built with the Cordova CLI with Xcode 9. The Cordova CLI has some issues when using Xcode 10.  Since Service Studio doesn't seem to have an option to specify the version of Xcode, the Cordova CLI needs to build using the old Xcode build system (e.g., cordova build ios --buildFlag='-UseModernBuildSystem=0').  Is there anyway of passing "buildFlags" through Outsystems or modifying the "build.json" like so?

build.json:

{
    "ios": {
        "debug": {
            "buildFlag": [
                "-UseModernBuildSystem=0"
            ]
        },
        "release": {
            "buildFlag": [
                "-UseModernBuildSystem=0"
            ]
        }
    }
}

I'm assuming Outsystems is already using the build.json approach to pass developer credentials?


Hi John! Currently OutSystems, more specifically the MABS (Mobile Apps Build Service) is using Xcode 9 and a slightly modified version of cordova-ios 4.3.1 (details can be found here).  Also, there's no oficial way for you to set any build flags through OutSystems as you mentioned. 

Is it possible that you're experiencing a different problem? 

While we're at it, you can read more about MABS from this blog post.


Regards,

João Gonçalves

Hi Joao,

Thanks for the info. If Outsystems is using Xcode 9, then it probably is something else. I'll have to look deeper into it.

Thanks.

- john

Looks like my problem wasn't the Xcode compiler like you thought. Still working on it ..


As an fyi though, I was able to figure out how to add build flags to the build by inserting this into the plugin.xml:

<hook type="before_compile" src="hooks/edit_build_json.js" />

And putting the attached script int the ./hooks folder.


Cheers.


edit_build_json.js:

var fs = require('fs');

if ( fs.existsSync("build.json") ) {

var text = fs.readFileSync('build.json','utf8');
var obj = JSON.parse( text );

if ( !obj.hasOwnProperty('ios') ) {
obj['ios'] = {};
}
var obj_ios = obj['ios'];

if ( !obj_ios.hasOwnProperty('debug') ) {
obj_ios['debug'] = {};
}
if ( !obj_ios.hasOwnProperty('release') ) {
obj_ios['release'] = {};
}
var obj_ios_debug = obj_ios['debug'];
var obj_ios_release = obj_ios['release'];

if ( !obj_ios_debug.hasOwnProperty('buildFlag') ) {
obj_ios_debug['buildFlag'] = [];
}
if ( !obj_ios_release.hasOwnProperty('buildFlag') ) {
obj_ios_release['buildFlag'] = [];
}

if( !obj_ios_debug.buildFlag.includes('-UseModernBuildSystem=0') ) {
obj_ios_debug.buildFlag.push( '-UseModernBuildSystem=0' );
}
if( !obj_ios_release.buildFlag.includes('-UseModernBuildSystem=0') ) {
obj_ios_release.buildFlag.push( '-UseModernBuildSystem=0' );
}

var json = JSON.stringify( obj, null, 2 );

fs.writeFileSync('build.json', json, 'utf8');
}