@rock-js/platform-android 0.8.13

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.
Files changed (128) hide show
  1. package/README.md +7 -0
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +4 -0
  5. package/dist/src/index.js.map +1 -0
  6. package/dist/src/lib/commands/aar/packageAar.d.ts +14 -0
  7. package/dist/src/lib/commands/aar/packageAar.d.ts.map +1 -0
  8. package/dist/src/lib/commands/aar/packageAar.js +34 -0
  9. package/dist/src/lib/commands/aar/packageAar.js.map +1 -0
  10. package/dist/src/lib/commands/aar/publishLocalAar.d.ts +6 -0
  11. package/dist/src/lib/commands/aar/publishLocalAar.d.ts.map +1 -0
  12. package/dist/src/lib/commands/aar/publishLocalAar.js +17 -0
  13. package/dist/src/lib/commands/aar/publishLocalAar.js.map +1 -0
  14. package/dist/src/lib/commands/buildAndroid/buildAndroid.d.ts +21 -0
  15. package/dist/src/lib/commands/buildAndroid/buildAndroid.d.ts.map +1 -0
  16. package/dist/src/lib/commands/buildAndroid/buildAndroid.js +68 -0
  17. package/dist/src/lib/commands/buildAndroid/buildAndroid.js.map +1 -0
  18. package/dist/src/lib/commands/buildAndroid/command.d.ts +3 -0
  19. package/dist/src/lib/commands/buildAndroid/command.d.ts.map +1 -0
  20. package/dist/src/lib/commands/buildAndroid/command.js +14 -0
  21. package/dist/src/lib/commands/buildAndroid/command.js.map +1 -0
  22. package/dist/src/lib/commands/generateKeystore.d.ts +13 -0
  23. package/dist/src/lib/commands/generateKeystore.d.ts.map +1 -0
  24. package/dist/src/lib/commands/generateKeystore.js +80 -0
  25. package/dist/src/lib/commands/generateKeystore.js.map +1 -0
  26. package/dist/src/lib/commands/getValidProjectConfig.d.ts +2 -0
  27. package/dist/src/lib/commands/getValidProjectConfig.d.ts.map +1 -0
  28. package/dist/src/lib/commands/getValidProjectConfig.js +10 -0
  29. package/dist/src/lib/commands/getValidProjectConfig.js.map +1 -0
  30. package/dist/src/lib/commands/runAndroid/adb.d.ts +5 -0
  31. package/dist/src/lib/commands/runAndroid/adb.d.ts.map +1 -0
  32. package/dist/src/lib/commands/runAndroid/adb.js +38 -0
  33. package/dist/src/lib/commands/runAndroid/adb.js.map +1 -0
  34. package/dist/src/lib/commands/runAndroid/command.d.ts +3 -0
  35. package/dist/src/lib/commands/runAndroid/command.d.ts.map +1 -0
  36. package/dist/src/lib/commands/runAndroid/command.js +15 -0
  37. package/dist/src/lib/commands/runAndroid/command.js.map +1 -0
  38. package/dist/src/lib/commands/runAndroid/findOutputFile.d.ts +2 -0
  39. package/dist/src/lib/commands/runAndroid/findOutputFile.d.ts.map +1 -0
  40. package/dist/src/lib/commands/runAndroid/findOutputFile.js +67 -0
  41. package/dist/src/lib/commands/runAndroid/findOutputFile.js.map +1 -0
  42. package/dist/src/lib/commands/runAndroid/listAndroidDevices.d.ts +7 -0
  43. package/dist/src/lib/commands/runAndroid/listAndroidDevices.d.ts.map +1 -0
  44. package/dist/src/lib/commands/runAndroid/listAndroidDevices.js +69 -0
  45. package/dist/src/lib/commands/runAndroid/listAndroidDevices.js.map +1 -0
  46. package/dist/src/lib/commands/runAndroid/listAndroidUsers.d.ts +7 -0
  47. package/dist/src/lib/commands/runAndroid/listAndroidUsers.d.ts.map +1 -0
  48. package/dist/src/lib/commands/runAndroid/listAndroidUsers.js +42 -0
  49. package/dist/src/lib/commands/runAndroid/listAndroidUsers.js.map +1 -0
  50. package/dist/src/lib/commands/runAndroid/runAndroid.d.ts +31 -0
  51. package/dist/src/lib/commands/runAndroid/runAndroid.d.ts.map +1 -0
  52. package/dist/src/lib/commands/runAndroid/runAndroid.js +178 -0
  53. package/dist/src/lib/commands/runAndroid/runAndroid.js.map +1 -0
  54. package/dist/src/lib/commands/runAndroid/tryInstallAppOnDevice.d.ts +3 -0
  55. package/dist/src/lib/commands/runAndroid/tryInstallAppOnDevice.d.ts.map +1 -0
  56. package/dist/src/lib/commands/runAndroid/tryInstallAppOnDevice.js +63 -0
  57. package/dist/src/lib/commands/runAndroid/tryInstallAppOnDevice.js.map +1 -0
  58. package/dist/src/lib/commands/runAndroid/tryLaunchAppOnDevice.d.ts +7 -0
  59. package/dist/src/lib/commands/runAndroid/tryLaunchAppOnDevice.d.ts.map +1 -0
  60. package/dist/src/lib/commands/runAndroid/tryLaunchAppOnDevice.js +51 -0
  61. package/dist/src/lib/commands/runAndroid/tryLaunchAppOnDevice.js.map +1 -0
  62. package/dist/src/lib/commands/runAndroid/tryLaunchEmulator.d.ts +2 -0
  63. package/dist/src/lib/commands/runAndroid/tryLaunchEmulator.d.ts.map +1 -0
  64. package/dist/src/lib/commands/runAndroid/tryLaunchEmulator.js +120 -0
  65. package/dist/src/lib/commands/runAndroid/tryLaunchEmulator.js.map +1 -0
  66. package/dist/src/lib/commands/runAndroid/tryRunAdbReverse.d.ts +1 -0
  67. package/dist/src/lib/commands/runAndroid/tryRunAdbReverse.d.ts.map +1 -0
  68. package/dist/src/lib/commands/runAndroid/tryRunAdbReverse.js +21 -0
  69. package/dist/src/lib/commands/runAndroid/tryRunAdbReverse.js.map +1 -0
  70. package/dist/src/lib/commands/runGradle.d.ts +18 -0
  71. package/dist/src/lib/commands/runGradle.d.ts.map +1 -0
  72. package/dist/src/lib/commands/runGradle.js +124 -0
  73. package/dist/src/lib/commands/runGradle.js.map +1 -0
  74. package/dist/src/lib/commands/signAndroid/bundle.d.ts +8 -0
  75. package/dist/src/lib/commands/signAndroid/bundle.d.ts.map +1 -0
  76. package/dist/src/lib/commands/signAndroid/bundle.js +58 -0
  77. package/dist/src/lib/commands/signAndroid/bundle.js.map +1 -0
  78. package/dist/src/lib/commands/signAndroid/command.d.ts +14 -0
  79. package/dist/src/lib/commands/signAndroid/command.d.ts.map +1 -0
  80. package/dist/src/lib/commands/signAndroid/command.js +67 -0
  81. package/dist/src/lib/commands/signAndroid/command.js.map +1 -0
  82. package/dist/src/lib/commands/signAndroid/signAndroid.d.ts +12 -0
  83. package/dist/src/lib/commands/signAndroid/signAndroid.d.ts.map +1 -0
  84. package/dist/src/lib/commands/signAndroid/signAndroid.js +163 -0
  85. package/dist/src/lib/commands/signAndroid/signAndroid.js.map +1 -0
  86. package/dist/src/lib/commands/toPascalCase.d.ts +1 -0
  87. package/dist/src/lib/commands/toPascalCase.d.ts.map +1 -0
  88. package/dist/src/lib/commands/toPascalCase.js +4 -0
  89. package/dist/src/lib/commands/toPascalCase.js.map +1 -0
  90. package/dist/src/lib/paths.d.ts +7 -0
  91. package/dist/src/lib/paths.d.ts.map +1 -0
  92. package/dist/src/lib/paths.js +60 -0
  93. package/dist/src/lib/paths.js.map +1 -0
  94. package/dist/src/lib/platformAndroid.d.ts +5 -0
  95. package/dist/src/lib/platformAndroid.d.ts.map +1 -0
  96. package/dist/src/lib/platformAndroid.js +23 -0
  97. package/dist/src/lib/platformAndroid.js.map +1 -0
  98. package/package.json +35 -0
  99. package/react-native.config.ts +13 -0
  100. package/template/.github/workflows/remote-build-android.yml +64 -0
  101. package/template/android/app/build.gradle +127 -0
  102. package/template/android/app/debug.keystore +0 -0
  103. package/template/android/app/proguard-rules.pro +10 -0
  104. package/template/android/app/src/debug/AndroidManifest.xml +9 -0
  105. package/template/android/app/src/main/AndroidManifest.xml +26 -0
  106. package/template/android/app/src/main/java/com/helloworld/MainActivity.kt +22 -0
  107. package/template/android/app/src/main/java/com/helloworld/MainApplication.kt +38 -0
  108. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  109. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  110. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  111. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  112. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  113. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  114. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  115. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  116. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  117. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  118. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  119. package/template/android/app/src/main/res/values/strings.xml +3 -0
  120. package/template/android/app/src/main/res/values/styles.xml +9 -0
  121. package/template/android/build.gradle +21 -0
  122. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  123. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  124. package/template/android/gradle.properties +46 -0
  125. package/template/android/gradlew +251 -0
  126. package/template/android/gradlew.bat +99 -0
  127. package/template/android/settings.gradle +6 -0
  128. package/template/package.json +9 -0
