@callstack/react-native-brownfield 3.13.2 → 3.15.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 (73) hide show
  1. package/CHANGELOG.md +22 -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 +0 -1
  7. package/lib/commonjs/expo-config-plugin/android/utils/constants.js +1 -1
  8. package/lib/commonjs/expo-config-plugin/android/utils/hermes.js +1 -1
  9. package/lib/commonjs/expo-config-plugin/android/utils/hermes.js.map +1 -1
  10. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  11. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  12. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +4 -2
  13. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  14. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  15. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  16. package/lib/commonjs/expo-config-plugin/ios/withFmtFix.js +4 -2
  17. package/lib/commonjs/expo-config-plugin/ios/withFmtFix.js.map +1 -1
  18. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  19. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  20. package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +19 -1
  21. package/lib/module/expo-config-plugin/android/utils/constants.js +1 -1
  22. package/lib/module/expo-config-plugin/android/utils/hermes.js +1 -1
  23. package/lib/module/expo-config-plugin/android/utils/hermes.js.map +1 -1
  24. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  25. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  26. package/lib/module/expo-config-plugin/ios/podfileHelpers.js +4 -2
  27. package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  28. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  29. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  30. package/lib/module/expo-config-plugin/ios/withFmtFix.js +4 -2
  31. package/lib/module/expo-config-plugin/ios/withFmtFix.js.map +1 -1
  32. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  33. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  34. package/lib/module/expo-config-plugin/template/android/build.gradle.kts +19 -1
  35. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
  36. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts +3 -1
  37. package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +2 -0
  39. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withFmtFix.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -0
  44. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +3 -3
  46. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +2 -2
  48. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -1
  49. package/lib/typescript/module/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
  50. package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts +3 -1
  51. package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -1
  52. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +2 -0
  53. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  54. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  55. package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  56. package/lib/typescript/module/src/expo-config-plugin/ios/withFmtFix.d.ts.map +1 -1
  57. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -0
  58. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  59. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +3 -3
  60. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
  61. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +2 -2
  62. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -1
  63. package/package.json +5 -4
  64. package/src/expo-config-plugin/android/utils/constants.ts +1 -1
  65. package/src/expo-config-plugin/android/utils/hermes.ts +82 -7
  66. package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +26 -2
  67. package/src/expo-config-plugin/ios/podfileHelpers.ts +11 -2
  68. package/src/expo-config-plugin/ios/withBrownfieldIos.ts +9 -2
  69. package/src/expo-config-plugin/ios/withFmtFix.ts +47 -17
  70. package/src/expo-config-plugin/ios/xcodeHelpers.ts +62 -1
  71. package/src/expo-config-plugin/template/android/build.gradle.kts +19 -1
  72. package/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.ts +6 -4
  73. package/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.ts +5 -3
@@ -4,8 +4,27 @@ import type { ResolvedBrownfieldPluginConfigWithIos } from '../types';
4
4
 
5
5
  const FMT_FIX_MARKER =
6
6
  '# Fix fmt 11.0.2 consteval compilation error with Xcode 26.4+';
7
+ const FMT_FIX_MARKER_START = '# >>> react-native-brownfield fmt fix >>>';
8
+ const FMT_FIX_MARKER_END = '# <<< react-native-brownfield fmt fix <<<';
9
+ const LEGACY_FMT_FIX_BLOCK = new RegExp(
10
+ [
11
+ '\\n?\\s*',
12
+ escapeRegExp(FMT_FIX_MARKER),
13
+ "\\n\\s*fmt_base = File\\.join\\(installer\\.sandbox\\.pod_dir\\('fmt'\\), 'include', 'fmt', 'base\\.h'\\)",
14
+ '\\n\\s*if File\\.exist\\?\\(fmt_base\\)',
15
+ '\\n\\s*content = File\\.read\\(fmt_base\\)',
16
+ "\\n\\s*patched = content\\.gsub\\(/\\^#\\\\s\\*define FMT_USE_CONSTEVAL 1\\$/, '# define FMT_USE_CONSTEVAL 0'\\)",
17
+ '\\n\\s*if patched != content',
18
+ '\\n\\s*File\\.chmod\\(0644, fmt_base\\)',
19
+ '\\n\\s*File\\.write\\(fmt_base, patched\\)',
20
+ '\\n\\s*end',
21
+ '\\n\\s*end\\n?',
22
+ ].join(''),
23
+ 'm'
24
+ );
7
25
 
