Compare commits
3 Commits
e12cb1cac7
...
a4add8adbc
| Author | SHA1 | Date | |
|---|---|---|---|
| a4add8adbc | |||
| 8ad1e8d884 | |||
| 37dba17074 |
@ -8,15 +8,14 @@ plugins {
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
dependencies {
|
||||
implementation("org.slf4j:slf4j-api:2.0.0-alpha1")
|
||||
runtimeOnly("org.slf4j:slf4j-simple:2.0.0-alpha1")
|
||||
implementation("io.pebbletemplates:pebble:3.1.5")
|
||||
implementation("com.github.ajalt.clikt:clikt:3.1.0")
|
||||
implementation("org.graalvm.js:js:21.0.0.2")
|
||||
implementation("org.slf4j:slf4j-api:2.0.7")
|
||||
runtimeOnly("org.slf4j:slf4j-simple:2.0.7")
|
||||
implementation("io.pebbletemplates:pebble:3.2.1")
|
||||
implementation("com.github.ajalt.clikt:clikt:3.5.2")
|
||||
implementation("org.graalvm.js:js:22.3.2")
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "scaffold.ScaffoldKt"
|
||||
mainClass.set("scaffold.ScaffoldKt")
|
||||
applicationName = "scaffold"
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.github.ajalt.clikt.output.CliktConsole
|
||||
import com.github.ajalt.clikt.output.TermUi
|
||||
import com.github.ajalt.clikt.output.defaultCliktConsole
|
||||
|
||||
@Suppress("DEPRECATION") // TODO: later..
|
||||
class Prompt(private val console: CliktConsole = defaultCliktConsole()) {
|
||||
|
||||
fun string(text: String, default: String?): String = TermUi.prompt(
|
||||
@ -26,7 +27,7 @@ class Prompt(private val console: CliktConsole = defaultCliktConsole()) {
|
||||
showDefault = false,
|
||||
console = console
|
||||
) {
|
||||
when (it.toLowerCase()) {
|
||||
when (it.lowercase()) {
|
||||
"y" -> true
|
||||
"n" -> false
|
||||
else -> throw UsageError("Can only be [y/n]")
|
||||
|
||||
@ -2,14 +2,13 @@ package scaffold.commands
|
||||
|
||||
import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.core.ProgramResult
|
||||
import com.github.ajalt.clikt.core.UsageError
|
||||
import com.github.ajalt.clikt.parameters.arguments.argument
|
||||
import com.github.ajalt.clikt.parameters.options.convert
|
||||
import com.github.ajalt.clikt.parameters.options.option
|
||||
import com.github.ajalt.clikt.parameters.options.required
|
||||
import com.mitchellbosecke.pebble.PebbleEngine
|
||||
import com.mitchellbosecke.pebble.loader.FileLoader
|
||||
import com.mitchellbosecke.pebble.template.PebbleTemplate
|
||||
import io.pebbletemplates.pebble.PebbleEngine
|
||||
import io.pebbletemplates.pebble.loader.FileLoader
|
||||
import io.pebbletemplates.pebble.template.PebbleTemplate
|
||||
import scaffold.Generator
|
||||
import scaffold.Generators
|
||||
import scaffold.Prompt
|
||||
|
||||
@ -2,16 +2,12 @@ plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
kotlinDslPluginOptions {
|
||||
experimentalWarning.set(false)
|
||||
}
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.4.31"))
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
|
||||
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.21"))
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
|
||||
implementation("com.github.johnrengelman:shadow:8.1.1")
|
||||
}
|
||||
|
||||
@ -7,8 +7,9 @@ repositories {
|
||||
}
|
||||
|
||||
java {
|
||||
targetCompatibility = JavaVersion.toVersion(11)
|
||||
sourceCompatibility = JavaVersion.toVersion(11)
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(19))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
@ -18,9 +20,10 @@ tasks.withType<Test> {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
javaParameters = true
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_19)
|
||||
javaParameters.set(true)
|
||||
languageVersion.set(KotlinVersion.KOTLIN_2_0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,43 @@
|
||||
import org.gradle.jvm.toolchain.JavaToolchainService;
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
task("buildNative") {
|
||||
dependsOn("installShadowDist")
|
||||
|
||||
outputs.file("${buildDir}/native/scaffold")
|
||||
|
||||
doLast {
|
||||
val graalvmHome = System.getenv("GRAALVM_HOME") ?: error("GRAALVM_HOME is not set")
|
||||
val graalvmHome = project.extensions.findByType<JavaToolchainService>()?.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(19))
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM)
|
||||
}
|
||||
?.orNull
|
||||
?.executablePath?.asFile?.toPath()?.parent?.parent?.toString()
|
||||
?: System.getenv("GRAALVM_HOME")
|
||||
?: error("GRAALVM_HOME is not set")
|
||||
|
||||
val out = ByteArrayOutputStream()
|
||||
|
||||
exec {
|
||||
commandLine(
|
||||
"${graalvmHome}/bin/gu",
|
||||
"list",
|
||||
"-v",
|
||||
)
|
||||
standardOutput = out
|
||||
}
|
||||
|
||||
val installedComponents = out.toString().lines()
|
||||
.filter { it.startsWith("ID") }
|
||||
.map { it.substringAfter(':').trim() }
|
||||
|
||||
if ("native-image" !in installedComponents) {
|
||||
throw GradleException("GRAALVM: Missing js component")
|
||||
}
|
||||
|
||||
if ("js" !in installedComponents) {
|
||||
throw GradleException("GRAALVM: Missing js component")
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine(
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2048M -XX:MaxPermSize=512m -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user