codeplay-common 4.9.0 → 4.9.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/files/finalrelease +44 -4
- package/package.json +1 -1
package/files/finalrelease
CHANGED
|
@@ -873,6 +873,41 @@ console.log(`Current versionCode: ${versionCode}`);
|
|
|
873
873
|
console.log(`Current versionName: ${versionName}`);
|
|
874
874
|
|
|
875
875
|
// Create an interface for user input
|
|
876
|
+
async function checkBaselineProfileBeforeRelease() {
|
|
877
|
+
const profilePaths = [
|
|
878
|
+
join(__dirname, 'baselineProfiles', 'baseline-prof.txt'),
|
|
879
|
+
join(__dirname, 'android', 'app', 'src', 'main', 'generated', 'baselineProfiles', 'baseline-prof.txt'),
|
|
880
|
+
join(__dirname, 'android', 'app', 'src', 'main', 'baseline-prof.txt'),
|
|
881
|
+
join(__dirname, 'android', 'app', 'src', 'main', 'baselineProfiles', 'baseline-prof.txt'),
|
|
882
|
+
];
|
|
883
|
+
const hasProfile = () => profilePaths.some(profilePath =>
|
|
884
|
+
existsSync(profilePath) && readFileSync(profilePath, 'utf8').trim().length > 0);
|
|
885
|
+
if (hasProfile()) return;
|
|
886
|
+
|
|
887
|
+
console.log('⚠️ baseline-prof.txt is missing or empty.');
|
|
888
|
+
console.log('Generation command: npm run baseline-profile:generate');
|
|
889
|
+
console.log('Generation requires an ADB-connected Android device or a configured emulator.');
|
|
890
|
+
const answer = await new Promise(resolveAnswer => {
|
|
891
|
+
rl.question('Generate AAB/APK without a Baseline Profile? [Enter/Y = continue, n = generate profile first]: ', resolveAnswer);
|
|
892
|
+
});
|
|
893
|
+
if (answer.trim().toLowerCase() !== 'n') return;
|
|
894
|
+
|
|
895
|
+
rl.pause();
|
|
896
|
+
try {
|
|
897
|
+
execSync('npm run baseline-profile:generate', { cwd: __dirname, stdio: 'inherit' });
|
|
898
|
+
if (!hasProfile()) {
|
|
899
|
+
throw new Error('Baseline Profile generation did not produce a non-empty baseline-prof.txt; release stopped.');
|
|
900
|
+
}
|
|
901
|
+
// Reuse setup to back up and synchronise the generated profile before packaging.
|
|
902
|
+
execFileSync(process.execPath, [join(__dirname, 'scripts', 'setup-baseline-profile.js')], {
|
|
903
|
+
cwd: __dirname,
|
|
904
|
+
stdio: 'inherit',
|
|
905
|
+
});
|
|
906
|
+
} finally {
|
|
907
|
+
rl.resume();
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
876
911
|
const rl = createInterface({
|
|
877
912
|
input: process.stdin,
|
|
878
913
|
output: process.stdout
|
|
@@ -883,7 +918,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
883
918
|
const finalVersionCode = newVersionCode || versionCode; // Use existing if no input
|
|
884
919
|
|
|
885
920
|
// Ask for new versionName
|
|
886
|
-
rl.question('Enter new versionName (press enter to keep current): ', (newVersionName) => {
|
|
921
|
+
rl.question('Enter new versionName (press enter to keep current): ', async (newVersionName) => {
|
|
887
922
|
const finalVersionName = newVersionName || versionName; // Use existing if no input
|
|
888
923
|
|
|
889
924
|
// Log the final version details
|
|
@@ -959,7 +994,8 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
959
994
|
writeFileSync(gradleFilePath, updatedGradleContent, 'utf8');
|
|
960
995
|
console.log(`✅ Updated build.gradle with versionCode: ${finalVersionCode}, versionName: ${finalVersionName}, resConfigs "en" and "minifyEnabled true"`);
|
|
961
996
|
|
|
962
|
-
|
|
997
|
+
let baselineProfileChecked = false;
|
|
998
|
+
for (const id of storeIds) {
|
|
963
999
|
console.log(`ℹ️ Building for Store ID ${id}`);
|
|
964
1000
|
|
|
965
1001
|
// Set the environment variable for store ID
|
|
@@ -975,7 +1011,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
975
1011
|
["OppoStore", "VivoStore"].includes(storeName)
|
|
976
1012
|
) {
|
|
977
1013
|
console.log(`⏭ Skipping ${storeName} because isOnlyOneAPK is enabled`);
|
|
978
|
-
|
|
1014
|
+
continue; // skip this iteration only
|
|
979
1015
|
}
|
|
980
1016
|
|
|
981
1017
|
|
|
@@ -1102,6 +1138,10 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
1102
1138
|
|
|
1103
1139
|
execSync('npx cap sync android', { stdio: 'inherit' });
|
|
1104
1140
|
|
|
1141
|
+
if (!baselineProfileChecked) {
|
|
1142
|
+
await checkBaselineProfileBeforeRelease();
|
|
1143
|
+
baselineProfileChecked = true;
|
|
1144
|
+
}
|
|
1105
1145
|
ensureReleaseCodeOptimization();
|
|
1106
1146
|
|
|
1107
1147
|
if (buildType === "APK") {
|
|
@@ -1149,7 +1189,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
1149
1189
|
cleanup: String(id) === '7' && amazon === true,
|
|
1150
1190
|
});
|
|
1151
1191
|
}
|
|
1152
|
-
}
|
|
1192
|
+
}
|
|
1153
1193
|
|
|
1154
1194
|
rl.close(); // Close the readline interface after all operations
|
|
1155
1195
|
});
|