codeplay-common 4.5.4 → 4.5.5

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.
@@ -1,43 +1,43 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const legacyPluginXmlPath = path.resolve(
5
- __dirname,
6
- '../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
7
- );
8
-
9
- const nextGenPackagePath = path.resolve(
10
- __dirname,
11
- '../node_modules/capacitor-admob-nextgen/package.json'
12
- );
13
-
14
- if (!fs.existsSync(legacyPluginXmlPath)) {
15
- if (fs.existsSync(nextGenPackagePath)) {
16
- console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
17
- process.exit(0);
18
- }
19
-
20
- console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
21
- process.exit(0);
22
- }
23
-
24
- fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
25
- if (err) {
26
- console.error('Error reading plugin.xml:', err);
27
- process.exit(1);
28
- }
29
-
30
- const modifiedData = data.replace(
31
- /<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
32
- ''
33
- );
34
-
35
- fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
36
- if (writeErr) {
37
- console.error('Error writing plugin.xml:', writeErr);
38
- process.exit(1);
39
- }
40
-
41
- console.log('plugin.xml updated successfully.');
42
- });
43
- });
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const legacyPluginXmlPath = path.resolve(
5
+ __dirname,
6
+ '../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
7
+ );
8
+
9
+ const nextGenPackagePath = path.resolve(
10
+ __dirname,
11
+ '../node_modules/capacitor-admob-nextgen/package.json'
12
+ );
13
+
14
+ if (!fs.existsSync(legacyPluginXmlPath)) {
15
+ if (fs.existsSync(nextGenPackagePath)) {
16
+ console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
17
+ process.exit(0);
18
+ }
19
+
20
+ console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
21
+ process.exit(0);
22
+ }
23
+
24
+ fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
25
+ if (err) {
26
+ console.error('Error reading plugin.xml:', err);
27
+ process.exit(1);
28
+ }
29
+
30
+ const modifiedData = data.replace(
31
+ /<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
32
+ ''
33
+ );
34
+
35
+ fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
36
+ if (writeErr) {
37
+ console.error('Error writing plugin.xml:', writeErr);
38
+ process.exit(1);
39
+ }
40
+
41
+ console.log('plugin.xml updated successfully.');
42
+ });
43
+ });
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "plugins":[
3
3
  {"name":"backbutton","pattern":"backbutton-(\\d+\\.\\d+)\\.js$","minVersion":"2.1","baseDir":"js","mandatoryUpdate":true},
4
- {"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.7","baseDir":"js","mandatoryUpdate":true},
4
+ {"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.7","baseDir":"js","mandatoryUpdate":true},
5
5
 
6
- {"name":"admob-emi-nextgen","pattern":"Ads[\\\\/]admob-emi-nextgen-(\\d+\\.\\d+)\\.js$","minVersion":"1.0","baseDir":"js","mandatoryUpdate":true},
6
+ {"name":"admob-emi-nextgen","pattern":"Ads[\\\\/]admob-emi-nextgen-(\\d+\\.\\d+)\\.js$","minVersion":"1.0","baseDir":"js","mandatoryUpdate":true},
7
7
  {"name":"video-player","pattern":"video-player-(\\d+\\.\\d+)\\.js$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true},
8
8
  {"name":"image-cropper","pattern":"image-cropper-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
9
9
  {"name":"beautify","pattern":"beautify-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
@@ -17,11 +17,11 @@
17
17
  {"name":"ffmpeg","pattern":"ffmpeg-(\\d+\\.\\d+)$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true,"isFolder":true},
18
18
  {"name":"theme","pattern":"theme-(\\d+\\.\\d+)$","minVersion":"3.5","baseDir":"theme","destDir":"theme","mandatoryUpdate":true,"isFolder":true},
19
19
  {"name":"certificatejs","pattern":"certificatejs-(\\d+\\.\\d+)$","minVersion":"1.9","baseDir":"certificate","destDir":"certificate","mandatoryUpdate":true,"isFolder":true},
20
- {"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"3.6","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
20
+ {"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"3.6","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
21
21
  {"name":"common-less","pattern":"common-(\\d+\\.\\d+)\\.less$","minVersion":"1.8","baseDir":"assets/css","mandatoryUpdate":true},
22
22
  {"name":"localNotification_AppSettings","pattern":"localNotification_AppSettings-(\\d+\\.\\d+)\\.js$","minVersion":"1.0","baseDir":"js","mandatoryUpdate":true},
23
23
  {"name":"localNotification","pattern":"localNotification-(\\d+\\.\\d+)\\.js$","minVersion":"2.2","baseDir":"js","mandatoryUpdate":true},
24
24
  {"name":"onesignal","pattern":"onesignal-(\\d+\\.\\d+)\\.js$","minVersion":"2.4","baseDir":"js","mandatoryUpdate":true},
25
25
  {"name":"saveToGalleryAndSaveAnyFile","pattern":"saveToGalleryAndSaveAnyFile-(\\d+\\.\\d+)(-ios)?\\.js$","minVersion":"3.1","baseDir":"js","mandatoryUpdate":true}
26
26
  ]
27
- }
27
+ }
@@ -16,128 +16,128 @@ import { dirname } from 'path';
16
16
  /* const path = require('path');
17
17
  const fs = require('fs'); */
18
18
 
19
- import fs from 'fs';
20
- import path from 'path';
21
-
22
- const __filename = fileURLToPath(import.meta.url);
23
- const __dirname = dirname(__filename);
24
-
25
- function stripJavaScriptComments(content) {
26
- let result = '';
27
- let state = 'code';
28
-
29
- for (let index = 0; index < content.length; index++) {
30
- const character = content[index];
31
- const nextCharacter = content[index + 1];
32
-
33
- if (state === 'lineComment') {
34
- if (character === '\n') {
35
- result += character;
36
- state = 'code';
37
- } else {
38
- result += ' ';
39
- }
40
- continue;
41
- }
42
-
43
- if (state === 'blockComment') {
44
- if (character === '*' && nextCharacter === '/') {
45
- result += ' ';
46
- index++;
47
- state = 'code';
48
- } else {
49
- result += character === '\n' ? '\n' : ' ';
50
- }
51
- continue;
52
- }
53
-
54
- if (state !== 'code') {
55
- result += character;
56
-
57
- if (character === '\\') {
58
- if (nextCharacter !== undefined) {
59
- result += nextCharacter;
60
- index++;
61
- }
62
- } else if (
63
- (state === 'singleQuote' && character === "'") ||
64
- (state === 'doubleQuote' && character === '"') ||
65
- (state === 'templateLiteral' && character === '`')
66
- ) {
67
- state = 'code';
68
- }
69
- continue;
70
- }
71
-
72
- if (character === '/' && nextCharacter === '/') {
73
- result += ' ';
74
- index++;
75
- state = 'lineComment';
76
- } else if (character === '/' && nextCharacter === '*') {
77
- result += ' ';
78
- index++;
79
- state = 'blockComment';
80
- } else {
81
- result += character;
82
-
83
- if (character === "'") state = 'singleQuote';
84
- else if (character === '"') state = 'doubleQuote';
85
- else if (character === '`') state = 'templateLiteral';
86
- }
87
- }
88
-
89
- return result;
90
- }
91
-
92
- function checkProductionAdmobAlias() {
93
- const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
94
- const viteConfigPath = possibleConfigFiles
95
- .map(configFile => resolve(__dirname, configFile))
96
- .find(filePath => existsSync(filePath));
97
-
98
- if (!viteConfigPath) {
99
- console.error('❌ FINAL RELEASE BLOCKED: No vite.config.mjs or vite.config.js file found.');
100
- process.exit(1);
101
- }
102
-
103
- const viteConfigContent = stripJavaScriptComments(readFileSync(viteConfigPath, 'utf8'));
104
- const aliasPattern = /(['"])@admob\1\s*:\s*path\.resolve\(\s*__dirname\s*,\s*(['"])([^'"\r\n]+)\2\s*\)/g;
105
- const activeAliases = [...viteConfigContent.matchAll(aliasPattern)].map(match => match[3]);
106
- const productionAliasPattern = /^\.\/src\/js\/Ads\/admob-emi-nextgen-\d+(?:\.\d+)+\.js$/;
107
-
108
- if (activeAliases.length === 0) {
109
- console.error('❌ FINAL RELEASE BLOCKED: The production @admob alias is commented out or missing in the Vite config.');
110
- console.error(" Enable: '@admob': path.resolve(__dirname, './src/js/Ads/admob-emi-nextgen-x.x.js')");
111
- process.exit(1);
112
- }
113
-
114
- if (activeAliases.length > 1) {
115
- console.error('❌ FINAL RELEASE BLOCKED: Multiple active @admob aliases were found in the Vite config.');
116
- console.error(' Keep exactly one active production admob-emi-nextgen-x.x.js alias.');
117
- process.exit(1);
118
- }
119
-
120
- const activeAlias = activeAliases[0];
121
- if (!productionAliasPattern.test(activeAlias)) {
122
- console.error(`❌ FINAL RELEASE BLOCKED: @admob currently points to '${activeAlias}'.`);
123
- console.error(" It must point to './src/js/Ads/admob-emi-nextgen-x.x.js', not a test AdMob file.");
124
- process.exit(1);
125
- }
126
-
127
- const productionAdmobPath = resolve(__dirname, activeAlias);
128
- if (!existsSync(productionAdmobPath)) {
129
- console.error(`❌ FINAL RELEASE BLOCKED: The production @admob file does not exist: ${productionAdmobPath}`);
130
- process.exit(1);
131
- }
132
-
133
- console.log(`✅ Production @admob alias verified: ${activeAlias}`);
134
- }
135
-
136
- // This must be the first release validation so test/no-ad builds cannot proceed.
137
- checkProductionAdmobAlias();
138
-
139
- // Define a mapping between store IDs and store names
140
- /* const storeNames = {
19
+ import fs from 'fs';
20
+ import path from 'path';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ function stripJavaScriptComments(content) {
26
+ let result = '';
27
+ let state = 'code';
28
+
29
+ for (let index = 0; index < content.length; index++) {
30
+ const character = content[index];
31
+ const nextCharacter = content[index + 1];
32
+
33
+ if (state === 'lineComment') {
34
+ if (character === '\n') {
35
+ result += character;
36
+ state = 'code';
37
+ } else {
38
+ result += ' ';
39
+ }
40
+ continue;
41
+ }
42
+
43
+ if (state === 'blockComment') {
44
+ if (character === '*' && nextCharacter === '/') {
45
+ result += ' ';
46
+ index++;
47
+ state = 'code';
48
+ } else {
49
+ result += character === '\n' ? '\n' : ' ';
50
+ }
51
+ continue;
52
+ }
53
+
54
+ if (state !== 'code') {
55
+ result += character;
56
+
57
+ if (character === '\\') {
58
+ if (nextCharacter !== undefined) {
59
+ result += nextCharacter;
60
+ index++;
61
+ }
62
+ } else if (
63
+ (state === 'singleQuote' && character === "'") ||
64
+ (state === 'doubleQuote' && character === '"') ||
65
+ (state === 'templateLiteral' && character === '`')
66
+ ) {
67
+ state = 'code';
68
+ }
69
+ continue;
70
+ }
71
+
72
+ if (character === '/' && nextCharacter === '/') {
73
+ result += ' ';
74
+ index++;
75
+ state = 'lineComment';
76
+ } else if (character === '/' && nextCharacter === '*') {
77
+ result += ' ';
78
+ index++;
79
+ state = 'blockComment';
80
+ } else {
81
+ result += character;
82
+
83
+ if (character === "'") state = 'singleQuote';
84
+ else if (character === '"') state = 'doubleQuote';
85
+ else if (character === '`') state = 'templateLiteral';
86
+ }
87
+ }
88
+
89
+ return result;
90
+ }
91
+
92
+ function checkProductionAdmobAlias() {
93
+ const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
94
+ const viteConfigPath = possibleConfigFiles
95
+ .map(configFile => resolve(__dirname, configFile))
96
+ .find(filePath => existsSync(filePath));
97
+
98
+ if (!viteConfigPath) {
99
+ console.error('❌ FINAL RELEASE BLOCKED: No vite.config.mjs or vite.config.js file found.');
100
+ process.exit(1);
101
+ }
102
+
103
+ const viteConfigContent = stripJavaScriptComments(readFileSync(viteConfigPath, 'utf8'));
104
+ const aliasPattern = /(['"])@admob\1\s*:\s*path\.resolve\(\s*__dirname\s*,\s*(['"])([^'"\r\n]+)\2\s*\)/g;
105
+ const activeAliases = [...viteConfigContent.matchAll(aliasPattern)].map(match => match[3]);
106
+ const productionAliasPattern = /^\.\/src\/js\/Ads\/admob-emi-nextgen-\d+(?:\.\d+)+\.js$/;
107
+
108
+ if (activeAliases.length === 0) {
109
+ console.error('❌ FINAL RELEASE BLOCKED: The production @admob alias is commented out or missing in the Vite config.');
110
+ console.error(" Enable: '@admob': path.resolve(__dirname, './src/js/Ads/admob-emi-nextgen-x.x.js')");
111
+ process.exit(1);
112
+ }
113
+
114
+ if (activeAliases.length > 1) {
115
+ console.error('❌ FINAL RELEASE BLOCKED: Multiple active @admob aliases were found in the Vite config.');
116
+ console.error(' Keep exactly one active production admob-emi-nextgen-x.x.js alias.');
117
+ process.exit(1);
118
+ }
119
+
120
+ const activeAlias = activeAliases[0];
121
+ if (!productionAliasPattern.test(activeAlias)) {
122
+ console.error(`❌ FINAL RELEASE BLOCKED: @admob currently points to '${activeAlias}'.`);
123
+ console.error(" It must point to './src/js/Ads/admob-emi-nextgen-x.x.js', not a test AdMob file.");
124
+ process.exit(1);
125
+ }
126
+
127
+ const productionAdmobPath = resolve(__dirname, activeAlias);
128
+ if (!existsSync(productionAdmobPath)) {
129
+ console.error(`❌ FINAL RELEASE BLOCKED: The production @admob file does not exist: ${productionAdmobPath}`);
130
+ process.exit(1);
131
+ }
132
+
133
+ console.log(`✅ Production @admob alias verified: ${activeAlias}`);
134
+ }
135
+
136
+ // This must be the first release validation so test/no-ad builds cannot proceed.
137
+ checkProductionAdmobAlias();
138
+
139
+ // Define a mapping between store IDs and store names
140
+ /* const storeNames = {
141
141
  "1": "PlayStore",
142
142
  "2": "SamsungStore",
143
143
  "7": "AmazonStore"
@@ -177,43 +177,43 @@ const androidManifestPath = join("android", "app", "src", "main", "AndroidManife
177
177
  const configPath = path.join(process.cwd(), 'capacitor.config.json');
178
178
  const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
179
179
 
180
- const _appUniqueId = config.android?.APP_UNIQUE_ID;
181
- const _appName=config.appName;
182
- const _appPackageId=config.appId;
183
-
184
- const FLOWCHART_API_APP_ID = 228;
185
- const FLOWCHART_SHARED_PATH = join('public', 'src', 'shared.js');
186
- const FLOWCHART_PLAY_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart';
187
- const FLOWCHART_OTHER_STORE_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart/otherapi';
188
- const FLOWCHART_OTHER_STORE_API_HASH = 'd1a3774529b74206ae2117f9c25f258e485a1f7348620e769db19c2796aa1fdf';
189
- const flowchartSharedOriginal = existsSync(FLOWCHART_SHARED_PATH)
190
- ? readFileSync(FLOWCHART_SHARED_PATH, 'utf8')
191
- : null;
192
-
193
- function applyFlowchartStoreApi(storeId) {
194
- if (String(_appUniqueId) !== String(FLOWCHART_API_APP_ID) || !flowchartSharedOriginal) return false;
195
- const apiBase = String(storeId) === '1' ? FLOWCHART_PLAY_API_BASE : FLOWCHART_OTHER_STORE_API_BASE;
196
- const accessHash = String(storeId) === '1' ? '' : FLOWCHART_OTHER_STORE_API_HASH;
197
- const updated = flowchartSharedOriginal
198
- .replace(/const FLOWCHART_API_BASE = "[^"]*";/, `const FLOWCHART_API_BASE = "${apiBase}";`)
199
- .replace(/const FLOWCHART_API_ACCESS_HASH = "[^"]*";/, `const FLOWCHART_API_ACCESS_HASH = "${accessHash}";`);
200
- if (updated === flowchartSharedOriginal) {
201
- throw new Error(`Flowchart API configuration markers were not found in ${FLOWCHART_SHARED_PATH}.`);
202
- }
203
- writeFileSync(FLOWCHART_SHARED_PATH, updated, 'utf8');
204
- console.log(`✅ App 228 API endpoint configured for Store ID ${storeId}.`);
205
- return true;
206
- }
207
-
208
- function restoreFlowchartStoreApi() {
209
- if (String(_appUniqueId) === String(FLOWCHART_API_APP_ID) && flowchartSharedOriginal) {
210
- writeFileSync(FLOWCHART_SHARED_PATH, flowchartSharedOriginal, 'utf8');
211
- }
212
- }
213
-
214
-
215
-
216
- function fileExists(filePath) {
180
+ const _appUniqueId = config.android?.APP_UNIQUE_ID;
181
+ const _appName=config.appName;
182
+ const _appPackageId=config.appId;
183
+
184
+ const FLOWCHART_API_APP_ID = 228;
185
+ const FLOWCHART_SHARED_PATH = join('public', 'src', 'shared.js');
186
+ const FLOWCHART_PLAY_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart';
187
+ const FLOWCHART_OTHER_STORE_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart/otherapi';
188
+ const FLOWCHART_OTHER_STORE_API_HASH = 'd1a3774529b74206ae2117f9c25f258e485a1f7348620e769db19c2796aa1fdf';
189
+ const flowchartSharedOriginal = existsSync(FLOWCHART_SHARED_PATH)
190
+ ? readFileSync(FLOWCHART_SHARED_PATH, 'utf8')
191
+ : null;
192
+
193
+ function applyFlowchartStoreApi(storeId) {
194
+ if (String(_appUniqueId) !== String(FLOWCHART_API_APP_ID) || !flowchartSharedOriginal) return false;
195
+ const apiBase = String(storeId) === '1' ? FLOWCHART_PLAY_API_BASE : FLOWCHART_OTHER_STORE_API_BASE;
196
+ const accessHash = String(storeId) === '1' ? '' : FLOWCHART_OTHER_STORE_API_HASH;
197
+ const updated = flowchartSharedOriginal
198
+ .replace(/const FLOWCHART_API_BASE = "[^"]*";/, `const FLOWCHART_API_BASE = "${apiBase}";`)
199
+ .replace(/const FLOWCHART_API_ACCESS_HASH = "[^"]*";/, `const FLOWCHART_API_ACCESS_HASH = "${accessHash}";`);
200
+ if (updated === flowchartSharedOriginal) {
201
+ throw new Error(`Flowchart API configuration markers were not found in ${FLOWCHART_SHARED_PATH}.`);
202
+ }
203
+ writeFileSync(FLOWCHART_SHARED_PATH, updated, 'utf8');
204
+ console.log(`✅ App 228 API endpoint configured for Store ID ${storeId}.`);
205
+ return true;
206
+ }
207
+
208
+ function restoreFlowchartStoreApi() {
209
+ if (String(_appUniqueId) === String(FLOWCHART_API_APP_ID) && flowchartSharedOriginal) {
210
+ writeFileSync(FLOWCHART_SHARED_PATH, flowchartSharedOriginal, 'utf8');
211
+ }
212
+ }
213
+
214
+
215
+
216
+ function fileExists(filePath) {
217
217
  return existsSync(filePath);
218
218
  }
219
219
 
@@ -848,9 +848,9 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
848
848
  if (!originalMinSdkVersion) {
849
849
  originalMinSdkVersion = currentMinSdkVersion;
850
850
  }
851
- try {
852
- applyFlowchartStoreApi(id);
853
- // Modify the minSdkVersion based on the store
851
+ try {
852
+ applyFlowchartStoreApi(id);
853
+ // Modify the minSdkVersion based on the store
854
854
 
855
855
 
856
856
  if(currentMinSdkVersion==23 || currentMinSdkVersion==24)
@@ -962,13 +962,13 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
962
962
  console.error(`❌ ${newExt.toUpperCase()} file not found after build.`);
963
963
  }
964
964
 
965
- } catch (error) {
966
- console.error(`❌ Error during build for Store ID ${id}:`, error);
967
- restoreFlowchartStoreApi();
968
- process.exit(1);
969
- } finally {
970
- restoreFlowchartStoreApi();
971
- }
965
+ } catch (error) {
966
+ console.error(`❌ Error during build for Store ID ${id}:`, error);
967
+ restoreFlowchartStoreApi();
968
+ process.exit(1);
969
+ } finally {
970
+ restoreFlowchartStoreApi();
971
+ }
972
972
  });
973
973
 
974
974
  rl.close(); // Close the readline interface after all operations
@@ -114,9 +114,9 @@ function toSafeJavaPackageName(value) {
114
114
  .join('.');
115
115
  }
116
116
 
117
- function getBaselineProfileBuildGradle(modulePackage) {
118
- return `apply plugin: 'com.android.test'\napply plugin: 'androidx.baselineprofile'\n\nandroid {\n namespace = \"${modulePackage}\"\n compileSdk = rootProject.ext.compileSdkVersion\n\n defaultConfig {\n minSdkVersion rootProject.ext.minSdkVersion\n targetSdkVersion rootProject.ext.targetSdkVersion\n testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n }\n\n targetProjectPath = \":app\"\n}\n\nbaselineProfile {\n useConnectedDevices true\n}\n\ndef generatedBaselineProfileDir = file(\"$projectDir/../app/src/main/generated/baselineProfiles\")\ndef stableBaselineProfileDir = file(\"$projectDir/../baselineProfiles\")\n\ntasks.register(\"copyGeneratedBaselineProfiles\") {\n group = \"baselineprofile\"\n description = \"Copies generated baseline profile files from app module to a stable project-level folder.\"\n\n doLast {\n if (generatedBaselineProfileDir.exists()) {\n delete(stableBaselineProfileDir)\n copy {\n from(generatedBaselineProfileDir)\n include(\"**/*.txt\")\n into(stableBaselineProfileDir)\n }\n println \"Copied baseline profile files to: \" + stableBaselineProfileDir\n } else {\n println \"No generated baseline profiles found at \" + generatedBaselineProfileDir\n }\n }\n}\n\ntasks.matching { task ->\n task.name in ["connectedReleaseAndroidTest", "connectedNonMinifiedReleaseAndroidTest", "connectedAndroidTest"]\n}.configureEach {\n finalizedBy("copyGeneratedBaselineProfiles")\n}\n\ndependencies {\n implementation \"androidx.benchmark:benchmark-macro-junit4:1.4.0\"\n implementation \"androidx.test.ext:junit:$androidxJunitVersion\"\n implementation \"androidx.test.uiautomator:uiautomator:2.3.0\"\n}\n`;
119
- }
117
+ function getBaselineProfileBuildGradle(modulePackage) {
118
+ return `apply plugin: 'com.android.test'\napply plugin: 'androidx.baselineprofile'\n\nandroid {\n namespace = \"${modulePackage}\"\n compileSdk = rootProject.ext.compileSdkVersion\n\n defaultConfig {\n minSdkVersion rootProject.ext.minSdkVersion\n targetSdkVersion rootProject.ext.targetSdkVersion\n testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n }\n\n targetProjectPath = \":app\"\n}\n\nbaselineProfile {\n useConnectedDevices true\n}\n\ndef generatedBaselineProfileDir = file(\"$projectDir/../app/src/main/generated/baselineProfiles\")\ndef stableBaselineProfileDir = file(\"$projectDir/../baselineProfiles\")\n\ntasks.register(\"copyGeneratedBaselineProfiles\") {\n group = \"baselineprofile\"\n description = \"Copies generated baseline profile files from app module to a stable project-level folder.\"\n\n doLast {\n if (generatedBaselineProfileDir.exists()) {\n delete(stableBaselineProfileDir)\n copy {\n from(generatedBaselineProfileDir)\n include(\"**/*.txt\")\n into(stableBaselineProfileDir)\n }\n println \"Copied baseline profile files to: \" + stableBaselineProfileDir\n } else {\n println \"No generated baseline profiles found at \" + generatedBaselineProfileDir\n }\n }\n}\n\ntasks.matching { task ->\n task.name in ["connectedReleaseAndroidTest", "connectedNonMinifiedReleaseAndroidTest", "connectedAndroidTest"]\n}.configureEach {\n finalizedBy("copyGeneratedBaselineProfiles")\n}\n\ndependencies {\n implementation \"androidx.benchmark:benchmark-macro-junit4:1.4.0\"\n implementation \"androidx.test.ext:junit:$androidxJunitVersion\"\n implementation \"androidx.test.uiautomator:uiautomator:2.3.0\"\n}\n`;
119
+ }
120
120
 
121
121
  const baselineProfileManifest = `<?xml version="1.0" encoding="utf-8"?>
122
122
  <manifest xmlns:android="http://schemas.android.com/apk/res/android" />