@callstack/react-native-brownfield 3.13.1 → 3.14.0

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 (98) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/ReactBrownfield.podspec +1 -1
  3. package/app.plugin.js +1 -0
  4. package/gradle-plugin/brownfield/gradle.properties +1 -1
  5. package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/ProjectConfigurations.kt +3 -2
  6. package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt +11 -4
  7. package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/VariantTaskProvider.kt +4 -3
  8. package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/utils/Utils.kt +14 -0
  9. package/lib/commonjs/expo-config-plugin/android/utils/constants.js +1 -1
  10. package/lib/commonjs/expo-config-plugin/android/utils/gradleHelpers.js +1 -1
  11. package/lib/commonjs/expo-config-plugin/android/utils/gradleHelpers.js.map +1 -1
  12. package/lib/commonjs/expo-config-plugin/android/utils/hermes.js +1 -1
  13. package/lib/commonjs/expo-config-plugin/android/utils/hermes.js.map +1 -1
  14. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  15. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  16. package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js +1 -1
  17. package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -1
  18. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +4 -2
  19. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  20. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  21. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  22. package/lib/commonjs/expo-config-plugin/ios/withFmtFix.js +4 -2
  23. package/lib/commonjs/expo-config-plugin/ios/withFmtFix.js.map +1 -1
  24. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  25. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  26. package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +19 -1
  27. package/lib/commonjs/expo-config-plugin/withBrownfield.js +1 -1
  28. package/lib/commonjs/expo-config-plugin/withBrownfield.js.map +1 -1
  29. package/lib/module/expo-config-plugin/android/utils/constants.js +1 -1
  30. package/lib/module/expo-config-plugin/android/utils/gradleHelpers.js +1 -1
  31. package/lib/module/expo-config-plugin/android/utils/gradleHelpers.js.map +1 -1
  32. package/lib/module/expo-config-plugin/android/utils/hermes.js +1 -1
  33. package/lib/module/expo-config-plugin/android/utils/hermes.js.map +1 -1
  34. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  35. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  36. package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js +1 -1
  37. package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -1
  38. package/lib/module/expo-config-plugin/ios/podfileHelpers.js +4 -2
  39. package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  40. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  41. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  42. package/lib/module/expo-config-plugin/ios/withFmtFix.js +4 -2
  43. package/lib/module/expo-config-plugin/ios/withFmtFix.js.map +1 -1
  44. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  45. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  46. package/lib/module/expo-config-plugin/template/android/build.gradle.kts +19 -1
  47. package/lib/module/expo-config-plugin/withBrownfield.js +1 -1
  48. package/lib/module/expo-config-plugin/withBrownfield.js.map +1 -1
  49. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
  50. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/gradleHelpers.d.ts +6 -2
  51. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/gradleHelpers.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts +3 -1
  53. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +2 -0
  55. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withFmtFix.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -0
  61. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +9 -3
  63. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
  64. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +2 -2
  65. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/src/expo-config-plugin/withBrownfield.d.ts.map +1 -1
  67. package/lib/typescript/module/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
  68. package/lib/typescript/module/src/expo-config-plugin/android/utils/gradleHelpers.d.ts +6 -2
  69. package/lib/typescript/module/src/expo-config-plugin/android/utils/gradleHelpers.d.ts.map +1 -1
  70. package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts +3 -1
  71. package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -1
  72. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +2 -0
  73. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  74. package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -1
  75. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  76. package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  77. package/lib/typescript/module/src/expo-config-plugin/ios/withFmtFix.d.ts.map +1 -1
  78. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -0
  79. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  80. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +9 -3
  81. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
  82. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +2 -2
  83. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -1
  84. package/lib/typescript/module/src/expo-config-plugin/withBrownfield.d.ts.map +1 -1
  85. package/package.json +5 -4
  86. package/src/expo-config-plugin/android/utils/constants.ts +1 -1
  87. package/src/expo-config-plugin/android/utils/gradleHelpers.ts +56 -5
  88. package/src/expo-config-plugin/android/utils/hermes.ts +82 -7
  89. package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +26 -2
  90. package/src/expo-config-plugin/android/withBrownfieldAndroid.ts +4 -2
  91. package/src/expo-config-plugin/ios/podfileHelpers.ts +11 -2
  92. package/src/expo-config-plugin/ios/withBrownfieldIos.ts +9 -2
  93. package/src/expo-config-plugin/ios/withFmtFix.ts +47 -17
  94. package/src/expo-config-plugin/ios/xcodeHelpers.ts +62 -1
  95. package/src/expo-config-plugin/template/android/build.gradle.kts +19 -1
  96. package/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.ts +13 -4
  97. package/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.ts +5 -3
  98. package/src/expo-config-plugin/withBrownfield.ts +15 -45
