2022-01-25 21:52:47 -08:00
|
|
|
plugins {
|
|
|
|
id("com.palantir.git-version") apply false
|
|
|
|
}
|
2021-12-14 01:30:51 +05:30
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
|
|
apply plugin: 'signing'
|
2022-01-20 00:48:09 -08:00
|
|
|
apply plugin: 'io.codearte.nexus-staging'
|
|
|
|
apply plugin: 'maven-publish'
|
2022-01-04 01:41:09 -08:00
|
|
|
apply plugin: 'jacoco'
|
2022-01-20 00:48:09 -08:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
|
|
|
jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation
|
|
|
|
|
2022-04-04 21:39:30 +02:00
|
|
|
//to rename artifacts for publish
|
2022-01-20 00:48:09 -08:00
|
|
|
project.archivesBaseName = 'datahub-'+project.name
|
|
|
|
|
|
|
|
//mark implementaion dependencies which needs to excluded along with transitive dependencies from shadowjar
|
2022-04-04 21:39:30 +02:00
|
|
|
//functionality is exactly same as "implementation"
|
2022-01-20 00:48:09 -08:00
|
|
|
configurations {
|
|
|
|
provided
|
2022-04-04 21:39:30 +02:00
|
|
|
implementation.extendsFrom provided
|
2022-01-20 00:48:09 -08:00
|
|
|
}
|
|
|
|
|
2022-01-25 21:52:47 -08:00
|
|
|
def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
|
|
|
|
def snapshotVersion = false
|
|
|
|
if (project.hasProperty("releaseVersion")) {
|
|
|
|
version = releaseVersion
|
|
|
|
detailedVersionString = releaseVersion
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
// apply this plugin in a try-catch block so that we can handle cases without .git directory
|
|
|
|
apply plugin: "com.palantir.git-version"
|
|
|
|
def details = versionDetails()
|
|
|
|
detailedVersionString = gitVersion()
|
|
|
|
version = details.lastTag
|
|
|
|
version = version.startsWith("v")? version.substring(1): version
|
|
|
|
def suffix = details.isCleanTag? "": "-SNAPSHOT"
|
|
|
|
snapshotVersion = ! details.isCleanTag
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
e.printStackTrace()
|
|
|
|
// last fall back
|
|
|
|
version = detailedVersionString
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// trim version if it is of size 4 to size 3
|
|
|
|
def versionParts = version.tokenize(".")
|
|
|
|
if (versionParts.size() > 3) {
|
|
|
|
// at-least 4 part version
|
|
|
|
// we check if the 4th part is a .0 in which case we want to create a release
|
|
|
|
if (versionParts[3] != '0') {
|
|
|
|
snapshotVersion = true
|
|
|
|
}
|
|
|
|
versionParts = versionParts[0..2]
|
|
|
|
version = versionParts[0..2].join('.')
|
|
|
|
}
|
2022-01-20 00:48:09 -08:00
|
|
|
|
2022-01-25 21:52:47 -08:00
|
|
|
if (snapshotVersion) {
|
|
|
|
if (versionParts[versionParts.size()-1].isInteger()) {
|
|
|
|
version = versionParts[0..versionParts.size()-2].join('.') + '.' + (versionParts[versionParts.size()-1].toInteger()+1).toString() + "-SNAPSHOT"
|
|
|
|
} else {
|
|
|
|
// we are unable to part the last token as an integer, so we just append SNAPSHOT to this version
|
|
|
|
version = versionParts[0..versionParts.size()-1].join('.') + '-SNAPSHOT'
|
|
|
|
}
|
|
|
|
}
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-01-25 21:52:47 -08:00
|
|
|
processResources {
|
|
|
|
filter(ReplaceTokens, tokens:[fullVersion: detailedVersionString])
|
|
|
|
}
|
2021-12-14 01:30:51 +05:30
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
|
|
//Needed for tie breaking of guava version need for spark and wiremock
|
2022-01-20 00:48:09 -08:00
|
|
|
provided(externalDependency.hadoopMapreduceClient) {
|
2021-12-14 01:30:51 +05:30
|
|
|
force = true
|
|
|
|
}
|
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
provided(externalDependency.hadoopCommon) {
|
2021-12-14 01:30:51 +05:30
|
|
|
force = true
|
2022-04-04 21:39:30 +02:00
|
|
|
} // required for org.apache.hadoop.util.StopWatch
|
2021-12-14 01:30:51 +05:30
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
provided(externalDependency.commonsIo) {
|
2021-12-14 01:30:51 +05:30
|
|
|
force = true
|
|
|
|
} // required for org.apache.commons.io.Charsets that is used internally
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2021-12-14 01:30:51 +05:30
|
|
|
compileOnly externalDependency.lombok
|
|
|
|
annotationProcessor externalDependency.lombok
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-02-03 23:24:11 +05:30
|
|
|
implementation externalDependency.typesafeConfig
|
2022-03-14 23:18:27 +05:30
|
|
|
implementation externalDependency.opentracingJdbc
|
2021-12-14 01:30:51 +05:30
|
|
|
|
2022-01-11 14:55:21 -08:00
|
|
|
implementation project(path: ':metadata-integration:java:datahub-client', configuration: 'shadow')
|
|
|
|
|
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
provided(externalDependency.sparkSql)
|
|
|
|
provided(externalDependency.sparkHive)
|
2022-01-11 14:55:21 -08:00
|
|
|
|
|
|
|
// Tests need a concrete log4j available. Providing it here
|
|
|
|
testImplementation 'org.apache.logging.log4j:log4j-api:2.17.1'
|
|
|
|
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.1'
|
2022-04-04 21:39:30 +02:00
|
|
|
|
|
|
|
|
2022-01-02 22:48:38 +05:30
|
|
|
testImplementation(externalDependency.postgresql){
|
|
|
|
exclude group: "com.fasterxml.jackson.core"
|
|
|
|
}
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2021-12-14 01:30:51 +05:30
|
|
|
testImplementation externalDependency.mockito
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-01-02 22:48:38 +05:30
|
|
|
testImplementation(externalDependency.mockServer){
|
|
|
|
exclude group: "com.fasterxml.jackson.core"
|
|
|
|
} // older version to allow older guava
|
|
|
|
testImplementation(externalDependency.mockServerClient){
|
2021-12-14 01:30:51 +05:30
|
|
|
exclude group: "com.fasterxml.jackson.core"
|
|
|
|
} // older version to allow older guava
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-01-11 14:55:21 -08:00
|
|
|
testImplementation(externalDependency.testContainersPostgresql)
|
2021-12-14 01:30:51 +05:30
|
|
|
}
|
|
|
|
|
2022-04-04 21:39:30 +02:00
|
|
|
task checkShadowJar(type: Exec) {
|
2022-01-20 00:48:09 -08:00
|
|
|
commandLine 'sh', '-c', 'scripts/check_jar.sh'
|
|
|
|
}
|
2021-12-14 01:30:51 +05:30
|
|
|
|
|
|
|
shadowJar {
|
2022-04-04 21:39:30 +02:00
|
|
|
zip64=true
|
2021-12-14 01:30:51 +05:30
|
|
|
classifier=''
|
2022-01-20 00:48:09 -08:00
|
|
|
mergeServiceFiles()
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
def exclude_modules = project
|
|
|
|
.configurations
|
|
|
|
.provided
|
|
|
|
.resolvedConfiguration
|
|
|
|
.getLenientConfiguration()
|
|
|
|
.getAllModuleDependencies()
|
|
|
|
.collect {
|
|
|
|
it.name
|
|
|
|
}
|
2021-12-14 01:30:51 +05:30
|
|
|
dependencies {
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
exclude(dependency {
|
|
|
|
exclude_modules.contains(it.name)
|
|
|
|
})
|
2022-04-04 21:39:30 +02:00
|
|
|
|
2021-12-14 01:30:51 +05:30
|
|
|
}
|
2022-05-04 23:09:29 -07:00
|
|
|
relocate 'com.fasterxml.jackson', 'datahub.shaded.jackson'
|
2022-01-20 00:48:09 -08:00
|
|
|
relocate 'org.apache.http','datahub.spark2.shaded.http'
|
|
|
|
relocate 'org.apache.commons.codec', 'datahub.spark2.shaded.o.a.c.codec'
|
2022-03-22 15:21:55 -06:00
|
|
|
relocate 'org.apache.commons.compress', 'datahub.spark2.shaded.o.a.c.compress'
|
2022-01-20 00:48:09 -08:00
|
|
|
relocate 'mozilla', 'datahub.spark2.shaded.mozilla'
|
2022-02-03 23:24:11 +05:30
|
|
|
relocate 'com.typesafe','datahub.spark2.shaded.typesafe'
|
2022-03-14 23:18:27 +05:30
|
|
|
relocate 'io.opentracing','datahub.spark2.shaded.io.opentracing'
|
2022-05-05 16:39:06 -07:00
|
|
|
relocate 'io.netty','datahub.spark2.shaded.io.netty'
|
2022-01-20 00:48:09 -08:00
|
|
|
finalizedBy checkShadowJar
|
2021-12-14 01:30:51 +05:30
|
|
|
}
|
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
checkShadowJar {
|
|
|
|
dependsOn shadowJar
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-04 01:41:09 -08:00
|
|
|
jacocoTestReport {
|
|
|
|
dependsOn test // tests are required to run before generating the report
|
|
|
|
}
|
2021-12-14 01:30:51 +05:30
|
|
|
|
|
|
|
test {
|
2022-06-03 20:02:22 +05:30
|
|
|
forkEvery = 1
|
2021-12-14 01:30:51 +05:30
|
|
|
useJUnit()
|
2022-01-04 01:41:09 -08:00
|
|
|
finalizedBy jacocoTestReport
|
2021-12-14 01:30:51 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
assemble {
|
|
|
|
dependsOn shadowJar
|
|
|
|
}
|
|
|
|
|
2022-02-23 09:03:21 +05:30
|
|
|
task integrationTest(type: Exec ) {
|
|
|
|
commandLine "spark-smoke-test/smoke.sh"
|
|
|
|
}
|
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
task sourcesJar(type: Jar) {
|
2021-12-14 01:30:51 +05:30
|
|
|
classifier 'sources'
|
|
|
|
from sourceSets.main.allJava
|
|
|
|
}
|
|
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
|
|
classifier 'javadoc'
|
|
|
|
from javadoc.destinationDir
|
|
|
|
}
|
|
|
|
|
2022-01-20 00:48:09 -08:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
shadow(MavenPublication) {
|
|
|
|
publication -> project.shadow.component(publication)
|
|
|
|
pom {
|
|
|
|
name = 'Datahub Spark Lineage'
|
|
|
|
group = 'io.acryl'
|
|
|
|
artifactId = 'datahub-spark-lineage'
|
|
|
|
description = 'Library to push data lineage from spark to datahub'
|
|
|
|
url = 'https://datahubproject.io'
|
|
|
|
artifacts = [ shadowJar, javadocJar, sourcesJar ]
|
|
|
|
|
|
|
|
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 {
|
|
|
|
def signingKey = findProperty("signingKey")
|
|
|
|
def signingPassword = System.getenv("SIGNING_PASSWORD")
|
|
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
|
|
sign publishing.publications.shadow
|
|
|
|
}
|
|
|
|
|
|
|
|
nexusStaging {
|
|
|
|
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")
|
2021-12-14 01:30:51 +05:30
|
|
|
}
|