Skip to content

Commit

Permalink
GEODE-6399: Manage dependency versions via java-platform (apache#3190)
Browse files Browse the repository at this point in the history
* All applicable projects should opt into dependency version management
via bom consumption, i.e.,
    compile(platform(project(':boms:geode-all-bom')))

* Those configurations that do not extend compile, such as compileOnly
or those provided by other plugins, will also require a dependency on
the platform's BOM

* The BOM itself is now configured via the buildSrc
DependencyConstraints.groovy.  This replaces
geode-dependency-management.gradle.

* Those lingering "property" versions are now accessible via
DependencyConstraints.get() rather than project properties.

* Published POMs now correctly consume the Geode BOM, rather than
reproducing the same dependencyManagement block across all POMs.

* expected_pom.xml, expected_classpath.txt, and dependency_classpath.txt
files have been accordingly updated.

* publish.gradle now sets the project property constrainVersionInBom,
indicating that the published artifact should be constrained to the same
version in the geode-all-bom as the BOM itself.  Use
    project.ext.set('constrainVersionInBom', true)
to opt into the constrain set without consuming publish.gradle, or the
inverse to opt out.

* Explicit dependency in test.gradle on geode-junit:1.3.0 has been
removed.
It is only needed in buildSrc testRuntime.

* Unused 'bundled' configuration from legacy publication style has been
removed.

Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
  • Loading branch information
PurelyApplied and robbadler authored Mar 1, 2019
1 parent dc2cb6f commit 4ec282f
Show file tree
Hide file tree
Showing 71 changed files with 1,091 additions and 15,449 deletions.
36 changes: 32 additions & 4 deletions boms/geode-all-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,47 @@
* limitations under the License.
*/

apply plugin: "java"
apply plugin: "maven-publish"
plugins {
id 'geode-dependency-constraints'
id 'java'
id 'maven-publish'
}

jar.enabled = false
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/publish.gradle"


publishing {
publications {
maven(MavenPublication) {
// publish.gradle injects 'from components.java', as well as some other pom configuration.
pom.packaging 'pom'
artifacts = []

pom {
withXml {
// Dependency constraints publish the scope of those constraints.
// We remove these from our published bom, as they should apply at all scopes.
asNode().dependencyManagement.dependencies.dependency.each {
dep -> dep.remove(dep['scope'])
}
}
withXml {
// Published Geode artifacts are constrained to match the version of this BOM.
// We exclude any child of the :boms subproject
def thisNode = asNode()
project.rootProject.subprojects.each { p ->
if (p.findProperty('constrainVersionInBom')
&& !project(':boms').allprojects.contains(p)) {
def geodeDependency =
thisNode.dependencyManagement.dependencies*.appendNode('dependency')
geodeDependency*.appendNode('groupId')*.setValue('org.apache.geode')
geodeDependency*.appendNode('artifactId')*.setValue((p.findProperty('artifactName') ?: p.name))
geodeDependency*.appendNode('version')*.setValue(p.version.toString())
}
}
thisNode
}
}
}
}
}
Loading

0 comments on commit 4ec282f

Please sign in to comment.