@@ -0,0 +1,60 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ export function getAndroidSdkPath() {
4
+ const sdkRoot = process.env['ANDROID_HOME'] || process.env['ANDROID_SDK_ROOT'];
5
+ if (!sdkRoot) {
6
+ throw new Error('ANDROID_HOME or ANDROID_SDK_ROOT environment variable is not set. Please follow instructions at: https://reactnative.dev/docs/set-up-your-environment?platform=android');
7
+ }
8
+ return sdkRoot;
9
+ }
10
+ export function getAndroidBuildToolsPath() {
11
+ return path.join(getAndroidSdkPath(), 'build-tools');
12
+ }
13
+ /**
14
+ * Build tools are located in the <sdk-root>/build-tools/<version>/ directory.
15
+ */
16
+ export function findAndroidBuildTool(toolName) {
17
+ const buildToolsPath = path.join(getAndroidBuildToolsPath());
18
+ const versions = fs
19
+ .readdirSync(buildToolsPath, { withFileTypes: true })
20
+ .filter((entry) => entry.isDirectory())
21
+ .map((entry) => entry.name)
22
+ .sort(versionCompare)
23
+ .reverse();
24
+ for (const version of versions) {
25
+ const toolPath = path.join(buildToolsPath, version, toolName);
26
+ if (fs.existsSync(toolPath)) {
27
+ return toolPath;
28
+ }
29
+ }
30
+ return null;
31
+ }
32
+ export function versionCompare(first, second) {
33
+ const firstVersion = parseVersionString(first);
34
+ const secondVersion = parseVersionString(second);
35
+ if (!firstVersion || !secondVersion) {
36
+ return first.localeCompare(second);
37
+ }
38
+ if (firstVersion.major !== secondVersion.major) {
39
+ return firstVersion.major - secondVersion.major;
40
+ }
41
+ if (firstVersion.minor !== secondVersion.minor) {
42
+ return firstVersion.minor - secondVersion.minor;
43
+ }
44
+ return firstVersion.patch - secondVersion.patch;
45
+ }
46
+ function parseVersionString(version) {
47
+ if (!isVersionString(version)) {
48
+ return null;
49
+ }
50
+ const [major, minor, patch] = version.split('.').map(Number);
51
+ return {
52
+ major: Number(major),
53
+ minor: Number(minor),
54
+ patch: Number(patch),
55
+ };
56
+ }
57
+ function isVersionString(version) {
58
+ return /^[0-9]+\.[0-9]+\.[0-9]+$/.test(version);
59
+ }
60
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/lib/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,wKAAwK,CACzK,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,aAAa,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,EAAE;SAChB,WAAW,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACpD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC1B,IAAI,CAAC,cAAc,CAAC;SACpB,OAAO,EAAE,CAAC;IAEb,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAc;IAC1D,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,CAAC,YAAY,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,YAAY,CAAC,KAAK,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;QAC/C,OAAO,YAAY,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;IAClD,CAAC;IACD,IAAI,YAAY,CAAC,KAAK,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;QAC/C,OAAO,YAAY,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;IAClD,CAAC;IAED,OAAO,YAAY,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;AAClD,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;KACrB,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { AndroidProjectConfig } from '@react-native-community/cli-types';
2
+ import type { PlatformOutput, PluginApi } from '@rock-js/config';
3
+ type PluginConfig = AndroidProjectConfig;
4
+ export declare const platformAndroid: (pluginConfig?: Partial<PluginConfig>) => (api: PluginApi) => PlatformOutput;
5
+ export default platformAndroid;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformAndroid.d.ts","sourceRoot":"","sources":["../../../src/lib/platformAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO9D,KAAK,YAAY,GAAG,oBAAoB,CAAC;AAEzC,eAAO,MAAM,eAAe,kBACV,YAAY,WACtB,SAAS,KAAG,cAmBjB,CAAC;AAEJ,eAAe,eAAe,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { registerBuildCommand } from './commands/buildAndroid/command.js';
2
+ import { registerCreateKeystoreCommand } from './commands/generateKeystore.js';
3
+ import { getValidProjectConfig } from './commands/getValidProjectConfig.js';
4
+ import { registerRunCommand } from './commands/runAndroid/command.js';
5
+ import { registerSignCommand } from './commands/signAndroid/command.js';
6
+ export const platformAndroid = (pluginConfig) => (api) => {
7
+ registerBuildCommand(api, pluginConfig);
8
+ registerRunCommand(api, pluginConfig);
9
+ registerCreateKeystoreCommand(api, pluginConfig);
10
+ registerSignCommand(api);
11
+ return {
12
+ name: '@rock-js/platform-android',
13
+ description: 'Rock plugin for everything Android.',
14
+ autolinkingConfig: {
15
+ get project() {
16
+ const androidConfig = getValidProjectConfig(api.getProjectRoot(), pluginConfig);
17
+ return { ...androidConfig };
18
+ },
19
+ },
20
+ };
21
+ };
22
+ export default platformAndroid;
23
+ //# sourceMappingURL=platformAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformAndroid.js","sourceRoot":"","sources":["../../../src/lib/platformAndroid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAIxE,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAC,YAAoC,EAAE,EAAE,CACzC,CAAC,GAAc,EAAkB,EAAE;IACjC,oBAAoB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACxC,kBAAkB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACtC,6BAA6B,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACjD,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAEzB,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,qCAAqC;QAClD,iBAAiB,EAAE;YACjB,IAAI,OAAO;gBACT,MAAM,aAAa,GAAG,qBAAqB,CACzC,GAAG,CAAC,cAAc,EAAE,EACpB,YAAY,CACb,CAAC;gBACF,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC;YAC9B,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,eAAe,eAAe,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@rock-js/platform-android",
3
+ "version": "0.8.13",
4
+ "type": "module",
5
+ "types": "./dist/src/index.d.ts",
6
+ "exports": {
7
+ "types": "./dist/src/index.d.ts",
8
+ "default": "./dist/src/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "template",
13
+ "react-native.config.ts"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc -p tsconfig.lib.json",
17
+ "dev": "tsc -p tsconfig.lib.json --watch",
18
+ "publish:npm": "npm publish --access public",
19
+ "publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc"
20
+ },
21
+ "dependencies": {
22
+ "@react-native-community/cli-config-android": "^19.1.0",
23
+ "@rock-js/tools": "^0.8.13",
24
+ "adm-zip": "^0.5.16",
25
+ "tslib": "^2.3.0"
26
+ },
27
+ "devDependencies": {
28
+ "@react-native-community/cli-types": "^19.1.0",
29
+ "@rock-js/config": "^0.8.13",
30
+ "@types/adm-zip": "^0.5.7"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
@@ -0,0 +1,13 @@
1
+ import {
2
+ dependencyConfig,
3
+ projectConfig,
4
+ } from '@react-native-community/cli-config-android';
5
+
6
+ export default {
7
+ platforms: {
8
+ android: {
9
+ projectConfig,
10
+ dependencyConfig,
11
+ },
12
+ },
13
+ };
@@ -0,0 +1,64 @@
1
+ name: Remote Build Android
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ concurrency:
12
+ group: remote-build-android-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ build-release:
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
+
23
+ - name: Setup Node
24
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
25
+ with:
26
+ node-version: '20'
27
+ cache: 'npm'
28
+
29
+ - name: Install dependencies
30
+ run: npm install
31
+
32
+ - name: Rock Remote Build - Android device
33
+ uses: callstackincubator/android@v2
34
+ with:
35
+ sign: true
36
+ variant: release
37
+ github-token: ${{ secrets.GITHUB_TOKEN }}
38
+ keystore-base64: ${{ secrets.KEYSTORE_BASE64 }}
39
+ keystore-store-file: ${{ secrets.ROCK_UPLOAD_STORE_FILE }}
40
+ keystore-store-password: ${{ secrets.ROCK_UPLOAD_STORE_PASSWORD }}
41
+ keystore-key-alias: ${{ secrets.ROCK_UPLOAD_KEY_ALIAS }}
42
+ keystore-key-password: ${{ secrets.ROCK_UPLOAD_KEY_PASSWORD }}
43
+
44
+ build-debug:
45
+ runs-on: ubuntu-latest
46
+
47
+ steps:
48
+ - name: Checkout repository
49
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50
+
51
+ - name: Setup Node
52
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
53
+ with:
54
+ node-version: '20'
55
+ cache: 'npm'
56
+
57
+ - name: Install dependencies
58
+ run: npm install
59
+
60
+ - name: Rock Remote Build - Android
61
+ uses: callstackincubator/android@v2
62
+ with:
63
+ variant: debug
64
+ github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,127 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
+ // reactNativeDir = file("../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
+ // codegenDir = file("../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
+ cliFile = file("../../node_modules/rock/dist/src/bin.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
56
+
57
+ /**
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
+ */
60
+ def enableProguardInReleaseBuilds = true
61
+
62
+ /**
63
+ * The preferred build flavor of JavaScriptCore (JSC)
64
+ *
65
+ * For example, to use the international variant, you can use:
66
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
67
+ *
68
+ * The international variant includes ICU i18n library and necessary data
69
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
+ * give correct results when using with locales other than en-US. Note that
71
+ * this variant is about 6MiB larger per architecture than default.
72
+ */
73
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
74
+
75
+ android {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
79
+
80
+ namespace "com.helloworld"
81
+ defaultConfig {
82
+ applicationId "com.helloworld"
83
+ minSdkVersion rootProject.ext.minSdkVersion
84
+ targetSdkVersion rootProject.ext.targetSdkVersion
85
+ versionCode 1
86
+ versionName "1.0"
87
+ }
88
+ signingConfigs {
89
+ debug {
90
+ storeFile file('debug.keystore')
91
+ storePassword 'android'
92
+ keyAlias 'androiddebugkey'
93
+ keyPassword 'android'
94
+ }
95
+ release {
96
+ if (project.hasProperty('ROCK_UPLOAD_STORE_FILE')) {
97
+ storeFile file(ROCK_UPLOAD_STORE_FILE)
98
+ storePassword ROCK_UPLOAD_STORE_PASSWORD
99
+ keyAlias ROCK_UPLOAD_KEY_ALIAS
100
+ keyPassword ROCK_UPLOAD_KEY_PASSWORD
101
+ }
102
+ }
103
+ }
104
+ buildTypes {
105
+ debug {
106
+ signingConfig signingConfigs.debug
107
+ }
108
+ release {
109
+ // Caution! In production, you need to generate your own keystore file.
110
+ // see https://reactnative.dev/docs/signed-apk-android.
111
+ signingConfig signingConfigs.release
112
+ minifyEnabled enableProguardInReleaseBuilds
113
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
114
+ }
115
+ }
116
+ }
117
+
118
+ dependencies {
119
+ // The version of react-native is set by the React Native Gradle Plugin
120
+ implementation("com.facebook.react:react-android")
121
+
122
+ if (hermesEnabled.toBoolean()) {
123
+ implementation("com.facebook.react:hermes-android")
124
+ } else {
125
+ implementation jscFlavor
126
+ }
127
+ }
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <application
6
+ android:usesCleartextTraffic="true"
7
+ tools:targetApi="28"
8
+ tools:ignore="GoogleAppIndexingWarning"/>
9
+ </manifest>
@@ -0,0 +1,26 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:theme="@style/AppTheme"
12
+ android:supportsRtl="true">
13
+ <activity
14
+ android:name=".MainActivity"
15
+ android:label="@string/app_name"
16
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
17
+ android:launchMode="singleTask"
18
+ android:windowSoftInputMode="adjustResize"
19
+ android:exported="true">
20
+ <intent-filter>
21
+ <action android:name="android.intent.action.MAIN" />
22
+ <category android:name="android.intent.category.LAUNCHER" />
23
+ </intent-filter>
24
+ </activity>
25
+ </application>
26
+ </manifest>
@@ -0,0 +1,22 @@
1
+ package com.helloworld
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "HelloWorld"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,38 @@
1
+ package com.helloworld
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
8
+ import com.facebook.react.ReactNativeHost
9
+ import com.facebook.react.ReactPackage
10
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
+ import com.facebook.react.defaults.DefaultReactNativeHost
12
+
13
+ class MainApplication : Application(), ReactApplication {
14
+
15
+ override val reactNativeHost: ReactNativeHost =
16
+ object : DefaultReactNativeHost(this) {
17
+ override fun getPackages(): List<ReactPackage> =
18
+ PackageList(this).packages.apply {
19
+ // Packages that cannot be autolinked yet can be added manually here, for example:
20
+ // add(MyReactNativePackage())
21
+ }
22
+
23
+ override fun getJSMainModuleName(): String = "index"
24
+
25
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
26
+
27
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
28
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
29
+ }
30
+
31
+ override val reactHost: ReactHost
32
+ get() = getDefaultReactHost(applicationContext, reactNativeHost)
33
+
34
+ override fun onCreate() {
35
+ super.onCreate()
36
+ loadReactNative(this)
37
+ }
38
+ }
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
21
+ >
22
+
23
+ <selector>
24
+ <!--
25
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
26
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
27
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
28
+
29
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
30
+
31
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
32
+ -->
33
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
34
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
35
+ </selector>
36
+
37
+ </inset>
@@ -0,0 +1,3 @@
1
+ <resources>
2
+ <string name="app_name">HelloWorld</string>
3
+ </resources>
@@ -0,0 +1,9 @@
1
+ <resources>
2
+
3
+ <!-- Base application theme. -->
4
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5
+ <!-- Customize your theme here. -->
6
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7
+ </style>
8
+
9
+ </resources>
@@ -0,0 +1,21 @@
1
+ buildscript {
2
+ ext {
3
+ buildToolsVersion = "35.0.0"
4
+ minSdkVersion = 24
5
+ compileSdkVersion = 35
6
+ targetSdkVersion = 35
7
+ ndkVersion = "27.1.12297006"
8
+ kotlinVersion = "2.1.20"
9
+ }
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ dependencies {
15
+ classpath("com.android.tools.build:gradle")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18
+ }
19
+ }
20
+
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,46 @@
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13
+ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14
+
15
+ # When configured, Gradle will run in incubating parallel mode.
16
+ # This option should only be used with decoupled projects. More details, visit
17
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+ # org.gradle.parallel=true
19
+
20
+ # AndroidX package structure to make it clearer which packages are bundled with the
21
+ # Android operating system, and which are packaged with your app's APK
22
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
23
+ android.useAndroidX=true
24
+
25
+ # Use this property to specify which architecture you want to build.
26
+ # You can also override it from the CLI using
27
+ # ./gradlew <task> -PreactNativeArchitectures=x86_64
28
+ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
29
+
30
+ # Use this property to enable support to the new architecture.
31
+ # This will allow you to use TurboModules and the Fabric render in
32
+ # your application. You should enable this flag either if you want
33
+ # to write custom TurboModules/Fabric components OR use libraries that
34
+ # are providing them.
35
+ newArchEnabled=true
36
+
37
+ # Use this property to enable or disable the Hermes JS engine.
38
+ # If set to false, you will be using JSC instead.
39
+ hermesEnabled=true
40
+
41
+ # Signing configuration – adjust the values and ideally
42
+ # move the following code to ~/.gradle/gradle.properties to keep it secure
43
+ ROCK_UPLOAD_STORE_FILE=release.keystore
44
+ ROCK_UPLOAD_KEY_ALIAS=rock-alias
45
+ ROCK_UPLOAD_STORE_PASSWORD=fake-pass
46
+ ROCK_UPLOAD_KEY_PASSWORD=fake-pass