@capacitor/background-runner 3.1.0-dev.20260922T141439 → 3.1.0-dev.20260925T182350
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/package.json +1 -1
- package/scripts/install_libs.js +32 -7
package/package.json
CHANGED
package/scripts/install_libs.js
CHANGED
|
@@ -22,18 +22,43 @@ if (!fs.existsSync(androidGradlePath)) {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const startMarker = '// BEGIN @capacitor/background-runner';
|
|
26
|
+
const endMarker = '// END @capacitor/background-runner';
|
|
27
|
+
const legacyDirsLine = /^.*dirs\s+'[^']*@capacitor\/background-runner\/android\/src\/main\/libs'.*\r?\n/gm;
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const libsPath = path.resolve(__dirname, '../android/src/main/libs');
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(libsPath)) {
|
|
32
|
+
console.warn(`${msgPrefix} android libs directory not found at ${libsPath}`);
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const libsDir = path
|
|
37
|
+
.relative(path.dirname(path.resolve(androidGradlePath)), libsPath)
|
|
38
|
+
.split(path.sep)
|
|
39
|
+
.join('/');
|
|
40
|
+
|
|
41
|
+
let gradleFile = fs.readFileSync(androidGradlePath).toString('utf-8');
|
|
42
|
+
|
|
43
|
+
const blockStart = gradleFile.indexOf(startMarker);
|
|
44
|
+
const blockEnd = gradleFile.indexOf(endMarker);
|
|
45
|
+
if (blockStart !== -1 && blockEnd > blockStart) {
|
|
46
|
+
gradleFile = gradleFile.substring(0, blockStart) + gradleFile.substring(blockEnd + endMarker.length);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
gradleFile = gradleFile.replace(legacyDirsLine, '');
|
|
50
|
+
|
|
51
|
+
const block = [
|
|
52
|
+
startMarker,
|
|
53
|
+
'repositories {',
|
|
54
|
+
' flatDir {',
|
|
55
|
+
` dirs '${libsDir}'`,
|
|
56
|
+
' }',
|
|
57
|
+
'}',
|
|
58
|
+
endMarker,
|
|
59
|
+
].join('\n');
|
|
35
60
|
|
|
36
|
-
fs.writeFileSync(androidGradlePath, gradleFile);
|
|
61
|
+
fs.writeFileSync(androidGradlePath, `${gradleFile.trimEnd()}\n\n${block}\n`);
|
|
37
62
|
|
|
38
63
|
// remove old version of aar
|
|
39
64
|
const oldReleaseAARPath = path.join(workingDir, 'android/src/main/libs/android-js-engine-release.aar');
|