-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1e87a8
commit 99dc618
Showing
19 changed files
with
7,658 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
kotlin version: 2.0.20 | ||
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output: | ||
1. Kotlin compile daemon is ready | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
kotlin version: 2.0.20 | ||
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output: | ||
1. Kotlin compile daemon is ready | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
kotlin version: 2.0.20 | ||
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output: | ||
1. Kotlin compile daemon is ready | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
kotlin("jvm") version "2.0.20" | ||
kotlin("plugin.serialization") version "2.0.20" | ||
|
||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") | ||
implementation("com.squareup:kotlinpoet-jvm:1.18.1") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
32 changes: 32 additions & 0 deletions
32
buildSrc/src/main/kotlin/io/portone/openapi/GenerateSchemaCodeTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.portone.openapi | ||
|
||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.jsonObject | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.TaskAction | ||
import java.nio.file.Files | ||
|
||
abstract class GenerateSchemaCodeTask : DefaultTask() { | ||
@get:InputFile | ||
abstract val inputFile: RegularFileProperty | ||
|
||
@get:OutputDirectory | ||
abstract val outputDirectory: DirectoryProperty | ||
|
||
@TaskAction | ||
fun generateSchemaCode() { | ||
val document = Json.parseToJsonElement(Files.readString(inputFile.get().asFile.toPath())).jsonObject | ||
SchemaGenerator(document, listOf( | ||
"/payments", | ||
"/payment-schedules", | ||
"/identity-verifications", | ||
"/billing-keys", | ||
"/cash-receipts", | ||
"/kakaopay", | ||
), outputDirectory.get().asFile.toPath()).generateFiles() | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
buildSrc/src/main/kotlin/io/portone/openapi/PatchCodeTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package io.portone.openapi | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.tasks.InputDirectory | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.TaskAction | ||
import java.io.ByteArrayOutputStream | ||
import java.nio.file.Files | ||
import kotlin.io.path.listDirectoryEntries | ||
import kotlin.io.path.relativeTo | ||
|
||
abstract class PatchCodeTask : DefaultTask() { | ||
@get:InputDirectory | ||
abstract val originDirectory: DirectoryProperty | ||
|
||
@get:InputDirectory | ||
abstract val patchesDirectory: DirectoryProperty | ||
|
||
@get:OutputDirectory | ||
abstract val outputDirectory: DirectoryProperty | ||
|
||
companion object { | ||
private const val TAG_NAME = "patch-base" | ||
} | ||
|
||
@TaskAction | ||
fun patchCode() { | ||
val originDirectory = this.originDirectory.get().asFile.toPath() | ||
val patchesDirectory = this.patchesDirectory.get().asFile.toPath() | ||
val outputDirectory = this.outputDirectory.get().asFile.toPath() | ||
|
||
Files.createDirectories(outputDirectory) | ||
|
||
project.exec { | ||
it.workingDir = outputDirectory.toFile() | ||
it.executable = "git" | ||
it.args = listOf("init") | ||
} | ||
|
||
project.exec { | ||
it.workingDir = outputDirectory.toFile() | ||
it.executable = "git" | ||
it.args = listOf("config", "commit.gpgSign", "false") | ||
}.assertNormalExitValue() | ||
|
||
project.exec { | ||
it.workingDir = project.rootProject.projectDir | ||
it.executable = "git" | ||
it.args = listOf("tag", TAG_NAME) | ||
}.assertNormalExitValue() | ||
|
||
project.exec { | ||
it.workingDir = project.rootProject.projectDir | ||
it.executable = "git" | ||
it.args = listOf("filter-repo", "--force", "--subdirectory-filter", originDirectory.relativeTo(project.rootProject.projectDir.toPath()).toString(), "--target", outputDirectory.toString()) | ||
}.assertNormalExitValue() | ||
|
||
project.exec { | ||
it.workingDir =project.rootProject.projectDir | ||
it.executable = "git" | ||
it.args = listOf("tag", "-d", TAG_NAME) | ||
}.assertNormalExitValue() | ||
|
||
project.exec { | ||
it.workingDir = outputDirectory.toFile() | ||
it.executable = "git" | ||
it.args = listOf("checkout", TAG_NAME) | ||
}.assertNormalExitValue() | ||
|
||
project.exec { | ||
it.workingDir = outputDirectory.toFile() | ||
it.executable = "git" | ||
it.args = listOf("am", "--abort") | ||
it.standardOutput = ByteArrayOutputStream() | ||
it.errorOutput = ByteArrayOutputStream() | ||
} | ||
|
||
val patchFiles = patchesDirectory.listDirectoryEntries("*.patch").sorted() | ||
|
||
project.exec { | ||
it.workingDir = outputDirectory.toFile() | ||
it.executable = "git" | ||
it.args = listOf("am", "--3way", *patchFiles.map { it.toString() }.toTypedArray()) | ||
}.assertNormalExitValue() | ||
} | ||
} |
Oops, something went wrong.