-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (88 loc) · 3.05 KB
/
Copy pathbuild.gradle
File metadata and controls
101 lines (88 loc) · 3.05 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
plugins {
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
id 'maven-publish'
}
allprojects {
// With this, we can reference java dependencies within git. https://www.jvt.me/posts/2021/10/27/gradle-plugin-jitpack/
repositories {
mavenCentral()
}
// Don't cache snapshots
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
spotless {
java {
palantirJavaFormat()
}
groovyGradle {
target '*.gradle' // default target of groovyGradle
greclipse()
indentWithSpaces()
}
}
java {
withSourcesJar()
withJavadocJar()
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
dependencies {
implementation 'com.google.guava:guava:32.1.1-jre'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0'
implementation 'org.slf4j:slf4j-api:2.0.12'
implementation 'com.google.auto.service:auto-service:1.1.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.8'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testImplementation 'org.assertj:assertj-core:3.27.7'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
group = 'com.ziro.engineering'
version = resolveProjectVersion()
def resolveProjectVersion() {
def gitDescribe = 'git describe --exact-match HEAD'.execute().text.trim()
def version = file("${rootDir}/version.txt").text.trim()
def branchName = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
return gitDescribe ? version : branchName + '-SNAPSHOT'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = uri("https://repository.goziro.com/repository/engineering/")
credentials {
try {
username = System.getenv("SONATYPE_USERNAME") as String
password = System.getenv("SONATYPE_PASSWORD") as String
} catch (Exception e) {
throw new Exception("SONATYPE_USERNAME and/or SONATYPE_PASSWORD environment variables are not set! Configure the following environment variables: SONATYPE_USERNAME=gradle SONATYPE_PASSWORD=<get password from 1pass>", e)
}
}
}
}
}
tasks.withType(PublishToMavenRepository).configureEach {
def predicate = provider {
version.contains('SNAPSHOT') || System.getenv().getOrDefault('CI_MODE', 'false') == 'true'
}
onlyIf("Artifact is a snapshot or running in CI") {
predicate.get()
}
}