codeplay-common 4.8.9 → 4.9.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.
@@ -1376,15 +1376,29 @@ function syncAndroidCodeOptimization() {
1376
1376
  }
1377
1377
 
1378
1378
  const newline = currentContent.includes('\r\n') ? '\r\n' : '\n';
1379
- nextContent = nextContent.replace(/^([ \t]*release[ \t]*\{)([\s\S]*?)(?=^[ \t]*\})/m, (match, header, body) => {
1379
+ if (!/^[ \t]*(?:\/\/[ \t]*)?debug[ \t]*\{/m.test(nextContent)) {
1380
+ nextContent = nextContent.replace(/^([ \t]*buildTypes[ \t]*\{)[ \t]*\r?\n/m,
1381
+ `$1${newline} debug {${newline} minifyEnabled true${newline} shrinkResources true${newline} proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'${newline} }${newline}`);
1382
+ }
1383
+ nextContent = nextContent.replace(/^([ \t]*(debug|release)[ \t]*\{)([\s\S]*?)(?=^[ \t]*\})/gm, (match, header, buildType, body) => {
1380
1384
  const comments = body.match(/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g) || [];
1381
1385
  if (comments.some(comment => /\bshrinkResources\b/.test(comment))) return match;
1382
1386
 
1387
+ if (buildType === 'debug') {
1388
+ if (!/^[ \t]*minifyEnabled\s*(?:=\s*)?(true|false)\b/m.test(body)
1389
+ && !comments.some(comment => /\bminifyEnabled\b/.test(comment))) {
1390
+ body = `${newline} minifyEnabled true${body}`;
1391
+ }
1392
+ if (!/^[ \t]*proguardFiles\b/m.test(body)
1393
+ && !comments.some(comment => /\bproguardFiles\b/.test(comment))) {
1394
+ body = `${newline} proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'${body}`;
1395
+ }
1396
+ }
1383
1397
  const activeBody = body.replace(/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g, '');
1384
1398
  const minifyEnabled = /^[ \t]*minifyEnabled\s*(?:=\s*)?true\b/m.test(activeBody);
1385
1399
  const shrinkPattern = /^([ \t]*shrinkResources\s*(?:=\s*)?)(true|false)\b/m;
1386
1400
  if (shrinkPattern.test(body)) {
1387
- return minifyEnabled ? match : header + body.replace(shrinkPattern, '$1false');
1401
+ return header + (minifyEnabled ? body : body.replace(shrinkPattern, '$1false'));
1388
1402
  }
1389
1403
  return `${header}${newline} shrinkResources ${minifyEnabled}${body}`;
1390
1404
  });
@@ -4364,7 +4378,7 @@ await main();
4364
4378
  Release Notes
4365
4379
 
4366
4380
  6.5
4367
- Release resource shrinking is configured automatically; commented settings and explicit false values preserve app-specific opt-outs.
4381
+ Debug and release resource shrinking are configured automatically; commented settings and explicit false values preserve app-specific opt-outs.
4368
4382
  Android builds use the optimisation-enabled default ProGuard rules without changing minification settings or custom keep rules.
4369
4383
  Kids ad configuration disables iOS ATT prompts and excludes Android AD_ID during builds.
4370
4384
  Non-kids apps retain tracking prompts and normal permission behavior.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.8.9",
3
+ "version": "4.9.0",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",