@pi-r/android 0.7.2 → 0.8.0

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.
@@ -3,10 +3,10 @@ const path = require("path");
3
3
  const fs = require("fs");
4
4
  const child_process = require("child_process");
5
5
  const which = require("which");
6
- const types_1 = require("@e-mc/types");
7
6
  const Document = require("@e-mc/document");
8
- const checkWin32 = (value) => value === "gradlew" && process.platform === 'win32' ? value + '.bat' : value;
9
- module.exports = async function finalize(instance) {
7
+ const types_1 = require("@e-mc/types");
8
+ const checkWin32 = (value) => value === "gradlew" && Document.PLATFORM_WIN32 ? value + '.bat' : value;
9
+ async function finalize(instance) {
10
10
  const commands = instance.config.commands;
11
11
  if (!commands || this.incremental === 'staging') {
12
12
  return;
@@ -99,7 +99,7 @@ module.exports = async function finalize(instance) {
99
99
  reject((0, types_1.errorValue)(message || (!foundDir && code === 1 ? "Unable to execute file" : "Unknown"), "Error code" + ': ' + code));
100
100
  }
101
101
  })
102
- .on('error', err => reject(err));
102
+ .on('error', reject);
103
103
  if (stdout) {
104
104
  stdout.setEncoding('utf-8').on('data', (value) => {
105
105
  if (broadcastId) {
@@ -117,6 +117,9 @@ module.exports = async function finalize(instance) {
117
117
  });
118
118
  }
119
119
  })
120
- .catch((err) => instance.writeFail(["Unable to perform task", command + ' ' + task], err, { type: 4, startTime }));
120
+ .catch((err) => {
121
+ instance.writeFail(["Unable to perform task", command + ' ' + task], err, { type: 4, startTime });
122
+ });
121
123
  }
