Skip to content

Instantly share code, notes, and snippets.

@dpogue
Last active March 21, 2018 15:38
Show Gist options
  • Save dpogue/186b6c1827363c48d644b0d59e91bc28 to your computer and use it in GitHub Desktop.
Save dpogue/186b6c1827363c48d644b0d59e91bc28 to your computer and use it in GitHub Desktop.
Hook for Cordova iOS to support "developmentTeam" in buildConfig.json
"use strict";
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var encoding = 'utf-8';
var filepath = 'platforms/ios/cordova/build.xcconfig';
if (context.opts.cordova.platforms.indexOf('ios') === -1) return;
if (!context.opts.options) return;
if (!context.opts.options.buildConfig) return;
var buildType = context.opts.options.release ? 'release' : 'debug';
var buildConfigPath = context.opts.options.buildConfig;
if (!path.isAbsolute(buildConfigPath)) {
buildConfigPath = path.join(context.opts.projectRoot, context.opts.options.buildConfig);
}
var config = require(buildConfigPath);
if (!config.ios) return;
if (!config.ios[buildType]) return;
if (!config.ios[buildType].developmentTeam) return;
var xcconfig = fs.readFileSync(filepath, encoding);
if (xcconfig.indexOf('DEVELOPMENT_TEAM') === -1) {
var content = '\nDEVELOPMENT_TEAM = ' + config.ios[buildType].developmentTeam;
xcconfig += content;
fs.writeFileSync(filepath, xcconfig, encoding);
}
};
@jaywilliams
Copy link

@jrmcdona
Copy link

jrmcdona commented May 3, 2017

Hey Darryl, I have an ionic app. I am not seeing build.json in my ionic project? Do you know where that would be. In my Ionic build output I see this.

Removing Xcconfig update hook
Error: Please specify a build.json file according to https://taco.visualstudio.com/en-us/docs/vs-taco-2017-ios-guide/#xcode8
at /Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/taco-team-build/taco-team-build.js:163:23
at _fulfilled (/Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:796:13)
at /Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:604:44
at runSingle (/Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:137:13)
at flush (/Users/jordanmc/Documents/osxagent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.10/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Task failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment