Skip to content

Commit ce5d16d

Browse files
fix: failures in non-ideal conditions
1 parent c460223 commit ce5d16d

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

hooks/post-process.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,32 @@ function patchTargetSdkVersion() {
7171

7272
if (sdkRegex.test(content)) {
7373
let api = "35";
74-
const froidFlag = path.join(getTmpDir(), 'fdroid.bool');
75-
76-
if (fs.existsSync(froidFlag)) {
77-
const fdroid = fs.readFileSync(froidFlag, 'utf-8').trim();
78-
if (fdroid == "true") {
79-
api = "28";
80-
}
81-
} else {
74+
const tmp = getTmpDir();
75+
if (tmp == null) {
8276
console.warn("---------------------------------------------------------------------------------\n\n\n\n");
83-
console.warn(`⚠️ ${getTmpDir()}/fdroid.bool not found`);
77+
console.warn(`⚠️ fdroid.bool not found`);
8478
console.warn("⚠️ Fdroid flavour will be built");
8579
api = "28";
8680
console.warn("\n\n\n\n---------------------------------------------------------------------------------");
87-
//process.exit(1);
81+
} else {
82+
const froidFlag = path.join(getTmpDir(), 'fdroid.bool');
83+
84+
if (fs.existsSync(froidFlag)) {
85+
const fdroid = fs.readFileSync(froidFlag, 'utf-8').trim();
86+
if (fdroid == "true") {
87+
api = "28";
88+
}
89+
} else {
90+
console.warn("---------------------------------------------------------------------------------\n\n\n\n");
91+
console.warn(`⚠️ fdroid.bool not found`);
92+
console.warn("⚠️ Fdroid flavour will be built");
93+
api = "28";
94+
console.warn("\n\n\n\n---------------------------------------------------------------------------------");
95+
//process.exit(1);
96+
}
8897
}
8998

99+
90100
content = content.replace(sdkRegex, 'targetSdkVersion ' + api);
91101
fs.writeFileSync(gradleFile, content, 'utf-8');
92102
console.log('[Cordova Hook] ✅ Patched targetSdkVersion to ' + api);

package-lock.json

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"cordova-plugin-buildinfo": {},
3838
"cordova-plugin-browser": {},
3939
"cordova-plugin-system": {},
40-
"com.foxdebug.acode.rk.exec.proot": {},
4140
"com.foxdebug.acode.rk.exec.terminal": {}
4241
},
4342
"platforms": [
@@ -63,7 +62,6 @@
6362
"@types/url-parse": "^1.4.11",
6463
"autoprefixer": "^10.4.21",
6564
"babel-loader": "^10.0.0",
66-
"com.foxdebug.acode.rk.exec.proot": "file:src/plugins/proot",
6765
"com.foxdebug.acode.rk.exec.terminal": "file:src/plugins/terminal",
6866
"cordova-android": "^14.0.1",
6967
"cordova-clipboard": "^1.3.0",

utils/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ cordovamode="--release"
6161
fi
6262

6363
# Set build target based on buildType
64-
if [ "$buildType" = "aar" ]; then
64+
if [ "$buildType" = "bundle" ]; then
6565
echo "Building AAR library file..."
6666
else
6767
echo "Building APK file..."

0 commit comments

Comments
 (0)