@pi-r/android 0.3.0 → 0.3.1
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/extensions/gradle/dependencies/index.js +22 -9
- package/extensions/task/index.js +8 -7
- package/index.d.ts +6 -6
- package/package.json +1 -1
- package/template/java/static/build.gradle +2 -2
- package/template/java+kotlin/build.gradle +1 -1
- package/template/java+kotlin/static/build.gradle +3 -3
- package/template/kotlin/build.gradle.kts +2 -2
- package/template/kotlin/static/build.gradle.kts +3 -3
|
@@ -26,7 +26,7 @@ function finalize(instance) {
|
|
|
26
26
|
if (!kotlin && items.some(value => value[1].endsWith('-ktx'))) {
|
|
27
27
|
setModified(Document.updateGradle(source, ['plugins'], "id 'kotlin-android'", { multiple: true }));
|
|
28
28
|
}
|
|
29
|
-
const match = /dependencies\s+\{([^}]+)\}/.exec(source);
|
|
29
|
+
const match = /dependencies\s+\{((?:{[^}]*}|(?![{}])[\S\s])+)\}/.exec(source);
|
|
30
30
|
if (match) {
|
|
31
31
|
const writeImpl = (item) => 'implementation' + (kotlin ? `("${item.join(':')}")` : ` '${item.join(':')}'`);
|
|
32
32
|
const pattern = kotlin ? /([ \t]*)implementation\((?:\s*"([^"]+)"\s*\))?/g : /([ \t]*)implementation(?:\s*\(?\s*["']([^"']+)["']\s*\)?|\s+((?:\s*(?:group|name|version)\s*:\s*["'][^"']+["']\s*,?){3}))?/g;
|
|
@@ -59,12 +59,25 @@ function finalize(instance) {
|
|
|
59
59
|
if (version && (index = items.findIndex(seg => seg[0] === group && seg[1] === name)) !== -1) {
|
|
60
60
|
found = 1;
|
|
61
61
|
if (version[0] !== '$' || !kotlin && impl[0].indexOf("'") !== -1) {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
const semver = /^((\s*,\s*)?[([\]]((\s*,\s*)?\d+\.\d+(\s*,\s*)?)+[)\][])+$/;
|
|
63
|
+
const pending = items[index][2];
|
|
64
|
+
if (semver.test(pending)) {
|
|
65
|
+
found = 2;
|
|
66
|
+
}
|
|
67
|
+
else if (!semver.test(version)) {
|
|
68
|
+
const getArray = (value) => value.split(/[.-]/).map(seg => +seg);
|
|
69
|
+
const current = getArray(pending);
|
|
70
|
+
const previous = getArray(version);
|
|
71
|
+
for (let i = 0; i < previous.length; ++i) {
|
|
72
|
+
const a = previous[i];
|
|
73
|
+
const b = current[i];
|
|
74
|
+
if (isNaN(a) || b > a) {
|
|
75
|
+
found = 2;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
if (isNaN(b) || b < a) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
83
|
}
|
|
@@ -97,9 +110,9 @@ function finalize(instance) {
|
|
|
97
110
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], 'compose = true');
|
|
98
111
|
}
|
|
99
112
|
else {
|
|
100
|
-
output = Document.updateGradle(output, ['plugins'], "id 'org.jetbrains.kotlin.android'", { upgrade: true, multiple: true, addendum: `version '${instance.findVersion('org.jetbrains.kotlin:kotlin-stdlib', "1.9.
|
|
113
|
+
output = Document.updateGradle(output, ['plugins'], "id 'org.jetbrains.kotlin.android'", { upgrade: true, multiple: true, addendum: `version '${instance.findVersion('org.jetbrains.kotlin:kotlin-stdlib', "1.9.10" /* VERSIONS.KOTLIN_STDLIB */)}'` });
|
|
101
114
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], "compose true");
|
|
102
|
-
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.
|
|
115
|
+
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.5" /* VERSIONS.KOTLIN_COMPILER */)}'`, true);
|
|
103
116
|
if (upgrade) {
|
|
104
117
|
output = Document.updateGradle(output, ['android', 'kotlinOptions'], `jvmTarget = '${javaVersion}'`, true);
|
|
105
118
|
}
|
package/extensions/task/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const fs = require("fs");
|
|
|
5
5
|
const child_process = require("child_process");
|
|
6
6
|
const types_1 = require("@e-mc/types");
|
|
7
7
|
const Document = require("@e-mc/document");
|
|
8
|
+
const checkWin32 = (value) => value === "gradlew" /* STRINGS.GRADLEW */ && process.platform === 'win32' ? value + '.bat' : value;
|
|
8
9
|
async function finalize(instance) {
|
|
9
10
|
const commands = instance.config.commands;
|
|
10
11
|
if (!commands || this.incremental === 'staging') {
|
|
@@ -27,7 +28,7 @@ async function finalize(instance) {
|
|
|
27
28
|
}
|
|
28
29
|
const settings = instance.settings.extensions?.task || {};
|
|
29
30
|
const exec = settings.exec;
|
|
30
|
-
let { broadcastId, baseDirectory } = this, command = settings.command, uid, gid, title,
|
|
31
|
+
let { broadcastId, baseDirectory } = this, command = settings.command, uid, gid, title, filename, foundCwd;
|
|
31
32
|
if (command) {
|
|
32
33
|
if (command.indexOf('mvn') !== -1) {
|
|
33
34
|
title = 'maven';
|
|
@@ -36,20 +37,20 @@ async function finalize(instance) {
|
|
|
36
37
|
title = /([^\\/]+?)(?:\.[a-z]+)?$/i.exec(command)?.[1] || 'SPAWN';
|
|
37
38
|
}
|
|
38
39
|
command = path.normalize(command);
|
|
39
|
-
if (
|
|
40
|
-
|
|
40
|
+
if (!/[\\/]/.test(command = path.normalize(command))) {
|
|
41
|
+
filename = checkWin32(command);
|
|
41
42
|
}
|
|
42
43
|
command = Document.sanitizeCmd(command);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
|
-
|
|
46
|
-
command = '.' + path.sep +
|
|
46
|
+
filename = checkWin32("gradlew" /* STRINGS.GRADLEW */);
|
|
47
|
+
command = '.' + path.sep + filename;
|
|
47
48
|
title = 'gradle';
|
|
48
49
|
}
|
|
49
|
-
if (
|
|
50
|
+
if (filename) {
|
|
50
51
|
try {
|
|
51
52
|
let appDir = baseDirectory;
|
|
52
|
-
while (!(foundCwd = fs.existsSync(path.join(appDir,
|
|
53
|
+
while (!(foundCwd = fs.existsSync(path.join(appDir, filename)))) {
|
|
53
54
|
const parent = path.dirname(appDir);
|
|
54
55
|
if (parent === appDir) {
|
|
55
56
|
break;
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IFileManager } from '@e-mc/types/types/lib';
|
|
2
|
-
|
|
3
|
-
import type { AndroidDocumentConstructor, DocumentAsset } from './types';
|
|
4
|
-
|
|
5
|
-
declare const Android: AndroidDocumentConstructor<IFileManager<DocumentAsset>>;
|
|
6
|
-
|
|
1
|
+
import type { IFileManager } from '@e-mc/types/types/lib';
|
|
2
|
+
|
|
3
|
+
import type { AndroidDocumentConstructor, DocumentAsset } from './types';
|
|
4
|
+
|
|
5
|
+
declare const Android: AndroidDocumentConstructor<IFileManager<DocumentAsset>>;
|
|
6
|
+
|
|
7
7
|
export = Android;
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ android {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
dependencies {
|
|
40
|
-
implementation 'androidx.core:core-ktx:1.
|
|
40
|
+
implementation 'androidx.core:core-ktx:1.12.0'
|
|
41
41
|
testImplementation 'junit:junit:4.13.2'
|
|
42
42
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
43
43
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
id 'com.android.application' version '8.
|
|
3
|
-
id 'com.android.library' version '8.
|
|
4
|
-
id 'org.jetbrains.kotlin.android' version '1.9.
|
|
2
|
+
id 'com.android.application' version '8.2.0' apply false
|
|
3
|
+
id 'com.android.library' version '8.2.0' apply false
|
|
4
|
+
id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
|
|
5
5
|
}
|
|
@@ -38,8 +38,8 @@ java {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
dependencies {
|
|
41
|
-
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.
|
|
42
|
-
implementation("androidx.core:core-ktx:1.
|
|
41
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.10")
|
|
42
|
+
implementation("androidx.core:core-ktx:1.12.0")
|
|
43
43
|
testImplementation("junit:junit:4.13.2")
|
|
44
44
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
|
45
45
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
id("com.android.application") version "8.
|
|
3
|
-
id("com.android.library") version "8.
|
|
4
|
-
id("org.jetbrains.kotlin.android") version "1.9.
|
|
2
|
+
id("com.android.application") version "8.2.0" apply false
|
|
3
|
+
id("com.android.library") version "8.2.0" apply false
|
|
4
|
+
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
|
|
5
5
|
}
|