forked from bluecontract/blue-language-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
166 lines (141 loc) · 4.41 KB
/
build.gradle
File metadata and controls
166 lines (141 loc) · 4.41 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
162
163
164
165
166
buildscript {
dependencies {
classpath 'org.apache.groovy:groovy-toml:4.0.22'
}
}
plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'org.jreleaser' version '1.13.1'
}
group = "blue.language"
version = determineProjectVersion()
archivesBaseName = "blue-language-java"
repositories {
if (!System.getenv('CI')) {
mavenLocal()
}
mavenCentral()
}
java {
withJavadocJar()
withSourcesJar()
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
// JUnit Jupiter (JUnit 5)
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core:3.12.4")
// Jackson
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2")
implementation("commons-codec:commons-codec:1.15")
implementation("org.apache.httpcomponents:httpclient:4.5.14")
implementation("org.reflections:reflections:0.10.2")
implementation("io.github.erdtman:java-json-canonicalization:1.1")
}
test {
useJUnitPlatform()
reports {
junitXml.required = false
html.required = true
}
}
ext.genResourcesDir = file("$buildDir/generated-resources")
task generateBuildProperties {
ext.buildPropertiesFile = file("$genResourcesDir/blue/language/build.properties")
outputs.file(buildPropertiesFile)
doLast {
buildPropertiesFile.text = """\
|blue-language-java.build.version=$project.version
|blue-language-java.build.timestamp=${new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")}
""".stripMargin().trim()
}
}
sourceSets.main.output.dir genResourcesDir, builtBy: generateBuildProperties
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
publishing {
publications {
maven(MavenPublication) {
groupId = "blue.language"
artifactId = 'blue-language-java'
from components.java
pom {
name = 'Blue Language Java Library'
description = 'Java client library for Blue Language'
url = 'https://timeline.blue'
licenses {
license {
name = 'MIT license'
url = 'https://github.com/bluecontract/blue-language-java/blob/master/LICENSE'
}
}
developers {
developer {
name = 'Blue'
email = 'devsupport@timeline.blue'
}
}
scm {
url = 'https://github.com/bluecontract/blue-language-java.git'
connection = 'scm:git:git@github.com:bluecontract/blue-language-java.git'
developerConnection = 'scm:git:git@github.com:bluecontract/blue-language-java.git'
}
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
if (!System.getenv('CI')) {
maven {
name = 'local'
url = uri('file:///' + new File(System.getProperty("user.home"), ".m2/repository").absolutePath)
}
}
}
}
if (System.getenv('CI')) {
jreleaser {
signing {
active = 'ALWAYS'
armored = true
}
project {
description = 'Java client library for Blue Language'
copyright = '© 2024 Blue Company. Licensed under the MIT License'
}
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
applyMavenCentralRules = true
snapshotSupported = true
stagingRepository('build/staging-deploy')
}
}
}
}
}
}
def determineProjectVersion() {
def tomlFile = file('.cz.toml')
if (tomlFile.exists()) {
def toml = new groovy.toml.TomlSlurper().parse(tomlFile)
return toml.tool.commitizen.version + (!System.getenv('CI') ? '-SNAPSHOT' : '')
} else {
throw new GradleException(".cz.toml file not found")
}
}