From 287824564c66a3da9a977670a51f982de88ecaa8 Mon Sep 17 00:00:00 2001 From: mmuller Date: Wed, 13 Feb 2019 10:16:05 -0800 Subject: [PATCH] Fix overrides of plugin repository The correct way to override the plugins repo is through the pluginManagement section in the gradle settings file. Also make use of the gradle.properties file to initialize repositoryUrl and also publishUrl so we don't have to mess around with finding and assigning them in the main gradle file. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=233778270 --- gradle/build.gradle | 22 ++++------------------ gradle/gradle.properties | 2 ++ gradle/settings.gradle | 13 +++++++++++++ 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 gradle/gradle.properties diff --git a/gradle/build.gradle b/gradle/build.gradle index c60ea9ce1..343a25bcb 100644 --- a/gradle/build.gradle +++ b/gradle/build.gradle @@ -1,18 +1,4 @@ buildscript { - ext.repositoryUrl = project.findProperty('repositoryUrl') - ext.publishUrl = project.findProperty('publishUrl') - repositories { - if (repositoryUrl == null) { - println "Using Maven central..." - mavenCentral() - } else { - maven { - println "Using GCS Maven repo..." - url repositoryUrl - } - } - } - // Lock buildscript dependencies. configurations.classpath { resolutionStrategy.activateDependencyLocking() @@ -71,7 +57,7 @@ task stage { } -if (publishUrl != null) { +if (publishUrl) { publishing { repositories { maven { @@ -129,12 +115,12 @@ allprojects { if (project.name == 'services') return repositories { - if (rootProject.repositoryUrl == null) { - mavenCentral() - } else { + if (rootProject.repositoryUrl) { maven { url rootProject.repositoryUrl } + } else { + mavenCentral() } } diff --git a/gradle/gradle.properties b/gradle/gradle.properties new file mode 100644 index 000000000..8035c0843 --- /dev/null +++ b/gradle/gradle.properties @@ -0,0 +1,2 @@ +repositoryUrl= +publishUrl= diff --git a/gradle/settings.gradle b/gradle/settings.gradle index 30879379f..cb3438ba0 100644 --- a/gradle/settings.gradle +++ b/gradle/settings.gradle @@ -1,3 +1,16 @@ +if (repositoryUrl) { + println "Using repository $repositoryUrl for plugins" + pluginManagement { + repositories { + maven { + url repositoryUrl + } + } + } +} else { + println "Using default repository for plugins" +} + rootProject.name = 'nomulus' include 'core'