2022-01-25 21:52:47 -08:00
|
|
|
plugins {
|
2023-05-01 13:18:41 -05:00
|
|
|
id("com.palantir.git-version") apply false
|
2022-01-25 21:52:47 -08:00
|
|
|
}
|
2022-01-02 22:48:38 +05:30
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
2022-01-04 01:41:09 -08:00
|
|
|
apply plugin: 'jacoco'
|
2022-01-20 00:48:09 -08:00
|
|
|
apply plugin: 'signing'
|
|
|
|
apply plugin: 'io.codearte.nexus-staging'
|
|
|
|
apply plugin: 'maven-publish'
|
2022-05-03 19:38:05 -05:00
|
|
|
apply plugin: 'org.hidetake.swagger.generator'
|
2022-09-08 23:36:15 -07:00
|
|
|
apply from: "../versioning.gradle"
|
2022-01-20 00:48:09 -08:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
2022-01-02 22:48:38 +05:30
|
|
|
|
2023-05-01 13:18:41 -05:00
|
|
|
|
2022-01-11 14:55:21 -08:00
|
|
|
jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation
|
|
|
|
|
2022-09-25 10:39:22 -05:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2023-05-01 13:18:41 -05:00
|
|
|
javaCompiler = javaToolchains.compilerFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
|
|
}
|
2022-09-25 10:39:22 -05:00
|
|
|
}
|
|
|
|
tasks.withType(Test).configureEach {
|
2023-05-01 13:18:41 -05:00
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
|
|
}
|
2022-09-25 10:39:22 -05:00
|
|
|
}
|
|
|
|
|
2022-01-02 22:48:38 +05:30
|
|
|
dependencies {
|
2023-05-01 13:18:41 -05:00
|
|
|
implementation project(':metadata-models')
|
|
|
|
implementation(externalDependency.kafkaAvroSerializer) {
|
|
|
|
exclude group: "org.apache.avro"
|
|
|
|
}
|
2023-09-01 09:06:01 -05:00
|
|
|
implementation externalDependency.avro_1_7
|
2023-05-01 13:18:41 -05:00
|
|
|
constraints {
|
|
|
|
implementation('commons-collections:commons-collections:3.2.2') {
|
|
|
|
because 'Vulnerability Issue'
|
2022-06-21 06:02:57 +05:30
|
|
|
}
|
2023-05-01 13:18:41 -05:00
|
|
|
}
|
2022-12-04 21:57:47 -06:00
|
|
|
|
2023-05-01 13:18:41 -05:00
|
|
|
compileOnly externalDependency.httpAsyncClient
|
|
|
|
implementation externalDependency.jacksonDataBind
|
|
|
|
implementation externalDependency.javaxValidation
|
|
|
|
runtimeOnly externalDependency.jna
|
|
|
|
implementation externalDependency.springContext
|
|
|
|
implementation externalDependency.swaggerAnnotations
|
2022-05-03 19:38:05 -05:00
|
|
|
|
2023-05-01 13:18:41 -05:00
|
|
|
implementation externalDependency.slf4jApi
|
|
|
|
compileOnly externalDependency.lombok
|
|
|
|
annotationProcessor externalDependency.lombok
|
2023-09-01 09:06:01 -05:00
|
|
|
// VisibleForTesting
|
|
|
|
compileOnly externalDependency.guava
|
|
|
|
testImplementation externalDependency.mockito
|
|
|
|
testImplementation externalDependency.mockServer
|
|
|
|
testImplementation externalDependency.mockServerClient
|
|
|
|
testImplementation externalDependency.testContainers
|
|
|
|
testImplementation externalDependency.httpAsyncClient
|
|
|
|
testRuntimeOnly externalDependency.logbackClassic
|
2023-05-01 13:18:41 -05:00
|
|
|
|
2023-09-07 17:09:52 -05:00
|
|
|
swaggerCodegen externalDependency.swaggerCli
|
2022-01-02 22:48:38 +05:30
|
|
|
}
|
|
|
|
|
2022-06-21 06:02:57 +05:30
|
|
|
task copyAvroSchemas {
|
|
|
|
dependsOn(':metadata-events:mxe-schemas:renameNamespace')
|
|
|
|
copy {
|
|
|
|
from file('../../../metadata-events/mxe-schemas/src/renamed/avro/com/linkedin/mxe/MetadataChangeProposal.avsc')
|
|
|
|
into file('./src/main/resources')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJava.dependsOn copyAvroSchemas
|
|
|
|
|
2022-01-04 01:41:09 -08:00
|
|
|
jacocoTestReport {
|
2023-05-01 13:18:41 -05:00
|
|
|
dependsOn test // tests are required to run before generating the report
|
2022-01-04 01:41:09 -08:00
|
|
|
}
|
|
|
|
|
2022-01-02 22:48:38 +05:30
|
|
|
test {
|
2022-04-19 04:21:26 +05:30
|
|
|
// to avoid simultaneous executions of tests when complete build is run
|
|
|
|
mustRunAfter(":metadata-io:test")
|
2022-01-02 22:48:38 +05:30
|
|
|
useJUnit()
|
2022-01-04 01:41:09 -08:00
|
|
|
finalizedBy jacocoTestReport
|
2022-01-02 22:48:38 +05:30
|
|
|
}
|
|
|
|
|
2022-04-04 21:39:30 +02:00
|
|
|
task checkShadowJar(type: Exec) {
|
2023-05-01 13:18:41 -05:00
|
|
|
commandLine 'sh', '-c', 'scripts/check_jar.sh'
|
2022-01-11 14:55:21 -08:00
|
|
|
}
|
|
|
|
|
2022-01-02 22:48:38 +05:30
|
|
|
shadowJar {
|
2023-05-01 13:18:41 -05:00
|
|
|
zip64 = true
|
2022-01-11 14:55:21 -08:00
|
|
|
archiveClassifier = ''
|
2022-09-25 10:39:22 -05:00
|
|
|
// preventing java multi-release JAR leakage
|
|
|
|
// https://github.com/johnrengelman/shadow/issues/729
|
|
|
|
exclude('module-info.class', 'META-INF/versions/**',
|
2023-05-01 13:18:41 -05:00
|
|
|
'**/LICENSE', '**/LICENSE.txt', '**/NOTICE', '**/NOTICE.txt')
|
2022-01-11 14:55:21 -08:00
|
|
|
mergeServiceFiles()
|
|
|
|
// we relocate namespaces manually, because we want to know exactly which libs we are exposing and why
|
|
|
|
// we can move to automatic relocation using ConfigureShadowRelocation after we get to a good place on these first
|
2022-09-18 18:04:47 -07:00
|
|
|
relocate 'org.springframework', 'datahub.shaded.org.springframework'
|
2022-01-11 14:55:21 -08:00
|
|
|
relocate 'com.fasterxml.jackson', 'datahub.shaded.jackson'
|
|
|
|
relocate 'net.jcip.annotations', 'datahub.shaded.annotations'
|
|
|
|
relocate 'javassist', 'datahub.shaded.javassist'
|
|
|
|
relocate 'edu.umd.cs.findbugs', 'datahub.shaded.findbugs'
|
|
|
|
relocate 'org.antlr', 'datahub.shaded.org.antlr'
|
|
|
|
relocate 'antlr', 'datahub.shaded.antlr'
|
|
|
|
relocate 'com.google.common', 'datahub.shaded.com.google.common'
|
|
|
|
relocate 'org.apache.commons', 'datahub.shaded.org.apache.commons'
|
|
|
|
relocate 'org.reflections', 'datahub.shaded.org.reflections'
|
|
|
|
relocate 'st4hidden', 'datahub.shaded.st4hidden'
|
|
|
|
relocate 'org.stringtemplate', 'datahub.shaded.org.stringtemplate'
|
|
|
|
relocate 'org.abego.treelayout', 'datahub.shaded.treelayout'
|
|
|
|
relocate 'org.slf4j', 'datahub.shaded.slf4j'
|
|
|
|
relocate 'javax.annotation', 'datahub.shaded.javax.annotation'
|
2022-03-09 15:31:16 -06:00
|
|
|
relocate 'com.github.benmanes.caffeine', 'datahub.shaded.com.github.benmanes.caffeine'
|
|
|
|
relocate 'org.checkerframework', 'datahub.shaded.org.checkerframework'
|
|
|
|
relocate 'com.google.errorprone', 'datahub.shaded.com.google.errorprone'
|
2022-10-05 16:53:38 -05:00
|
|
|
relocate 'com.sun.jna', 'datahub.shaded.com.sun.jna'
|
2022-06-21 06:02:57 +05:30
|
|
|
// Below jars added for kafka emitter only
|
|
|
|
relocate 'org.apache.avro', 'datahub.shaded.org.apache.avro'
|
|
|
|
relocate 'com.thoughtworks.paranamer', 'datahub.shaded.com.thoughtworks.paranamer'
|
|
|
|
relocate 'org.xerial.snappy', 'datahub.shaded.org.xerial.snappy'
|
|
|
|
relocate 'org.apache.kafka', 'datahub.shaded.org.apache.kafka'
|
|
|
|
relocate 'io.confluent', 'datahub.shaded.io.confluent'
|
|
|
|
relocate 'org.apache.zookeeper', 'datahub.shaded.org.apache.zookeeper'
|
|
|
|
relocate 'org.apache.yetus', 'datahub.shaded.org.apache.yetus'
|
|
|
|
relocate 'jline', 'datahub.shaded.jline'
|
|
|
|
relocate 'org.apache.jute', 'datahub.shaded.org.apache.jute'
|
|
|
|
relocate 'org.I0Itec.zkclient', 'datahub.shaded.org.I0Itec.zkclient'
|
|
|
|
relocate 'net.jpountz', 'datahub.shaded.net.jpountz'
|
|
|
|
relocate 'com.github.luben', 'datahub.shaded.com.github.luben'
|
2023-05-01 13:18:41 -05:00
|
|
|
relocate 'common.message', 'datahub.shaded.common.message'
|
|
|
|
relocate 'org.glassfish', 'datahub.shaded.org.glassfish'
|
2023-04-13 12:01:51 -05:00
|
|
|
relocate 'ch.randelshofer', 'datahub.shaded.ch.randelshofer'
|
2023-05-01 13:18:41 -05:00
|
|
|
|
2022-01-11 14:55:21 -08:00
|
|
|
finalizedBy checkShadowJar
|
|
|
|
}
|
|
|
|
|
|
|
|
checkShadowJar {
|
2023-05-01 13:18:41 -05:00
|
|
|
dependsOn shadowJar
|
2022-01-02 22:48:38 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
assemble {
|
2023-05-01 13:18:41 -05:00
|
|
|
dependsOn shadowJar
|
2022-01-02 22:48:38 +05:30
|
|
|
}
|
2023-09-01 09:06:01 -05:00
|
|
|
compileTestJava.dependsOn shadowJar
|
2022-01-20 00:48:09 -08:00
|
|
|
|
|
|
|
task sourcesJar(type: Jar) {
|
2023-05-01 13:18:41 -05:00
|
|
|
archiveClassifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
task javadocJar(type: Jar) {
|
2023-05-01 13:18:41 -05:00
|
|
|
archiveClassifier = 'javadoc'
|
|
|
|
from javadoc
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
2023-05-01 13:18:41 -05:00
|
|
|
shadow(MavenPublication) { publication ->
|
|
|
|
project.shadow.component(publication)
|
2022-01-20 00:48:09 -08:00
|
|
|
pom {
|
|
|
|
name = 'Datahub Client'
|
|
|
|
group = 'io.acryl'
|
|
|
|
artifactId = 'datahub-client'
|
|
|
|
description = 'DataHub Java client for metadata integration'
|
|
|
|
url = 'https://datahubproject.io'
|
2023-05-01 13:18:41 -05:00
|
|
|
artifacts = [shadowJar, javadocJar, sourcesJar]
|
2022-01-20 00:48:09 -08:00
|
|
|
|
|
|
|
scm {
|
2022-04-04 21:39:30 +02:00
|
|
|
connection = 'scm:git:git://github.com/datahub-project/datahub.git'
|
|
|
|
developerConnection = 'scm:git:ssh://github.com:datahub-project/datahub.git'
|
2022-03-18 22:12:19 +01:00
|
|
|
url = 'https://github.com/datahub-project/datahub.git'
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = 'The Apache License, Version 2.0'
|
|
|
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id = 'datahub'
|
|
|
|
name = 'Datahub'
|
|
|
|
email = 'datahub@acryl.io'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
|
|
|
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
|
|
|
def ossrhUsername = System.getenv('RELEASE_USERNAME')
|
|
|
|
def ossrhPassword = System.getenv('RELEASE_PASSWORD')
|
|
|
|
credentials {
|
|
|
|
username ossrhUsername
|
|
|
|
password ossrhPassword
|
|
|
|
}
|
|
|
|
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
signing {
|
2023-05-01 13:18:41 -05:00
|
|
|
def signingKey = findProperty("signingKey")
|
|
|
|
def signingPassword = System.getenv("SIGNING_PASSWORD")
|
|
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
|
|
sign publishing.publications.shadow
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nexusStaging {
|
2023-05-01 13:18:41 -05:00
|
|
|
serverUrl = "https://s01.oss.sonatype.org/service/local/"
|
|
|
|
//required only for projects registered in Sonatype after 2021-02-24
|
|
|
|
username = System.getenv("NEXUS_USERNAME")
|
|
|
|
password = System.getenv("NEXUS_PASSWORD")
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
2022-05-03 19:38:05 -05:00
|
|
|
|
|
|
|
tasks.register('generateOpenApiPojos', GenerateSwaggerCode) {
|
2023-05-01 13:18:41 -05:00
|
|
|
it.setInputFile(file("${project(':metadata-models').projectDir}/src/generatedJsonSchema/combined/open-api.yaml"))
|
2022-05-03 19:38:05 -05:00
|
|
|
it.setOutputDir(file("$projectDir/generated"))
|
|
|
|
it.setLanguage("spring")
|
|
|
|
it.setComponents(['models'])
|
|
|
|
it.setTemplateDir(file("$projectDir/src/main/resources/JavaSpring"))
|
2023-05-01 13:18:41 -05:00
|
|
|
it.setAdditionalProperties(["group-id" : "io.datahubproject",
|
|
|
|
"dateLibrary" : "java8",
|
|
|
|
"java8" : "true",
|
|
|
|
"modelPropertyNaming": "original",
|
|
|
|
"modelPackage" : "io.datahubproject.openapi.generated"] as Map<String, String>)
|
2022-05-03 19:38:05 -05:00
|
|
|
|
|
|
|
dependsOn ':metadata-models:generateJsonSchema'
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJava.dependsOn generateOpenApiPojos
|
2023-09-01 09:06:01 -05:00
|
|
|
processResources.dependsOn generateOpenApiPojos
|
2022-05-03 19:38:05 -05:00
|
|
|
sourceSets.main.java.srcDir "${generateOpenApiPojos.outputDir}/src/main/java"
|
|
|
|
sourceSets.main.resources.srcDir "${generateOpenApiPojos.outputDir}/src/main/resources"
|
|
|
|
|
|
|
|
checkstyleMain.exclude '**/generated/**'
|
2023-08-24 13:09:57 +05:30
|
|
|
|
|
|
|
clean {
|
|
|
|
project.delete("$projectDir/generated")
|
|
|
|
}
|