mirror of
https://github.com/google/nomulus.git
synced 2025-05-04 22:17:51 +02:00
Convert update_dependency procedure to use gradle proxy
Collect the set of dependencies using the gradle proxy and push to GCS using gcs_sync. TESTED: Verified that the script works against both unupdated and up-to-date dependency sets, verified that the proxy server is destroyed after completion. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241529357
This commit is contained in:
parent
c0f5710c31
commit
5470414e48
7 changed files with 10 additions and 92 deletions
|
@ -13,7 +13,6 @@ buildscript {
|
|||
}
|
||||
|
||||
plugins {
|
||||
id 'maven-publish'
|
||||
id 'nebula.lint' version '10.4.2'
|
||||
// Config helper for annotation processors such as AutoValue and Dagger.
|
||||
// Ensures that source code is generated at an appropriate location.
|
||||
|
@ -73,60 +72,6 @@ task stage {
|
|||
description = 'Generates application directories for all services.'
|
||||
}
|
||||
|
||||
|
||||
if (publishUrl) {
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url publishUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.processedDependencies = [] as Set<String>
|
||||
ext.processDependencies = { Set<ResolvedDependency> deps ->
|
||||
|
||||
if (deps.isEmpty()) {
|
||||
return
|
||||
}
|
||||
deps.each { ResolvedDependency dep ->
|
||||
if (dep.moduleGroup == "nomulus" ||
|
||||
rootProject.processedDependencies.contains(dep.module.toString())) {
|
||||
return
|
||||
}
|
||||
def name = "${dep.moduleGroup}_${dep.moduleName}_${dep.moduleVersion}"
|
||||
rootProject.publishing {
|
||||
publications {
|
||||
"${name}"(MavenPublication) {
|
||||
groupId = dep.moduleGroup
|
||||
artifactId = dep.moduleName
|
||||
version = dep.moduleVersion
|
||||
dep.moduleArtifacts.each { moduleArtifact ->
|
||||
artifact(moduleArtifact.file) {
|
||||
classifier = moduleArtifact.classifier
|
||||
}
|
||||
}
|
||||
if (!dep.children.isEmpty()) {
|
||||
pom.withXml {
|
||||
def dependenciesNode = asNode().appendNode("dependencies")
|
||||
dep.children.each {
|
||||
def dependencyNode =
|
||||
dependenciesNode.appendNode("dependency")
|
||||
dependencyNode.appendNode("groupId", it.moduleGroup)
|
||||
dependencyNode.appendNode("artifactId", it.moduleName)
|
||||
dependencyNode.appendNode("version", it.moduleVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rootProject.processedDependencies.add(dep.module.toString())
|
||||
rootProject.processDependencies(dep.children)
|
||||
}
|
||||
}
|
||||
|
||||
ext.constructMavenCoordinate = { deps, distinctMetadata ->
|
||||
if (deps.isEmpty()) {
|
||||
return
|
||||
|
@ -146,31 +91,15 @@ allprojects {
|
|||
if (project.name == 'services') return
|
||||
|
||||
repositories {
|
||||
if (rootProject.repositoryUrl) {
|
||||
if (rootProject.mavenUrl) {
|
||||
maven {
|
||||
url rootProject.repositoryUrl
|
||||
url rootProject.mavenUrl
|
||||
}
|
||||
} else {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
ext.generateDependencyPublications = {
|
||||
def allconfigs = []
|
||||
|
||||
allconfigs.addAll(configurations)
|
||||
// This only adds buildscript dependencies declare in this project.
|
||||
allconfigs.addAll(buildscript.configurations)
|
||||
|
||||
allconfigs.each {
|
||||
if (!it.isCanBeResolved()) {
|
||||
return
|
||||
}
|
||||
rootProject.processDependencies(
|
||||
it.resolvedConfiguration.firstLevelModuleDependencies)
|
||||
}
|
||||
}
|
||||
|
||||
// This task generates a Maven coordinate for each resolved dependency and
|
||||
// stores them in the given file.
|
||||
task generateMavenCoordinateForDependency {
|
||||
|
@ -218,8 +147,6 @@ subprojects {
|
|||
lockAllConfigurations()
|
||||
}
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
def services = [':services:default',
|
||||
':services:backend',
|
||||
':services:tools',
|
||||
|
@ -290,7 +217,6 @@ subprojects {
|
|||
|
||||
appengine {
|
||||
deploy {
|
||||
// TODO: change this to a variable.
|
||||
project = gcpProject
|
||||
}
|
||||
}
|
||||
|
@ -413,5 +339,3 @@ subprojects {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateDependencyPublications()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
repositories {
|
||||
if (project.ext.properties.repositoryUrl == null) {
|
||||
if (project.ext.properties.mavenUrl == null) {
|
||||
println "Plugins: Using Maven central..."
|
||||
mavenCentral()
|
||||
} else {
|
||||
maven {
|
||||
println "Plugins: Using repo ${repositoryUrl}..."
|
||||
url repositoryUrl
|
||||
println "Plugins: Using repo ${mavenUrl}..."
|
||||
url mavenUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -687,5 +687,3 @@ task nomulus(type: Jar) {
|
|||
with jar
|
||||
dependsOn project(':third_party').jar
|
||||
}
|
||||
|
||||
generateDependencyPublications()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
repositoryUrl=
|
||||
publishUrl=
|
||||
mavenUrl=
|
||||
pluginsUrl=
|
||||
uploaderDestination=
|
||||
uploaderCredentialsFile=
|
||||
uploaderMultithreadedUpload=
|
||||
|
|
|
@ -74,5 +74,3 @@ dependencies {
|
|||
annotationProcessor deps['com.google.dagger:dagger-compiler']
|
||||
testAnnotationProcessor deps['com.google.dagger:dagger-compiler']
|
||||
}
|
||||
|
||||
generateDependencyPublications()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
if (repositoryUrl) {
|
||||
println "Using repository $repositoryUrl for plugins"
|
||||
if (pluginsUrl) {
|
||||
println "Using repository $pluginsUrl for plugins"
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
url repositoryUrl
|
||||
url pluginsUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,5 +30,3 @@ dependencies {
|
|||
testAnnotationProcessor deps['com.google.auto.value:auto-value']
|
||||
testAnnotationProcessor deps['com.google.dagger:dagger-compiler']
|
||||
}
|
||||
|
||||
generateDependencyPublications()
|
||||
|
|
Loading…
Add table
Reference in a new issue