@@ -186,7 +186,9 @@ export type PbxReferenceLike = { value?: string; comment?: string } | string;
186
186
 
187
187
  export type PbxNativeTarget = {
188
188
  buildPhases?: PbxReferenceLike[];
189
+ buildConfigurationList?: string;
189
190
  name?: string;
191
+ productReference?: string;
190
192
  };
191
193
 
192
194
  export type PbxResourcesBuildPhase = {
@@ -428,7 +430,7 @@ export function getFrameworkBuildSettings(
428
430
 
429
431
  // basic settings
430
432
  PRODUCT_BUNDLE_IDENTIFIER: `"${bundleIdentifier}"`,
431
- IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
433
+ IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget ?? '15.0',
432
434
 
433
435
  // Ensure the BrownfieldLib (or equivalent name) is installed at the correct path
434
436
  DYLIB_INSTALL_NAME_BASE: '"@rpath"',
@@ -681,6 +683,65 @@ function resolveAppTargetName(
681
683
  return null;
682
684
  }
683
685
 
686
+ function normalizeXcodeBuildSettingValue(
687
+ value: string | number | boolean | null | undefined
688
+ ): string | null {
689
+ if (value == null) {
690
+ return null;
691
+ }
692
+
693
+ const normalized = IOSConfig.XcodeUtils.unquote(String(value)).trim();
694
+ return normalized.length > 0 ? normalized : null;
695
+ }
696
+
697
+ export function getAppTargetDeploymentTarget(
698
+ project: Pick<XcodeProject, 'getBuildProperty'>,
699
+ appTargetName: string | null
700
+ ): string | null {
701
+ if (!appTargetName) {
702
+ return null;
703
+ }
704
+
705
+ return (
706
+ normalizeXcodeBuildSettingValue(
707
+ project.getBuildProperty(
708
+ 'IPHONEOS_DEPLOYMENT_TARGET',
709
+ 'Release',
710
+ appTargetName
711
+ )
712
+ ) ??
713
+ normalizeXcodeBuildSettingValue(
714
+ project.getBuildProperty(
715
+ 'IPHONEOS_DEPLOYMENT_TARGET',
716
+ 'Debug',
717
+ appTargetName
718
+ )
719
+ )
720
+ );
721
+ }
722
+
723
+ export function resolveFrameworkDeploymentTarget(
724
+ project: XcodeProject,
725
+ modRequest: ModProps<XcodeProject>,
726
+ {
727
+ fallbackDeploymentTarget,
728
+ }: {
729
+ fallbackDeploymentTarget?: string;
730
+ }
731
+ ): string {
732
+ if (fallbackDeploymentTarget != null) {
733
+ return fallbackDeploymentTarget;
734
+ }
735
+
736
+ const appTargetName = resolveAppTargetName(project, modRequest);
737
+ const appTargetDeploymentTarget = getAppTargetDeploymentTarget(
738
+ project,
739
+ appTargetName
740
+ );
741
+
742
+ return appTargetDeploymentTarget ?? '15.0';
743
+ }
744
+
684
745
  /**
685
746
  * Adds the "Patch ExpoModulesProvider" shell script phase to the framework target.
686
747
  * Safe to call on every prebuild: skips creation when the phase is already present.
@@ -1,4 +1,3 @@
1
- import groovy.json.JsonOutput
2
1
  import groovy.json.JsonSlurper
3
2
 
4
3
  plugins {
@@ -9,6 +8,24 @@ plugins {
9
8
  id("com.facebook.react")
10
9
  }
11
10
 
11
+ fun resolveRootProjectInt(name: String): Int {
12
+ val extraProperties = rootProject.extensions.extraProperties
13
+ val value =
14
+ when {
15
+ extraProperties.has(name) -> extraProperties.get(name)
16
+ rootProject.findProperty(name) != null -> rootProject.findProperty(name)
17
+ rootProject.findProperty("android.$name") != null -> rootProject.findProperty("android.$name")
18
+ else -> error("Unable to resolve root project property '$name' for Brownfield Android packaging.")
19
+ }
20
+
21
+ return when (value) {
22
+ is Int -> value
23
+ is Number -> value.toInt()
24
+ is String -> value.toInt()
25
+ else -> value.toString().toInt()
26
+ }
27
+ }
28
+
12
29
  publishing {
13
30
  publications {
14
31
  create<MavenPublication>("mavenAar") {
@@ -36,6 +53,7 @@ android {
36
53
 
37
54
  defaultConfig {
38
55
  minSdk = {{MIN_SDK_VERSION}}
56
+ targetSdk = {{TARGET_SDK_VERSION}}
39
57
 
40
58
  buildConfigField(
41
59
  "boolean",
@@ -22,13 +22,13 @@ export interface BrownfieldPluginAndroidConfig {
22
22
 
23
23
  /**
24
24
  * Target SDK version for the Android library
25
- * @default 35
25
+ * @default inherited from the generated Expo app project when available
26
26
  */
27
27
  targetSdkVersion?: number;
28
28
 
29
29
  /**
30
30
  * Compile SDK version for the Android library
31
- * @default 35
31
+ * @default inherited from the generated Expo app project when available
32
32
  */
33
33
  compileSdkVersion?: number;
34
34
 
@@ -49,10 +49,19 @@ export interface BrownfieldPluginAndroidConfig {
49
49
  * @default "0.0.1-SNAPSHOT"
50
50
  */
51
51
  version?: string;
52
+
53
+ /**
54
+ * Load the Brownfield Gradle plugin from node_modules via includeBuild
55
+ * instead of the Maven classpath dependency.
56
+ * @default false
57
+ */
58
+ useLocalGradlePlugin?: boolean;
52
59
  }
53
60
 
54
61
  /**
55
62
  * Android configuration with resolved defaults (all fields required)
56
63
  */
57
- export type ResolvedBrownfieldPluginAndroidConfig =
58
- Required<BrownfieldPluginAndroidConfig>;
64
+ export type ResolvedBrownfieldPluginAndroidConfig = Required<
65
+ Omit<BrownfieldPluginAndroidConfig, 'compileSdkVersion' | 'targetSdkVersion'>
66
+ > &
67
+ Pick<BrownfieldPluginAndroidConfig, 'compileSdkVersion' | 'targetSdkVersion'>;
@@ -22,7 +22,7 @@ export interface BrownfieldPluginIosConfig {
22
22
 
23
23
  /**
24
24
  * Minimum iOS deployment target
25
- * @default "15.0"
25
+ * @default inherited from the generated Expo app target when available
26
26
  */
27
27
  deploymentTarget?: string;
28
28
 
@@ -37,5 +37,7 @@ export interface BrownfieldPluginIosConfig {
37
37
  /**
38
38
  * iOS configuration with resolved defaults (all fields required)
39
39
  */
40
- export type ResolvedBrownfieldPluginIosConfig =
41
- Required<BrownfieldPluginIosConfig>;
40
+ export type ResolvedBrownfieldPluginIosConfig = Required<
41
+ Omit<BrownfieldPluginIosConfig, 'deploymentTarget'>
42
+ > &
43
+ Pick<BrownfieldPluginIosConfig, 'deploymentTarget'>;
@@ -4,7 +4,12 @@ import {
4
4
  type ConfigPlugin,
5
5
  type StaticPlugin,
6
6
  } from '@expo/config-plugins';
7
- import type { ExpoConfig } from '@expo/config-types';
7
+
8
+ import {
9
+ assertNoConfigFilePluginOverlap,
10
+ loadBrownfieldConfig,
11
+ resolveBrownfieldPluginConfig,
12
+ } from '@callstack/brownfield-cli/expo-plugin-config';
8
13
 
9
14
  import { withBrownfieldIos } from './ios/withBrownfieldIos';
10
15
  import { withBrownfieldAndroid } from './android/withBrownfieldAndroid';
@@ -15,49 +20,6 @@ import type {
15
20
 
16
21
  import { Logger } from './logging';
17
22
 
18
- /**
19
- * Resolves the plugin configuration using provided config and config defaults.
20
- * @param config The user-provided Brownfield configuration.
21
- * @param expoConfig The Expo configuration object.
22
- * @returns The resolved Brownfield configuration.
23
- */
24
- function resolveConfig(
25
- config: BrownfieldPluginConfig = {},
26
- expoConfig: ExpoConfig
27
- ): ResolvedBrownfieldPluginConfig {
28
- Logger.setIsDebug(config.debug ?? false);
29
-
30
- const androidPackage = expoConfig.android?.package;
31
- const androidModuleName = config.android?.moduleName ?? 'brownfieldlib';
32
-
33
- return {
34
- ios: expoConfig.ios
35
- ? {
36
- frameworkName: config.ios?.frameworkName ?? 'BrownfieldLib',
37
- bundleIdentifier:
38
- config.ios?.bundleIdentifier ??
39
- `${expoConfig.ios.bundleIdentifier}.brownfield`,
40
- buildSettings: config.ios?.buildSettings ?? {},
41
- deploymentTarget: config.ios?.deploymentTarget ?? '15.0',
42
- frameworkVersion: config.ios?.frameworkVersion ?? '1',
43
- }
44
- : null,
45
- android: androidPackage
46
- ? {
47
- moduleName: androidModuleName,
48
- packageName: config.android?.packageName ?? androidPackage,
49
- minSdkVersion: config.android?.minSdkVersion ?? 24,
50
- targetSdkVersion: config.android?.targetSdkVersion ?? 35,
51
- compileSdkVersion: config.android?.compileSdkVersion ?? 35,
52
- groupId: config.android?.groupId ?? androidPackage,
53
- artifactId: config.android?.artifactId ?? androidModuleName,
54
- version: config.android?.version ?? '0.0.1-SNAPSHOT',
55
- }
56
- : null,
57
- debug: config.debug ?? false,
58
- };
59
- }
60
-
61
23
  /**
62
24
  * React Native Brownfield - Expo Config Plugin.
63
25
  *
@@ -90,7 +52,15 @@ const withBrownfield: ConfigPlugin<BrownfieldPluginConfig | void> = (
90
52
  config,
91
53
  props = {}
92
54
  ) => {
93
- const resolvedConfig = resolveConfig(props ?? {}, config);
55
+ const pluginProps = props ?? {};
56
+ const fileConfig = loadBrownfieldConfig();
57
+
58
+ assertNoConfigFilePluginOverlap(fileConfig, pluginProps);
59
+
60
+ const resolvedConfig: ResolvedBrownfieldPluginConfig =
61
+ resolveBrownfieldPluginConfig(pluginProps, fileConfig, config);
62
+
63
+ Logger.setIsDebug(resolvedConfig.debug);
94
64
 
95
65
  const plugins: (ConfigPlugin | StaticPlugin)[] = [];
96
66