Fix dependency resolution on EAS Build by injecting JCenter and JitPack to settings.gradle
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const { withSettingsGradle } = require('@expo/config-plugins');
|
||||
|
||||
const withSettingsRepositories = (config) => {
|
||||
return withSettingsGradle(config, (config) => {
|
||||
let contents = config.modResults.contents;
|
||||
|
||||
// Append dependencyResolutionManagement block at the end of settings.gradle
|
||||
// to add repositories at settings level. This is required because EAS Build
|
||||
// uses PREFER_SETTINGS repositories mode, which ignores project-level repositories.
|
||||
const reposBlock = `
|
||||
// Added by withSettingsRepositories plugin
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://jcenter.bintray.com' }
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
if (!contents.includes('https://jcenter.bintray.com')) {
|
||||
contents += reposBlock;
|
||||
}
|
||||
|
||||
config.modResults.contents = contents;
|
||||
return config;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = withSettingsRepositories;
|
||||
Reference in New Issue
Block a user