122
- };
124
+ }
125
+ module.exports = finalize;
package/index.js CHANGED
@@ -8,7 +8,7 @@ class AndroidDocument extends Document {
8
8
  if (instance.aborted) {
9
9
  return (0, types_1.createAbortError)(true);
10
10
  }
11
- if (instance.extensions.length) {
11
+ if (instance.extensions.length > 0) {
12
12
  const config = instance.config;
13
13
  const mainActivityFile = config.mainActivityFile;
14
14
  if (mainActivityFile && !path.isAbsolute(mainActivityFile)) {
@@ -35,6 +35,7 @@ class AndroidDocument extends Document {
35
35
  mainSrcDir: 'src/main',
36
36
  mainActivityFile: '',
37
37
  javaVersion: 0,
38
+ jvmToolchain: 0,
38
39
  dataBinding: false,
39
40
  projectName: undefined,
40
41
  versionName: undefined,
@@ -45,6 +46,7 @@ class AndroidDocument extends Document {
45
46
  profileable: undefined,
46
47
  dependencies: undefined,
47
48
  dependencyScopes: undefined,
49
+ versionCatalog: undefined,
48
50
  commands: undefined
49
51
  };
50
52
  elements = [];
@@ -55,7 +57,7 @@ class AndroidDocument extends Document {
55
57
  _threadable = true;
56
58
  init(assets, config) {
57
59
  if (config) {
58
- const { targetAPI, mainParentDir, mainSrcDir, mainActivityFile, javaVersion, projectName, versionName, versionCode = 0, manifest, namespace, applicationId, profileable, dependencies, dependencyScopes, dataBinding, commands, directories, elements, extensionData } = config;
60
+ const { targetAPI, mainParentDir, mainSrcDir, mainActivityFile, javaVersion, jvmToolchain, projectName, versionName, versionCode = 0, manifest, namespace, applicationId, profileable, dependencies, dependencyScopes, versionCatalog, dataBinding, commands, directories, elements, extensionData } = config;
59
61
  const target = this.config;
60
62
  if (projectName) {
61
63
  target.projectName = projectName;
@@ -78,30 +80,36 @@ class AndroidDocument extends Document {
78
80
  if (versionName) {
79
81
  target.versionName = versionName;
80
82
  }
83
+ if (commands) {
84
+ target.commands = commands;
85
+ }
86
+ if (jvmToolchain) {
87
+ target.jvmToolchain = jvmToolchain;
88
+ }
89
+ if (dependencyScopes) {
90
+ target.dependencyScopes = dependencyScopes;
91
+ }
92
+ if (dataBinding) {
93
+ target.dataBinding = true;
94
+ }
81
95
  if ((0, types_1.isPlainObject)(manifest)) {
82
96
  target.manifest = manifest;
83
97
  }
84
98
  if (profileable !== undefined) {
85
99
  target.profileable = profileable;
86
100
  }
101
+ if (typeof versionCatalog === 'boolean') {
102
+ target.versionCatalog = versionCatalog;
103
+ }
87
104
  if (versionCode >= 1) {
88
105
  target.versionCode = Math.min(Math.ceil(versionCode), 2100000000);
89
106
  }
90
- if (commands) {
91
- target.commands = commands;
92
- }
93
107
  if (javaVersion) {
94
108
  target.javaVersion = typeof javaVersion === 'string' ? +javaVersion.replace(/_/g, '.') : javaVersion;
95
109
  }
96
- if (dataBinding) {
97
- target.dataBinding = true;
98
- }
99
110
  if ((0, types_1.isArray)(dependencies)) {
100
111
  target.dependencies = dependencies;
101
112
  }
102
- if (dependencyScopes) {
103
- target.dependencyScopes = dependencyScopes;
104
- }
105
113
  if (targetAPI) {
106
114
  this.targetAPI = targetAPI;
107
115
  }
@@ -129,6 +137,12 @@ class AndroidDocument extends Document {
129
137
  }
130
138
  return super.findVersion(name, fallback);
131
139
  }
140
+ resolveDir(name, ...paths) {
141
+ let result = super.resolveDir(name, ...paths);
142
+ if (result || fs.existsSync(result = path.join(__dirname, name, ...paths))) {
143
+ return result;
144
+ }
145
+ }
132
146
  async using(data) {
133
147
  if (this.aborted) {
134
148
  return (0, types_1.createAbortError)(true);
@@ -176,7 +190,7 @@ class AndroidDocument extends Document {
176
190
  }
177
191
  let kotlin, language;
178
192
  if (languageOf) {
179
- kotlin = (language = this.settings.language?.[languageOf]) === 'kotlin';
193
+ kotlin = (language = this.languageOf(languageOf)) === 'kotlin';
180
194
  if (detect !== false) {
181
195
  const isKts = this.detectKts(baseDir, filename);
182
196
  if (isKts && language === 'java') {
@@ -203,25 +217,27 @@ class AndroidDocument extends Document {
203
217
  }
204
218
  paths.push(filename);
205
219
  let uri;
206
- if (!existing && !(uri = this.resolveDir('template', ...paths)) && !fs.existsSync(uri = path.join(__dirname, 'template', ...paths))) {
220
+ if (!existing && !(uri = this.resolveDir('template', ...paths))) {
207
221
  throw (0, types_1.errorValue)("File not found", uri);
208
222
  }
209
223
  return { localUri, source: fs.readFileSync(uri || localUri, 'utf-8'), existing, kotlin, language };
210
224
  }
211
225
  catch (err) {
212
- this.writeFail(["Unable to read file", path.basename(localUri)], err, 32);
226
+ if (options?.throwsDoesNotExist !== false) {
227
+ this.writeFail(["Unable to read file", path.basename(localUri)], err, 32);
228
+ }
213
229
  }
214
230
  return { kotlin, language };
215
231
  }
216
232
  findData(filename, format) {
217
233
  let localUri;
218
- if ((localUri = this.resolveDir('data', filename)) || Document.isPath(localUri = path.join(__dirname, 'data', filename))) {
219
- try {
234
+ try {
235
+ if (localUri = this.resolveDir('data', filename)) {
220
236
  return this.tryParse(fs.readFileSync(localUri, 'utf-8'), format || path.extname(localUri).substring(1));
221
237
  }
222
- catch (err) {
223
- this.writeFail(["Unable to read file", path.basename(localUri)], err, 32);
224
- }
238
+ }
239
+ catch (err) {
240
+ this.writeFail(["Unable to read file", localUri && path.basename(localUri)], err, 32);
225
241
  }
226
242
  return null;
227
243
  }
@@ -239,6 +255,15 @@ class AndroidDocument extends Document {
239
255
  }
240
256
  return null;
241
257
  }
258
+ languageOf(name, value) {
259
+ const result = this.settings.language?.[name];
260
+ if (result && (!value || value === result)) {
261
+ return result;
262
+ }
263
+ }
264
+ detect(host = this.host) {
265
+ return host?.incremental !== 'staging';
266
+ }
242
267
  get settings() {
243
268
  return this.module.settings ||= {};
244
269
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@pi-r/android",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "Android document constructor for E-mc.",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "publishConfig": {
7
8
  "access": "public"
8
9
  },
@@ -20,8 +21,8 @@
20
21
  "license": "MIT",
21
22
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
23
  "dependencies": {
23
- "@e-mc/document": "^0.9.4",
24
- "@e-mc/types": "^0.9.4",
24
+ "@e-mc/document": "^0.10.0",
25
+ "@e-mc/types": "^0.10.0",
25
26
  "htmlparser2": "^9.1.0",
26
27
  "which": "^2.0.2"
27
28
  }
@@ -0,0 +1,170 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="108dp"
4
+ android:height="108dp"
5
+ android:viewportWidth="108"
6
+ android:viewportHeight="108">
7
+ <path
8
+ android:fillColor="#3DDC84"
9
+ android:pathData="M0,0h108v108h-108z" />
10
+ <path
11
+ android:fillColor="#00000000"
12
+ android:pathData="M9,0L9,108"
13
+ android:strokeWidth="0.8"
14
+ android:strokeColor="#33FFFFFF" />
15
+ <path
16
+ android:fillColor="#00000000"
17
+ android:pathData="M19,0L19,108"
18
+ android:strokeWidth="0.8"
19
+ android:strokeColor="#33FFFFFF" />
20
+ <path
21
+ android:fillColor="#00000000"
22
+ android:pathData="M29,0L29,108"
23
+ android:strokeWidth="0.8"
24
+ android:strokeColor="#33FFFFFF" />
25
+ <path
26
+ android:fillColor="#00000000"
27
+ android:pathData="M39,0L39,108"
28
+ android:strokeWidth="0.8"
29
+ android:strokeColor="#33FFFFFF" />
30
+ <path
31
+ android:fillColor="#00000000"
32
+ android:pathData="M49,0L49,108"
33
+ android:strokeWidth="0.8"
34
+ android:strokeColor="#33FFFFFF" />
35
+ <path
36
+ android:fillColor="#00000000"
37
+ android:pathData="M59,0L59,108"
38
+ android:strokeWidth="0.8"
39
+ android:strokeColor="#33FFFFFF" />
40
+ <path
41
+ android:fillColor="#00000000"
42
+ android:pathData="M69,0L69,108"
43
+ android:strokeWidth="0.8"
44
+ android:strokeColor="#33FFFFFF" />
45
+ <path
46
+ android:fillColor="#00000000"
47
+ android:pathData="M79,0L79,108"
48
+ android:strokeWidth="0.8"
49
+ android:strokeColor="#33FFFFFF" />
50
+ <path
51
+ android:fillColor="#00000000"
52
+ android:pathData="M89,0L89,108"
53
+ android:strokeWidth="0.8"
54
+ android:strokeColor="#33FFFFFF" />
55
+ <path
56
+ android:fillColor="#00000000"
57
+ android:pathData="M99,0L99,108"
58
+ android:strokeWidth="0.8"
59
+ android:strokeColor="#33FFFFFF" />
60
+ <path
61
+ android:fillColor="#00000000"
62
+ android:pathData="M0,9L108,9"
63
+ android:strokeWidth="0.8"
64
+ android:strokeColor="#33FFFFFF" />
65
+ <path
66
+ android:fillColor="#00000000"
67
+ android:pathData="M0,19L108,19"
68
+ android:strokeWidth="0.8"
69
+ android:strokeColor="#33FFFFFF" />
70
+ <path
71
+ android:fillColor="#00000000"
72
+ android:pathData="M0,29L108,29"
73
+ android:strokeWidth="0.8"
74
+ android:strokeColor="#33FFFFFF" />
75
+ <path
76
+ android:fillColor="#00000000"
77
+ android:pathData="M0,39L108,39"
78
+ android:strokeWidth="0.8"
79
+ android:strokeColor="#33FFFFFF" />
80
+ <path
81
+ android:fillColor="#00000000"
82
+ android:pathData="M0,49L108,49"
83
+ android:strokeWidth="0.8"
84
+ android:strokeColor="#33FFFFFF" />
85
+ <path
86
+ android:fillColor="#00000000"
87
+ android:pathData="M0,59L108,59"
88
+ android:strokeWidth="0.8"
89
+ android:strokeColor="#33FFFFFF" />
90
+ <path
91
+ android:fillColor="#00000000"
92
+ android:pathData="M0,69L108,69"
93
+ android:strokeWidth="0.8"
94
+ android:strokeColor="#33FFFFFF" />
95
+ <path
96
+ android:fillColor="#00000000"
97
+ android:pathData="M0,79L108,79"
98
+ android:strokeWidth="0.8"
99
+ android:strokeColor="#33FFFFFF" />
100
+ <path
101
+ android:fillColor="#00000000"
102
+ android:pathData="M0,89L108,89"
103
+ android:strokeWidth="0.8"
104
+ android:strokeColor="#33FFFFFF" />
105
+ <path
106
+ android:fillColor="#00000000"
107
+ android:pathData="M0,99L108,99"
108
+ android:strokeWidth="0.8"
109
+ android:strokeColor="#33FFFFFF" />
110
+ <path
111
+ android:fillColor="#00000000"
112
+ android:pathData="M19,29L89,29"
113
+ android:strokeWidth="0.8"
114
+ android:strokeColor="#33FFFFFF" />
115
+ <path
116
+ android:fillColor="#00000000"
117
+ android:pathData="M19,39L89,39"
118
+ android:strokeWidth="0.8"
119
+ android:strokeColor="#33FFFFFF" />
120
+ <path
121
+ android:fillColor="#00000000"
122
+ android:pathData="M19,49L89,49"
123
+ android:strokeWidth="0.8"
124
+ android:strokeColor="#33FFFFFF" />
125
+ <path
126
+ android:fillColor="#00000000"
127
+ android:pathData="M19,59L89,59"
128
+ android:strokeWidth="0.8"
129
+ android:strokeColor="#33FFFFFF" />
130
+ <path
131
+ android:fillColor="#00000000"
132
+ android:pathData="M19,69L89,69"
133
+ android:strokeWidth="0.8"
134
+ android:strokeColor="#33FFFFFF" />
135
+ <path
136
+ android:fillColor="#00000000"
137
+ android:pathData="M19,79L89,79"
138
+ android:strokeWidth="0.8"
139
+ android:strokeColor="#33FFFFFF" />
140
+ <path
141
+ android:fillColor="#00000000"
142
+ android:pathData="M29,19L29,89"
143
+ android:strokeWidth="0.8"
144
+ android:strokeColor="#33FFFFFF" />
145
+ <path
146
+ android:fillColor="#00000000"
147
+ android:pathData="M39,19L39,89"
148
+ android:strokeWidth="0.8"
149
+ android:strokeColor="#33FFFFFF" />
150
+ <path
151
+ android:fillColor="#00000000"
152
+ android:pathData="M49,19L49,89"
153
+ android:strokeWidth="0.8"
154
+ android:strokeColor="#33FFFFFF" />
155
+ <path
156
+ android:fillColor="#00000000"
157
+ android:pathData="M59,19L59,89"
158
+ android:strokeWidth="0.8"
159
+ android:strokeColor="#33FFFFFF" />
160
+ <path
161
+ android:fillColor="#00000000"
162
+ android:pathData="M69,19L69,89"
163
+ android:strokeWidth="0.8"
164
+ android:strokeColor="#33FFFFFF" />
165
+ <path
166
+ android:fillColor="#00000000"
167
+ android:pathData="M79,19L79,89"
168
+ android:strokeWidth="0.8"
169
+ android:strokeColor="#33FFFFFF" />
170
+ </vector>
@@ -0,0 +1,30 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ xmlns:aapt="http://schemas.android.com/aapt"
3
+ android:width="108dp"
4
+ android:height="108dp"
5
+ android:viewportWidth="108"
6
+ android:viewportHeight="108">
7
+ <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
8
+ <aapt:attr name="android:fillColor">
9
+ <gradient
10
+ android:endX="85.84757"
11
+ android:endY="92.4963"
12
+ android:startX="42.9492"
13
+ android:startY="49.59793"
14
+ android:type="linear">
15
+ <item
16
+ android:color="#44000000"
17
+ android:offset="0.0" />
18
+ <item
19
+ android:color="#00000000"
20
+ android:offset="1.0" />
21
+ </gradient>
22
+ </aapt:attr>
23
+ </path>
24
+ <path
25
+ android:fillColor="#FFFFFF"
26
+ android:fillType="nonZero"
27
+ android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
28
+ android:strokeWidth="1"
29
+ android:strokeColor="#00000000" />
30
+ </vector>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <background android:drawable="@drawable/ic_launcher_background" />
4
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+ <monochrome android:drawable="@drawable/ic_launcher_foreground" />
6
+ </adaptive-icon>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <background android:drawable="@drawable/ic_launcher_background" />
4
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+ <monochrome android:drawable="@drawable/ic_launcher_foreground" />
6
+ </adaptive-icon>
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
@@ -0,0 +1,4 @@
1
+ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
2
+ android.useAndroidX=true
3
+ kotlin.code.style=official
4
+ android.nonTransitiveRClass=true
@@ -4,12 +4,12 @@ plugins {
4
4
 
5
5
  android {
6
6
  namespace ''
7
- compileSdk 34
7
+ compileSdk 35
8
8
 
9
9
  defaultConfig {
10
10
  applicationId ''
11
11
  minSdk 21
12
- targetSdk 34
12
+ targetSdk 35
13
13
  versionCode 1
14
14
  versionName '1.0'
15
15
 
@@ -1,4 +1,4 @@
1
1
  plugins {
2
- id 'com.android.application' version '8.4.0' apply false
3
- id 'com.android.library' version '8.4.0' apply false
2
+ id 'com.android.application' version '8.5.1' apply false
3
+ id 'com.android.library' version '8.5.1' apply false
4
4
  }
@@ -5,12 +5,12 @@ plugins {
5
5
 
6
6
  android {
7
7
  namespace ''
8
- compileSdk 34
8
+ compileSdk 35
9
9
 
10
10
  defaultConfig {
11
11
  applicationId ''
12
12
  minSdk 21
13
- targetSdk 34
13
+ targetSdk 35
14
14
  versionCode 1
15
15
  versionName '1.0'
16
16
 
@@ -1,5 +1,5 @@
1
1
  plugins {
2
- id 'com.android.application' version '8.4.0' apply false
3
- id 'com.android.library' version '8.4.0' apply false
2
+ id 'com.android.application' version '8.5.1' apply false
3
+ id 'com.android.library' version '8.5.1' apply false
4
4
  id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
5
5
  }
@@ -1,16 +1,17 @@
1
1
  plugins {
2
- id("com.android.application")
3
- id("org.jetbrains.kotlin.android")
2
+ alias(libs.plugins.android.application)
3
+ alias(libs.plugins.jetbrains.kotlin.android)
4
+ alias(libs.plugins.jetbrains.kotlin.compose)
4
5
  }
5
6
 
6
7
  android {
7
8
  namespace = ""
8
- compileSdk = 34
9
+ compileSdk = 35
9
10
 
10
11
  defaultConfig {
11
12
  applicationId = ""
12
13
  minSdk = 21
13
- targetSdk = 34
14
+ targetSdk = 35
14
15
  versionCode = 1
15
16
  versionName = "1.0"
16
17
 
@@ -38,9 +39,11 @@ java {
38
39
  }
39
40
 
40
41
  dependencies {
41
- implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
42
- implementation("androidx.core:core-ktx:1.13.1")
43
- testImplementation("junit:junit:4.13.2")
44
- androidTestImplementation("androidx.test.ext:junit:1.1.5")
45
- androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
42
+ implementation(libs.jetbrains.kotlin)
43
+ implementation(libs.androidx.core.ktx)
44
+ implementation(libs.androidx.appcompat)
45
+ implementation(libs.androidx.constraintlayout)
46
+ testImplementation(libs.junit)
47
+ androidTestImplementation(libs.androidx.junit)
48
+ androidTestImplementation(libs.androidx.espresso.core)
46
49
  }
@@ -0,0 +1,23 @@
1
+ [versions]
2
+ agp = "8.5.1"
3
+ kotlin = "2.0.0"
4
+ coreKtx = "1.13.1"
5
+ junit = "4.13.2"
6
+ junitVersion = "1.1.5"
7
+ espressoCore = "3.5.1"
8
+ appcompat = "1.7.0"
9
+ constraintlayout = "2.1.4"
10
+
11
+ [libraries]
12
+ androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
13
+ jetbrains-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
14
+ junit = { group = "junit", name = "junit", version.ref = "junit" }
15
+ androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
16
+ androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
17
+ androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
18
+ androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
19
+
20
+ [plugins]
21
+ android-application = { id = "com.android.application", version.ref = "agp" }
22
+ jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
23
+ jetbrains-kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
@@ -1,3 +1,5 @@
1
+ val snapshotVersion : String? = System.getenv("ANDROIDX_SNAPSHOT_ID")
2
+
1
3
  pluginManagement {
2
4
  repositories {
3
5
  google()
@@ -9,6 +11,10 @@ pluginManagement {
9
11
  dependencyResolutionManagement {
10
12
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11
13
  repositories {
14
+ snapshotVersion?.let {
15
+ println("https://androidx.dev/snapshots/builds/$it/artifacts/repository/")
16
+ maven { url = uri("https://androidx.dev/snapshots/builds/$it/artifacts/repository/") }
17
+ }
12
18
  google()
13
19
  mavenCentral()
14
20
  }
@@ -1,5 +1,5 @@
1
1
  plugins {
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
2
+ alias(libs.plugins.android.application) apply false
3
+ alias(libs.plugins.jetbrains.kotlin.android) apply false
4
+ alias(libs.plugins.jetbrains.kotlin.compose) apply false
5
5
  }
package/types/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
- import type { FinalizedElement } from '@e-mc/types/lib/squared';
2
-
3
1
  import type { DocumentConstructor, IDocument, IFileManager } from '@e-mc/types/lib';
4
2
  import type { ExternalAsset } from '@e-mc/types/lib/asset';
5
3
  import type { ExecAction, DocumentDirectory as IDocumentDirectory, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
6
4
 
7
- import type { DependencyScopes, DocumentOutput } from './squared';
5
+ import type { DependencyScopes, DocumentOutput, FinalizedElement } from './squared';
8
6
 
9
7
  interface DocumentDirectory extends IDocumentDirectory {
10
8
  template?: string;
9
+ project?: string;
11
10
  }
12
11
 
13
12
  interface AndroidDocumentSettings extends Pick<IDocumentSettings, "users" | "directory">, PlainObject {
@@ -18,11 +17,10 @@ interface AndroidDocumentSettings extends Pick<IDocumentSettings, "users" | "dir
18
17
  };
19
18
  };
20
19
  language?: {
21
- gradle?: "java" | "kotlin" | "java+kotlin";
20
+ [T in LanguageOfType]?: LanguageType;
22
21
  };
23
22
  }
24
23
 
25
- type LanguageType = "gradle";
26
24
  type DocumentProperties = "targetAPI" | "elements" | "extensionData" | "directories";
27
25
 
28
26
  export interface UserConfig extends Omit<DocumentOutput, DocumentProperties> {
@@ -42,13 +40,14 @@ export interface TemplateData {
42
40
  source?: string;
43
41
  existing?: boolean;
44
42
  kotlin?: boolean;
45
- language?: string;
43
+ language?: LanguageType;
46
44
  }
47
45
 
48
46
  export interface FindTemplateOptions {
49
47
  detect?: boolean;
50
- languageOf?: LanguageType;
48
+ languageOf?: LanguageOfType;
51
49
  subDir?: ArrayOf<string>;
50
+ throwsDoesNotExist?: boolean;
52
51
  }
53
52
 
54
53
  export interface MavenArtifact {
@@ -59,19 +58,23 @@ export interface MavenArtifact {
59
58
  dependencies?: MavenArtifact[];
60
59
  }
61
60
 
62
- export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U>, Pick<DocumentOutput, DocumentProperties> {
61
+ export type LanguageType = "java" | "kotlin" | "java+kotlin";
62
+ export type LanguageOfType = "gradle";
63
+ export type DocumentAsset = ExternalAsset;
64
+
65
+ export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U, DocumentModule>, Pick<DocumentOutput, DocumentProperties> {
63
66
  config: UserConfig;
64
67
  elements: FinalizedElement[];
65
68
  extensionData: PlainObject;
66
69
  findTemplate(baseDir: string, filename: string, options?: FindTemplateOptions): TemplateData;
67
70
  findData<V = AnyObject>(filename: string, format?: string): Null<V>;
71
+ languageOf(name: LanguageOfType, value?: LanguageType): Undef<LanguageType>;
68
72
  detectKts(...paths: string[]): Null<boolean>;
73
+ detect(host?: T): boolean;
69
74
  get settings(): AndroidDocumentSettings;
70
75
  }
71
76
 
72
- export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
77
+ export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends ConstructorDerived<DocumentConstructor<T, U>> {
73
78
  readonly prototype: IAndroidDocument<T, U>;
74
79
  new(module?: DocumentModule, ...args: unknown[]): IAndroidDocument<T, U>;
75
- }
76
-
77
- export type DocumentAsset = ExternalAsset;
80
+ }