@capacitor/cli 3.2.4 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/assets/android-template.tar.gz +0 -0
- package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
- package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
- package/assets/ios-template.tar.gz +0 -0
- package/dist/android/add.js +5 -5
- package/dist/android/update.js +2 -0
- package/dist/config.js +12 -12
- package/dist/cordova.js +28 -4
- package/dist/declarations.d.ts +16 -0
- package/dist/ios/common.js +1 -9
- package/dist/ios/update.js +31 -52
- package/dist/tasks/add.js +5 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,61 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.3.2](https://github.com/ionic-team/capacitor/compare/3.3.1...3.3.2) (2021-11-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli:** add cordova-plugin-google-analytics to static list ([#5220](https://github.com/ionic-team/capacitor/issues/5220)) ([67a996c](https://github.com/ionic-team/capacitor/commit/67a996c0a6896e32c41ea01822d6435fdd706b84))
|
|
12
|
+
* **cli:** Add plugin to static list if pod has use-frameworks ([#5232](https://github.com/ionic-team/capacitor/issues/5232)) ([8a0518b](https://github.com/ionic-team/capacitor/commit/8a0518be9f6f6a4be4a9f1366cb8dcb191225b9d))
|
|
13
|
+
* **cli:** sync gradle from android folder ([#5233](https://github.com/ionic-team/capacitor/issues/5233)) ([cd779c4](https://github.com/ionic-team/capacitor/commit/cd779c4b6ed4ffc96777be7c94a0af4baca6d6d5))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [3.3.1](https://github.com/ionic-team/capacitor/compare/3.3.0...3.3.1) (2021-11-05)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **cli:** Make config don't error if iOS is missing ([#5212](https://github.com/ionic-team/capacitor/issues/5212)) ([db9f12b](https://github.com/ionic-team/capacitor/commit/db9f12b545994b2ed88098c0168bb051f8191771))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [3.3.0](https://github.com/ionic-team/capacitor/compare/3.2.5...3.3.0) (2021-11-03)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **cli:** Add Batch plugin to static list ([#5138](https://github.com/ionic-team/capacitor/issues/5138)) ([9470633](https://github.com/ionic-team/capacitor/commit/94706338c096b30390fa288c9b107e253923a644))
|
|
36
|
+
* **cli:** Add onesignal-cordova-plugin to static pod list ([#5143](https://github.com/ionic-team/capacitor/issues/5143)) ([937e240](https://github.com/ionic-team/capacitor/commit/937e2408f9bb60691e653b70d8b7cb02f540b251))
|
|
37
|
+
* **cli:** detect and register multiple plugins from same package ([#5098](https://github.com/ionic-team/capacitor/issues/5098)) ([25e770c](https://github.com/ionic-team/capacitor/commit/25e770c3f598bf3a1e05e21d607ab3ad70268674))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* **cli:** add support for 'pod install' in VM based environments ([#5144](https://github.com/ionic-team/capacitor/issues/5144)) ([32ecf22](https://github.com/ionic-team/capacitor/commit/32ecf22de0a550756dbfa68b3b17c2333c89a430))
|
|
43
|
+
* **cli:** Allow to configure access origin tags on cordova config.xml ([#5134](https://github.com/ionic-team/capacitor/issues/5134)) ([0841a09](https://github.com/ionic-team/capacitor/commit/0841a093bf73ed4acac9a90be44a8e8a3aedbcdb))
|
|
44
|
+
* **cli:** Allow users to include Cordova plugins to the static list ([#5175](https://github.com/ionic-team/capacitor/issues/5175)) ([664149a](https://github.com/ionic-team/capacitor/commit/664149aadbe80e66dd757315a826ec1ab305edb9))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [3.2.5](https://github.com/ionic-team/capacitor/compare/3.2.4...3.2.5) (2021-10-13)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* **cli:** create only static pod if needed ([#5099](https://github.com/ionic-team/capacitor/issues/5099)) ([8304744](https://github.com/ionic-team/capacitor/commit/83047445562a52cc927c7c77d55b48288cfc1fcc))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
6
61
|
## [3.2.4](https://github.com/ionic-team/capacitor/compare/3.2.3...3.2.4) (2021-09-27)
|
|
7
62
|
|
|
8
63
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/add.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addAndroid = void 0;
|
|
3
|
+
exports.createLocalProperties = exports.addAndroid = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const os_1 = require("os");
|
|
@@ -13,9 +13,6 @@ async function addAndroid(config) {
|
|
|
13
13
|
await common_1.runTask(`Adding native android project in ${colors_1.default.strong(config.android.platformDir)}`, async () => {
|
|
14
14
|
return template_1.extractTemplate(config.cli.assets.android.platformTemplateArchiveAbs, config.android.platformDirAbs);
|
|
15
15
|
});
|
|
16
|
-
await common_1.runTask('Syncing Gradle', async () => {
|
|
17
|
-
return createLocalProperties(config.android.platformDirAbs);
|
|
18
|
-
});
|
|
19
16
|
}
|
|
20
17
|
exports.addAndroid = addAndroid;
|
|
21
18
|
async function createLocalProperties(platformDir) {
|
|
@@ -47,6 +44,9 @@ sdk.dir=${defaultAndroidPath}
|
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
}
|
|
47
|
+
exports.createLocalProperties = createLocalProperties;
|
|
50
48
|
async function gradleSync(platformDir) {
|
|
51
|
-
await subprocess_1.runCommand(
|
|
49
|
+
await subprocess_1.runCommand(`./gradlew`, [], {
|
|
50
|
+
cwd: platformDir,
|
|
51
|
+
});
|
|
52
52
|
}
|
package/dist/android/update.js
CHANGED
|
@@ -69,10 +69,12 @@ async function findAndroidPluginClassesInPlugin(plugin) {
|
|
|
69
69
|
debug('Searching %O source files in %O by %O regex', srcFiles.length, srcPath, classRegex);
|
|
70
70
|
const entries = await Promise.all(srcFiles.map(async (srcFile) => {
|
|
71
71
|
const srcFileContents = await utils_fs_1.readFile(srcFile, { encoding: 'utf-8' });
|
|
72
|
+
classRegex.lastIndex = 0;
|
|
72
73
|
const classMatch = classRegex.exec(srcFileContents);
|
|
73
74
|
if (classMatch) {
|
|
74
75
|
const className = classMatch[1];
|
|
75
76
|
debug('Searching %O for package by %O regex', srcFile, packageRegex);
|
|
77
|
+
packageRegex.lastIndex = 0;
|
|
76
78
|
const packageMatch = packageRegex.exec(srcFileContents.substring(0, classMatch.index));
|
|
77
79
|
if (!packageMatch) {
|
|
78
80
|
errors_1.fatal(`Package could not be parsed from Android plugin.\n` +
|
package/dist/config.js
CHANGED
|
@@ -251,22 +251,22 @@ function determineOS(os) {
|
|
|
251
251
|
return "unknown" /* Unknown */;
|
|
252
252
|
}
|
|
253
253
|
async function determineXcodeWorkspaceDirAbs(nativeProjectDirAbs) {
|
|
254
|
-
|
|
255
|
-
if (!(await utils_fs_1.pathExists(xcodeDir))) {
|
|
256
|
-
errors_1.fatal('Xcode workspace does not exist.\n' +
|
|
257
|
-
`See the docs for adding the ${colors_1.default.strong('ios')} platform: ${colors_1.default.strong('https://capacitorjs.com/docs/ios#adding-the-ios-platform')}`);
|
|
258
|
-
}
|
|
259
|
-
return xcodeDir;
|
|
254
|
+
return path_1.resolve(nativeProjectDirAbs, 'App.xcworkspace');
|
|
260
255
|
}
|
|
261
256
|
async function determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, nativeXcodeProjDirAbs) {
|
|
262
257
|
const re = /path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/;
|
|
263
258
|
const pbxprojPath = path_1.resolve(nativeXcodeProjDirAbs, 'project.pbxproj');
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
`
|
|
269
|
-
|
|
259
|
+
try {
|
|
260
|
+
const pbxproj = await utils_fs_1.readFile(pbxprojPath, { encoding: 'utf8' });
|
|
261
|
+
const m = pbxproj.match(re);
|
|
262
|
+
if (m && m[1] === 'SOURCE_ROOT') {
|
|
263
|
+
log_1.logger.warn(`Using the iOS project root for the ${colors_1.default.strong('public')} directory is deprecated.\n` +
|
|
264
|
+
`Please follow the Upgrade Guide to move ${colors_1.default.strong('public')} inside the iOS target directory: ${colors_1.default.strong('https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory')}`);
|
|
265
|
+
return path_1.resolve(nativeProjectDirAbs, 'public');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
catch (e) {
|
|
269
|
+
// ignore
|
|
270
270
|
}
|
|
271
271
|
return path_1.resolve(nativeTargetDirAbs, 'public');
|
|
272
272
|
}
|
package/dist/cordova.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeCordovaAndroidManifest = exports.getCordovaPreferences = exports.getIncompatibleCordovaPlugins = exports.checkPluginDependencies = exports.logCordovaManualSteps = exports.getCordovaPlugins = exports.handleCordovaPluginsJS = exports.autoGenerateConfig = exports.removePluginFiles = exports.createEmptyCordovaJS = exports.copyCordovaJS = exports.copyPluginsJS = exports.generateCordovaPluginsJSFile = void 0;
|
|
3
|
+
exports.writeCordovaAndroidManifest = exports.getCordovaPreferences = exports.needsStaticPod = exports.getIncompatibleCordovaPlugins = exports.checkPluginDependencies = exports.logCordovaManualSteps = exports.getCordovaPlugins = exports.handleCordovaPluginsJS = exports.autoGenerateConfig = exports.removePluginFiles = exports.createEmptyCordovaJS = exports.copyCordovaJS = exports.copyPluginsJS = exports.generateCordovaPluginsJSFile = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -152,7 +152,7 @@ async function removePluginFiles(config, platform) {
|
|
|
152
152
|
}
|
|
153
153
|
exports.removePluginFiles = removePluginFiles;
|
|
154
154
|
async function autoGenerateConfig(config, cordovaPlugins, platform) {
|
|
155
|
-
var _a, _b;
|
|
155
|
+
var _a, _b, _c, _d;
|
|
156
156
|
let xmlDir = path_1.join(config.android.resDirAbs, 'xml');
|
|
157
157
|
const fileName = 'config.xml';
|
|
158
158
|
if (platform === 'ios') {
|
|
@@ -180,12 +180,22 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
|
+
let accessOriginString = [];
|
|
184
|
+
if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.accessOrigins) {
|
|
185
|
+
accessOriginString = await Promise.all(config.app.extConfig.cordova.accessOrigins.map(async (host) => {
|
|
186
|
+
return `
|
|
187
|
+
<access origin="${host}" />`;
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
accessOriginString.push(`<access origin="*" />`);
|
|
192
|
+
}
|
|
183
193
|
const pluginEntriesString = await Promise.all(pluginEntries.map(async (item) => {
|
|
184
194
|
const xmlString = await xml_1.writeXML(item);
|
|
185
195
|
return xmlString;
|
|
186
196
|
}));
|
|
187
197
|
let pluginPreferencesString = [];
|
|
188
|
-
if ((
|
|
198
|
+
if ((_d = (_c = config.app.extConfig) === null || _c === void 0 ? void 0 : _c.cordova) === null || _d === void 0 ? void 0 : _d.preferences) {
|
|
189
199
|
pluginPreferencesString = await Promise.all(Object.entries(config.app.extConfig.cordova.preferences).map(async ([key, value]) => {
|
|
190
200
|
return `
|
|
191
201
|
<preference name="${key}" value="${value}" />`;
|
|
@@ -193,7 +203,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
|
|
|
193
203
|
}
|
|
194
204
|
const content = `<?xml version='1.0' encoding='utf-8'?>
|
|
195
205
|
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
196
|
-
|
|
206
|
+
${accessOriginString.join('')}
|
|
197
207
|
${pluginEntriesString.join('')}
|
|
198
208
|
${pluginPreferencesString.join('')}
|
|
199
209
|
</widget>`;
|
|
@@ -376,6 +386,20 @@ function getIncompatibleCordovaPlugins(platform) {
|
|
|
376
386
|
return pluginList;
|
|
377
387
|
}
|
|
378
388
|
exports.getIncompatibleCordovaPlugins = getIncompatibleCordovaPlugins;
|
|
389
|
+
function needsStaticPod(plugin, config) {
|
|
390
|
+
var _a, _b, _c, _d;
|
|
391
|
+
let pluginList = ['phonegap-plugin-push', '@batch.com/cordova-plugin'];
|
|
392
|
+
if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.staticPlugins) {
|
|
393
|
+
pluginList = pluginList.concat((_d = (_c = config.app.extConfig) === null || _c === void 0 ? void 0 : _c.cordova) === null || _d === void 0 ? void 0 : _d.staticPlugins);
|
|
394
|
+
}
|
|
395
|
+
return pluginList.includes(plugin.id) || useFrameworks(plugin);
|
|
396
|
+
}
|
|
397
|
+
exports.needsStaticPod = needsStaticPod;
|
|
398
|
+
function useFrameworks(plugin) {
|
|
399
|
+
const podspecs = plugin_1.getPlatformElement(plugin, 'ios', 'podspec');
|
|
400
|
+
const frameworkPods = podspecs.filter((podspec) => podspec.pods.filter((pods) => pods.$ && pods.$['use-frameworks'] === 'true').length > 0);
|
|
401
|
+
return frameworkPods.length > 0;
|
|
402
|
+
}
|
|
379
403
|
async function getCordovaPreferences(config) {
|
|
380
404
|
var _a, _b, _c, _d, _e;
|
|
381
405
|
const configXml = path_1.join(config.app.rootDir, 'config.xml');
|
package/dist/declarations.d.ts
CHANGED
|
@@ -387,6 +387,15 @@ export interface CapacitorConfig {
|
|
|
387
387
|
allowNavigation?: string[];
|
|
388
388
|
};
|
|
389
389
|
cordova?: {
|
|
390
|
+
/**
|
|
391
|
+
* Populates <access> tags in the config.xml with the origin set to
|
|
392
|
+
* the values entered here.
|
|
393
|
+
* If not provided, a single <access origin="*" /> tag gets included.
|
|
394
|
+
* It only has effect on a few Cordova plugins that respect the whitelist.
|
|
395
|
+
*
|
|
396
|
+
* @since 3.3.0
|
|
397
|
+
*/
|
|
398
|
+
accessOrigins?: string[];
|
|
390
399
|
/**
|
|
391
400
|
* Configure Cordova preferences.
|
|
392
401
|
*
|
|
@@ -395,6 +404,13 @@ export interface CapacitorConfig {
|
|
|
395
404
|
preferences?: {
|
|
396
405
|
[key: string]: string | undefined;
|
|
397
406
|
};
|
|
407
|
+
/**
|
|
408
|
+
* List of Cordova plugins that need to be static but are not
|
|
409
|
+
* already in the static plugin list.
|
|
410
|
+
*
|
|
411
|
+
* @since 3.3.0
|
|
412
|
+
*/
|
|
413
|
+
staticPlugins?: string[];
|
|
398
414
|
};
|
|
399
415
|
/**
|
|
400
416
|
* Configure plugins.
|
package/dist/ios/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkIOSPackage = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -69,11 +69,3 @@ async function editProjectSettingsIOS(config) {
|
|
|
69
69
|
await utils_fs_1.writeFile(pbxPath, pbxContent, { encoding: 'utf-8' });
|
|
70
70
|
}
|
|
71
71
|
exports.editProjectSettingsIOS = editProjectSettingsIOS;
|
|
72
|
-
function shouldPodInstall(config, platformName) {
|
|
73
|
-
// Don't run pod install or xcodebuild if not on macOS
|
|
74
|
-
if (config.cli.os !== "mac" /* Mac */ && platformName === 'ios') {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
exports.shouldPodInstall = shouldPodInstall;
|
package/dist/ios/update.js
CHANGED
|
@@ -40,14 +40,9 @@ async function updateIOS(config, deployment) {
|
|
|
40
40
|
}
|
|
41
41
|
exports.updateIOS = updateIOS;
|
|
42
42
|
async function installCocoaPodsPlugins(config, plugins, deployment) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
log_1.logger.warn('Skipping pod install on unsupported OS');
|
|
50
|
-
}
|
|
43
|
+
await common_1.runTask(`Updating iOS native dependencies with ${colors_1.default.input(`${config.ios.podPath} install`)}`, () => {
|
|
44
|
+
return updatePodfile(config, plugins, deployment);
|
|
45
|
+
});
|
|
51
46
|
}
|
|
52
47
|
exports.installCocoaPodsPlugins = installCocoaPodsPlugins;
|
|
53
48
|
async function updatePodfile(config, plugins, deployment) {
|
|
@@ -57,13 +52,25 @@ async function updatePodfile(config, plugins, deployment) {
|
|
|
57
52
|
let podfileContent = await utils_fs_1.readFile(podfilePath, { encoding: 'utf-8' });
|
|
58
53
|
podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
|
|
59
54
|
await utils_fs_1.writeFile(podfilePath, podfileContent, { encoding: 'utf-8' });
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const podCommandExists = await subprocess_1.isInstalled('pod');
|
|
56
|
+
if (podCommandExists) {
|
|
57
|
+
if (!deployment) {
|
|
58
|
+
await utils_fs_1.remove(podfileLockPath);
|
|
59
|
+
}
|
|
60
|
+
await subprocess_1.runCommand(config.ios.podPath, ['install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
log_1.logger.warn('Skipping pod install because CocoaPods is not installed');
|
|
64
|
+
}
|
|
65
|
+
const isXcodebuildAvailable = await subprocess_1.isInstalled('xcodebuild');
|
|
66
|
+
if (isXcodebuildAvailable) {
|
|
67
|
+
await subprocess_1.runCommand('xcodebuild', ['-project', path_1.basename(`${config.ios.nativeXcodeProjDirAbs}`), 'clean'], {
|
|
68
|
+
cwd: config.ios.nativeProjectDirAbs,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
log_1.logger.warn('Unable to find "xcodebuild". Skipping xcodebuild clean step...');
|
|
62
73
|
}
|
|
63
|
-
await subprocess_1.runCommand(config.ios.podPath, ['install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
64
|
-
await subprocess_1.runCommand('xcodebuild', ['-project', path_1.basename(`${config.ios.nativeXcodeProjDirAbs}`), 'clean'], {
|
|
65
|
-
cwd: config.ios.nativeProjectDirAbs,
|
|
66
|
-
});
|
|
67
74
|
}
|
|
68
75
|
async function generatePodFile(config, plugins) {
|
|
69
76
|
const capacitoriOSPath = node_1.resolveNode(config.app.rootDir, '@capacitor/ios', 'package.json');
|
|
@@ -103,19 +110,14 @@ async function generatePodFile(config, plugins) {
|
|
|
103
110
|
});
|
|
104
111
|
});
|
|
105
112
|
});
|
|
106
|
-
const
|
|
107
|
-
|
|
113
|
+
const staticPlugins = cordovaPlugins.filter(p => cordova_1.needsStaticPod(p, config));
|
|
114
|
+
const noStaticPlugins = cordovaPlugins.filter(el => !staticPlugins.includes(el));
|
|
115
|
+
if (noStaticPlugins.length > 0) {
|
|
108
116
|
pods.push(` pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'\n`);
|
|
109
117
|
}
|
|
110
|
-
|
|
111
|
-
const podSwiftPlugins = podPlugins.filter(filterSwift);
|
|
112
|
-
const podObjCPlugins = podPlugins.filter(el => !podSwiftPlugins.includes(el));
|
|
113
|
-
if (podObjCPlugins.length > 0) {
|
|
118
|
+
if (staticPlugins.length > 0) {
|
|
114
119
|
pods.push(` pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'\n`);
|
|
115
120
|
}
|
|
116
|
-
if (podSwiftPlugins.length > 0) {
|
|
117
|
-
pods.push(` pod 'CordovaPluginsStaticSwift', :path => '../capacitor-cordova-ios-plugins'\n`);
|
|
118
|
-
}
|
|
119
121
|
const resourcesPlugins = cordovaPlugins.filter(filterResources);
|
|
120
122
|
if (resourcesPlugins.length > 0) {
|
|
121
123
|
pods.push(` pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'\n`);
|
|
@@ -140,15 +142,12 @@ function isFramework(framework) {
|
|
|
140
142
|
return framework.$.src.split('.').pop().includes('framework');
|
|
141
143
|
}
|
|
142
144
|
async function generateCordovaPodspecs(cordovaPlugins, config) {
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
generateCordovaPodspec(noPodPlugins, config, false, false);
|
|
148
|
-
generateCordovaPodspec(podObjCPlugins, config, true, false);
|
|
149
|
-
generateCordovaPodspec(podSwiftPlugins, config, true, true);
|
|
145
|
+
const staticPlugins = cordovaPlugins.filter(p => cordova_1.needsStaticPod(p, config));
|
|
146
|
+
const noStaticPlugins = cordovaPlugins.filter(el => !staticPlugins.includes(el));
|
|
147
|
+
generateCordovaPodspec(noStaticPlugins, config, false);
|
|
148
|
+
generateCordovaPodspec(staticPlugins, config, true);
|
|
150
149
|
}
|
|
151
|
-
async function generateCordovaPodspec(cordovaPlugins, config, isStatic
|
|
150
|
+
async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
|
|
152
151
|
const weakFrameworks = [];
|
|
153
152
|
const linkedFrameworks = [];
|
|
154
153
|
const customFrameworks = [];
|
|
@@ -164,10 +163,6 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic, isSwift)
|
|
|
164
163
|
frameworkDeps.push('s.static_framework = true');
|
|
165
164
|
sourcesFolderName += 'static';
|
|
166
165
|
}
|
|
167
|
-
if (isSwift) {
|
|
168
|
-
name += 'Swift';
|
|
169
|
-
sourcesFolderName += 'swift';
|
|
170
|
-
}
|
|
171
166
|
cordovaPlugins.map((plugin) => {
|
|
172
167
|
const frameworks = plugin_1.getPlatformElement(plugin, platform, 'framework');
|
|
173
168
|
frameworks.map((framework) => {
|
|
@@ -302,14 +297,9 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
302
297
|
const headerFiles = plugin_1.getPlatformElement(p, platform, 'header-file');
|
|
303
298
|
const codeFiles = sourceFiles.concat(headerFiles);
|
|
304
299
|
const frameworks = plugin_1.getPlatformElement(p, platform, 'framework');
|
|
305
|
-
const podFrameworks = frameworks.filter((framework) => framework.$.type && framework.$.type === 'podspec');
|
|
306
|
-
const podspecs = plugin_1.getPlatformElement(p, platform, 'podspec');
|
|
307
300
|
let sourcesFolderName = 'sources';
|
|
308
|
-
if (
|
|
301
|
+
if (cordova_1.needsStaticPod(p, config)) {
|
|
309
302
|
sourcesFolderName += 'static';
|
|
310
|
-
if (filterSwift(p)) {
|
|
311
|
-
sourcesFolderName += 'swift';
|
|
312
|
-
}
|
|
313
303
|
}
|
|
314
304
|
const sourcesFolder = path_1.join(config.ios.cordovaPluginsDirAbs, sourcesFolderName, p.name);
|
|
315
305
|
for (const codeFile of codeFiles) {
|
|
@@ -368,17 +358,6 @@ async function removePluginsNativeFiles(config) {
|
|
|
368
358
|
await utils_fs_1.remove(config.ios.cordovaPluginsDirAbs);
|
|
369
359
|
await template_1.extractTemplate(config.cli.assets.ios.cordovaPluginsTemplateArchiveAbs, config.ios.cordovaPluginsDirAbs);
|
|
370
360
|
}
|
|
371
|
-
function filterNoPods(plugin) {
|
|
372
|
-
const frameworks = plugin_1.getPlatformElement(plugin, platform, 'framework');
|
|
373
|
-
const podFrameworks = frameworks.filter((framework) => framework.$.type && framework.$.type === 'podspec');
|
|
374
|
-
const podspecs = plugin_1.getPlatformElement(plugin, platform, 'podspec');
|
|
375
|
-
return podFrameworks.length === 0 && podspecs.length === 0;
|
|
376
|
-
}
|
|
377
|
-
function filterSwift(plugin) {
|
|
378
|
-
const sourceFiles = plugin_1.getPlatformElement(plugin, platform, 'source-file');
|
|
379
|
-
const swiftFiles = sourceFiles.filter((sf) => sf.$.src && sf.$.src.split('.').pop() === 'swift');
|
|
380
|
-
return swiftFiles.length > 0;
|
|
381
|
-
}
|
|
382
361
|
function filterResources(plugin) {
|
|
383
362
|
const resources = plugin_1.getPlatformElement(plugin, platform, 'resource-file');
|
|
384
363
|
return resources.length > 0;
|
package/dist/tasks/add.js
CHANGED
|
@@ -56,6 +56,11 @@ async function addCommand(config, selectedPlatformName) {
|
|
|
56
56
|
await editPlatforms(config, platformName);
|
|
57
57
|
if (await utils_fs_1.pathExists(config.app.webDirAbs)) {
|
|
58
58
|
await sync_1.sync(config, platformName, false);
|
|
59
|
+
if (platformName === config.android.name) {
|
|
60
|
+
await common_2.runTask('Syncing Gradle', async () => {
|
|
61
|
+
return add_1.createLocalProperties(config.android.platformDirAbs);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
65
|
else {
|
|
61
66
|
log_1.logger.warn(`${colors_1.default.success(colors_1.default.strong('sync'))} could not run--missing ${colors_1.default.strong(config.app.webDir)} directory.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "3.2
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"debug": "^4.2.0",
|
|
53
53
|
"env-paths": "^2.2.0",
|
|
54
54
|
"kleur": "^4.1.1",
|
|
55
|
-
"native-run": "^1.
|
|
55
|
+
"native-run": "^1.5.0",
|
|
56
56
|
"open": "^7.4.2",
|
|
57
57
|
"plist": "^3.0.2",
|
|
58
58
|
"prompts": "^2.3.2",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "3158cd9a293ac79de801c833bb937d2df54e0d96"
|
|
89
89
|
}
|