-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
178 lines (160 loc) · 5.12 KB
/
build.gradle
File metadata and controls
178 lines (160 loc) · 5.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
plugins {
id 'com.github.ben-manes.versions' version '0.53.0'
id 'scala'
// id 'java-library'
// id 'maven-publish'
id 'signing'
id 'com.gradle.plugin-publish' version '2.0.0'
// id 'com.gradleup.nmcp.aggregation' version '1.4.0'
}
group = 'org.podval.tools'
version = '0.4.3'
description = 'Deploy Service to Google Cloud Run'
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
scala.scalaVersion = '3.7.4'
project.gradle.startParameter.excludedTaskNames.add('compileJava')
dependencies {
implementation 'com.google.auth:google-auth-library-oauth2-http:1.41.0'
implementation 'com.google.api-client:google-api-client:2.8.1'
implementation 'org.slf4j:slf4j-api:2.0.17'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.20.1'
// see https://cloud.google.com/run/docs/reference/about-apis -
// I am making API calls, but I rely on Kubernetes compatibility, so I am staying with v1.
implementation 'com.google.apis:google-api-services-run:v1-rev20251202-2.0.0'
// JIB Gradle plugin versions after 3.2.1 are available as Maven artifacts only
// - in the Gradle Plugin Portal Maven repository and
// - without the `gradle.plugin.` prefix on the group
// (see https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/build.gradle#L10):
compileOnly 'com.google.cloud.tools:jib-gradle-plugin:3.5.2'
}
def isNonStable = { String version ->
boolean stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
String regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
tasks.withType(ScalaCompile).configureEach {
scalaCompileOptions.with {
additionalParameters = [
'-new-syntax',
'-feature',
'-language:strictEquality',
'-source:future'
]
}
}
jar {
manifest {
attributes(
'Implementation-Title' : project.description,
'Implementation-Version': project.version
)
}
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}
tasks.register('scaladocJar', Jar) {
from scaladoc.destinationDir
archiveClassifier.set('scaladoc')
}
scaladocJar.dependsOn scaladoc
// There is no Java in the project, but Maven Central requires javadoc JAR...
tasks.register('javadocJar', Jar) {
from javadoc.destinationDir
archiveClassifier.set('javadoc')
}
javadocJar.dependsOn(javadoc)
final String gitHubRepository = "dubinsky/cloud-run"
final String gitHubRepositoryUrl = "https://github.com/$gitHubRepository"
final String orgName = 'Podval Group'
final String orgUrl = 'https://www.podval.org'
publishing {
publications {
library(MavenPublication) {
from components.java
artifact sourcesJar
artifact scaladocJar
artifact javadocJar
pom {
name = project.name
description = project.description
url = gitHubRepositoryUrl
scm {
url = gitHubRepositoryUrl
connection = "scm:git:git://github.com/${gitHubRepository}.git"
developerConnection = "scm:git:ssh://github.com/${gitHubRepository}.git"
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
comments = 'A business-friendly OSS license'
}
}
organization {
name = orgName
url = orgUrl
}
developers {
developer {
id = 'dub'
name = 'Leonid Dubinsky'
email = '[email protected]'
url = 'https://dub.podval.org'
organization = orgName
organizationUrl = orgUrl
timezone = '-5'
}
}
}
}
}
}
signing {
sign publishing.publications.library
useInMemoryPgpKeys(
findProperty('signingKey') as String,
findProperty('signingPassword') as String
)
}
gradlePlugin {
website = gitHubRepositoryUrl
vcsUrl = gitHubRepositoryUrl //.git' ?
plugins {
cloudRun {
id = project.name
implementationClass = 'org.podval.tools.cloudrun.CloudRunPlugin'
displayName = project.description
description = project.description
tags = ['Google', 'CloudRun', 'JIB', 'Docker']
}
}
}
// ./gradlew nmcpZipAggregation - to see what will be published
// ./gradlew publishAggregationToCentralPortal - to publish
// https://central.sonatype.com/publishing/deployments - to release
//nmcpAggregation {
// centralPortal {
// publishingType = "USER_MANAGED"
// username = findProperty('mavenCentralUsername') as String
// password = findProperty('mavenCentralPassword') as String
// }
//}
//
//tasks.register('uploadLibrary')
//uploadLibrary.description = 'Upload artifacts'
//uploadLibrary.group = 'publishing'
//uploadLibrary.dependsOn(publishAggregationToCentralPortal)
//
//tasks.register('upload')
//upload.description = 'Upload artifacts and plugins'
//upload.group = 'publishing'
//upload.dependsOn(uploadLibrary)
//upload.dependsOn(publishPlugins)