@capacitor/cli 3.4.0 → 3.4.3
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 +33 -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/run.js +13 -3
- package/dist/android/update.js +44 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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.4.3](https://github.com/ionic-team/capacitor/compare/3.4.2...3.4.3) (2022-03-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli:** avoid srcFiles is not iterable on kotlinNeededCheck ([#5481](https://github.com/ionic-team/capacitor/issues/5481)) ([3c2b579](https://github.com/ionic-team/capacitor/commit/3c2b579c6edb1fc69d85689b268eb92067b7821b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.4.2](https://github.com/ionic-team/capacitor/compare/3.4.1...3.4.2) (2022-03-03)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **android:** compatibility with cordova kotlin plugins ([#5438](https://github.com/ionic-team/capacitor/issues/5438)) ([55bf004](https://github.com/ionic-team/capacitor/commit/55bf004897b3feb280ab6b6575d2a2c1a0a183e2))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [3.4.1](https://github.com/ionic-team/capacitor/compare/3.4.0...3.4.1) (2022-02-09)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **cli:** Better error on gradlew permission problems ([#5405](https://github.com/ionic-team/capacitor/issues/5405)) ([9420f08](https://github.com/ionic-team/capacitor/commit/9420f08dedad78cfaa5500cccf8bdbf1a9140684))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
# [3.4.0](https://github.com/ionic-team/capacitor/compare/3.3.4...3.4.0) (2022-01-19)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package @capacitor/cli
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/run.js
CHANGED
|
@@ -15,9 +15,19 @@ async function runAndroid(config, { target: selectedTarget }) {
|
|
|
15
15
|
const arg = `assemble${((_a = config.android) === null || _a === void 0 ? void 0 : _a.flavor) || ''}Debug`;
|
|
16
16
|
const gradleArgs = [arg];
|
|
17
17
|
debug('Invoking ./gradlew with args: %O', gradleArgs);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
try {
|
|
19
|
+
await common_1.runTask('Running Gradle build', async () => subprocess_1.runCommand('./gradlew', gradleArgs, {
|
|
20
|
+
cwd: config.android.platformDirAbs,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
if (e.includes('EACCES')) {
|
|
25
|
+
throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.strong(`chmod +x ./${config.android.platformDir}/gradlew`)} and try again.`;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
21
31
|
const apkPath = path_1.resolve(config.android.buildOutputDirAbs, config.android.apkName);
|
|
22
32
|
const nativeRunArgs = ['android', '--app', apkPath, '--target', target.id];
|
|
23
33
|
debug('Invoking native-run with args: %O', nativeRunArgs);
|
package/dist/android/update.js
CHANGED
|
@@ -166,7 +166,11 @@ if (hasProperty('postBuildExtras')) {
|
|
|
166
166
|
}
|
|
167
167
|
exports.installGradlePlugins = installGradlePlugins;
|
|
168
168
|
async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
169
|
+
var _a, _b, _c;
|
|
169
170
|
const pluginsGradlePath = path_1.join(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
171
|
+
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
172
|
+
const isKotlinVersionInVariablesGradle = (await getVariablesGradleFile(config)).includes('kotlin_version');
|
|
173
|
+
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.4.32';
|
|
170
174
|
const frameworksArray = [];
|
|
171
175
|
let prefsArray = [];
|
|
172
176
|
const applyArray = [];
|
|
@@ -193,10 +197,24 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
193
197
|
})
|
|
194
198
|
.join('\n');
|
|
195
199
|
frameworkString = await replaceFrameworkVariables(config, prefsArray, frameworkString);
|
|
200
|
+
if (kotlinNeeded) {
|
|
201
|
+
frameworkString += `\n implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"`;
|
|
202
|
+
frameworkString += `\n implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"`;
|
|
203
|
+
}
|
|
196
204
|
const applyString = applyArray.join('\n');
|
|
197
205
|
let buildGradle = await utils_fs_1.readFile(pluginsGradlePath, { encoding: 'utf-8' });
|
|
198
206
|
buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + frameworkString.concat('\n') + ' $2');
|
|
199
207
|
buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + applyString.concat('\n') + '$2');
|
|
208
|
+
if (kotlinNeeded) {
|
|
209
|
+
buildGradle = buildGradle.replace(/(buildscript\s{\n(\t|\s{4})repositories\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})}\n(\t|\s{4})dependencies\s{\n(\t{2}|\s{8}).+)\n((\t|\s{4})}\n}\n)/, `$1\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:` +
|
|
210
|
+
(isKotlinVersionInVariablesGradle
|
|
211
|
+
? '$kotlin_version'
|
|
212
|
+
: kotlinVersionString) +
|
|
213
|
+
`"\n$8`);
|
|
214
|
+
buildGradle = buildGradle.replace(/(ext\s{)/, `$1\n kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '${kotlinVersionString}'\n androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.6.0'`);
|
|
215
|
+
buildGradle = buildGradle.replace(/(apply\splugin:\s'com\.android\.library')/, `$1\napply plugin: 'kotlin-android'`);
|
|
216
|
+
buildGradle = buildGradle.replace(/(compileOptions\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})})\n(})/, `$1\n sourceSets {\n main.java.srcDirs += 'src/main/kotlin'\n }\n$5`);
|
|
217
|
+
}
|
|
200
218
|
await utils_fs_1.writeFile(pluginsGradlePath, buildGradle);
|
|
201
219
|
const cordovaVariables = `// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
202
220
|
ext {
|
|
@@ -208,6 +226,27 @@ ext {
|
|
|
208
226
|
await utils_fs_1.writeFile(path_1.join(config.android.cordovaPluginsDirAbs, 'cordova.variables.gradle'), cordovaVariables);
|
|
209
227
|
}
|
|
210
228
|
exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
|
|
229
|
+
async function kotlinNeededCheck(config, cordovaPlugins) {
|
|
230
|
+
var _a, _b;
|
|
231
|
+
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !==
|
|
232
|
+
'true') {
|
|
233
|
+
for (const plugin of cordovaPlugins) {
|
|
234
|
+
const androidPlatform = plugin_1.getPluginPlatform(plugin, platform);
|
|
235
|
+
const sourceFiles = androidPlatform['source-file'];
|
|
236
|
+
if (sourceFiles) {
|
|
237
|
+
for (const srcFile of sourceFiles) {
|
|
238
|
+
if (/^.*\.kt$/.test(srcFile['$'].src)) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
211
250
|
async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
212
251
|
const pluginsPath = path_1.join(config.android.cordovaPluginsDirAbs, 'src', 'main');
|
|
213
252
|
for (const p of cordovaPlugins) {
|
|
@@ -257,12 +296,16 @@ async function getPluginsTask(config) {
|
|
|
257
296
|
return androidPlugins;
|
|
258
297
|
});
|
|
259
298
|
}
|
|
260
|
-
async function
|
|
299
|
+
async function getVariablesGradleFile(config) {
|
|
261
300
|
const variablesFile = path_1.resolve(config.android.platformDirAbs, 'variables.gradle');
|
|
262
301
|
let variablesGradle = '';
|
|
263
302
|
if (await utils_fs_1.pathExists(variablesFile)) {
|
|
264
303
|
variablesGradle = await utils_fs_1.readFile(variablesFile, { encoding: 'utf-8' });
|
|
265
304
|
}
|
|
305
|
+
return variablesGradle;
|
|
306
|
+
}
|
|
307
|
+
async function replaceFrameworkVariables(config, prefsArray, frameworkString) {
|
|
308
|
+
const variablesGradle = await getVariablesGradleFile(config);
|
|
266
309
|
prefsArray.map((preference) => {
|
|
267
310
|
if (!variablesGradle.includes(preference.$.name)) {
|
|
268
311
|
frameworkString = frameworkString.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
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)",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "33e9b342790ddedfb654c589ffde18b101d4cd98"
|
|
89
89
|
}
|