@pi-r/android 0.7.0 → 0.7.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/data/google-maven-snapshot.json +1 -1
- package/data/google-maven.json +1 -1
- package/extensions/app/manifest/index.js +26 -28
- package/extensions/gradle/dependencies/index.js +7 -8
- package/extensions/task/index.js +1 -1
- package/index.js +10 -2
- package/package.json +3 -3
- 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
|
@@ -77,35 +77,33 @@ module.exports = function finalize(instance) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
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
|
-
|
|
105
|
-
modified = true;
|
|
106
|
-
}
|
|
107
|
-
break;
|
|
80
|
+
for (const name in activity) {
|
|
81
|
+
const { layout: attribs } = activity[name];
|
|
82
|
+
if (attribs) {
|
|
83
|
+
let element = domutils.findOne(elem => elem.attribs['android:name'] === name, activities);
|
|
84
|
+
if (!element) {
|
|
85
|
+
domutils.appendChild(target, element = new domhandler.Element('activity', { 'android:name': name }));
|
|
86
|
+
domutils.append(element, new domhandler.Text('\n'));
|
|
87
|
+
}
|
|
88
|
+
let layout = domutils.findOne(elem => elem.tagName === 'layout', [element]), found = true;
|
|
89
|
+
if (!layout) {
|
|
90
|
+
domutils.appendChild(element, layout = new domhandler.Element('layout', {}));
|
|
91
|
+
domutils.append(layout, new domhandler.Text('\n'));
|
|
92
|
+
found = false;
|
|
93
|
+
}
|
|
94
|
+
for (const attr in attribs) {
|
|
95
|
+
switch (attr) {
|
|
96
|
+
case 'defaultHeight':
|
|
97
|
+
case 'defaultWidth':
|
|
98
|
+
case 'minHeight':
|
|
99
|
+
case 'minWidth':
|
|
100
|
+
case 'gravity': {
|
|
101
|
+
const value = attribs[attr];
|
|
102
|
+
if (!found || layout.attribs['android:' + attr] !== value) {
|
|
103
|
+
layout.attribs['android:' + attr] = value;
|
|
104
|
+
modified = true;
|
|
108
105
|
}
|
|
106
|
+
break;
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
}
|
|
@@ -28,15 +28,14 @@ function isUpgrade(version, pending) {
|
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
30
|
module.exports = function finalize(instance) {
|
|
31
|
-
const
|
|
32
|
-
const { profileable, dependencies, dataBinding, versionName, versionCode, namespace, applicationId } = config;
|
|
31
|
+
const { profileable, dependencies, dataBinding, versionName, versionCode, namespace, applicationId, mainParentDir } = instance.config;
|
|
33
32
|
if (!profileable && !dependencies && !dataBinding && !versionName && !versionCode && !namespace && !applicationId) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
let { localUri, source, existing, kotlin } = instance.findTemplate(path.join(this.baseDirectory,
|
|
35
|
+
const options = { detect: this.incremental !== 'staging', languageOf: 'gradle' };
|
|
36
|
+
let { localUri, source, existing, kotlin } = instance.findTemplate(path.join(this.baseDirectory, mainParentDir), "build.gradle", options);
|
|
38
37
|
if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
|
|
39
|
-
const { javaVersion, dependencyScopes } = config;
|
|
38
|
+
const { javaVersion, dependencyScopes } = instance.config;
|
|
40
39
|
let jvmTarget, modified;
|
|
41
40
|
const upgrade = javaVersion > 0;
|
|
42
41
|
const setModified = (output) => {
|
|
@@ -264,9 +263,9 @@ module.exports = function finalize(instance) {
|
|
|
264
263
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], 'compose = true');
|
|
265
264
|
}
|
|
266
265
|
else {
|
|
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.
|
|
266
|
+
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.24")}'` });
|
|
268
267
|
output = Document.updateGradle(output, ['android', 'buildFeatures'], "compose true");
|
|
269
|
-
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.
|
|
268
|
+
output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.14")}'`, true);
|
|
270
269
|
if (upgrade) {
|
|
271
270
|
output = Document.updateGradle(output, ['android', 'kotlinOptions'], `jvmTarget = '${javaVersion}'`, true);
|
|
272
271
|
}
|
|
@@ -373,7 +372,7 @@ module.exports = function finalize(instance) {
|
|
|
373
372
|
}
|
|
374
373
|
}
|
|
375
374
|
if (!existing) {
|
|
376
|
-
({ localUri, source, existing, kotlin } = instance.findTemplate(this.baseDirectory, "build.gradle", {
|
|
375
|
+
({ localUri, source, existing, kotlin } = instance.findTemplate(this.baseDirectory, "build.gradle", { ...options, subDir: 'static' }));
|
|
377
376
|
if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
|
|
378
377
|
try {
|
|
379
378
|
if (instance.writeFile(localUri, source, { encoding: 'utf-8', ownPermissionOnly: true, throwsPermission: true })) {
|
package/extensions/task/index.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = async function finalize(instance) {
|
|
|
20
20
|
taskArgs = [commands];
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
taskArgs = commands.map(value =>
|
|
23
|
+
taskArgs = commands.map(value => Array.isArray(value) ? value : [value]);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
else {
|
package/index.js
CHANGED
|
@@ -177,8 +177,16 @@ class AndroidDocument extends Document {
|
|
|
177
177
|
let kotlin, language;
|
|
178
178
|
if (languageOf) {
|
|
179
179
|
kotlin = (language = this.settings.language?.[languageOf]) === 'kotlin';
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
if (detect !== false) {
|
|
181
|
+
const isKts = this.detectKts(baseDir, filename);
|
|
182
|
+
if (isKts && language === 'java') {
|
|
183
|
+
kotlin = true;
|
|
184
|
+
detect = true;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
detect = typeof isKts === 'boolean' && (kotlin && isKts || !kotlin && !isKts);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
182
190
|
if (kotlin) {
|
|
183
191
|
filename += '.kts';
|
|
184
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/android",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
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.9.
|
|
24
|
-
"@e-mc/types": "^0.9.
|
|
23
|
+
"@e-mc/document": "^0.9.2",
|
|
24
|
+
"@e-mc/types": "^0.9.2",
|
|
25
25
|
"htmlparser2": "^9.1.0",
|
|
26
26
|
"which": "^2.0.2"
|
|
27
27
|
}
|
|
@@ -37,7 +37,7 @@ android {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
dependencies {
|
|
40
|
-
implementation 'androidx.core:core-ktx:1.13.
|
|
40
|
+
implementation 'androidx.core:core-ktx:1.13.1'
|
|
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.4.0' apply false
|
|
3
|
+
id 'com.android.library' version '8.4.0' apply false
|
|
4
|
+
id 'org.jetbrains.kotlin.android' version '1.9.24' 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.13.
|
|
41
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
|
|
42
|
+
implementation("androidx.core:core-ktx:1.13.1")
|
|
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.4.0" apply false
|
|
3
|
+
id("com.android.library") version "8.4.0" apply false
|
|
4
|
+
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
|
|
5
5
|
}
|