@callstack/react-native-brownfield 6.0.1 → 6.1.1
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 +30 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt +12 -12
- package/android/src/main/java/com/callstack/reactnativebrownfield/RetryableOnce.kt +27 -0
- package/android/src/test/java/com/callstack/reactnativebrownfield/RetryableOnceTest.kt +37 -0
- package/gradle-plugin/brownfield/build.gradle.kts +4 -0
- package/gradle-plugin/brownfield/gradle/libs.versions.toml +2 -0
- package/gradle-plugin/brownfield/gradle.properties +1 -1
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNBrownfieldPlugin.kt +24 -7
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt +4 -37
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/JNILibsProcessor.kt +206 -104
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/ResourceTaskProcessor.kt +201 -4
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/VariantHelper.kt +7 -0
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/VariantTaskProvider.kt +4 -0
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/shared/GradleExclude.kt +31 -0
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/shared/MergeClassesTask.kt +2 -0
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/shared/PublishingMetadataInjector.kt +28 -3
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/utils/Extension.kt +14 -1
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/utils/TaskOutputs.kt +40 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/AgpCompatibilityMatrixTest.kt +14 -6
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/HardExcludePredicateTest.kt +28 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/ConfigureProcessJniTaskTest.kt +60 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/CopyExplodedResTaskTest.kt +368 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/JniLibsPlanTest.kt +252 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/MergeClassesLocalJarsTest.kt +73 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/MetroResDirWiringTest.kt +39 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/processors/ProcessAndCopyJniLibsTaskTest.kt +136 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/shared/GradleExcludesTest.kt +81 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/shared/PublishingMetadataInjectorTest.kt +56 -0
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/utils/ExtensionTest.kt +5 -0
- package/ios/ReactNativeBrownfield.swift +3 -1
- package/ios/ReactNativeBrownfieldModule.mm +35 -7
- package/lib/commonjs/expo-config-plugin/android/utils/constants.js +1 -1
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/scaffold/index.js +1 -1
- package/lib/commonjs/scaffold/index.js.map +1 -1
- package/lib/module/expo-config-plugin/android/utils/constants.js +1 -1
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
- package/lib/module/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/scaffold/index.js +1 -1
- package/lib/module/scaffold/index.js.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +6 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/scaffold/index.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/android/utils/constants.d.ts +2 -2
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +6 -0
- package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/scaffold/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/expo-config-plugin/android/utils/constants.ts +1 -1
- package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +42 -0
- package/src/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.ts +7 -0
- package/src/index.ts +4 -2
- package/src/scaffold/index.ts +1 -0
|
@@ -40,6 +40,43 @@ function renderMissingDimensionStrategyBlock(
|
|
|
40
40
|
return ` missingDimensionStrategy(${args})`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const COORDINATE_PART = /^[A-Za-z0-9._-]+$/;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Renders `excludeDependencies` as a `configurations.all` block. The Brownfield Gradle plugin
|
|
47
|
+
* leaves anything excluded this way out of the published POM and module.json. Entries become
|
|
48
|
+
* Kotlin string literals, so anything but a plain coordinate is rejected.
|
|
49
|
+
*/
|
|
50
|
+
function renderExcludeDependenciesBlock(excludeDependencies: string[]): string {
|
|
51
|
+
// It comes from user JSON, so the type isn't guaranteed.
|
|
52
|
+
if (!Array.isArray(excludeDependencies)) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
'android.excludeDependencies must be a list of "group:module" or "group" strings.'
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (excludeDependencies.length === 0) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const lines = excludeDependencies.map((entry) => {
|
|
62
|
+
const parts = entry.split(':');
|
|
63
|
+
if (
|
|
64
|
+
parts.length > 2 ||
|
|
65
|
+
!parts.every((part) => COORDINATE_PART.test(part))
|
|
66
|
+
) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`android.excludeDependencies: '${entry}' is not in the form "group:module" or "group".`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const [group, module] = parts;
|
|
72
|
+
return module
|
|
73
|
+
? ` exclude(group = "${group}", module = "${module}")`
|
|
74
|
+
: ` exclude(group = "${group}")`;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return `configurations.all {\n${lines.join('\n')}\n}\n\n`;
|
|
78
|
+
}
|
|
79
|
+
|
|
43
80
|
export function resolveCompileSdkVersionExpression(
|
|
44
81
|
config: ResolvedBrownfieldPluginConfigWithAndroid
|
|
45
82
|
): string {
|
|
@@ -154,6 +191,10 @@ export function createAndroidModule({
|
|
|
154
191
|
android.missingDimensionStrategies
|
|
155
192
|
);
|
|
156
193
|
|
|
194
|
+
const excludeDependenciesBlock = renderExcludeDependenciesBlock(
|
|
195
|
+
android.excludeDependencies
|
|
196
|
+
);
|
|
197
|
+
|
|
157
198
|
// generate module files
|
|
158
199
|
const files: RenderedTemplateFile[] = [
|
|
159
200
|
{
|
|
@@ -171,6 +212,7 @@ export function createAndroidModule({
|
|
|
171
212
|
'{{IS_MINIFY_ENABLED}}': minifyEnabled.toString(),
|
|
172
213
|
'{{MISSING_DIMENSION_STRATEGIES}}': missingDimensionStrategiesList,
|
|
173
214
|
'{{MISSING_DIMENSION_STRATEGY_BLOCK}}': missingDimensionStrategyBlock,
|
|
215
|
+
'{{EXCLUDE_DEPENDENCIES_BLOCK}}': excludeDependenciesBlock,
|
|
174
216
|
}),
|
|
175
217
|
},
|
|
176
218
|
{
|
|
@@ -69,6 +69,13 @@ export interface BrownfieldPluginAndroidConfig {
|
|
|
69
69
|
* @default []
|
|
70
70
|
*/
|
|
71
71
|
missingDimensionStrategies?: string[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Dependencies to keep out of the published AAR's POM and module.json, as
|
|
75
|
+
* "group:module" or "group" for a whole group, e.g. "com.caverock:androidsvg".
|
|
76
|
+
* @default []
|
|
77
|
+
*/
|
|
78
|
+
excludeDependencies?: string[];
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
/**
|
package/src/index.ts
CHANGED
|
@@ -96,11 +96,13 @@ const ReactNativeBrownfield = {
|
|
|
96
96
|
): { remove: () => void } => {
|
|
97
97
|
const subscription = ReactNativeBrownfieldModule.onBrownfieldMessage(
|
|
98
98
|
(payload) => {
|
|
99
|
+
let data: unknown;
|
|
99
100
|
try {
|
|
100
|
-
|
|
101
|
+
data = JSON.parse(payload.text);
|
|
101
102
|
} catch {
|
|
102
|
-
|
|
103
|
+
data = payload.text;
|
|
103
104
|
}
|
|
105
|
+
callback({ data });
|
|
104
106
|
}
|
|
105
107
|
);
|
|
106
108
|
return { remove: () => subscription.remove() };
|
package/src/scaffold/index.ts
CHANGED