codeplay-common 4.11.4 → 4.11.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.
- package/CHANGELOG.md +82 -77
- package/README.md +4 -2
- package/RELEASE_NOTES.md +75 -75
- package/files/buildCodeplay/codeplayBeforeBuild.js +8 -0
- package/files/buildCodeplay/ensure-current-build.cjs +42 -0
- package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
- package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
- package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
- package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
- package/files/buildCodeplay/ios-emi-admob-modification.js +25 -25
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/scripts-common/generate-baseline-profile.js +46 -46
- package/package.json +1 -1
- package/scripts/ensure-current-build.test.cjs +76 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Detect version-suffixed files in the app's `buildCodeplay` folder at build startup, then run `npm uninstall codeplay-common` and `npm install codeplay-common` sequentially before resuming with the refreshed before-build script.
|
|
6
|
+
- Stop on reinstall failure or incomplete legacy cleanup rather than continuing with stale build templates.
|
|
7
|
+
|
|
3
8
|
## 4.11.4 — 2026-10-27
|
|
4
9
|
|
|
5
10
|
Version name: 4.11.4. Version code/build number: not applicable to this npm package.
|
|
@@ -11,80 +16,80 @@ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/fix
|
|
|
11
16
|
- Ship the helper inside `buildCodeplay` so shared templates do not depend on an app-specific `Scripts` file.
|
|
12
17
|
- Provide `npm run android:r8-rules` and migrate the known previous helper command while preserving custom commands.
|
|
13
18
|
- Keep permission declarations, prompts, minification settings and iOS configuration unchanged; already-distributed binaries require rebuilding.
|
|
14
|
-
- Preserve explicit release minification settings when distributing shared templates, and retain the tested FFmpeg JNI rules when that plugin is installed.
|
|
15
|
-
|
|
16
|
-
## 4.10.5 — 2026-10-23
|
|
17
|
-
|
|
18
|
-
Version name: 4.10.5. Version code/build number: not applicable to this npm package.
|
|
19
|
-
|
|
20
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
21
|
-
|
|
22
|
-
- Migrate known legacy filename lookups in an existing app configurator after installing shared scripts.
|
|
23
|
-
- Prefer unversioned pre-build and package-ID helpers while retaining the versioned fallback.
|
|
24
|
-
- Correct the known old sync-hook folder assignment without replacing app-specific configuration or adding a configurator to apps that do not have one.
|
|
25
|
-
|
|
26
|
-
## 4.10.4 — 2026-10-23
|
|
27
|
-
|
|
28
|
-
Version name: 4.10.4. Version code/build number: not applicable to this npm package.
|
|
29
|
-
|
|
30
|
-
Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
31
|
-
|
|
32
|
-
- Ship an updated sync-after hook for apps retaining the custom hook command after script migration.
|
|
33
|
-
- Run unversioned splash helpers instead of searching for removed versioned filenames.
|
|
34
|
-
- Resolve baseline profile setup from `scripts-common/` and preserve the existing native splash when no splash icon is configured.
|
|
35
|
-
|
|
36
|
-
## 4.10.3 — 2026-10-23
|
|
37
|
-
|
|
38
|
-
Version name: 4.10.3. Version code/build number: not applicable to this npm package.
|
|
39
|
-
|
|
40
|
-
Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
41
|
-
|
|
42
|
-
- Allow ad-free apps with `plugins.AdMob.ADMOB_ENABLED: false` to pass release validation without an AdMob alias or controller.
|
|
43
|
-
- Continue requiring a production AdMob alias when advertising is enabled or the enabled flag is unspecified.
|
|
44
|
-
- Preserve rejection of test aliases, commented or duplicate aliases, and missing production controllers for apps with ads enabled.
|
|
45
|
-
|
|
46
|
-
## 4.10.0 — 2026-10-23
|
|
47
|
-
|
|
48
|
-
Version name: 4.10.0. Version code/build number: not applicable to this npm package.
|
|
49
|
-
Bundled pre-build script: 6.7.
|
|
50
|
-
|
|
51
|
-
Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
52
|
-
|
|
53
|
-
- Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
|
|
54
|
-
- Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
|
|
55
|
-
- Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
|
|
56
|
-
- Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
|
|
57
|
-
- Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
|
|
58
|
-
- Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
|
|
59
|
-
- Copy the full finalrelease implementation so it can be tested from the application folder.
|
|
60
|
-
- Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
|
|
61
|
-
|
|
62
|
-
## 4.9.8 — 2026-10-22
|
|
63
|
-
|
|
64
|
-
Version name: 4.9.8. Version code/build number: not applicable to this npm package.
|
|
65
|
-
Bundled pre-build script: 6.5.
|
|
66
|
-
|
|
67
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
68
|
-
|
|
69
|
-
- Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
|
|
70
|
-
- Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
|
|
71
|
-
- Preserve app-owned ad configuration and select each app's existing IAP analytics module.
|
|
72
|
-
- Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
|
|
73
|
-
- Validate ZIP contents before switching imports; retain the working package when a remote update fails.
|
|
74
|
-
- Validate the selected folder controller during final-release checks while continuing to reject test aliases.
|
|
75
|
-
|
|
76
|
-
## 4.7.7 — 2026-10-07
|
|
77
|
-
|
|
78
|
-
Version name: 4.7.7. Version code/build number: not applicable to this npm package.
|
|
79
|
-
Bundled pre-build script: 6.4.
|
|
80
|
-
|
|
81
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
|
|
82
|
-
(replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
83
|
-
|
|
84
|
-
- Keep `npm run build` as the Android default on every host; add `npm run build:ios` automatically during installation.
|
|
85
|
-
- Route `build-capacitor-android` through the same pre-build validation before copying the web build.
|
|
86
|
-
- Migrate direct save-gallery imports to `@saveGallery` and select the matching platform helper in Vite after one detailed Enter/y confirmation.
|
|
87
|
-
- Stop without import writes on cancellation, missing helpers, mixed versions, unsupported query/hash aliases or concurrent source edits.
|
|
88
|
-
- Reuse source directory traversal and combine gallery, retired OneSignal import, StatusBar and editor checks in one content pass.
|
|
89
|
-
- Automatically remove an installed/declared `onesignal-cordova-plugin` with a warning; skip legacy OneSignal patching/helper downloads and stop on remaining package imports.
|
|
90
|
-
- Keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries without adding them in future projects.
|
|
19
|
+
- Preserve explicit release minification settings when distributing shared templates, and retain the tested FFmpeg JNI rules when that plugin is installed.
|
|
20
|
+
|
|
21
|
+
## 4.10.5 — 2026-10-23
|
|
22
|
+
|
|
23
|
+
Version name: 4.10.5. Version code/build number: not applicable to this npm package.
|
|
24
|
+
|
|
25
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
26
|
+
|
|
27
|
+
- Migrate known legacy filename lookups in an existing app configurator after installing shared scripts.
|
|
28
|
+
- Prefer unversioned pre-build and package-ID helpers while retaining the versioned fallback.
|
|
29
|
+
- Correct the known old sync-hook folder assignment without replacing app-specific configuration or adding a configurator to apps that do not have one.
|
|
30
|
+
|
|
31
|
+
## 4.10.4 — 2026-10-23
|
|
32
|
+
|
|
33
|
+
Version name: 4.10.4. Version code/build number: not applicable to this npm package.
|
|
34
|
+
|
|
35
|
+
Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
36
|
+
|
|
37
|
+
- Ship an updated sync-after hook for apps retaining the custom hook command after script migration.
|
|
38
|
+
- Run unversioned splash helpers instead of searching for removed versioned filenames.
|
|
39
|
+
- Resolve baseline profile setup from `scripts-common/` and preserve the existing native splash when no splash icon is configured.
|
|
40
|
+
|
|
41
|
+
## 4.10.3 — 2026-10-23
|
|
42
|
+
|
|
43
|
+
Version name: 4.10.3. Version code/build number: not applicable to this npm package.
|
|
44
|
+
|
|
45
|
+
Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
46
|
+
|
|
47
|
+
- Allow ad-free apps with `plugins.AdMob.ADMOB_ENABLED: false` to pass release validation without an AdMob alias or controller.
|
|
48
|
+
- Continue requiring a production AdMob alias when advertising is enabled or the enabled flag is unspecified.
|
|
49
|
+
- Preserve rejection of test aliases, commented or duplicate aliases, and missing production controllers for apps with ads enabled.
|
|
50
|
+
|
|
51
|
+
## 4.10.0 — 2026-10-23
|
|
52
|
+
|
|
53
|
+
Version name: 4.10.0. Version code/build number: not applicable to this npm package.
|
|
54
|
+
Bundled pre-build script: 6.7.
|
|
55
|
+
|
|
56
|
+
Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
57
|
+
|
|
58
|
+
- Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
|
|
59
|
+
- Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
|
|
60
|
+
- Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
|
|
61
|
+
- Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
|
|
62
|
+
- Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
|
|
63
|
+
- Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
|
|
64
|
+
- Copy the full finalrelease implementation so it can be tested from the application folder.
|
|
65
|
+
- Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
|
|
66
|
+
|
|
67
|
+
## 4.9.8 — 2026-10-22
|
|
68
|
+
|
|
69
|
+
Version name: 4.9.8. Version code/build number: not applicable to this npm package.
|
|
70
|
+
Bundled pre-build script: 6.5.
|
|
71
|
+
|
|
72
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
73
|
+
|
|
74
|
+
- Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
|
|
75
|
+
- Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
|
|
76
|
+
- Preserve app-owned ad configuration and select each app's existing IAP analytics module.
|
|
77
|
+
- Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
|
|
78
|
+
- Validate ZIP contents before switching imports; retain the working package when a remote update fails.
|
|
79
|
+
- Validate the selected folder controller during final-release checks while continuing to reject test aliases.
|
|
80
|
+
|
|
81
|
+
## 4.7.7 — 2026-10-07
|
|
82
|
+
|
|
83
|
+
Version name: 4.7.7. Version code/build number: not applicable to this npm package.
|
|
84
|
+
Bundled pre-build script: 6.4.
|
|
85
|
+
|
|
86
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
|
|
87
|
+
(replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
88
|
+
|
|
89
|
+
- Keep `npm run build` as the Android default on every host; add `npm run build:ios` automatically during installation.
|
|
90
|
+
- Route `build-capacitor-android` through the same pre-build validation before copying the web build.
|
|
91
|
+
- Migrate direct save-gallery imports to `@saveGallery` and select the matching platform helper in Vite after one detailed Enter/y confirmation.
|
|
92
|
+
- Stop without import writes on cancellation, missing helpers, mixed versions, unsupported query/hash aliases or concurrent source edits.
|
|
93
|
+
- Reuse source directory traversal and combine gallery, retired OneSignal import, StatusBar and editor checks in one content pass.
|
|
94
|
+
- Automatically remove an installed/declared `onesignal-cordova-plugin` with a warning; skip legacy OneSignal patching/helper downloads and stop on remaining package imports.
|
|
95
|
+
- Keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries without adding them in future projects.
|
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ App package scripts run local files: node buildCodeplay/codeplayBeforeBuild.js,
|
|
|
31
31
|
|
|
32
32
|
Installation migrates both legacy versioned filenames and the temporary node_modules runner commands to these local paths. It removes only superseded versioned build scripts, preserves app-owned release configuration and splash XML overrides, and keeps screenshot data and custom helpers. The root finalrelease script is also copied as a local implementation.
|
|
33
33
|
|
|
34
|
+
After this update is installed, `npm run build` checks the app's `buildCodeplay/` folder for version-suffixed files before preparing the build. If any exist, it runs `npm uninstall codeplay-common` followed by `npm install codeplay-common`, then runs the refreshed before-build script before continuing. A failed command or remaining versioned files stops the build. Unrecognized legacy files must be migrated manually; they are not deleted automatically.
|
|
35
|
+
|
|
34
36
|
Before-build includes the automatic IAP startup and Home Pro-button migrations. IAP and AdMob ZIPs are downloaded directly from https://htmlcodeplay.com/code-play-plugin/ using the existing update flow. No plugin ZIPs are bundled in this npm package. App-specific configuration and designs remain in the app.
|
|
35
37
|
|
|
36
38
|
## AdMob folder packages
|
|
@@ -223,5 +225,5 @@ Version : 4.0.0 (Previous version 3.2.19)
|
|
|
223
225
|
1) In here we are completly remove the admob-emi and use "capacitor-admob-nextgen"
|
|
224
226
|
2) Removed "modify-plugin-xml.js"
|
|
225
227
|
3)
|
|
226
|
-
|
|
227
|
-
The fix preserves the metadata behind the release permission-check failure verified in testing. It does not guarantee every native dialog or plugin: required manifest declarations, Android permission policy, device settings and plugin-specific keep rules still apply.
|
|
228
|
+
|
|
229
|
+
The fix preserves the metadata behind the release permission-check failure verified in testing. It does not guarantee every native dialog or plugin: required manifest declarations, Android permission policy, device settings and plugin-specific keep rules still apply.
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -11,78 +11,78 @@ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/fix
|
|
|
11
11
|
- Restore protection after native platform regeneration and package updates, and check it on every Gradle build without overwriting custom ProGuard rules.
|
|
12
12
|
- Keep the fix self-contained in the shared package and provide a manual restore command.
|
|
13
13
|
- No new permissions or prompts are added. Update the package and rebuild each app to include the correction.
|
|
14
|
-
- Preserve existing release minification choices and protect FFmpeg native entry points in apps using that plugin.
|
|
15
|
-
|
|
16
|
-
## 4.10.5 — 2026-10-23
|
|
17
|
-
|
|
18
|
-
Version name: 4.10.5. Version code/build number: not applicable to this npm package.
|
|
19
|
-
|
|
20
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
21
|
-
|
|
22
|
-
- Prevent app postinstall failures after shared scripts switch to unversioned filenames.
|
|
23
|
-
- Repair the known old sync-hook path during plugin installation.
|
|
24
|
-
- Preserve each app's custom configuration and leave apps without the affected configurator unchanged.
|
|
25
|
-
|
|
26
|
-
## 4.10.4 — 2026-10-23
|
|
27
|
-
|
|
28
|
-
Version name: 4.10.4. Version code/build number: not applicable to this npm package.
|
|
29
|
-
|
|
30
|
-
Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
31
|
-
|
|
32
|
-
- Fix Android sync failures caused by the old versioned splash script lookup.
|
|
33
|
-
- Use the migrated baseline profile setup path.
|
|
34
|
-
- Update the custom sync hook automatically during plugin installation.
|
|
35
|
-
|
|
36
|
-
## 4.10.3 — 2026-10-23
|
|
37
|
-
|
|
38
|
-
Version name: 4.10.3. Version code/build number: not applicable to this npm package.
|
|
39
|
-
|
|
40
|
-
Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
41
|
-
|
|
42
|
-
- Release ad-free apps without adding an unnecessary AdMob alias or controller.
|
|
43
|
-
- Explicitly set `plugins.AdMob.ADMOB_ENABLED` to `false` to use the ad-free release path.
|
|
44
|
-
- Keep production AdMob safety checks for apps with advertising enabled.
|
|
45
|
-
|
|
46
|
-
## 4.10.0 — 2026-10-23
|
|
47
|
-
|
|
48
|
-
Version name: 4.10.0. Version code/build number: not applicable to this npm package.
|
|
49
|
-
Bundled pre-build script: 6.7.
|
|
50
|
-
|
|
51
|
-
Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
52
|
-
|
|
53
|
-
- Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
|
|
54
|
-
- Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
|
|
55
|
-
- Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
|
|
56
|
-
- Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
|
|
57
|
-
- Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
|
|
58
|
-
- Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
|
|
59
|
-
- Copy the full finalrelease implementation so it can be tested from the application folder.
|
|
60
|
-
- Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
|
|
61
|
-
|
|
62
|
-
## 4.9.8 — 2026-10-22
|
|
63
|
-
|
|
64
|
-
Version name: 4.9.8. Version code/build number: not applicable to this npm package.
|
|
65
|
-
Bundled pre-build script: 6.5.
|
|
66
|
-
|
|
67
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
68
|
-
|
|
69
|
-
- Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
|
|
70
|
-
- Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
|
|
71
|
-
- Preserve app-owned ad configuration and select each app's existing IAP analytics module.
|
|
72
|
-
- Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
|
|
73
|
-
- Validate ZIP contents before switching imports; retain the working package when a remote update fails.
|
|
74
|
-
- Validate the selected folder controller during final-release checks while continuing to reject test aliases.
|
|
75
|
-
|
|
76
|
-
## 4.7.7 — 2026-10-07
|
|
77
|
-
|
|
78
|
-
Version name: 4.7.7. Version code/build number: not applicable to this npm package.
|
|
79
|
-
|
|
80
|
-
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
|
|
81
|
-
(replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
82
|
-
|
|
83
|
-
- Installation automatically configures Android and iOS build commands in your app's `package.json`.
|
|
84
|
-
- Android builds remain the default; use `npm run build:ios` for iOS.
|
|
85
|
-
- Save-gallery imports use one alias with a platform-specific helper and a clear confirmation before source changes.
|
|
86
|
-
- Shared checks reuse file traversal to reduce repeated scanning.
|
|
87
|
-
- Builds warn and automatically uninstall the retired OneSignal Cordova plugin when found.
|
|
88
|
-
- `agent-temp/` stays ignored, while `buildCodeplay/` is removed from ignore rules.
|
|
14
|
+
- Preserve existing release minification choices and protect FFmpeg native entry points in apps using that plugin.
|
|
15
|
+
|
|
16
|
+
## 4.10.5 — 2026-10-23
|
|
17
|
+
|
|
18
|
+
Version name: 4.10.5. Version code/build number: not applicable to this npm package.
|
|
19
|
+
|
|
20
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
21
|
+
|
|
22
|
+
- Prevent app postinstall failures after shared scripts switch to unversioned filenames.
|
|
23
|
+
- Repair the known old sync-hook path during plugin installation.
|
|
24
|
+
- Preserve each app's custom configuration and leave apps without the affected configurator unchanged.
|
|
25
|
+
|
|
26
|
+
## 4.10.4 — 2026-10-23
|
|
27
|
+
|
|
28
|
+
Version name: 4.10.4. Version code/build number: not applicable to this npm package.
|
|
29
|
+
|
|
30
|
+
Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
31
|
+
|
|
32
|
+
- Fix Android sync failures caused by the old versioned splash script lookup.
|
|
33
|
+
- Use the migrated baseline profile setup path.
|
|
34
|
+
- Update the custom sync hook automatically during plugin installation.
|
|
35
|
+
|
|
36
|
+
## 4.10.3 — 2026-10-23
|
|
37
|
+
|
|
38
|
+
Version name: 4.10.3. Version code/build number: not applicable to this npm package.
|
|
39
|
+
|
|
40
|
+
Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
41
|
+
|
|
42
|
+
- Release ad-free apps without adding an unnecessary AdMob alias or controller.
|
|
43
|
+
- Explicitly set `plugins.AdMob.ADMOB_ENABLED` to `false` to use the ad-free release path.
|
|
44
|
+
- Keep production AdMob safety checks for apps with advertising enabled.
|
|
45
|
+
|
|
46
|
+
## 4.10.0 — 2026-10-23
|
|
47
|
+
|
|
48
|
+
Version name: 4.10.0. Version code/build number: not applicable to this npm package.
|
|
49
|
+
Bundled pre-build script: 6.7.
|
|
50
|
+
|
|
51
|
+
Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
52
|
+
|
|
53
|
+
- Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
|
|
54
|
+
- Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
|
|
55
|
+
- Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
|
|
56
|
+
- Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
|
|
57
|
+
- Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
|
|
58
|
+
- Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
|
|
59
|
+
- Copy the full finalrelease implementation so it can be tested from the application folder.
|
|
60
|
+
- Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
|
|
61
|
+
|
|
62
|
+
## 4.9.8 — 2026-10-22
|
|
63
|
+
|
|
64
|
+
Version name: 4.9.8. Version code/build number: not applicable to this npm package.
|
|
65
|
+
Bundled pre-build script: 6.5.
|
|
66
|
+
|
|
67
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
68
|
+
|
|
69
|
+
- Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
|
|
70
|
+
- Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
|
|
71
|
+
- Preserve app-owned ad configuration and select each app's existing IAP analytics module.
|
|
72
|
+
- Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
|
|
73
|
+
- Validate ZIP contents before switching imports; retain the working package when a remote update fails.
|
|
74
|
+
- Validate the selected folder controller during final-release checks while continuing to reject test aliases.
|
|
75
|
+
|
|
76
|
+
## 4.7.7 — 2026-10-07
|
|
77
|
+
|
|
78
|
+
Version name: 4.7.7. Version code/build number: not applicable to this npm package.
|
|
79
|
+
|
|
80
|
+
Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
|
|
81
|
+
(replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
|
|
82
|
+
|
|
83
|
+
- Installation automatically configures Android and iOS build commands in your app's `package.json`.
|
|
84
|
+
- Android builds remain the default; use `npm run build:ios` for iOS.
|
|
85
|
+
- Save-gallery imports use one alias with a platform-specific helper and a clear confirmation before source changes.
|
|
86
|
+
- Shared checks reuse file traversal to reduce repeated scanning.
|
|
87
|
+
- Builds warn and automatically uninstall the retired OneSignal Cordova plugin when found.
|
|
88
|
+
- `agent-temp/` stays ignored, while `buildCodeplay/` is removed from ignore rules.
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
// Version 6.7: deferred IAP startup, ownership-safe ads, and unified store preparation.
|
|
3
3
|
// Version 6.7: migrate AdMob files to ZIP-distributed folder packages.
|
|
4
4
|
// Version 6.7: recreate failed WebViews, defer background recovery, and suppress foreground recovery toasts.
|
|
5
|
+
// Reinstall legacy build templates before loading dependencies or changing the app.
|
|
6
|
+
try {
|
|
7
|
+
if (require('./ensure-current-build.cjs').ensureCurrentBuild()) process.exit(0);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error(`Build preparation failed: ${error.message}`);
|
|
10
|
+
process.exit(typeof error.status === 'number' && error.status > 0 ? error.status : 1);
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
const fs = require('fs');
|
|
6
14
|
const path = require('path');
|
|
7
15
|
const plist = require('plist');
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execSync, execFileSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
function findVersionedBuildFiles(projectRoot) {
|
|
6
|
+
const directory = path.join(projectRoot, 'buildCodeplay');
|
|
7
|
+
if (!fs.existsSync(directory)) return [];
|
|
8
|
+
return fs.readdirSync(directory, { withFileTypes: true })
|
|
9
|
+
.filter(entry => entry.isFile() && /-\d+(?:\.\d+)*(?:-beta-\d+)?\.[^.]+$/i.test(entry.name))
|
|
10
|
+
.map(entry => entry.name);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function ensureCurrentBuild(options = {}) {
|
|
14
|
+
const projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
15
|
+
const legacyFiles = findVersionedBuildFiles(projectRoot);
|
|
16
|
+
if (!legacyFiles.length) return false;
|
|
17
|
+
|
|
18
|
+
console.log(`Legacy buildCodeplay files found: ${legacyFiles.join(', ')}. Reinstalling codeplay-common before continuing.`);
|
|
19
|
+
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'inherit' }));
|
|
20
|
+
runNpm('npm uninstall codeplay-common');
|
|
21
|
+
runNpm('npm install codeplay-common');
|
|
22
|
+
|
|
23
|
+
// Postinstall replaces the scripts and removes recognized legacy files.
|
|
24
|
+
// Do not run stale code or retry indefinitely if migration did not finish.
|
|
25
|
+
const remaining = findVersionedBuildFiles(projectRoot);
|
|
26
|
+
if (remaining.length) {
|
|
27
|
+
throw new Error(`Legacy buildCodeplay files remain after reinstall: ${remaining.join(', ')}. Build stopped; migrate these files before retrying.`);
|
|
28
|
+
}
|
|
29
|
+
const entrypoint = path.join(projectRoot, 'buildCodeplay', 'codeplayBeforeBuild.js');
|
|
30
|
+
if (!fs.existsSync(entrypoint)) throw new Error('codeplayBeforeBuild.js is missing after reinstall. Build stopped.');
|
|
31
|
+
|
|
32
|
+
// The current process loaded the old templates. Finish preparation in a fresh
|
|
33
|
+
// process before the caller's remaining build commands are allowed to run.
|
|
34
|
+
const runBeforeBuild = options.runBeforeBuild || (script => execFileSync(process.execPath, [script, ...process.argv.slice(2)], {
|
|
35
|
+
cwd: projectRoot,
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
}));
|
|
38
|
+
runBeforeBuild(entrypoint);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { ensureCurrentBuild, findVersionedBuildFiles };
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function syncCapacitorPermissionRules(projectRoot = path.resolve(__dirname, '../..')) {
|
|
5
|
-
const appPath = path.join(projectRoot, 'android', 'app');
|
|
6
|
-
if (!fs.existsSync(path.join(appPath, 'build.gradle'))) return false;
|
|
7
|
-
|
|
8
|
-
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
9
|
-
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
10
|
-
const rules = [
|
|
11
|
-
'-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
|
|
12
|
-
'-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
|
|
13
|
-
'-keep @interface com.getcapacitor.annotation.Permission { *; }',
|
|
14
|
-
];
|
|
15
|
-
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
16
|
-
const missing = rules.filter(rule => !existing.has(rule));
|
|
17
|
-
if (!missing.length) return false;
|
|
18
|
-
|
|
19
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
20
|
-
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
21
|
-
+ `# Preserve Capacitor permission metadata used at runtime.${newline}`
|
|
22
|
-
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (require.main === module) {
|
|
27
|
-
const changed = syncCapacitorPermissionRules();
|
|
28
|
-
console.log(changed ? 'Capacitor R8 permission rules restored.' : 'Capacitor R8 permission rules unchanged.');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = { syncCapacitorPermissionRules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function syncCapacitorPermissionRules(projectRoot = path.resolve(__dirname, '../..')) {
|
|
5
|
+
const appPath = path.join(projectRoot, 'android', 'app');
|
|
6
|
+
if (!fs.existsSync(path.join(appPath, 'build.gradle'))) return false;
|
|
7
|
+
|
|
8
|
+
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
9
|
+
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
10
|
+
const rules = [
|
|
11
|
+
'-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
|
|
12
|
+
'-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
|
|
13
|
+
'-keep @interface com.getcapacitor.annotation.Permission { *; }',
|
|
14
|
+
];
|
|
15
|
+
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
16
|
+
const missing = rules.filter(rule => !existing.has(rule));
|
|
17
|
+
if (!missing.length) return false;
|
|
18
|
+
|
|
19
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
20
|
+
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
21
|
+
+ `# Preserve Capacitor permission metadata used at runtime.${newline}`
|
|
22
|
+
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (require.main === module) {
|
|
27
|
+
const changed = syncCapacitorPermissionRules();
|
|
28
|
+
console.log(changed ? 'Capacitor R8 permission rules restored.' : 'Capacitor R8 permission rules unchanged.');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { syncCapacitorPermissionRules };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// FFmpegKit's JNI library looks up these Java members by name at runtime.
|
|
5
|
-
const FFMPEG_JNI_RULES = [
|
|
6
|
-
'-keep class com.antonkarpenko.ffmpegkit.** { *; }',
|
|
7
|
-
'-keep interface com.antonkarpenko.ffmpegkit.** { *; }',
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
function syncFfmpegJniRules(projectRoot) {
|
|
11
|
-
const pluginPath = path.join(projectRoot, 'node_modules', 'codeplay-fmpg', 'plugin.xml');
|
|
12
|
-
const appPath = path.join(projectRoot, 'android', 'app');
|
|
13
|
-
if (!fs.existsSync(pluginPath) || !fs.existsSync(appPath)) return false;
|
|
14
|
-
|
|
15
|
-
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
16
|
-
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
17
|
-
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
18
|
-
const missing = FFMPEG_JNI_RULES.filter(rule => !existing.has(rule));
|
|
19
|
-
if (!missing.length) return false;
|
|
20
|
-
|
|
21
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
22
|
-
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
23
|
-
+ `# Preserve FFmpegKit JNI entry points and callbacks.${newline}`
|
|
24
|
-
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = { syncFfmpegJniRules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// FFmpegKit's JNI library looks up these Java members by name at runtime.
|
|
5
|
+
const FFMPEG_JNI_RULES = [
|
|
6
|
+
'-keep class com.antonkarpenko.ffmpegkit.** { *; }',
|
|
7
|
+
'-keep interface com.antonkarpenko.ffmpegkit.** { *; }',
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
function syncFfmpegJniRules(projectRoot) {
|
|
11
|
+
const pluginPath = path.join(projectRoot, 'node_modules', 'codeplay-fmpg', 'plugin.xml');
|
|
12
|
+
const appPath = path.join(projectRoot, 'android', 'app');
|
|
13
|
+
if (!fs.existsSync(pluginPath) || !fs.existsSync(appPath)) return false;
|
|
14
|
+
|
|
15
|
+
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
16
|
+
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
17
|
+
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
18
|
+
const missing = FFMPEG_JNI_RULES.filter(rule => !existing.has(rule));
|
|
19
|
+
if (!missing.length) return false;
|
|
20
|
+
|
|
21
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
22
|
+
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
23
|
+
+ `# Preserve FFmpegKit JNI entry points and callbacks.${newline}`
|
|
24
|
+
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { syncFfmpegJniRules };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Restore native metadata before Gradle configures an optimized Android build.
|
|
2
|
-
def codeplayAppRoot = rootProject.projectDir.parentFile
|
|
3
|
-
def codeplayRepairScript = new File(codeplayAppRoot, 'buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs')
|
|
4
|
-
def codeplayNodeBinary = project.findProperty('codeplayNodeBinary') ?: 'node'
|
|
5
|
-
|
|
6
|
-
providers.exec {
|
|
7
|
-
workingDir codeplayAppRoot
|
|
8
|
-
commandLine codeplayNodeBinary, codeplayRepairScript.absolutePath
|
|
9
|
-
}.result.get().assertNormalExitValue()
|
|
1
|
+
// Restore native metadata before Gradle configures an optimized Android build.
|
|
2
|
+
def codeplayAppRoot = rootProject.projectDir.parentFile
|
|
3
|
+
def codeplayRepairScript = new File(codeplayAppRoot, 'buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs')
|
|
4
|
+
def codeplayNodeBinary = project.findProperty('codeplayNodeBinary') ?: 'node'
|
|
5
|
+
|
|
6
|
+
providers.exec {
|
|
7
|
+
workingDir codeplayAppRoot
|
|
8
|
+
commandLine codeplayNodeBinary, codeplayRepairScript.absolutePath
|
|
9
|
+
}.result.get().assertNormalExitValue()
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { syncFfmpegJniRules } = require('./ffmpeg-jni-rules.cjs');
|
|
4
|
-
const { syncCapacitorPermissionRules } = require('./android-r8-rules.cjs');
|
|
5
|
-
|
|
6
|
-
function syncAndroidR8Rules(projectRoot = path.resolve(__dirname, '../..'), { installGradleHook = false } = {}) {
|
|
7
|
-
const buildPath = path.join(projectRoot, 'android', 'app', 'build.gradle');
|
|
8
|
-
if (!fs.existsSync(buildPath)) return false;
|
|
9
|
-
const capacitorChanged = syncCapacitorPermissionRules(projectRoot);
|
|
10
|
-
const ffmpegChanged = syncFfmpegJniRules(projectRoot);
|
|
11
|
-
let hookChanged = false;
|
|
12
|
-
if (installGradleHook) {
|
|
13
|
-
const original = fs.readFileSync(buildPath, 'utf8');
|
|
14
|
-
const hook = "apply from: '../../buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle'";
|
|
15
|
-
const existingHook = /^[ \t]*apply\s+from:\s*(['"])\.\.\/\.\.\/buildCodeplay\/fix-optimize-builld\/fix-optimize-build\.gradle\1[ \t]*;?[ \t]*$/m;
|
|
16
|
-
if (!existingHook.test(original)) {
|
|
17
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
18
|
-
fs.writeFileSync(buildPath, `${original.trimEnd()}${newline}${newline}${hook}${newline}`, 'utf8');
|
|
19
|
-
hookChanged = true;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return capacitorChanged || ffmpegChanged || hookChanged;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (require.main === module) {
|
|
26
|
-
const changed = syncAndroidR8Rules(undefined, { installGradleHook: process.argv.includes('--install-gradle-hook') });
|
|
27
|
-
console.log(changed ? 'Android R8 keep rules restored.' : 'Android R8 keep rules unchanged; no Android app or rules already present.');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
module.exports = { syncAndroidR8Rules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { syncFfmpegJniRules } = require('./ffmpeg-jni-rules.cjs');
|
|
4
|
+
const { syncCapacitorPermissionRules } = require('./android-r8-rules.cjs');
|
|
5
|
+
|
|
6
|
+
function syncAndroidR8Rules(projectRoot = path.resolve(__dirname, '../..'), { installGradleHook = false } = {}) {
|
|
7
|
+
const buildPath = path.join(projectRoot, 'android', 'app', 'build.gradle');
|
|
8
|
+
if (!fs.existsSync(buildPath)) return false;
|
|
9
|
+
const capacitorChanged = syncCapacitorPermissionRules(projectRoot);
|
|
10
|
+
const ffmpegChanged = syncFfmpegJniRules(projectRoot);
|
|
11
|
+
let hookChanged = false;
|
|
12
|
+
if (installGradleHook) {
|
|
13
|
+
const original = fs.readFileSync(buildPath, 'utf8');
|
|
14
|
+
const hook = "apply from: '../../buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle'";
|
|
15
|
+
const existingHook = /^[ \t]*apply\s+from:\s*(['"])\.\.\/\.\.\/buildCodeplay\/fix-optimize-builld\/fix-optimize-build\.gradle\1[ \t]*;?[ \t]*$/m;
|
|
16
|
+
if (!existingHook.test(original)) {
|
|
17
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
18
|
+
fs.writeFileSync(buildPath, `${original.trimEnd()}${newline}${newline}${hook}${newline}`, 'utf8');
|
|
19
|
+
hookChanged = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return capacitorChanged || ffmpegChanged || hookChanged;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (require.main === module) {
|
|
26
|
+
const changed = syncAndroidR8Rules(undefined, { installGradleHook: process.argv.includes('--install-gradle-hook') });
|
|
27
|
+
console.log(changed ? 'Android R8 keep rules restored.' : 'Android R8 keep rules unchanged; no Android app or rules already present.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { syncAndroidR8Rules };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const replaceEmiPluginCode=()=>
|
|
5
|
-
{
|
|
6
|
-
// path to your .m file
|
|
7
|
-
const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
|
|
8
|
-
const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (fs.existsSync(filePath)) {
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const replaceEmiPluginCode=()=>
|
|
5
|
+
{
|
|
6
|
+
// path to your .m file
|
|
7
|
+
const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
|
|
8
|
+
const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
if (fs.existsSync(filePath)) {
|
|
12
12
|
let fileContent = fs.readFileSync(filePath, 'utf8');
|
|
13
13
|
|
|
14
14
|
// match the hideBannerAd method
|
|
@@ -33,17 +33,17 @@ const replaceEmiPluginCode=()=>
|
|
|
33
33
|
fileContent.slice(match.index + match[0].length);
|
|
34
34
|
|
|
35
35
|
fs.writeFileSync(filePath, updatedFileContent, 'utf8');
|
|
36
|
-
console.log(
|
|
37
|
-
'✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
|
|
38
|
-
);
|
|
39
|
-
} else {
|
|
40
|
-
console.log('⚠️ hideBannerAd method not found.');
|
|
41
|
-
}
|
|
42
|
-
} else if (fs.existsSync(nextGenPackagePath)) {
|
|
43
|
-
console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
|
|
44
|
-
} else {
|
|
45
|
-
console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
replaceEmiPluginCode();
|
|
36
|
+
console.log(
|
|
37
|
+
'✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
|
|
38
|
+
);
|
|
39
|
+
} else {
|
|
40
|
+
console.log('⚠️ hideBannerAd method not found.');
|
|
41
|
+
}
|
|
42
|
+
} else if (fs.existsSync(nextGenPackagePath)) {
|
|
43
|
+
console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
|
|
44
|
+
} else {
|
|
45
|
+
console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
replaceEmiPluginCode();
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
|
|
2
|
-
|
|
3
|
-
1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
|
|
4
|
-
// iOS Checks
|
|
5
|
-
/* if (isMac && !iosImportFound) {
|
|
6
|
-
console.warn(`⚠️ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
|
|
7
|
-
process.exit(1);
|
|
8
|
-
} else if (isMac && iosImportFound) {
|
|
9
|
-
console.log('✅ iOS version detected for macOS build.');
|
|
10
|
-
} else if (!iosImportFound) {
|
|
11
|
-
console.log('✅ No iOS-specific imports detected for non-macOS.');
|
|
12
|
-
} */
|
|
13
|
-
|
|
14
|
-
// ✅ Only care if iOS import is found in NON-mac systems
|
|
15
|
-
if (iosImportFound && !isMac) {
|
|
16
|
-
console.error(`\n❌ ERROR: iOS-specific file is imported in non-macOS environment.`);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
} else if (iosImportFound && isMac) {
|
|
19
|
-
console.log('✅ iOS import detected (valid for macOS build).');
|
|
20
|
-
} else {
|
|
21
|
-
console.log('✅ No iOS-specific imports found (this is totally fine).');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
2) Statusbar color set in app startup is checked and through erro
|
|
26
|
-
|
|
27
|
-
const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
|
|
28
|
-
const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const ONESIGNAL_OLD_FILES = [
|
|
32
|
-
path.resolve(__dirname, '../src/js/onesignal-settings.js')
|
|
33
|
-
];
|
|
34
|
-
const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
|
|
35
|
-
|
|
36
|
-
....
|
|
37
|
-
....
|
|
38
|
-
....
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const JS_ROOT = path.resolve(__dirname, '../src/js');
|
|
42
|
-
const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
|
|
43
|
-
|
|
44
|
-
// 🚨 Block old OneSignal file locations (ONLY in src/js root)
|
|
45
|
-
if (path.dirname(dir) === JS_ROOT) {
|
|
46
|
-
|
|
47
|
-
// ❌ onesignal-settings.js
|
|
48
|
-
if (ONESIGNAL_OLD_FILES.includes(dir)) {
|
|
49
|
-
console.error(`\n❌ ERROR: onesignal-settings.js should not be in src/js/`);
|
|
50
|
-
console.error(`📁 Move it to: src/js/onesignal/`);
|
|
51
|
-
console.error(`📄 File: ${dir}\n`);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ❌ onesignal-x.x.js
|
|
56
|
-
if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
|
|
57
|
-
console.error(`\n❌ ERROR: ${baseName} should not be in src/js/`);
|
|
58
|
-
console.error(`📁 Move it to: src/js/onesignal/`);
|
|
59
|
-
console.error(`📄 File: ${dir}\n`);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 🚨 Special check ONLY for common-configuration.js
|
|
65
|
-
if (dir === STATUSBAR_FILE) {
|
|
66
|
-
let content = fs.readFileSync(dir, 'utf8');
|
|
67
|
-
|
|
68
|
-
// 🧹 Remove ALL comments (single-line + multi-line)
|
|
69
|
-
const contentWithoutComments = content
|
|
70
|
-
.replace(/\/\/.*$/gm, '') // remove // comments
|
|
71
|
-
.replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
|
|
72
|
-
|
|
73
|
-
// ✅ Now check only real code
|
|
74
|
-
if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
|
|
75
|
-
console.error(`\n❌ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
|
|
76
|
-
console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
|
|
77
|
-
console.error(`📄 File: ${dir}\n`);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
3) Modification in "fix-onesignal-plugin.js" file
|
|
84
|
-
Search following and that whole block added for add permission to "info.plist" file
|
|
85
|
-
INFO.PLIST START
|
|
86
|
-
|
|
87
|
-
4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
|
|
88
|
-
updateInfoPlist()
|
|
89
|
-
|
|
1
|
+
Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
|
|
2
|
+
|
|
3
|
+
1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
|
|
4
|
+
// iOS Checks
|
|
5
|
+
/* if (isMac && !iosImportFound) {
|
|
6
|
+
console.warn(`⚠️ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
} else if (isMac && iosImportFound) {
|
|
9
|
+
console.log('✅ iOS version detected for macOS build.');
|
|
10
|
+
} else if (!iosImportFound) {
|
|
11
|
+
console.log('✅ No iOS-specific imports detected for non-macOS.');
|
|
12
|
+
} */
|
|
13
|
+
|
|
14
|
+
// ✅ Only care if iOS import is found in NON-mac systems
|
|
15
|
+
if (iosImportFound && !isMac) {
|
|
16
|
+
console.error(`\n❌ ERROR: iOS-specific file is imported in non-macOS environment.`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
} else if (iosImportFound && isMac) {
|
|
19
|
+
console.log('✅ iOS import detected (valid for macOS build).');
|
|
20
|
+
} else {
|
|
21
|
+
console.log('✅ No iOS-specific imports found (this is totally fine).');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
2) Statusbar color set in app startup is checked and through erro
|
|
26
|
+
|
|
27
|
+
const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
|
|
28
|
+
const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const ONESIGNAL_OLD_FILES = [
|
|
32
|
+
path.resolve(__dirname, '../src/js/onesignal-settings.js')
|
|
33
|
+
];
|
|
34
|
+
const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
|
|
35
|
+
|
|
36
|
+
....
|
|
37
|
+
....
|
|
38
|
+
....
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const JS_ROOT = path.resolve(__dirname, '../src/js');
|
|
42
|
+
const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
|
|
43
|
+
|
|
44
|
+
// 🚨 Block old OneSignal file locations (ONLY in src/js root)
|
|
45
|
+
if (path.dirname(dir) === JS_ROOT) {
|
|
46
|
+
|
|
47
|
+
// ❌ onesignal-settings.js
|
|
48
|
+
if (ONESIGNAL_OLD_FILES.includes(dir)) {
|
|
49
|
+
console.error(`\n❌ ERROR: onesignal-settings.js should not be in src/js/`);
|
|
50
|
+
console.error(`📁 Move it to: src/js/onesignal/`);
|
|
51
|
+
console.error(`📄 File: ${dir}\n`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ❌ onesignal-x.x.js
|
|
56
|
+
if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
|
|
57
|
+
console.error(`\n❌ ERROR: ${baseName} should not be in src/js/`);
|
|
58
|
+
console.error(`📁 Move it to: src/js/onesignal/`);
|
|
59
|
+
console.error(`📄 File: ${dir}\n`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 🚨 Special check ONLY for common-configuration.js
|
|
65
|
+
if (dir === STATUSBAR_FILE) {
|
|
66
|
+
let content = fs.readFileSync(dir, 'utf8');
|
|
67
|
+
|
|
68
|
+
// 🧹 Remove ALL comments (single-line + multi-line)
|
|
69
|
+
const contentWithoutComments = content
|
|
70
|
+
.replace(/\/\/.*$/gm, '') // remove // comments
|
|
71
|
+
.replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
|
|
72
|
+
|
|
73
|
+
// ✅ Now check only real code
|
|
74
|
+
if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
|
|
75
|
+
console.error(`\n❌ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
|
|
76
|
+
console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
|
|
77
|
+
console.error(`📄 File: ${dir}\n`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
3) Modification in "fix-onesignal-plugin.js" file
|
|
84
|
+
Search following and that whole block added for add permission to "info.plist" file
|
|
85
|
+
INFO.PLIST START
|
|
86
|
+
|
|
87
|
+
4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
|
|
88
|
+
updateInfoPlist()
|
|
89
|
+
|
|
90
90
|
5) The "checkPackageVersion()" metod is updated. Now check the "codeplay-common" latest version and uninstall/install automatically.
|
|
@@ -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,46 +1,46 @@
|
|
|
1
|
-
const { execFileSync, spawnSync } = require('child_process');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { syncGeneratedProfileBackup } = require('./setup-baseline-profile.js');
|
|
4
|
-
|
|
5
|
-
function main() {
|
|
6
|
-
const devices = execFileSync('adb', ['devices'], { encoding: 'utf8' })
|
|
7
|
-
.split(/\r?\n/)
|
|
8
|
-
.map(line => line.match(/^(.+?)\tdevice\s*$/))
|
|
9
|
-
.filter(Boolean)
|
|
10
|
-
.map(match => match[1]);
|
|
11
|
-
const requestedSerial = process.env.ANDROID_SERIAL?.trim();
|
|
12
|
-
if (requestedSerial?.includes(',')) {
|
|
13
|
-
throw new Error('Set ANDROID_SERIAL to one device connection for Baseline Profile generation.');
|
|
14
|
-
}
|
|
15
|
-
const serial = requestedSerial || devices[0];
|
|
16
|
-
if (!serial || !devices.includes(serial)) {
|
|
17
|
-
throw new Error(requestedSerial
|
|
18
|
-
? `ADB device is not online: ${requestedSerial}`
|
|
19
|
-
: 'No online ADB device. Connect an Android device before generating a Baseline Profile.');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
console.log(`Generating Baseline Profile using one ADB connection: ${serial}`);
|
|
23
|
-
const args = [':app:generateBaselineProfile', '--console=plain'];
|
|
24
|
-
const result = spawnSync(
|
|
25
|
-
process.platform === 'win32' ? 'cmd.exe' : './gradlew',
|
|
26
|
-
process.platform === 'win32' ? ['/d', '/s', '/c', `gradlew.bat ${args.join(' ')}`] : args,
|
|
27
|
-
{
|
|
28
|
-
cwd: path.resolve(__dirname, '..', 'android'),
|
|
29
|
-
env: { ...process.env, ANDROID_SERIAL: serial },
|
|
30
|
-
stdio: 'inherit',
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
if (result.error) throw result.error;
|
|
34
|
-
if (result.signal) throw new Error(`Baseline Profile generation stopped by ${result.signal}.`);
|
|
35
|
-
process.exitCode = result.status ?? 1;
|
|
36
|
-
if (process.exitCode === 0) {
|
|
37
|
-
syncGeneratedProfileBackup({ backupOnly: true });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
main();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error(`Baseline Profile generation failed: ${error.message}`);
|
|
45
|
-
process.exitCode = 1;
|
|
46
|
-
}
|
|
1
|
+
const { execFileSync, spawnSync } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { syncGeneratedProfileBackup } = require('./setup-baseline-profile.js');
|
|
4
|
+
|
|
5
|
+
function main() {
|
|
6
|
+
const devices = execFileSync('adb', ['devices'], { encoding: 'utf8' })
|
|
7
|
+
.split(/\r?\n/)
|
|
8
|
+
.map(line => line.match(/^(.+?)\tdevice\s*$/))
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.map(match => match[1]);
|
|
11
|
+
const requestedSerial = process.env.ANDROID_SERIAL?.trim();
|
|
12
|
+
if (requestedSerial?.includes(',')) {
|
|
13
|
+
throw new Error('Set ANDROID_SERIAL to one device connection for Baseline Profile generation.');
|
|
14
|
+
}
|
|
15
|
+
const serial = requestedSerial || devices[0];
|
|
16
|
+
if (!serial || !devices.includes(serial)) {
|
|
17
|
+
throw new Error(requestedSerial
|
|
18
|
+
? `ADB device is not online: ${requestedSerial}`
|
|
19
|
+
: 'No online ADB device. Connect an Android device before generating a Baseline Profile.');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
console.log(`Generating Baseline Profile using one ADB connection: ${serial}`);
|
|
23
|
+
const args = [':app:generateBaselineProfile', '--console=plain'];
|
|
24
|
+
const result = spawnSync(
|
|
25
|
+
process.platform === 'win32' ? 'cmd.exe' : './gradlew',
|
|
26
|
+
process.platform === 'win32' ? ['/d', '/s', '/c', `gradlew.bat ${args.join(' ')}`] : args,
|
|
27
|
+
{
|
|
28
|
+
cwd: path.resolve(__dirname, '..', 'android'),
|
|
29
|
+
env: { ...process.env, ANDROID_SERIAL: serial },
|
|
30
|
+
stdio: 'inherit',
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
if (result.error) throw result.error;
|
|
34
|
+
if (result.signal) throw new Error(`Baseline Profile generation stopped by ${result.signal}.`);
|
|
35
|
+
process.exitCode = result.status ?? 1;
|
|
36
|
+
if (process.exitCode === 0) {
|
|
37
|
+
syncGeneratedProfileBackup({ backupOnly: true });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
main();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(`Baseline Profile generation failed: ${error.message}`);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const { test } = require('node:test');
|
|
2
|
+
const assert = require('node:assert/strict');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { ensureCurrentBuild } = require('../files/buildCodeplay/ensure-current-build.cjs');
|
|
7
|
+
const { removeVersionedBuildScripts } = require('../files/buildCodeplay/project-scripts.cjs');
|
|
8
|
+
|
|
9
|
+
function fixture(t, names = []) {
|
|
10
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'codeplay-legacy-build-'));
|
|
11
|
+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
12
|
+
fs.mkdirSync(path.join(root, 'buildCodeplay'));
|
|
13
|
+
for (const name of ['codeplayBeforeBuild.js', ...names]) fs.writeFileSync(path.join(root, 'buildCodeplay', name), '');
|
|
14
|
+
return root;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test('current structure continues without npm commands', t => {
|
|
18
|
+
const projectRoot = fixture(t, ['versions.json', 'custom-helper.js']);
|
|
19
|
+
assert.equal(ensureCurrentBuild({ projectRoot, runNpm: () => assert.fail('unexpected npm command') }), false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('legacy files force ordered reinstall and fresh preparation before continuing', t => {
|
|
23
|
+
const projectRoot = fixture(t, ['codeplayBeforeBuild-6.7.js', 'setSplashAnimation-1.2.mjs']);
|
|
24
|
+
const calls = [];
|
|
25
|
+
assert.equal(ensureCurrentBuild({
|
|
26
|
+
projectRoot,
|
|
27
|
+
runNpm(command) {
|
|
28
|
+
calls.push(command);
|
|
29
|
+
if (command === 'npm install codeplay-common') removeVersionedBuildScripts(projectRoot);
|
|
30
|
+
},
|
|
31
|
+
runBeforeBuild(script) {
|
|
32
|
+
assert.equal(script, path.join(projectRoot, 'buildCodeplay', 'codeplayBeforeBuild.js'));
|
|
33
|
+
calls.push('fresh preparation');
|
|
34
|
+
},
|
|
35
|
+
}), true);
|
|
36
|
+
assert.deepEqual(calls, ['npm uninstall codeplay-common', 'npm install codeplay-common', 'fresh preparation']);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
for (const failedCommand of ['npm uninstall codeplay-common', 'npm install codeplay-common']) {
|
|
40
|
+
test(`failure of ${failedCommand} stops preparation`, t => {
|
|
41
|
+
const projectRoot = fixture(t, ['add-splash-screen-1.0.js']);
|
|
42
|
+
const calls = [];
|
|
43
|
+
assert.throws(() => ensureCurrentBuild({
|
|
44
|
+
projectRoot,
|
|
45
|
+
runNpm(command) {
|
|
46
|
+
calls.push(command);
|
|
47
|
+
if (command === failedCommand) throw new Error('npm failed');
|
|
48
|
+
},
|
|
49
|
+
runBeforeBuild: () => assert.fail('must not continue'),
|
|
50
|
+
}), /npm failed/);
|
|
51
|
+
assert.equal(calls.at(-1), failedCommand);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
test('unknown versioned files trigger reinstall but stop without deleting app files or looping', t => {
|
|
56
|
+
const projectRoot = fixture(t, ['custom-helper-1.0.js']);
|
|
57
|
+
const calls = [];
|
|
58
|
+
assert.throws(() => ensureCurrentBuild({
|
|
59
|
+
projectRoot,
|
|
60
|
+
runNpm: command => calls.push(command),
|
|
61
|
+
runBeforeBuild: () => assert.fail('must not continue'),
|
|
62
|
+
}), /Legacy buildCodeplay files remain/);
|
|
63
|
+
assert.deepEqual(calls, ['npm uninstall codeplay-common', 'npm install codeplay-common']);
|
|
64
|
+
assert.ok(fs.existsSync(path.join(projectRoot, 'buildCodeplay', 'custom-helper-1.0.js')));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('failed refreshed preparation propagates to stop the build', t => {
|
|
68
|
+
const projectRoot = fixture(t, ['packageidBaseModification-1.0.js']);
|
|
69
|
+
assert.throws(() => ensureCurrentBuild({
|
|
70
|
+
projectRoot,
|
|
71
|
+
runNpm(command) {
|
|
72
|
+
if (command === 'npm install codeplay-common') removeVersionedBuildScripts(projectRoot);
|
|
73
|
+
},
|
|
74
|
+
runBeforeBuild() { throw Object.assign(new Error('preparation failed'), { status: 7 }); },
|
|
75
|
+
}), { message: 'preparation failed', status: 7 });
|
|
76
|
+
});
|