Skip to content

Commit 7a8b88c

Browse files
committed
fix
1 parent e0d7b5f commit 7a8b88c

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

test/plugins/withJscAndroid.js

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const assert = require('assert');
2-
const { withAppBuildGradle } = require('expo/config-plugins');
2+
const {
3+
withAppBuildGradle,
4+
withProjectBuildGradle,
5+
} = require('expo/config-plugins');
36

47
const withJscAndroidAppBuildGradle = (config) => {
58
return withAppBuildGradle(config, (config) => {
@@ -13,7 +16,7 @@ const withJscAndroidAppBuildGradle = (config) => {
1316
// [begin] @generated withJscAndroidAppBuildGradle
1417
afterEvaluate {
1518
project.rootProject.allprojects {
16-
// Remove original mavenCentral
19+
// Remove original mavenCentral added by RNGP
1720
repositories.removeIf { repo ->
1821
repo instanceof MavenArtifactRepository && repo.url.toString().contains('https://repo.maven.apache.org/maven2')
1922
}
@@ -48,8 +51,28 @@ afterEvaluate {
4851
});
4952
};
5053

54+
const withJscAndroidProjectBuildGradle = (config) => {
55+
return withProjectBuildGradle(config, (config) => {
56+
assert(config.modResults.language === 'groovy');
57+
const code = `
58+
mavenCentral {
59+
content {
60+
excludeGroup('org.webkit')
61+
excludeGroup('io.github.react-native-community')
62+
}
63+
}
64+
`;
65+
config.modResults.contents = config.modResults.contents.replace(
66+
/^(\s+)(mavenCentral\(\))(\s*)$/gm,
67+
code
68+
);
69+
return config;
70+
});
71+
};
72+
5173
const withJscAndroid = (config) => {
5274
config = withJscAndroidAppBuildGradle(config);
75+
config = withJscAndroidProjectBuildGradle(config);
5376
return config;
5477
};
5578

0 commit comments

Comments
 (0)