Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var Q = require('q');
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var xcode = require('xcode');
var unorm = require('unorm');
var plist = require('plist');
var URL = require('url');
var events = require('cordova-common').events;
var xmlHelpers = require('cordova-common').xmlHelpers;
var ConfigParser = require('cordova-common').ConfigParser;
var CordovaError = require('cordova-common').CordovaError;
var PlatformJson = require('cordova-common').PlatformJson;
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
var FileUpdater = require('cordova-common').FileUpdater;
var projectFile = require('./projectFile');
// launch storyboard and related constants
var LAUNCHIMAGE_BUILD_SETTING = 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME';
var LAUNCHIMAGE_BUILD_SETTING_VALUE = 'LaunchImage';
var UI_LAUNCH_STORYBOARD_NAME = 'UILaunchStoryboardName';
var CDV_LAUNCH_STORYBOARD_NAME = 'CDVLaunchScreen';
var IMAGESET_COMPACT_SIZE_CLASS = 'compact';
var CDV_ANY_SIZE_CLASS = 'any';
module.exports.prepare = function (cordovaProject, options) {
var self = this;
var platformJson = PlatformJson.load(this.locations.root, 'ios');
this file is found by cordova-lib when you attempt to
'cordova platform add PATH' where path is this repo.
*/
var shell = require('shelljs');
var path = require('path');
var fs = require('fs');
var cdvcmn = require('cordova-common');
var CordovaLogger = cdvcmn.CordovaLogger;
var ConfigParser = cdvcmn.ConfigParser;
var ActionStack = cdvcmn.ActionStack;
var selfEvents = cdvcmn.events;
var xmlHelpers = cdvcmn.xmlHelpers;
var PlatformJson = cdvcmn.PlatformJson;
var PlatformMunger = cdvcmn.ConfigChanges.PlatformMunger;
var PluginInfoProvider = cdvcmn.PluginInfoProvider;
var BrowserParser = require('./browser_parser');
var PLATFORM_NAME = 'browser';
function setupEvents (externalEventEmitter) {
if (externalEventEmitter) {
// This will make the platform internal events visible outside
selfEvents.forwardEventsTo(externalEventEmitter);
return externalEventEmitter;
}
// There is no logger if external emitter is not present,
// so attach a console logger
CordovaLogger.get().subscribe(selfEvents);
return selfEvents;
*/
/*
this file is found by cordova-lib when you attempt to
'cordova platform add PATH' where path is this repo.
*/
const path = require('path');
const fs = require('fs-extra');
const CordovaCommon = require('cordova-common');
const CordovaLogger = CordovaCommon.CordovaLogger;
// const ConfigParser = CordovaCommon.ConfigParser;
const ActionStack = CordovaCommon.ActionStack;
const selfEvents = CordovaCommon.events;
// const xmlHelpers = CordovaCommon.xmlHelpers;
const PlatformJson = CordovaCommon.PlatformJson;
const PlatformMunger = CordovaCommon.ConfigChanges.PlatformMunger;
const PluginInfoProvider = CordovaCommon.PluginInfoProvider;
const Parser = require('./parser');
function setupEvents (externalEventEmitter) {
if (externalEventEmitter) {
// This will make the platform internal events visible outside
selfEvents.forwardEventsTo(externalEventEmitter);
return externalEventEmitter;
}
// There is no logger if external emitter is not present,
// so attach a console logger
CordovaLogger.get().subscribe(selfEvents);
return selfEvents;
}
*/
/* eslint no-useless-escape: 0 */
var Q = require('q');
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var events = require('cordova-common').events;
var AndroidManifest = require('./AndroidManifest');
var checkReqs = require('./check_reqs');
var xmlHelpers = require('cordova-common').xmlHelpers;
var CordovaError = require('cordova-common').CordovaError;
var ConfigParser = require('cordova-common').ConfigParser;
var FileUpdater = require('cordova-common').FileUpdater;
var PlatformJson = require('cordova-common').PlatformJson;
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
module.exports.prepare = function (cordovaProject, options) {
var self = this;
var platformJson = PlatformJson.load(this.locations.root, this.platform);
var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);
// Update own www dir with project's www assets and plugins' assets and js-files
return Q.when(updateWww(cordovaProject, this.locations)).then(function () {
// update project according to config.xml changes.
return updateProjectAccordingTo(self._config, self.locations);
}).then(function () {
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var cordova_util = require('./util'),
ConfigParser = require('cordova-common').ConfigParser,
PlatformJson = require('cordova-common').PlatformJson,
PluginInfoProvider = require('cordova-common').PluginInfoProvider,
PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger,
events = require('cordova-common').events,
platforms = require('../platforms/platforms'),
PlatformApiPoly = require('../platforms/PlatformApiPoly'),
HooksRunner = require('../hooks/HooksRunner'),
Q = require('q'),
restore = require('./restore-util'),
path = require('path'),
config = require('./config'),
_ = require('underscore');
// Returns a promise.
exports = module.exports = prepare;
function prepare(options) {
return Q().then(function() {
var projectRoot = cordova_util.cdProjectRoot();
var config_json = config.read(projectRoot);
*/
/* eslint no-useless-escape: 0 */
var Q = require('q');
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var events = require('cordova-common').events;
var AndroidManifest = require('./AndroidManifest');
var checkReqs = require('./check_reqs');
var xmlHelpers = require('cordova-common').xmlHelpers;
var CordovaError = require('cordova-common').CordovaError;
var ConfigParser = require('cordova-common').ConfigParser;
var FileUpdater = require('cordova-common').FileUpdater;
var PlatformJson = require('cordova-common').PlatformJson;
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
const GradlePropertiesParser = require('./config/GradlePropertiesParser');
module.exports.prepare = function (cordovaProject, options) {
var self = this;
var platformJson = PlatformJson.load(this.locations.root, this.platform);
var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);
// Get the min SDK version from config.xml
const minSdkVersion = this._config.getPreference('android-minSdkVersion', 'android');
const maxSdkVersion = this._config.getPreference('android-maxSdkVersion', 'android');
const targetSdkVersion = this._config.getPreference('android-targetSdkVersion', 'android');
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var util = require('util');
var path = require('path');
var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var CapsNeedUapPrefix = require(path.join(__dirname, 'AppxManifest')).CapsNeedUapPrefix;
var CAPS_SELECTOR = '/Package/Capabilities';
var WINDOWS10_MANIFEST = 'package.windows10.appxmanifest';
function PlatformMunger (platform, project_dir, platformJson, pluginInfoProvider) {
CommonMunger.apply(this, arguments);
}
util.inherits(PlatformMunger, CommonMunger);
/**
* This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
* In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
* added by AppxManifest class
*
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var Q = require('q');
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var CordovaError = require('cordova-common').CordovaError;
var PlatformJson = require('cordova-common').PlatformJson;
var ActionStack = require('cordova-common').ActionStack;
var AndroidProject = require('./lib/AndroidProject');
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
var ConsoleLogger = require('./lib/ConsoleLogger');
var pluginHandlers = require('./lib/pluginHandlers');
var PLATFORM = 'android';
/**
* Class, that acts as abstraction over particular platform. Encapsulates the
* platform's properties and methods.
*
* Platform that implements own PlatformApi instance _should implement all
* prototype methods_ of this class to be fully compatible with cordova-lib.
*
* The PlatformApi instance also should define the following field:
*
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var BaseMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PlatformMunger = require('../../template/cordova/lib/ConfigChanges').PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
var PluginInfo = require('../../template/cordova/lib/PluginInfo.js').PluginInfo;
var Api = require('../../template/cordova/Api');
var AppxManifest = require('../../template/cordova/lib/AppxManifest');
var os = require('os');
var path = require('path');
var shell = require('shelljs');
var EventEmitter = require('events');
var configChanges = require('../../template/cordova/lib/ConfigChanges');
var tempDir = path.join(os.tmpdir(), 'windows');
var WINDOWS_MANIFEST = 'package.windows.appxmanifest';
var WINDOWS10_MANIFEST = 'package.windows10.appxmanifest';
var FIXTURES = path.join(__dirname, 'fixtures');
var path = require('path');
var unorm = require('unorm');
var shell = require('shelljs');
var semver = require('semver');
var common = require('../plugman/platforms/common');
var superspawn = require('cordova-common').superspawn;
var xmlHelpers = require('cordova-common').xmlHelpers;
var knownPlatforms = require('./platforms');
var CordovaError = require('cordova-common').CordovaError;
var PluginInfo = require('cordova-common').PluginInfo;
var ConfigParser = require('cordova-common').ConfigParser;
var PlatformJson = require('cordova-common').PlatformJson;
var ActionStack = require('cordova-common').ActionStack;
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
/**
* Class, that acts as abstraction over particular platform. Encapsulates the
* platform's properties and methods.
*
* Platform that implements own PlatformApi instance _should implement all
* prototype methods_ of this class to be fully compatible with cordova-lib.
*
* The PlatformApi instance also should define the following field:
*
* * platform: String that defines a platform name.
*/
function PlatformApiPoly(platform, platformRootDir, events) {
if (!platform) throw new CordovaError('\'platform\' argument is missing');
if (!platformRootDir) throw new CordovaError('platformRootDir argument is missing');