Skip to content
代码片段 群组 项目
提交 328c202a 编辑于 作者: sunjincheng121's avatar sunjincheng121
浏览文件

fixup

上级 282bd364
No related branches found
No related tags found
无相关合并请求
......@@ -318,7 +318,14 @@ if (project.hasProperty('javaLinkageArtifactIds')) {
dependsOn project.getTasksByName('publishMavenJavaPublicationToMavenLocal', true /* recursively */)
classpath = project.configurations.linkageCheckerJava
main = 'com.google.cloud.tools.opensource.classpath.LinkageCheckerMain'
args '-a', project.javaLinkageArtifactIds.split(',').collect({"${project.ext.mavenGroupId}:${it}:0.1"}).join(',')
args '-a', project.javaLinkageArtifactIds.split(',').collect({
if (it.contains(':')) {
"${project.ext.mavenGroupId}:${it}"
} else {
// specify the version if not provided
"${project.ext.mavenGroupId}:${it}:${project.version}"
}
}).join(',')
doLast {
println "NOTE: This task published artifacts into your local Maven repository. You may want to remove them manually."
}
......
......@@ -21,9 +21,7 @@ package org.apache.beam.gradle
import org.gradle.api.Project
/**
* Utilities for working with our vendored version of gRPC. The test dependency junit and the runtime dependencies
* slf4j, commons-logging and log4j are not included in the vendored jar. The linkage checker complains about
* these dependencies could be ignored.
* Utilities for working with our vendored version of gRPC.
*/
class GrpcVendoring_1_26_0 {
/** Returns the list of compile time dependencies. */
......
......@@ -21,6 +21,7 @@ package org.apache.beam.gradle
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.FileTree
import org.gradle.api.publish.maven.MavenPublication
......@@ -97,8 +98,8 @@ class VendorJavaPlugin implements Plugin<Project> {
project.dependencies {
config.dependencies.each { compile it }
config.runtimeDependencies.each { runtime it }
config.testDependencies.each { testImplementation it}
config.runtimeDependencies.each { runtimeOnly it }
config.testDependencies.each { compileOnly it}
}
// Create a task which emulates the maven-archiver plugin in generating a
......@@ -283,6 +284,55 @@ artifactId=${project.name}
}
pom.withXml {
def root = asNode()
def dependenciesNode = root.appendNode('dependencies')
def generateDependenciesFromConfiguration = { param ->
project.configurations."${param.configuration}".allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
def appendClassifier = { dep ->
dep.artifacts.each { art ->
if (art.hasProperty('classifier')) {
dependencyNode.appendNode('classifier', art.classifier)
}
}
}
if (it instanceof ProjectDependency) {
dependencyNode.appendNode('groupId', it.getDependencyProject().mavenGroupId)
dependencyNode.appendNode('artifactId', it.getDependencyProject().archivesBaseName)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', param.scope)
appendClassifier(it)
} else {
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', param.scope)
appendClassifier(it)
}
// Start with any exclusions that were added via configuration exclude rules.
// Then add all the exclusions that are specific to the dependency (if any
// were declared). Finally build the node that represents all exclusions.
def exclusions = []
exclusions += project.configurations."${param.configuration}".excludeRules
if (it.hasProperty('excludeRules')) {
exclusions += it.excludeRules
}
if (!exclusions.empty) {
def exclusionsNode = dependencyNode.appendNode('exclusions')
exclusions.each { exclude ->
def exclusionNode = exclusionsNode.appendNode('exclusion')
exclusionNode.appendNode('groupId', exclude.group)
exclusionNode.appendNode('artifactId', exclude.module)
}
}
}
}
generateDependenciesFromConfiguration(configuration: 'runtimeOnly', scope: 'runtime')
generateDependenciesFromConfiguration(configuration: 'compileOnly', scope: 'provided')
// NB: This must come after asNode() logic, as it seems asNode()
// removes XML comments.
// TODO: Load this from file?
......
......@@ -31,7 +31,8 @@ The upgrading of the vendored dependencies should be performed in two steps:
The [linkage tool](https://lists.apache.org/thread.html/eb5d95b9a33d7e32dc9bcd0f7d48ba8711d42bd7ed03b9cf0f1103f1%40%3Cdev.beam.apache.org%3E)
is useful for the vendored dependency upgrades. It reports the linkage errors across multiple Apache Beam artifact ids.
For example, when we upgrade the vendored gRPC to 1.26.0, we could run the linkage tool as following:
For example, when we upgrade the version of gRPC to 1.26.0 and the version of the vendored gRPC is 0.1-SNAPSHOT,
we could run the linkage tool as following:
```
./gradlew -Ppublishing -PjavaLinkageArtifactIds=beam-vendor-grpc-1_26_0 :checkJavaLinkage
./gradlew -PvendoredDependenciesOnly -Ppublishing -PjavaLinkageArtifactIds=beam-vendor-grpc-1_26_0:0.1-SNAPSHOT :checkJavaLinkage
```
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册