codeplay-common 4.11.15 → 4.11.16
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.
|
@@ -4584,13 +4584,7 @@ function syncAndroidBuildOptimization() {
|
|
|
4584
4584
|
if (!buildTypesBlock) throw new Error('Android Gradle buildTypes block was not found.');
|
|
4585
4585
|
let buildTypesContent = androidContent.slice(buildTypesBlock.start, buildTypesBlock.end);
|
|
4586
4586
|
|
|
4587
|
-
// Match the existing finalrelease compatibility exception for this native plugin.
|
|
4588
|
-
const ffmpegPluginXml = path.join(process.cwd(), 'node_modules', 'codeplay-fmpg', 'plugin.xml');
|
|
4589
|
-
const optimizeRelease = !(fs.existsSync(ffmpegPluginXml)
|
|
4590
|
-
&& /<plugin\b/.test(fs.readFileSync(ffmpegPluginXml, 'utf8')));
|
|
4591
|
-
|
|
4592
4587
|
for (const name of ['debug', 'release']) {
|
|
4593
|
-
const enabled = name === 'debug' || optimizeRelease;
|
|
4594
4588
|
const block = findAndroidBuildBlock(buildTypesContent, name);
|
|
4595
4589
|
const blockComments = buildTypesContent.match(/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g) || [];
|
|
4596
4590
|
if (!block && blockComments.some(comment => (comment.startsWith('//') || comment.startsWith('/*'))
|
|
@@ -4602,12 +4596,14 @@ function syncAndroidBuildOptimization() {
|
|
|
4602
4596
|
const masked = body.replace(/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g,
|
|
4603
4597
|
value => value.replace(/[^\r\n]/g, ' '));
|
|
4604
4598
|
const settingPattern = new RegExp(`\\b${setting}\\b`);
|
|
4605
|
-
//
|
|
4606
|
-
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4599
|
+
// Force explicit boolean values to true, preserving assignment style and comments.
|
|
4600
|
+
const values = [...masked.matchAll(new RegExp(`\\b${setting}\\s*(?:=\\s*)?(true|false)\\b`, 'g'))];
|
|
4601
|
+
for (const match of values.reverse()) {
|
|
4602
|
+
const valueStart = match.index + match[0].length - match[1].length;
|
|
4603
|
+
body = body.slice(0, valueStart) + 'true' + body.slice(valueStart + match[1].length);
|
|
4604
|
+
}
|
|
4605
|
+
// Keep custom expressions; add a true default when no active setting exists.
|
|
4606
|
+
if (!settingPattern.test(masked)) body = `${newline} ${setting} true${body}`;
|
|
4611
4607
|
}
|
|
4612
4608
|
const activeBody = body.replace(/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g,
|
|
4613
4609
|
value => value.startsWith('//') || value.startsWith('/*') ? value.replace(/[^\r\n]/g, ' ') : value);
|
|
@@ -4638,7 +4634,7 @@ function syncAndroidBuildOptimization() {
|
|
|
4638
4634
|
? properties
|
|
4639
4635
|
: `${properties.trimEnd()}${newline}${property}${newline}`;
|
|
4640
4636
|
if (nextProperties !== properties) fs.writeFileSync(propertiesPath, nextProperties, 'utf8');
|
|
4641
|
-
console.log('✅ Android build optimization
|
|
4637
|
+
console.log('✅ Android build optimization checked; minifyEnabled and shrinkResources boolean values set to true.');
|
|
4642
4638
|
}
|
|
4643
4639
|
// Android build optimization END
|
|
4644
4640
|
|