From 668249ced119e0e409c886ba4c95dbaa37331e24 Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 16:38:35 +0900 Subject: [PATCH 01/10] =?UTF-8?q?./gradlew=20run=20=E3=81=A7=E5=AE=9F?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + .idea/workspace.xml | 72 +++++++++++++++++++++++++++++---------------- build.gradle.kts | 6 +++- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 14746e7..2a65317 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - { - "associatedIndex": 2 -} - - - - - { - "keyToString": { - "Gradle.Build ga913yaml.executor": "Run", - "Kotlin.MainKt.executor": "Run", - "RunOnceActivity.ShowReadmeOnStart": "true", - "SHARE_PROJECT_CONFIGURATION_FILES": "true", - "git-widget-placeholder": "command__line", - "kotlin-language-version-configured": "true", - "settings.editor.selected.configurable": "preferences.pluginManager" - } -} - - - - - - - - - - - - - - - - - - - 1723360648238 - - - - - - - - - - - - - - \ No newline at end of file From 7664125565ac8db22c9eff90ab8ff437af19897c Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 16:55:10 +0900 Subject: [PATCH 06/10] =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=83=B3=E5=BC=95=E6=95=B0=E3=83=98=E3=83=AB?= =?UTF-8?q?=E3=83=97=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt b/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt index c212da6..52a1826 100644 --- a/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt +++ b/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt @@ -2,7 +2,8 @@ package com.tfandkusu.ga913yaml fun main(args: Array) { if (args.isEmpty()) { - println("./gradlew run validate or make") + println("./gradlew run --args validate") + println("./gradlew run --args make") return } val command = args[0] From 3748a1bc3bd7b6f764ac59c063ece9c6318e18a0 Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 17:02:11 +0900 Subject: [PATCH 07/10] =?UTF-8?q?Kotlin=20=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=20libs.versions.toml=20=E3=81=A7?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- gradle/libs.versions.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 260afe2..8169eb9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "2.0.0" + kotlin("jvm") version libs.versions.kotlin application } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..9d02cec --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,4 @@ +[versions] +kotlin = "2.0.0" +[plugins] +spotless = { id = "com.diffplug.spotless", version = "6.25.0" } From 53d5c4b16feab29608fd81b8ba4987138f885cf0 Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 17:05:31 +0900 Subject: [PATCH 08/10] =?UTF-8?q?Spotless=20Gradle=20Plugin=20=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 7 +++++++ src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8169eb9..cc526b0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ plugins { kotlin("jvm") version libs.versions.kotlin application + alias(libs.plugins.spotless) } group = "com.tfandkusu" @@ -23,3 +24,9 @@ kotlin { application { mainClass.set("com.tfandkusu.ga913yaml.MainKt") } +spotless { + kotlin { + target("**/*.kt") + ktlint("1.3.1") + } +} diff --git a/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt b/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt index 52a1826..4c4e616 100644 --- a/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt +++ b/src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt @@ -7,7 +7,7 @@ fun main(args: Array) { return } val command = args[0] - when(command) { + when (command) { "validate" -> println("Validate") "make" -> println("Make") else -> println("Unknown command") From f89702e8ee450328fcb5ce1a7f6e1ae21755f5a5 Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 17:06:08 +0900 Subject: [PATCH 09/10] =?UTF-8?q?CI=20=E3=81=A7=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=88=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 48de995..a7f4aad 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,4 +21,5 @@ jobs: distribution: 'temurin' java-version: '17' - uses: gradle/gradle-build-action@v2 + - run: ./gradlew spotlessCheck - run: ./gradlew run --args validate From 9ebb220afa4ac5e5414f1d9be9b61604ee662708 Mon Sep 17 00:00:00 2001 From: Haruhiko Takada Date: Sun, 11 Aug 2024 17:34:28 +0900 Subject: [PATCH 10/10] =?UTF-8?q?=E5=8D=98=E4=BD=93=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 1 + build.gradle.kts | 3 ++- gradle/libs.versions.toml | 2 ++ .../kotlin/com/tfandkusu/ga913yaml/MainTest.kt | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/test/kotlin/com/tfandkusu/ga913yaml/MainTest.kt diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a7f4aad..ad67c8a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,4 +22,5 @@ jobs: java-version: '17' - uses: gradle/gradle-build-action@v2 - run: ./gradlew spotlessCheck + - run: ./gradlew test - run: ./gradlew run --args validate diff --git a/build.gradle.kts b/build.gradle.kts index cc526b0..9c75301 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,10 +13,11 @@ repositories { dependencies { testImplementation(kotlin("test")) + testImplementation(libs.junit) } tasks.test { - useJUnitPlatform() + useJUnit() } kotlin { jvmToolchain(17) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9d02cec..e3bea0c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,6 @@ [versions] kotlin = "2.0.0" +[libraries] +junit = "junit:junit:4.13.2" [plugins] spotless = { id = "com.diffplug.spotless", version = "6.25.0" } diff --git a/src/test/kotlin/com/tfandkusu/ga913yaml/MainTest.kt b/src/test/kotlin/com/tfandkusu/ga913yaml/MainTest.kt new file mode 100644 index 0000000..dd7e43f --- /dev/null +++ b/src/test/kotlin/com/tfandkusu/ga913yaml/MainTest.kt @@ -0,0 +1,17 @@ +package com.tfandkusu.ga913yaml + +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test + +class MainTest { + @Before + fun setup() { + println("setup") + } + + @Test + fun test() { + assertTrue(true) + } +}