diff --git a/avro-fastserde/build.gradle b/avro-fastserde/build.gradle index 112845926..b02a026cf 100644 --- a/avro-fastserde/build.gradle +++ b/avro-fastserde/build.gradle @@ -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" } @@ -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 dependencyNodes = dependenciesNode.children() + List 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 allPublicationNames = new ArrayList<>(Arrays.asList(rootProject.bintray.publications)) + List projectAndDepPublicationNames = new ArrayList<>(project.publishing.publications.names) + for (String projectPubName : projectAndDepPublicationNames) { + if (!allPublicationNames.contains(projectPubName)) { + allPublicationNames.add(projectPubName) + } + } + rootProject.bintray.publications = allPublicationNames.toArray() + } +} diff --git a/build.gradle b/build.gradle index 11fe792d3..df7329c02 100644 --- a/build.gradle +++ b/build.gradle @@ -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 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 projectsToPublish = new HashSet<>(Arrays.asList("avro-migration-helper", "avro-codegen")) Set projectsToRecordGitInfoFor = new HashSet<>(projectsToPublish) projectsToRecordGitInfoFor.add("helper")