Ejemplo n.º 1
0
function addPlatforms (root, platforms, verbose) {
    var cwd = process.cwd(),
        appPath = path.resolve(root, settings.cordovaAppPath);

    platforms = platforms.filter(function (platform) {
        return isAvailableOnHostSync(platformHelper.getName(platform));
    });

    process.chdir(appPath);

    var hooks = new cordova_hooker(appPath),
        opts = {
            platforms: platforms,
            spawnoutput: {
                stdio: 'ignore'
            }
        };

    warnPlatformVersion(platforms);

    return cordova_platform_add(hooks, appPath, platforms, opts).then(function () {
        process.chdir(cwd);
    }).then(function () {
        return afterPlatformAdd(platforms, appPath, verbose);
    }).then(function () {
        if (verbose) {
            platforms.forEach(function (target) {
                print.success('platform %s added', target);
            });
        }
        return platforms;
    });
}
Ejemplo n.º 2
0
function addPlatforms (root, platforms, verbose) {
    var cwd = process.cwd();

    process.chdir(path.resolve(root, settings.cordovaAppPath));

    var cordovaRoot = cordova_util.cdProjectRoot(),
        hooks = new cordova_hooker(cordovaRoot),
        opts = {
            platforms: platforms,
            spawnoutput: {
                stdio: 'ignore'
            }
        };

    return cordova_platform_add(hooks, cordovaRoot, platforms, opts).then(function () {
        process.chdir(cwd);
        if (platforms.indexOf('android') > -1) return copyGradleBuildFile(cordovaRoot);
    }).then(function () {
        if (verbose) {
            platforms.forEach(function (target) {
                print.success('cordova platform %s added', target);
            });
        }
        return platforms;
    });
}