| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | plugins { | 
					
						
							|  |  |  |     id("com.palantir.git-version") apply false | 
					
						
							| 
									
										
										
										
											2022-09-18 18:04:47 -07:00
										 |  |  |     id "application" | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | } | 
					
						
							|  |  |  | apply plugin: 'java' | 
					
						
							|  |  |  | apply plugin: 'jacoco' | 
					
						
							| 
									
										
										
										
											2022-09-08 22:10:36 -07:00
										 |  |  | apply plugin: 'com.github.johnrengelman.shadow' | 
					
						
							|  |  |  | apply plugin: 'signing' | 
					
						
							|  |  |  | apply plugin: 'io.codearte.nexus-staging' | 
					
						
							|  |  |  | apply plugin: 'maven-publish' | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | apply from: '../versioning.gradle' | 
					
						
							| 
									
										
										
										
											2022-09-08 22:10:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation
 | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:04:47 -07:00
										 |  |  | ext { | 
					
						
							|  |  |  |    javaMainClass = "datahub.protobuf.Proto2DataHub" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | application { | 
					
						
							|  |  |  |     mainClassName = javaMainClass | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | dependencies { | 
					
						
							|  |  |  |     implementation project(':metadata-models') | 
					
						
							|  |  |  |     implementation project(path: ':metadata-integration:java:datahub-client', configuration: 'shadow') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 09:06:01 -05:00
										 |  |  |     implementation externalDependency.guava | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  |     implementation externalDependency.protobuf | 
					
						
							|  |  |  |     implementation externalDependency.jgrapht | 
					
						
							| 
									
										
										
										
											2022-03-30 12:50:13 -05:00
										 |  |  |     implementation externalDependency.gson | 
					
						
							| 
									
										
										
										
											2022-09-18 18:04:47 -07:00
										 |  |  |     implementation externalDependency.commonsCli | 
					
						
							| 
									
										
										
										
											2022-12-07 05:28:17 -08:00
										 |  |  |     implementation externalDependency.httpAsyncClient | 
					
						
							| 
									
										
										
										
											2022-12-04 21:57:47 -06:00
										 |  |  |     implementation externalDependency.slf4jApi | 
					
						
							| 
									
										
										
										
											2023-12-19 09:24:03 -08:00
										 |  |  |     implementation externalDependency.jacksonCore | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  |     compileOnly externalDependency.lombok | 
					
						
							|  |  |  |     annotationProcessor externalDependency.lombok | 
					
						
							| 
									
										
										
										
											2023-12-19 09:24:03 -08:00
										 |  |  |     testImplementation externalDependency.testng | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-30 12:50:13 -05:00
										 |  |  | import java.nio.file.Paths | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  | task compileProtobuf { | 
					
						
							|  |  |  |     doLast { | 
					
						
							| 
									
										
										
										
											2022-03-30 12:50:13 -05:00
										 |  |  |         def basePath = Paths.get("${projectDir}/src/test/resources") | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  |         [ | 
					
						
							|  |  |  |                 fileTree("${projectDir}/src/test/resources/protobuf") { include "*.proto" }, | 
					
						
							|  |  |  |                 fileTree("${projectDir}/src/test/resources/extended_protobuf") { include "*.proto" } | 
					
						
							|  |  |  |         ].collectMany { it.collect() }.each { f -> | 
					
						
							| 
									
										
										
										
											2022-03-30 12:50:13 -05:00
										 |  |  |             def input = basePath.relativize(Paths.get(f.getAbsolutePath())) | 
					
						
							| 
									
										
										
										
											2022-03-11 12:13:00 -06:00
										 |  |  |             println(input.toString() + " => " + input.toString().replace(".proto", ".protoc")) | 
					
						
							|  |  |  |             exec { | 
					
						
							|  |  |  |                 workingDir "${projectDir}/src/test/resources" | 
					
						
							|  |  |  |                 commandLine 'protoc', '--proto_path=.', '--include_imports', '--include_source_info', | 
					
						
							|  |  |  |                         "--descriptor_set_out=${input.toString().replace(".proto", ".protoc")}", | 
					
						
							|  |  |  |                         input | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | jacocoTestReport { | 
					
						
							|  |  |  |     dependsOn test // tests are required to run before generating the report
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-19 09:24:03 -08:00
										 |  |  | test.finalizedBy jacocoTestReport | 
					
						
							| 
									
										
										
										
											2022-09-08 22:10:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task checkShadowJar(type: Exec) { | 
					
						
							|  |  |  |    commandLine 'sh', '-c', 'scripts/check_jar.sh' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //mark implementation dependencies which needs to excluded along with transitive dependencies from shadowjar
 | 
					
						
							|  |  |  | //functionality is exactly same as "implementation"
 | 
					
						
							|  |  |  | configurations { | 
					
						
							|  |  |  |     provided | 
					
						
							|  |  |  |     implementation.extendsFrom provided | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | shadowJar { | 
					
						
							|  |  |  |   zip64=true | 
					
						
							|  |  |  |   archiveClassifier = '' | 
					
						
							|  |  |  |   def exclude_modules = project | 
					
						
							|  |  |  |             .configurations | 
					
						
							|  |  |  |             .provided | 
					
						
							|  |  |  |             .resolvedConfiguration | 
					
						
							|  |  |  |             .getLenientConfiguration() | 
					
						
							|  |  |  |             .getAllModuleDependencies() | 
					
						
							|  |  |  |             .collect { | 
					
						
							|  |  |  |                 it.name | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |   dependencies { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     exclude(dependency { | 
					
						
							|  |  |  |             exclude_modules.contains(it.name) | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   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
 | 
					
						
							|  |  |  |     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' | 
					
						
							| 
									
										
										
										
											2022-12-07 05:28:17 -08:00
										 |  |  |     relocate 'antlr', 'datahub.shaded.antlr' | 
					
						
							| 
									
										
										
										
											2022-09-08 22:10:36 -07:00
										 |  |  |     relocate 'org.apache.commons', 'datahub.shaded.org.apache.commons' | 
					
						
							|  |  |  |     relocate 'org.apache.http', 'datahub.shaded.org.apache.http' | 
					
						
							|  |  |  |     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 'com.github.benmanes.caffeine', 'datahub.shaded.com.github.benmanes.caffeine' | 
					
						
							|  |  |  |     relocate 'org.checkerframework', 'datahub.shaded.org.checkerframework' | 
					
						
							|  |  |  |     relocate 'org.jgrapht', 'datahub.shaded.org.jgrapht' | 
					
						
							|  |  |  |     relocate 'org.jheaps', 'datahub.shaded.org.jheaps' | 
					
						
							| 
									
										
										
										
											2023-04-13 12:01:51 -05:00
										 |  |  |     relocate 'ch.randelshofer', 'datahub.shaded.ch.randelshofer' | 
					
						
							| 
									
										
										
										
											2022-09-08 22:10:36 -07:00
										 |  |  |   | 
					
						
							|  |  |  |   finalizedBy checkShadowJar | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | checkShadowJar { | 
					
						
							|  |  |  |    dependsOn shadowJar | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | assemble { | 
					
						
							|  |  |  |     dependsOn shadowJar | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task sourcesJar(type: Jar) { | 
					
						
							|  |  |  |      archiveClassifier = 'sources' | 
					
						
							|  |  |  |      from sourceSets.main.allSource | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task javadocJar(type: Jar) { | 
					
						
							|  |  |  |     archiveClassifier = 'javadoc' | 
					
						
							|  |  |  |     from javadoc | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | publishing { | 
					
						
							|  |  |  |   publications { | 
					
						
							|  |  |  |     shadow(MavenPublication) { | 
					
						
							|  |  |  |       publication -> project.shadow.component(publication) | 
					
						
							|  |  |  |       pom { | 
					
						
							|  |  |  |         name = 'Datahub Protobuf' | 
					
						
							|  |  |  |         group = 'io.acryl' | 
					
						
							|  |  |  |         artifactId = 'datahub-protobuf' | 
					
						
							|  |  |  |         description = 'DataHub integration with Protobuf schemas for metadata' | 
					
						
							|  |  |  |         url = 'https://datahubproject.io' | 
					
						
							|  |  |  |         artifacts = [ shadowJar, javadocJar, sourcesJar ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         scm { | 
					
						
							|  |  |  |           connection = 'scm:git:git://github.com/datahub-project/datahub.git' | 
					
						
							|  |  |  |           developerConnection = 'scm:git:ssh://github.com:datahub-project/datahub.git' | 
					
						
							|  |  |  |           url = 'https://github.com/datahub-project/datahub.git' | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         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") | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-18 18:04:47 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  | startScripts.dependsOn shadowJar |