8
26
  const FMT_FIX_RUBY = `\
27
+ ${FMT_FIX_MARKER_START}
9
28
  ${FMT_FIX_MARKER}
10
29
  fmt_base = File.join(installer.sandbox.pod_dir('fmt'), 'include', 'fmt', 'base.h')
11
30
  if File.exist?(fmt_base)
@@ -15,14 +34,30 @@ const FMT_FIX_RUBY = `\
15
34
  File.chmod(0644, fmt_base)
16
35
  File.write(fmt_base, patched)
17
36
  end
18
- end`;
37
+ end
38
+ ${FMT_FIX_MARKER_END}`;
39
+
40
+ function escapeRegExp(value: string): string {
41
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
42
+ }
19
43
 
20
44
  export function injectFmtFixIntoPodfile(podfile: string): string {
21
- if (podfile.includes(FMT_FIX_MARKER)) {
22
- return podfile;
45
+ const withoutLegacyBlock = podfile.replace(LEGACY_FMT_FIX_BLOCK, '\n');
46
+ const existingBlockPattern = new RegExp(
47
+ `\\n?\\s*${escapeRegExp(FMT_FIX_MARKER_START)}[\\s\\S]*?${escapeRegExp(
48
+ FMT_FIX_MARKER_END
49
+ )}\\n?`,
50
+ 'm'
51
+ );
52
+
53
+ if (existingBlockPattern.test(withoutLegacyBlock)) {
54
+ return withoutLegacyBlock.replace(
55
+ existingBlockPattern,
56
+ `\n${FMT_FIX_RUBY}\n`
57
+ );
23
58
  }
24
59
 
25
- const lines = podfile.split('\n');
60
+ const lines = withoutLegacyBlock.split('\n');
26
61
  const postInstallIndex = lines.findIndex((line) =>
27
62
  /^\s*post_install do \|installer\|/.test(line)
28
63
  );
@@ -31,24 +66,19 @@ export function injectFmtFixIntoPodfile(podfile: string): string {
31
66
  return podfile;
32
67
  }
33
68
 
34
- let depth = 0;
69
+ const baseIndent = lines[postInstallIndex].match(/^(\s*)/)?.[1].length ?? 0;
35
70
  let insertionIndex = -1;
36
71
 
37
- for (let index = postInstallIndex; index < lines.length; index += 1) {
38
- const trimmed = lines[index].trim();
39
-
40
- if (trimmed.endsWith(' do |installer|')) {
41
- depth += 1;
72
+ for (let index = postInstallIndex + 1; index < lines.length; index += 1) {
73
+ const endMatch = lines[index].match(/^(\s*)end\s*$/);
74
+ if (!endMatch) {
42
75
  continue;
43
76
  }
44
77
 
45
- if (trimmed === 'end') {
46
- depth -= 1;
47
-
48
- if (depth === 0) {
49
- insertionIndex = index;
50
- break;
51
- }
78
+ const endIndent = endMatch[1].length;
79
+ if (endIndent === baseIndent) {
80
+ insertionIndex = index;
81
+ break;
52
82
  }
53
83
  }
54
84
 
@@ -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
 
@@ -61,5 +61,7 @@ export interface BrownfieldPluginAndroidConfig {
61
61
  /**
62
62
  * Android configuration with resolved defaults (all fields required)
63
63
  */
64
- export type ResolvedBrownfieldPluginAndroidConfig =
65
- 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'>;