Skip to content

Commit 5994474

Browse files
committed
fix: build script changes for github actions
1 parent 36cb1d4 commit 5994474

File tree

8 files changed

+66
-47
lines changed

8 files changed

+66
-47
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
strategy:
187187
fail-fast: true
188188
matrix:
189-
jdk: [ "openjdk:17-slim-buster", "openjdk:17-alpine" ]
189+
jdk: [ "openjdk:18-slim-buster", "openjdk:17-alpine" ]
190190

191191
defaults:
192192
run:

buildSrc/src/Deps.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ object Deps {
194194

195195
object ApiService {
196196
const val sdmv1 =
197-
"com.google.apis:google-api-services-smartdevicemanagement:v1-rev20210604-1.31.0"
197+
"com.google.apis:google-api-services-smartdevicemanagement:v1-rev20210604-1.31.5"
198198
}
199199

200200
const val re2j = "com.google.re2j:re2j:1.5"
@@ -673,7 +673,7 @@ inline val PluginDependenciesSpec.springboot get() = id("org.springframework.boo
673673
inline val PluginDependenciesSpec.springDepMgmt get() = id("io.spring.dependency-management") version "1.0.9.RELEASE"
674674

675675
// Static Analysis and Linting
676-
inline val PluginDependenciesSpec.spotless get() = id("com.diffplug.spotless") version "5.13.0"
676+
inline val PluginDependenciesSpec.spotless get() = id("com.diffplug.spotless") version "5.14.0"
677677
inline val PluginDependenciesSpec.spotlessChangelog get() = id("com.diffplug.spotless-changelog") version "2.2.0"
678678
inline val PluginDependenciesSpec.spotbugs get() = id("com.github.spotbugs") version "4.3.0"
679679
inline val PluginDependenciesSpec.ktlint get() = id("com.eden.orchidPlugin") version "9.3.0"

buildSrc/src/main/kotlin/plugins/common.gradle.kts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ tasks {
2727
val uberJar = named("shadowJar", Jar::class)
2828
val jarFile = uberJar.get().archiveFile.get().asFile
2929

30-
val jdeps = ToolProvider.findFirst("jdeps").orElseGet { error("") }
30+
val jdeps =
31+
ToolProvider.findFirst("jdeps").orElseGet { error("jdeps tool is missing in the JDK!") }
3132
val out = StringWriter()
3233
val pw = PrintWriter(out)
3334
jdeps.run(pw, pw, "--print-module-deps", "--ignore-missing-deps", jarFile.absolutePath)
@@ -38,33 +39,32 @@ tasks {
3839
dependsOn("shadowJar")
3940
}
4041

42+
4143
val copyTemplates by registering(Copy::class) {
42-
description = "Generate template classes."
44+
description = "Generate template classes"
4345
group = LifecycleBasePlugin.BUILD_TASK_NAME
4446

45-
val configuredVersion = providers
46-
.gradleProperty("version")
47-
.forUseAtConfigurationTime()
48-
.get()
49-
50-
val props = project.extra.properties
51-
props["projectVersion"] = project.version
52-
props["configuredVersion"] = configuredVersion
53-
props["kotlinVersion"] = System.getProperty("kotlinVersion")
47+
// Github actions workaround
48+
val props = project.properties.toMutableMap()
49+
props["git_branch"] = project.findProperty("branch_name")
50+
props["git_tag"] = project.findProperty("base_tag")
5451

55-
val debug: String by project
52+
val debug: String? by project
5653
if (debug.toBoolean()) {
5754
props.forEach { (t, u) ->
5855
println("%1\$-42s --> %2\$s".format(t, u))
5956
}
6057
}
6158

6259
filteringCharset = "UTF-8"
63-
inputs.property("buildversions", props.hashCode())
6460
from(project.projectDir.resolve("src/main/templates"))
6561
into(project.buildDir.resolve("generated-sources/templates/kotlin/main"))
6662
exclude { it.name.startsWith("jte") }
6763
expand(props)
64+
65+
// val configuredVersion = providers.gradleProperty("version").forUseAtConfigurationTime().get()
66+
// expand("configuredVersion" to configuredVersion)
67+
// inputs.property("buildversions", props.hashCode())
6868
}
6969

7070
/**

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ systemProp.jvmArguments=--enable-preview
5555

5656
## Application properties
5757
group=dev.suresh
58-
version=1.1.0
5958
appMainClass=dev.suresh.Main
6059
description=OpenJDK latest release playground!
6160
debug=false
61+
#version=2.0.0

src/main/java/JavaApp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ public static void main(String[] args) throws Exception {
9999
out.println(stats);
100100

101101
out.printf("%n✧✧✧✧✧ Streams ✧✧✧✧✧%n");
102-
Stream.of("java", "kotlin", "scala")
102+
Stream.of("java", "kotlin", "scala", " ")
103103
.map(String::toUpperCase)
104+
.filter(s -> !s.isBlank())
104105
.mapMulti(
105106
(s, consumer) -> {
106107
consumer.accept(s);

src/main/kotlin/dev/suresh/jte/RenderJte.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RenderJte {
1818
"ktConfig" to KtConfig(
1919
version = App.KOTLIN_VERSION,
2020
appVersion = App.VERSION
21-
),
21+
)
2222
)
2323

2424
listOf("hello.jte", "hello-kt.kte").forEach {

src/main/templates/App.kt

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,45 @@
99
* [semver]: https://semver.org
1010
*/
1111
object App {
12-
/**
13-
* Application version.
14-
*/
15-
const val VERSION = "$projectVersion"
12+
/**
13+
* Application version.
14+
*/
15+
const val VERSION = "$version"
1616

17-
/**
18-
* Application base version used for calculating the version.
19-
*/
20-
const val BASE_VERSION = "$base_version"
17+
/**
18+
* Application base version used for calculating the version.
19+
*/
20+
const val BASE_VERSION = "$base_version"
2121

22-
/**
23-
* Java version used for building the app.
24-
*/
25-
const val JAVA_VERSION = "${getProperty('systemProp.javaVersion')}"
22+
/**
23+
* Java version used for building the app.
24+
*/
25+
const val JAVA_VERSION = "${getProperty('systemProp.javaVersion')}"
2626

27-
/**
28-
* Kotlin library version.
29-
*/
30-
const val KOTLIN_VERSION = "$kotlinVersion"
27+
/**
28+
* Kotlin library version.
29+
*/
30+
const val KOTLIN_VERSION = "${getProperty('systemProp.kotlinVersion')}"
3131

32-
/**
33-
* Gradle version
34-
*/
35-
const val GRADLE_VERSION = "${getProperty('systemProp.gradleRelease')}"
32+
/**
33+
* Gradle version
34+
*/
35+
const val GRADLE_VERSION = "${getProperty('systemProp.gradleRelease')}"
3636

37-
/**
38-
* Git [Metadata](https://github.com/jgitver/jgitver/blob/master/src/main/java/fr/brouillard/oss/jgitver/metadata/Metadatas.java).
39-
*/
40-
const val GIT_SHA1_8 = "$git_sha1_8"
37+
/**
38+
* Git [Metadata](https://github.com/jgitver/jgitver/blob/master/src/main/java/fr/brouillard/oss/jgitver/metadata/Metadatas.java).
39+
*/
40+
const val GIT_SHA1_8 = "$git_sha1_8"
4141

42-
const val GIT_BRANCH = "$branch_name"
42+
const val GIT_SHA1_FULL = "$git_sha1_full"
4343

44-
const val GIT_COMMIT_TIMESTAMP = "$commit_timestamp"
44+
const val GIT_BRANCH = "$git_branch"
4545

46-
const val GIT_COMMITER_NAME = "$head_committer_name"
46+
const val GIT_TAG = "$git_tag"
4747

48-
const val GIT_COMMITER_EMAIL = "$head_commiter_email"
48+
const val GIT_COMMIT_TIMESTAMP = "$commit_timestamp"
49+
50+
const val GIT_COMMITER_NAME = "$head_committer_name"
51+
52+
const val GIT_COMMITER_EMAIL = "$head_commiter_email"
4953
}

src/main/templates/jte/hello-kt.kte

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,18 @@
88
App Version = ${ktConfig.appVersion ?: "1.0.0"}
99
${config.language()} = ${config.version()}
1010
${ktConfig.language} = ${ktConfig.version}
11+
----------Application Properties-----------
12+
VERSION : ${App.VERSION}
13+
BASE_VERSION : ${App.BASE_VERSION}
14+
JAVA_VERSION : ${App.JAVA_VERSION}
15+
KOTLIN_VERSION : ${App.KOTLIN_VERSION}
16+
GRADLE_VERSION : ${App.GRADLE_VERSION}
17+
GIT_BRANCH : ${App.GIT_BRANCH}
18+
GIT_TAG : ${App.GIT_TAG}
19+
GIT_COMMITER_EMAIL : ${App.GIT_COMMITER_EMAIL}
20+
GIT_COMMITER_NAME : ${App.GIT_COMMITER_NAME}
21+
GIT_COMMIT_TIMESTAMP : ${App.GIT_COMMIT_TIMESTAMP}
22+
GIT_SHA1_8 : ${App.GIT_SHA1_8}
23+
GIT_SHA1_FULL : ${App.GIT_SHA1_FULL}
24+
-------------------------------------------
1125
Rendered By Kotlin Jte on ${LocalDateTime.now().toString()}

0 commit comments

Comments
 (0)