codeplay-common 4.11.1 → 4.11.3

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.
@@ -1145,11 +1145,20 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
1145
1145
  }
1146
1146
  ensureReleaseCodeOptimization();
1147
1147
 
1148
+ const releaseBuildEnv = { ...process.env };
1149
+ if (_appPackageId === 'resume.generator.cv') {
1150
+ releaseBuildEnv.GRADLE_OPTS = [
1151
+ process.env.GRADLE_OPTS,
1152
+ '-Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=1g"',
1153
+ '-Dorg.gradle.workers.max=2',
1154
+ ].filter(Boolean).join(' ');
1155
+ }
1156
+
1148
1157
  if (buildType === "APK") {
1149
1158
  console.log("📦 Using custom Node signing script for APK build...");
1150
- execFileSync(process.execPath, [join(process.cwd(), 'buildCodeplay', 'apk-store-builder.js')], { stdio: 'inherit' });
1159
+ execFileSync(process.execPath, [join(process.cwd(), 'buildCodeplay', 'apk-store-builder.js')], { stdio: 'inherit', env: releaseBuildEnv });
1151
1160
  } else {
1152
- execSync(`npx cap build android --androidreleasetype=${buildType}`, { stdio: 'inherit' });
1161
+ execSync(`npx cap build android --androidreleasetype=${buildType}`, { stdio: 'inherit', env: releaseBuildEnv });
1153
1162
  signReleaseBundleWithSha256();
1154
1163
  }
1155
1164
 
@@ -1,5 +1,6 @@
1
1
  const { execFileSync, spawnSync } = require('child_process');
2
2
  const path = require('path');
3
+ const { syncGeneratedProfileBackup } = require('./setup-baseline-profile.js');
3
4
 
4
5
  function main() {
5
6
  const devices = execFileSync('adb', ['devices'], { encoding: 'utf8' })
@@ -32,6 +33,9 @@ function main() {
32
33
  if (result.error) throw result.error;
33
34
  if (result.signal) throw new Error(`Baseline Profile generation stopped by ${result.signal}.`);
34
35
  process.exitCode = result.status ?? 1;
36
+ if (process.exitCode === 0) {
37
+ syncGeneratedProfileBackup({ backupOnly: true });
38
+ }
35
39
  }
36
40
 
37
41
  try {
@@ -4,15 +4,14 @@ const path = require('path');
4
4
  const rootDir = path.resolve(__dirname, '..');
5
5
  const androidDir = path.join(rootDir, 'android');
6
6
  const capacitorConfigPath = path.join(rootDir, 'capacitor.config.json');
7
- const backupProfile = path.join(rootDir, 'baselineProfiles', 'baseline-prof.txt');
8
- const generatedProfile = path.join(
7
+ const backupProfileDir = path.join(rootDir, 'baselineProfiles');
8
+ const generatedProfileDir = path.join(
9
9
  androidDir,
10
10
  'app',
11
11
  'src',
12
12
  'main',
13
13
  'generated',
14
- 'baselineProfiles',
15
- 'baseline-prof.txt'
14
+ 'baselineProfiles'
16
15
  );
17
16
 
18
17
  function readFile(filePath) {
@@ -210,17 +209,37 @@ function ensureBaselineProfileModule(appId) {
210
209
  console.log('Ensured android/baselineprofile module');
211
210
  }
212
211
 
213
- function syncGeneratedProfileBackup() {
212
+ function syncGeneratedProfileBackup({ backupOnly = false } = {}) {
213
+ if (backupOnly && !fs.existsSync(path.join(generatedProfileDir, 'baseline-prof.txt'))) {
214
+ throw new Error(`No generated baseline-prof.txt found at ${generatedProfileDir}`);
215
+ }
216
+
217
+ for (const profileName of ['baseline-prof.txt', 'startup-prof.txt']) {
218
+ const generatedProfile = path.join(generatedProfileDir, profileName);
219
+ const backupProfile = path.join(backupProfileDir, profileName);
220
+ syncProfileFile(generatedProfile, backupProfile, backupOnly);
221
+ }
222
+ }
223
+
224
+ function syncProfileFile(generatedProfile, backupProfile, backupOnly) {
214
225
  const generatedExists = fs.existsSync(generatedProfile);
215
226
  const backupExists = fs.existsSync(backupProfile);
227
+ const profileName = path.basename(generatedProfile);
228
+
229
+ if (backupOnly) {
230
+ if (generatedExists) {
231
+ copyProfileFile(generatedProfile, backupProfile, `Backed up generated ${profileName} to baselineProfiles/${profileName}`);
232
+ }
233
+ return;
234
+ }
216
235
 
217
236
  if (!generatedExists && !backupExists) {
218
- console.log('No baseline-prof.txt found yet. Run: cd android && .\\gradlew.bat :app:generateBaselineProfile --console=plain');
237
+ console.log(`No ${profileName} found yet. Run: node scripts-common/generate-baseline-profile.js`);
219
238
  return;
220
239
  }
221
240
 
222
241
  if (generatedExists && !backupExists) {
223
- copyProfileFile(generatedProfile, backupProfile, 'Backed up generated baseline profile to baselineProfiles/baseline-prof.txt');
242
+ copyProfileFile(generatedProfile, backupProfile, `Backed up generated ${profileName} to baselineProfiles/${profileName}`);
224
243
  return;
225
244
  }
226
245
 
@@ -239,6 +258,11 @@ function syncGeneratedProfileBackup() {
239
258
  }
240
259
 
241
260
  function main() {
261
+ if (process.argv.includes('--backup-only')) {
262
+ syncGeneratedProfileBackup({ backupOnly: true });
263
+ return;
264
+ }
265
+
242
266
  const appId = getAppIdFromCapacitorConfig();
243
267
 
244
268
  if (!fs.existsSync(androidDir)) {
@@ -254,7 +278,9 @@ function main() {
254
278
  console.log('Baseline Profile setup is ready.');
255
279
  }
256
280
 
257
- main();
281
+ module.exports = { syncGeneratedProfileBackup };
282
+
283
+ if (require.main === module) main();
258
284
 
259
285
 
260
286
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.11.1",
3
+ "version": "4.11.3",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",