Skip to content

Commit

Permalink
remove avro-fastserde's declared dependency on helper from pom (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Radai Rosenblatt <rrosenbl@rrosenbl-mn2.linkedin.biz>
  • Loading branch information
radai-rosenblatt and Radai Rosenblatt authored Mar 24, 2020
1 parent 9c499da commit 7ae6344
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 1 deletion.
120 changes: 120 additions & 0 deletions avro-fastserde/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright 2020 LinkedIn Corp.
* Licensed under the BSD 2-Clause License (the "License").

* See License in the project root for license information.
*/

plugins {
id "java-library"
}
Expand Down Expand Up @@ -145,3 +151,117 @@ cleanupAndRebuildTestsForAvro18.dependsOn generateAvroClasses18
testAvro14.dependsOn cleanupAndRebuildTestsForAvro14
testAvro17.dependsOn cleanupAndRebuildTestsForAvro17
testAvro18.dependsOn cleanupAndRebuildTestsForAvro18

//custom publishing code to export a depndency on "helper-all":

task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
}

task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}

task testJar(type: Jar) {
from sourceSets.test.allJava
classifier = 'tests'
}

publishing {
publications {
"$project.name"(MavenPublication) {
groupId project.group
artifactId project.name
version project.version

from components.java
artifact sourceJar
artifact javadocJar
artifact testJar

//we strive to meet https://central.sonatype.org/pages/requirements.html
pom {
name = 'Avro Util'
description = 'utilities for writing code that works across major avro versions'
url = 'https://github.com/linkedin/avro-util'

licenses {
license {
name = 'BSD 2-Clause'
url = 'https://raw.githubusercontent.com/linkedin/avro-util/master/LICENSE'
}
}
developers {
developer {
id = 'radai-rosenblatt'
name = 'Radai Rosenblatt'
email = 'radai.rosenblatt@gmail.com'
organization = 'LinkedIn'
organizationUrl = 'linkedin.com'
}
developer {
id = 'abhishekmendhekar'
name = 'Abhishek Mendhekar'
organization = 'LinkedIn'
organizationUrl = 'linkedin.com'
}
developer {
id = 'jimhe'
name = 'Jim He'
email = 'jimjhe@gmail.com'
organization = 'LinkedIn'
organizationUrl = 'linkedin.com'
}
developer {
id = 'ghosthack'
name = 'Adrian Fernandez'
email = 'adrian@ghosthack.com'
organization = 'LinkedIn'
organizationUrl = 'linkedin.com'
}
}
scm {
connection = 'scm:git:git://github.com:linkedin/avro-util.git'
developerConnection = 'scm:git:ssh://github.com:linkedin/avro-util.git'
url = 'https://github.com/linkedin/avro-util'
}
}

//remove the dependency on helper, and replace with one on helper-all
pom.withXml {
Node dependenciesNode = (Node) (asNode().dependencies[0])
Collection<Node> dependencyNodes = dependenciesNode.children()
List<Node> toRemove = new ArrayList<>()

for (Node o : dependencyNodes) {
if ("$project.group" == o.groupId[0].text() && "helper" == o.artifactId[0].text()) {
toRemove.add(o)
}
}

for (Node o : toRemove) {
dependencyNodes.remove(o)
}

def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', "$project.group")
dependencyNode.appendNode('artifactId', "helper-all")
dependencyNode.appendNode('version', "$project.version")
dependencyNode.appendNode('scope', "compile")
}
}

//record all of this module's publications in the bintray publications list
//for the root project
List<String> allPublicationNames = new ArrayList<>(Arrays.asList(rootProject.bintray.publications))
List<String> projectAndDepPublicationNames = new ArrayList<>(project.publishing.publications.names)
for (String projectPubName : projectAndDepPublicationNames) {
if (!allPublicationNames.contains(projectPubName)) {
allPublicationNames.add(projectPubName)
}
}
rootProject.bintray.publications = allPublicationNames.toArray()
}
}
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ plugins {
group = 'com.linkedin.avroutil1'

//does not include "helper" as that module has its own publishing section (because fat jar)
Set<String> projectsToPublish = new HashSet<>(Arrays.asList("avro-migration-helper", "avro-codegen", "avro-fastserde"))
//does not include "avro-fastserde" as that module has its own publishing section (because we want it to depend on the fat jar)
Set<String> projectsToPublish = new HashSet<>(Arrays.asList("avro-migration-helper", "avro-codegen"))
Set<String> projectsToRecordGitInfoFor = new HashSet<>(projectsToPublish)
projectsToRecordGitInfoFor.add("helper")

Expand Down

0 comments on commit 7ae6344

Please sign in to comment.