-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle.kts
140 lines (130 loc) · 4.17 KB
/
build.gradle.kts
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
plugins {
`java-library`
`maven-publish`
signing
//id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
//version = "1.4.0"
group = "com.open-meteo"
sourceSets {
main {
java {
setSrcDirs(listOf("java"))
}
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
repositories {
mavenCentral()
}
dependencies {
api("com.google.flatbuffers:flatbuffers-java:24.3.25")
api("com.google.code.findbugs:jsr305:3.0.2")
constraints {
add("implementation", "com.google.flatbuffers:flatbuffers-java") {
version {
prefer("24.3.25")
require("22.10.0")
}
}
add("implementation", "com.google.code.findbugs:jsr305") {
version {
prefer("3.0.2")
require("3.0.0")
}
}
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("Open-Meteo Java SDK")
description.set("Compiled FlatBuffers schema files for the Open-Meteo Weather API")
url.set("https://open-meteo.com")
licenses {
license {
name.set("MIT")
url.set("https://github.com/open-meteo/sdk/blob/main/LICENSE")
}
}
developers {
developer {
id.set("patrick-zippenfenig")
name.set("Patrick Zippenfenig")
email.set("patrick@zippenfenig.de")
}
}
scm {
connection.set("scm:git:git://github.com/open-meteo/sdk.git")
developerConnection.set("scm:git:git://github.com/open-meteo/sdk.git")
url.set("https://github.com/open-meteo/sdk")
}
}
}
}
/*
Manuel deploy to maven central
- Enable repo below, set version
- ./gradlew publishMavenJavaPublicationToLocalRepository
- delete maven meta data
- zip com directory in ~/Download/local_repo
- deployment name "com.open-meteo:sdk:1.4.0"
*/
/*repositories {
maven {
name = "local"
url = uri("file://Users/patrick/Downloads/local_repo/")
}
}*/
}
// GitHub packages requires a github token even to read packages
// Not suitable for an easy workflow
/*publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/open-meteo/sdk")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_TOKEN")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GH_ACTOR")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
}*/
val signingKey: String? = providers.environmentVariable("GRADLE_SIGNING_KEY").orNull
val signingPassword: String? = providers.environmentVariable("GRADLE_SIGNING_PASSWORD").orNull
signing {
if (!signingKey.isNullOrBlank() && !signingPassword.isNullOrBlank()) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign(configurations.archives.get())
sign(publishing.publications["mavenJava"])
//sign(publishing.publications["gpr"])
} else {
logger.warn("The signing key and password are null. This can be ignored if this is a pull request.")
}
}
/*val sonatypeUsername: String? = providers.environmentVariable("SONATYPE_USERNAME").orNull
val sonatypePassword: String? = providers.environmentVariable("SONATYPE_PASSWORD").orNull
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = sonatypeUsername
password = sonatypePassword
}
}
}*/