Skip to content

Commit a2cb379

Browse files
committed
Update to Kotlin 1.8.0
Also make the build log a bit less noisy
1 parent d1252e5 commit a2cb379

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1717
import org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask
1818

1919
plugins {
20-
kotlin("jvm") version "1.7.20"
20+
kotlin("jvm") version "1.8.0"
2121
java
2222
mcdev
2323
groovy

buildSrc/src/main/kotlin/util.kt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* MIT License
99
*/
1010

11+
import java.io.ByteArrayOutputStream
1112
import org.cadixdev.gradle.licenser.LicenseExtension
1213
import org.gradle.api.JavaVersion
1314
import org.gradle.api.Project
@@ -30,14 +31,19 @@ fun Project.lexer(flex: String, pack: String): TaskDelegate<JavaExec> {
3031
val src = layout.projectDirectory.file("src/main/grammars/$flex.flex")
3132
val dst = layout.buildDirectory.dir("gen/$pack")
3233
val output = layout.buildDirectory.file("gen/$pack/$flex.java")
34+
val logOutout = layout.buildDirectory.file("logs/generate$flex.log")
3335

3436
val jflex by project.configurations
3537
val jflexSkeleton by project.configurations
3638

3739
classpath = jflex
3840
mainClass.set("jflex.Main")
3941

40-
doFirst {
42+
val taskOutput = ByteArrayOutputStream()
43+
standardOutput = taskOutput
44+
errorOutput = taskOutput
45+
46+
doFirst {
4147
args(
4248
"--skel", jflexSkeleton.singleFile.absolutePath,
4349
"-d", dst.get().asFile.absolutePath,
@@ -46,6 +52,11 @@ fun Project.lexer(flex: String, pack: String): TaskDelegate<JavaExec> {
4652

4753
// Delete current lexer
4854
project.delete(output)
55+
logOutout.get().asFile.parentFile.mkdirs()
56+
}
57+
58+
doLast {
59+
logOutout.get().asFile.writeBytes(taskOutput.toByteArray())
4960
}
5061

5162
inputs.files(src, jflexSkeleton)
@@ -64,12 +75,13 @@ fun Project.parser(bnf: String, pack: String): TaskDelegate<JavaExec> {
6475
val dst = dstRoot.map { it.dir(pack) }
6576
val psiDir = dst.map { it.dir("psi") }
6677
val parserDir = dst.map { it.dir("parser") }
78+
val logOutout = layout.buildDirectory.file("logs/generate$bnf.log")
6779

6880
val grammarKit by project.configurations
6981

70-
doFirst {
71-
project.delete(psiDir, parserDir)
72-
}
82+
val taskOutput = ByteArrayOutputStream()
83+
standardOutput = taskOutput
84+
errorOutput = taskOutput
7385

7486
classpath = grammarKit
7587
mainClass.set("org.intellij.grammar.Main")
@@ -83,7 +95,12 @@ fun Project.parser(bnf: String, pack: String): TaskDelegate<JavaExec> {
8395
}
8496

8597
doFirst {
98+
project.delete(psiDir, parserDir)
8699
args(dstRoot.get().asFile, src.asFile)
100+
logOutout.get().asFile.parentFile.mkdirs()
101+
}
102+
doLast {
103+
logOutout.get().asFile.writeBytes(taskOutput.toByteArray())
87104
}
88105

89106
inputs.file(src)

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ coreVersion = 1.5.21
1818
downloadIdeaSources = true
1919

2020
pluginTomlVersion = 221.5080.126
21+
22+
kotlin.stdlib.default.dependency = false

0 commit comments

Comments
 (0)