-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
161 lines (136 loc) · 4.12 KB
/
build.gradle
File metadata and controls
161 lines (136 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import org.jreleaser.gradle.plugin.JReleaserExtension
plugins {
id 'java'
// MIT
id "io.freefair.lombok" version "8.10.2"
id 'java-library'
id 'maven-publish'
id 'signing'
id 'org.jreleaser' version "1.19.0"
}
java {
sourceCompatibility = 1.17
targetCompatibility = 1.17
}
// Ensure source and target compatibility
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17) // Or your desired Java version
}
// This ensures sources.jar is created
withSourcesJar()
// This ensures javadoc.jar is created
withJavadocJar()
}
ext {
appVersion = "0.0.1"
}
group = 'dev.datatracks'
version = appVersion
repositories {
mavenCentral()
}
dependencies {
// Apache 2.0
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.18.1'
// Apache 2.0
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.18.1'
// Apache 2.0
implementation group: 'com.google.flatbuffers', name: 'flatbuffers-java', version: '24.3.25'
// Apache 2.0
compileOnly 'org.jetbrains:annotations:26.0.2'
// Testing
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
tasks.withType(JavaCompile).configureEach {
options.annotationProcessorPath = configurations.annotationProcessor
}
tasks.register('copyProtocol', Copy) {
dependsOn(":generateEffectiveLombokConfig")
from "protocol/generated/java/protocol"
into layout.buildDirectory.dir("generated/flatbuffers").get().asFile
}
compileJava.dependsOn copyProtocol
delombok.dependsOn copyProtocol
sourcesJar.dependsOn copyProtocol
sourceSets {
main {
java {
srcDir "$buildDir/generated/flatbuffers" // Adds generated FlatBuffers classes to Java source
}
}
}
test {
useJUnitPlatform()
}
jar {
enabled = true
archiveBaseName = 'JavaTracks'
archiveVersion = appVersion
archiveFileName = 'javatracks.jar'
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = "dev.datatracks"
artifactId = "javatracks"
from components.java
// Optional: Customize artifactId if different from project name
// artifactId = 'my-awesome-library'
pom {
name = 'javatracks'
description = 'Java client to interact with DataTracks.'
url = 'https://github.com/data-tracks/JavaTracks'
licenses {
license {
name = 'The GNU General Public License v3.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'datomo'
name = 'David Lengweiler'
email = 'dave.lengw@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/data-tracks/JavaTracks.git'
developerConnection = 'scm:git:ssh://github.com:data-tracks/JavaTracks.git'
url = 'https://github.com/data-tracks/JavaTracks'
}
}
}
}
repositories {
maven {
name = "localStaging" // A descriptive name for this local repo
// Point this to the *same* directory as JReleaser's stagingRepository
url = layout.buildDirectory.dir("local-staging-repo")
}
}
}
signing {
setRequired {
gradle.taskGraph.allTasks.any { it.name.contains("LocalMavenWithChecksums") }
}
sign publishing.publications.mavenJava
}
jreleaser {
signing {
active = 'ALWAYS'
armored = true
}
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository(file("build/local-staging-repo").absolutePath)
}
}
}
}
}