Skip to content

Commit 291f9aa

Browse files
committed
gradle
1 parent 080aca7 commit 291f9aa

File tree

10 files changed

+517
-449
lines changed

10 files changed

+517
-449
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ release.properties
2828
.vscode/
2929

3030
.DS_Store
31+
build/
32+
.gradle/

build.gradle

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
}

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.configuration-cache=true
5+

gradle/libs.versions.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3+
4+
[versions]
5+
com-google-guava-guava = "33.3.1-jre"
6+
org-junit-jupiter-junit-jupiter = "5.11.2"
7+
org-junit-platform-junit-platform-launcher = "1.11.2"
8+
org-openjdk-jmh-jmh-core = "1.19"
9+
org-openjdk-jmh-jmh-generator-annprocess = "1.19"
10+
11+
[libraries]
12+
com-google-guava-guava = { module = "com.google.guava:guava", version.ref = "com-google-guava-guava" }
13+
org-junit-jupiter-junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "org-junit-jupiter-junit-jupiter" }
14+
org-junit-platform-junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "org-junit-platform-junit-platform-launcher" }
15+
org-openjdk-jmh-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "org-openjdk-jmh-jmh-core" }
16+
org-openjdk-jmh-jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "org-openjdk-jmh-jmh-generator-annprocess" }

gradle/wrapper/gradle-wrapper.jar

42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)