1
1
const assert = require ( 'assert' ) ;
2
- const { withAppBuildGradle } = require ( 'expo/config-plugins' ) ;
2
+ const {
3
+ withAppBuildGradle,
4
+ withProjectBuildGradle,
5
+ } = require ( 'expo/config-plugins' ) ;
3
6
4
7
const withJscAndroidAppBuildGradle = ( config ) => {
5
8
return withAppBuildGradle ( config , ( config ) => {
@@ -13,7 +16,7 @@ const withJscAndroidAppBuildGradle = (config) => {
13
16
// [begin] @generated withJscAndroidAppBuildGradle
14
17
afterEvaluate {
15
18
project.rootProject.allprojects {
16
- // Remove original mavenCentral
19
+ // Remove original mavenCentral added by RNGP
17
20
repositories.removeIf { repo ->
18
21
repo instanceof MavenArtifactRepository && repo.url.toString().contains('https://repo.maven.apache.org/maven2')
19
22
}
@@ -48,8 +51,28 @@ afterEvaluate {
48
51
} ) ;
49
52
} ;
50
53
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 + ) ( m a v e n C e n t r a l \( \) ) ( \s * ) $ / gm,
67
+ code
68
+ ) ;
69
+ return config ;
70
+ } ) ;
71
+ } ;
72
+
51
73
const withJscAndroid = ( config ) => {
52
74
config = withJscAndroidAppBuildGradle ( config ) ;
75
+ config = withJscAndroidProjectBuildGradle ( config ) ;
53
76
return config ;
54
77
} ;
55
78
0 commit comments