@pi-r/android 0.5.0 → 0.6.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/README.md +2 -0
- package/data/google-maven-snapshot.json +1 -1
- package/data/google-maven.json +1 -1
- package/extensions/gradle/dependencies/index.js +86 -77
- package/extensions/task/index.js +1 -1
- package/index.d.ts +6 -6
- package/package.json +3 -3
- package/template/java/static/build.gradle +2 -2
- package/template/java+kotlin/static/build.gradle +3 -3
- package/template/kotlin/build.gradle.kts +1 -1
- package/template/kotlin/static/build.gradle.kts +3 -3
- package/types/index.d.ts +1 -1
- package/types/squared.d.ts +1 -2
|
@@ -64,85 +64,79 @@ function finalize(instance) {
|
|
|
64
64
|
}
|
|
65
65
|
return [groupId, artifactId, version || (snapshot ? 'latest.integration' : 'latest.release'), type];
|
|
66
66
|
});
|
|
67
|
-
if (dependencyScopes) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
current[2] = version;
|
|
105
|
-
found = true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else if (rangeVer && type < t) {
|
|
109
|
-
current[2] = version;
|
|
110
|
-
found = true;
|
|
111
|
-
}
|
|
112
|
-
current[3] = '0';
|
|
113
|
-
}
|
|
114
|
-
else if (isUpgrade(current[2], version)) {
|
|
115
|
-
current[2] = version;
|
|
116
|
-
found = true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
supplement.push([groupId, artifactId, version, type.toString()]);
|
|
121
|
-
found = true;
|
|
122
|
-
}
|
|
67
|
+
if (dependencyScopes && (data = getData())) {
|
|
68
|
+
const supplement = [];
|
|
69
|
+
for (const item of items) {
|
|
70
|
+
const [gId, id] = item;
|
|
71
|
+
const target = data[gId]?.find(group => id === group.artifactId);
|
|
72
|
+
if (!target) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (target.dependencies) {
|
|
76
|
+
let found;
|
|
77
|
+
for (const { groupId, artifactId, version, scope } of target.dependencies) {
|
|
78
|
+
if (scope && (dependencyScopes === true || hasScope(scope))) {
|
|
79
|
+
let type = -1;
|
|
80
|
+
switch (scope) {
|
|
81
|
+
case 'compile':
|
|
82
|
+
type = 0 /* DEPENDENCY_TYPE.IMPLEMENTATION */;
|
|
83
|
+
break;
|
|
84
|
+
case 'provided':
|
|
85
|
+
type = 2 /* DEPENDENCY_TYPE.COMPILE_ONLY */;
|
|
86
|
+
break;
|
|
87
|
+
case 'runtime':
|
|
88
|
+
type = 4 /* DEPENDENCY_TYPE.RUNTIME_ONLY */;
|
|
89
|
+
break;
|
|
90
|
+
case 'test':
|
|
91
|
+
type = 5 /* DEPENDENCY_TYPE.TEST_IMPLEMENTATION */;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (type !== -1) {
|
|
95
|
+
const current = supplement.find(seg => seg[0] === groupId && seg[1] === artifactId);
|
|
96
|
+
if (current) {
|
|
97
|
+
const t = parseInt(current[3]);
|
|
98
|
+
if (t !== type) {
|
|
99
|
+
const rangeVer = REGEXP_SEMVER.test(version);
|
|
100
|
+
if (!REGEXP_SEMVER.test(current[2])) {
|
|
101
|
+
if (rangeVer || type < t) {
|
|
102
|
+
current[2] = version;
|
|
103
|
+
found = true;
|
|
123
104
|
}
|
|
124
105
|
}
|
|
106
|
+
else if (rangeVer && type < t) {
|
|
107
|
+
current[2] = version;
|
|
108
|
+
found = true;
|
|
109
|
+
}
|
|
110
|
+
current[3] = '0';
|
|
125
111
|
}
|
|
126
|
-
if (
|
|
127
|
-
|
|
112
|
+
else if (isUpgrade(current[2], version)) {
|
|
113
|
+
current[2] = version;
|
|
114
|
+
found = true;
|
|
128
115
|
}
|
|
129
116
|
}
|
|
130
|
-
|
|
117
|
+
else {
|
|
118
|
+
supplement.push([groupId, artifactId, version, type.toString()]);
|
|
119
|
+
found = true;
|
|
120
|
+
}
|
|
131
121
|
}
|
|
132
122
|
}
|
|
133
123
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const [groupId, artifactId] = item;
|
|
137
|
-
const index = items.findIndex(seg => seg[0] === groupId && seg[1] === artifactId);
|
|
138
|
-
if (index === -1) {
|
|
139
|
-
items.push(item);
|
|
140
|
-
}
|
|
141
|
-
else if (snapshot) {
|
|
142
|
-
item[3] = items[index][3];
|
|
143
|
-
items[index] = item;
|
|
124
|
+
if (found && (snapshot || isUpgrade(item[2], target.version))) {
|
|
125
|
+
item[2] = target.version;
|
|
144
126
|
}
|
|
145
127
|
}
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
for (const item of supplement) {
|
|
131
|
+
const [groupId, artifactId] = item;
|
|
132
|
+
const index = items.findIndex(seg => seg[0] === groupId && seg[1] === artifactId);
|
|
133
|
+
if (index === -1) {
|
|
134
|
+
items.push(item);
|
|
135
|
+
}
|
|
136
|
+
else if (snapshot) {
|
|
137
|
+
item[3] = items[index][3];
|
|
138
|
+
items[index] = item;
|
|
139
|
+
}
|
|
146
140
|
}
|
|
147
141
|
}
|
|
148
142
|
items.sort((a, b) => {
|
|
@@ -161,9 +155,9 @@ function finalize(instance) {
|
|
|
161
155
|
if (!kotlin && items.some(seg => seg[1].endsWith('-ktx'))) {
|
|
162
156
|
setModified(Document.updateGradle(source, ['plugins'], "id 'kotlin-android'", { multiple: true }));
|
|
163
157
|
}
|
|
164
|
-
const match = /dependencies\s+\{((?:{[^}]*}|
|
|
158
|
+
const match = /dependencies\s+\{((?:{[^{]*{|{[^}]*}|}[^}]*}|\\}*?|[^{}+])+)\}/.exec(source);
|
|
165
159
|
if (match) {
|
|
166
|
-
const pattern = kotlin ? /([ \t]*)(implementation|api|compileOnly
|
|
160
|
+
const pattern = kotlin ? /([ \t]*)(implementation|api|compileOnly(?:Api)?|runtimeOnly|(?:test|androidTest)(?:Implementation|RuntimeOnly|CompileOnly))\((?:\s*(?:"([^"]+)"|((?:\s*(?:group|name|version)\s*=\s*"[^"]+"\s*,?){3}))\s*\))?/g : /([ \t]*)(implementation|api|compileOnly(?:Api)?|runtimeOnly|(?:test|androidTest)(?:Implementation|RuntimeOnly|CompileOnly))(?:\s*\(?\s*["']([^"']+)["']\s*\)?|\s+((?:\s*(?:group|name|version)\s*:\s*["'][^"']+["']\s*,?){3}))?/g;
|
|
167
161
|
let content = match[1], named = false, indent, method;
|
|
168
162
|
const writeMethod = (item, args, prefix = 'implementation') => {
|
|
169
163
|
switch (parseInt(item[3])) {
|
|
@@ -176,15 +170,30 @@ function finalize(instance) {
|
|
|
176
170
|
case 2 /* DEPENDENCY_TYPE.COMPILE_ONLY */:
|
|
177
171
|
prefix = 'compileOnly';
|
|
178
172
|
break;
|
|
179
|
-
case 3 /* DEPENDENCY_TYPE.
|
|
173
|
+
case 3 /* DEPENDENCY_TYPE.COMPILE_ONLY_API */:
|
|
174
|
+
prefix = 'compileOnlyApi';
|
|
175
|
+
break;
|
|
176
|
+
case 4 /* DEPENDENCY_TYPE.RUNTIME_ONLY */:
|
|
180
177
|
prefix = 'runtimeOnly';
|
|
181
178
|
break;
|
|
182
|
-
case
|
|
179
|
+
case 5 /* DEPENDENCY_TYPE.TEST_IMPLEMENTATION */:
|
|
183
180
|
prefix = 'testImplementation';
|
|
184
181
|
break;
|
|
185
|
-
case
|
|
182
|
+
case 6 /* DEPENDENCY_TYPE.TEST_COMPILE_ONLY */:
|
|
183
|
+
prefix = 'testCompileOnly';
|
|
184
|
+
break;
|
|
185
|
+
case 7 /* DEPENDENCY_TYPE.TEST_RUNTIME_ONLY */:
|
|
186
|
+
prefix = 'testRuntimeOnly';
|
|
187
|
+
break;
|
|
188
|
+
case 8 /* DEPENDENCY_TYPE.ANDROID_TEST_IMPLEMENTATION */:
|
|
186
189
|
prefix = 'androidTestImplementation';
|
|
187
190
|
break;
|
|
191
|
+
case 9 /* DEPENDENCY_TYPE.ANDROID_TEST_COMPILE_ONLY */:
|
|
192
|
+
prefix = 'androidTestCompileOnly';
|
|
193
|
+
break;
|
|
194
|
+
case 10 /* DEPENDENCY_TYPE.ANDROID_TEST_RUNTIME_ONLY */:
|
|
195
|
+
prefix = 'androidTestRuntimeOnly';
|
|
196
|
+
break;
|
|
188
197
|
}
|
|
189
198
|
let dependency;
|
|
190
199
|
if (args || named) {
|
|
@@ -224,7 +233,7 @@ function finalize(instance) {
|
|
|
224
233
|
if (group && name) {
|
|
225
234
|
let found = 0, index = -1;
|
|
226
235
|
if (version && (index = items.findIndex(seg => seg[0] === group && seg[1] === name)) !== -1) {
|
|
227
|
-
found = (version
|
|
236
|
+
found = (!version.startsWith('$') || !kotlin && method[0].includes("'")) && isUpgrade(version, items[index][2]) ? 2 : 1;
|
|
228
237
|
}
|
|
229
238
|
if (found) {
|
|
230
239
|
if (found === 2) {
|
|
@@ -255,9 +264,9 @@ function finalize(instance) {
|
|
|
255
264
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], 'compose = true');
|
|
256
265
|
}
|
|
257
266
|
else {
|
|
258
|
-
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.
|
|
267
|
+
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.22" /* VERSIONS.KOTLIN_STDLIB */)}'` });
|
|
259
268
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], "compose true");
|
|
260
|
-
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.
|
|
269
|
+
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.8" /* VERSIONS.KOTLIN_COMPILER */)}'`, true);
|
|
261
270
|
if (upgrade) {
|
|
262
271
|
output = Document.updateGradle(output, ['android', 'kotlinOptions'], `jvmTarget = '${javaVersion}'`, true);
|
|
263
272
|
}
|
package/extensions/task/index.js
CHANGED
|
@@ -31,7 +31,7 @@ async function finalize(instance) {
|
|
|
31
31
|
const exec = settings.exec;
|
|
32
32
|
let { broadcastId, baseDirectory } = this, command = settings.command, uid, gid, title, filename, altname, foundDir;
|
|
33
33
|
if (command) {
|
|
34
|
-
if (command.
|
|
34
|
+
if (command.includes('mvn')) {
|
|
35
35
|
title = "maven" /* STRINGS.MAVEN */;
|
|
36
36
|
}
|
|
37
37
|
else {
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/android",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Android document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/document": "^0.
|
|
24
|
-
"@e-mc/types": "^0.
|
|
23
|
+
"@e-mc/document": "^0.8.2",
|
|
24
|
+
"@e-mc/types": "^0.8.2",
|
|
25
25
|
"htmlparser2": "^9.0.0",
|
|
26
26
|
"which": "^2.0.2"
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
id 'com.android.application' version '8.2.
|
|
3
|
-
id 'com.android.library' version '8.2.
|
|
4
|
-
id 'org.jetbrains.kotlin.android' version '1.9.
|
|
2
|
+
id 'com.android.application' version '8.2.2' apply false
|
|
3
|
+
id 'com.android.library' version '8.2.2' apply false
|
|
4
|
+
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
|
|
5
5
|
}
|
|
@@ -38,7 +38,7 @@ java {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
dependencies {
|
|
41
|
-
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.
|
|
41
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
|
|
42
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")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
id("com.android.application") version "8.2.
|
|
3
|
-
id("com.android.library") version "8.2.
|
|
4
|
-
id("org.jetbrains.kotlin.android") version "1.9.
|
|
2
|
+
id("com.android.application") version "8.2.2" apply false
|
|
3
|
+
id("com.android.library") version "8.2.2" apply false
|
|
4
|
+
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
|
|
5
5
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FinalizedElement } from '@e-mc/types/lib/squared';
|
|
|
2
2
|
|
|
3
3
|
import type { DocumentConstructor, IDocument, IFileManager } from '@e-mc/types/lib';
|
|
4
4
|
import type { ExternalAsset } from '@e-mc/types/lib/asset';
|
|
5
|
-
import type { DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings
|
|
5
|
+
import type { ExecAction, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
|
|
6
6
|
|
|
7
7
|
import type { DocumentOutput, MavenScopes } from './squared';
|
|
8
8
|
|
package/types/squared.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FinalizedElement, ControllerSettingsDirectoryUI as IControllerSettingsDirectoryUI } from '@e-mc/types/lib/squared';
|
|
2
2
|
|
|
3
|
-
import type { ExternalAsset } from '@e-mc/types/lib/asset';
|
|
4
3
|
import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
|
|
5
4
|
|
|
6
5
|
export interface DocumentOutput {
|
|
@@ -24,7 +23,7 @@ export interface DocumentOutput {
|
|
|
24
23
|
extensionData?: PlainObject;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
export interface RequestData extends IRequestData
|
|
26
|
+
export interface RequestData extends IRequestData, DocumentOutput {}
|
|
28
27
|
|
|
29
28
|
export interface ManifestData {
|
|
30
29
|
package?: string;
|