codeplay-common 4.3.7 → 4.3.8
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 -5
- package/package.json +1 -1
package/files/finalrelease
CHANGED
|
@@ -527,8 +527,30 @@ if (existsSync(aabOutputDir)) {
|
|
|
527
527
|
|
|
528
528
|
|
|
529
529
|
// Extract version code and version name from build.gradle
|
|
530
|
-
const gradleFilePath = join("android", "app", "build.gradle");
|
|
531
|
-
const gradleContent = readFileSync(gradleFilePath, 'utf8');
|
|
530
|
+
const gradleFilePath = join("android", "app", "build.gradle");
|
|
531
|
+
const gradleContent = readFileSync(gradleFilePath, 'utf8');
|
|
532
|
+
|
|
533
|
+
// Return the character range of a Gradle block, allowing nested blocks inside it.
|
|
534
|
+
function findGradleBlock(content, headerPattern) {
|
|
535
|
+
const headerMatch = content.match(headerPattern);
|
|
536
|
+
if (!headerMatch) return null;
|
|
537
|
+
const openingBrace = content.indexOf('{', headerMatch.index + headerMatch[0].length);
|
|
538
|
+
if (openingBrace === -1) return null;
|
|
539
|
+
let depth = 0;
|
|
540
|
+
let quote = null;
|
|
541
|
+
for (let index = openingBrace; index < content.length; index += 1) {
|
|
542
|
+
const character = content[index];
|
|
543
|
+
const previous = content[index - 1];
|
|
544
|
+
if (quote) {
|
|
545
|
+
if (character === quote && previous !== '\\') quote = null;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
if (character === '\"' || character === "'") quote = character;
|
|
549
|
+
else if (character === '{') depth += 1;
|
|
550
|
+
else if (character === '}' && --depth === 0) return { start: openingBrace + 1, end: index };
|
|
551
|
+
}
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
532
554
|
|
|
533
555
|
const versionCodeMatch = gradleContent.match(/versionCode\s+(\d+)/);
|
|
534
556
|
const versionNameMatch = gradleContent.match(/versionName\s+"([^"]+)"/);
|
|
@@ -595,9 +617,26 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
595
617
|
`$1\n minifyEnabled ${desiredMinify}`
|
|
596
618
|
);
|
|
597
619
|
console.log(`✅ Inserted minifyEnabled ${desiredMinify} into release block.`);
|
|
598
|
-
} else {
|
|
599
|
-
console.log('⚠️ Warning: buildTypes > release block not found. minifyEnabled was not added.');
|
|
600
|
-
}
|
|
620
|
+
} else {
|
|
621
|
+
console.log('⚠️ Warning: buildTypes > release block not found. minifyEnabled was not added.');
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// Add native debug symbols for release AABs, but leave any existing setting untouched.
|
|
625
|
+
const releaseBlock = findGradleBlock(updatedGradleContent, /buildTypes\s*\{[\s\S]*?\brelease\s*/);
|
|
626
|
+
if (releaseBlock) {
|
|
627
|
+
const releaseContent = updatedGradleContent.slice(releaseBlock.start, releaseBlock.end);
|
|
628
|
+
if (/\bdebugSymbolLevel\b/.test(releaseContent)) {
|
|
629
|
+
console.log('ℹ️ debugSymbolLevel already exists in buildTypes.release; leaving it unchanged.');
|
|
630
|
+
} else {
|
|
631
|
+
const ndkBlock = `\n ndk {\n debugSymbolLevel 'FULL'\n }`;
|
|
632
|
+
updatedGradleContent = updatedGradleContent.slice(0, releaseBlock.end)
|
|
633
|
+
+ ndkBlock
|
|
634
|
+
+ updatedGradleContent.slice(releaseBlock.end);
|
|
635
|
+
console.log("✅ Added debugSymbolLevel 'FULL' to buildTypes.release.");
|
|
636
|
+
}
|
|
637
|
+
} else {
|
|
638
|
+
console.log('⚠️ Warning: buildTypes.release block not found. debugSymbolLevel was not added.');
|
|
639
|
+
}
|
|
601
640
|
|
|
602
641
|
|
|
603
642
|
|