1+ plugins {
2+ id ' java'
3+ id ' java-library'
4+ id ' maven-publish'
5+ id ' signing'
6+ id ' jacoco'
7+ // id 'com.github.spotbugs' version '5.2.1'
8+ id ' com.diffplug.spotless' version ' 6.25.0'
9+ // id 'org.graalvm.buildtools.native' version '0.10.3'
10+ }
11+
12+ group = ' com.uber'
13+ version = ' 4.1.3-SNAPSHOT'
14+ description = ' Java bindings for H3, a hierarchical hexagonal geospatial indexing system.'
15+
16+ java {
17+ sourceCompatibility = JavaVersion . VERSION_1_8
18+ targetCompatibility = JavaVersion . VERSION_1_8
19+ withJavadocJar()
20+ withSourcesJar()
21+ }
22+
23+ repositories {
24+ mavenCentral()
25+ }
26+
27+ dependencies {
28+ testImplementation ' org.openjdk.jmh:jmh-core:1.19'
29+ testAnnotationProcessor ' org.openjdk.jmh:jmh-generator-annprocess:1.19'
30+ testImplementation ' com.google.guava:guava:33.3.1-jre'
31+ testImplementation ' org.junit.jupiter:junit-jupiter:5.11.2'
32+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher:1.11.2'
33+ }
34+
35+ test {
36+ useJUnitPlatform()
37+ systemProperty ' junit.platform.listeners.uid.tracking.enabled' , ' true'
38+ finalizedBy jacocoTestReport
39+ }
40+
41+ // Native build properties
42+ ext {
43+ h3GitRemote = ' https://github.com/uber/h3.git'
44+ h3UseDocker = false // TODO: true
45+ h3SystemPrune = false
46+ h3DockcrossTag = ' 20240812-60fa1b0'
47+ h3DockcrossOnly = ' '
48+ h3GithubArtifactsUse = false
49+ h3GithubArtifactsByRun = ' '
50+ }
51+
52+ // Load H3 version from properties file
53+ def h3VersionProps = new Properties ()
54+ file(" h3version.properties" ). withInputStream { h3VersionProps. load(it) }
55+ ext. h3GitReference = h3VersionProps. getProperty(' h3.git.reference' )
56+
57+ // Task to build H3 native code
58+ task buildH3 (type : Exec ) {
59+ workingDir " ${ projectDir} "
60+ if (System . getProperty(' os.name' ). toLowerCase(). contains(' windows' )) {
61+ commandLine ' powershell' , ' -ExecutionPolicy' , ' Bypass' , ' -File' ,
62+ ' ./src/main/c/h3-java/build-h3-windows.ps1' , h3GitRemote, h3GitReference
63+ } else {
64+ commandLine ' ./src/main/c/h3-java/build-h3.sh' , h3GitRemote, h3GitReference, h3UseDocker,
65+ h3SystemPrune, h3DockcrossTag, h3DockcrossOnly,
66+ h3GithubArtifactsUse, h3GithubArtifactsByRun
67+ }
68+ }
69+
70+ compileJava {
71+ options. compilerArgs + = [' -h' , " ${ projectDir} /src/main/c/h3-java/src" ]
72+ finalizedBy buildH3
73+ }
74+
75+ spotless {
76+ java {
77+ googleJavaFormat()
78+ }
79+ }
80+
81+ jacoco {
82+ toolVersion = ' 0.8.12'
83+ }
84+
85+ jacocoTestReport {
86+ reports {
87+ xml. required = true
88+ html. required = true
89+ }
90+ }
91+
92+ publishing {
93+ publications {
94+ mavenJava(MavenPublication ) {
95+ from components. java
96+ pom {
97+ name = ' h3'
98+ url = ' https://github.com/uber/h3-java'
99+ licenses {
100+ license {
101+ name = ' Apache License, Version 2.0'
102+ url = ' https://www.apache.org/licenses/LICENSE-2.0.txt'
103+ distribution = ' repo'
104+ }
105+ }
106+ organization {
107+ name = ' Uber Open Source'
108+ url = ' https://github.com/uber/'
109+ }
110+ scm {
111+ connection = ' scm:git:git://github.com/uber/h3-java.git'
112+ developerConnection
= ' scm:git:ssh://[email protected] /uber/h3-java.git' 113+ url = ' http://github.com/uber/h3-java/tree/master'
114+ }
115+ developers {
116+ developer {
117+ name = ' Isaac Brodsky'
118+ 119+ organization = ' Uber Technologies, Inc.'
120+ organizationUrl = ' https://github.com/uber/'
121+ }
122+ }
123+ }
124+ }
125+ }
126+ // repositories {
127+ // maven {
128+ // def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
129+ // def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
130+ // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
131+ // credentials {
132+ // username = project.findProperty('ossrhUsername') ?: ''
133+ // password = project.findProperty('ossrhPassword') ?: ''
134+ // }
135+ // }
136+ // }
137+ }
138+
139+ signing {
140+ sign publishing. publications. mavenJava
141+ }
0 commit comments