11const assert = require ( 'assert' ) ;
2- const { withAppBuildGradle } = require ( 'expo/config-plugins' ) ;
2+ const {
3+ withAppBuildGradle,
4+ withProjectBuildGradle,
5+ } = require ( 'expo/config-plugins' ) ;
36
47const withJscAndroidAppBuildGradle = ( config ) => {
58 return withAppBuildGradle ( config , ( config ) => {
@@ -13,7 +16,7 @@ const withJscAndroidAppBuildGradle = (config) => {
1316// [begin] @generated withJscAndroidAppBuildGradle
1417afterEvaluate {
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 + ) ( m a v e n C e n t r a l \( \) ) ( \s * ) $ / gm,
67+ code
68+ ) ;
69+ return config ;
70+ } ) ;
71+ } ;
72+
5173const withJscAndroid = ( config ) => {
5274 config = withJscAndroidAppBuildGradle ( config ) ;
75+ config = withJscAndroidProjectBuildGradle ( config ) ;
5376 return config ;
5477} ;
5578
0 commit comments