kotlin 1.6, gradle tidying
This commit is contained in:
parent
b3af697636
commit
d6a9a58dc9
14 changed files with 74 additions and 295 deletions
|
|
@ -3,35 +3,13 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
plugins {
|
||||
idea
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version "1.5.31"
|
||||
kotlin("jvm") version "1.6.0"
|
||||
`java-gradle-plugin`
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("tstl") {
|
||||
id = "dev.adamko.tstl"
|
||||
description =
|
||||
"Gradle plugin for TypescriptToLua. Requires plugin `com.github.node-gradle.node`."
|
||||
implementationClass = "dev.adamko.gradle.tstl.TstlPlugin"
|
||||
}
|
||||
create("json-kotlin-schema-gen") {
|
||||
id = "dev.adamko.json-kotlin-schema-gen"
|
||||
description =
|
||||
"Gradle plugin for 'json-kotlin-schema-codegen' - Code generation for JSON Schema (Draft 07) https://github.com/pwall567/json-kotlin-schema-codegen"
|
||||
implementationClass = "dev.adamko.gradle.jsonkotlinschemagen.JsonKotlinSchemaGenPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
val kotlinVersion = "1.5.31"
|
||||
|
||||
// implementation(gradleApi())
|
||||
|
||||
// implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:${org.gradle.kotlin.dsl.support.expectedKotlinDslPluginsVersion}")
|
||||
// implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:${kotlinVersion}")
|
||||
val kotlinVersion = "1.6.0"
|
||||
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion"))
|
||||
implementation("org.jetbrains.kotlin:kotlin-serialization")
|
||||
|
|
@ -39,8 +17,6 @@ dependencies {
|
|||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
||||
|
||||
implementation("com.github.node-gradle:gradle-node-plugin:3.1.1")
|
||||
|
||||
implementation("net.pwall.json:json-kotlin-schema-codegen:0.53")
|
||||
}
|
||||
|
||||
val projectJvmTarget = "11"
|
||||
|
|
@ -49,8 +25,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
|||
|
||||
kotlinOptions {
|
||||
jvmTarget = projectJvmTarget
|
||||
apiVersion = "1.5"
|
||||
languageVersion = "1.5"
|
||||
apiVersion = "1.6"
|
||||
languageVersion = "1.6"
|
||||
}
|
||||
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
|
|
|
|||
45
buildSrc/repositories.settings.gradle.kts
Normal file
45
buildSrc/repositories.settings.gradle.kts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
@Suppress("UnstableApiUsage")
|
||||
dependencyResolutionManagement {
|
||||
|
||||
// https://github.com/gradle/gradle/issues/15754#issuecomment-763614651
|
||||
// https://github.com/gradle/gradle/blob/09fcaacc9848f09aa584b4119be9271bee6916e6/build-logic/build-logic-base/settings-plugin/src/main/kotlin/gradlebuild.repositories.settings.gradle.kts#L68
|
||||
|
||||
// Cannot use 'FAIL_ON_PROJECT_REPOS' because
|
||||
// - the 'gradle-guides-plugin' adds a repo (which it should not do)
|
||||
// - the 'kotlin-gradle-plugin' adds a repo (and removes it afterwards) to download NodeJS
|
||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://jitpack.io")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
|
||||
|
||||
// Declare the Node.js download repository
|
||||
ivy("https://nodejs.org/dist/") {
|
||||
name = "Node Distributions at $url"
|
||||
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
|
||||
metadataSources { artifact() }
|
||||
content { includeModule("org.nodejs", "node") }
|
||||
}
|
||||
ivy("https://github.com/yarnpkg/yarn/releases/download") {
|
||||
name = "Yarn Distributions at $url"
|
||||
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
|
||||
metadataSources { artifact() }
|
||||
content { includeModule("com.yarnpkg", "yarn") }
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,43 +1,3 @@
|
|||
rootProject.name = "buildSrc"
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
dependencyResolutionManagement {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
|
||||
|
||||
// Declare the Node.js download repository
|
||||
ivy {
|
||||
name = "Node.js"
|
||||
setUrl("https://nodejs.org/dist/")
|
||||
patternLayout {
|
||||
artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]")
|
||||
}
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
content {
|
||||
includeModule("org.nodejs", "node")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
apply(from = "./repositories.settings.gradle.kts")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ kotlin {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
val kotlinWrappersVersion = "0.0.1-pre.263-kotlin-1.5.31"
|
||||
val kotlinWrappersVersion = "0.0.1-pre.270-kotlin-1.6.0"
|
||||
implementation(
|
||||
project.dependencies.enforcedPlatform(
|
||||
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ dependencies {
|
|||
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
|
||||
testImplementation("io.kotest:kotest-property-jvm:$kotestVersion")
|
||||
testImplementation("io.kotest:kotest-assertions-json:$kotestVersion")
|
||||
|
||||
testImplementation("io.mockk:mockk:1.12.0")
|
||||
|
||||
//</editor-fold>
|
||||
|
|
@ -46,8 +47,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
|||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
apiVersion = "1.5"
|
||||
languageVersion = "1.5"
|
||||
apiVersion = "1.6"
|
||||
languageVersion = "1.6"
|
||||
}
|
||||
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package dev.adamko.gradle
|
||||
|
||||
import org.gradle.kotlin.dsl.`component-model-base`
|
||||
import org.gradle.kotlin.dsl.kotlin
|
||||
|
||||
|
||||
plugins {
|
||||
base
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package dev.adamko.gradle.tstl
|
||||
|
||||
import com.github.gradle.node.NodePlugin
|
||||
import dev.adamko.gradle.tstl.tasks.TypescriptToLuaTask
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.BasePlugin
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||
|
||||
|
||||
class TstlPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
|
||||
project.plugins.withType<NodePlugin> {
|
||||
}
|
||||
|
||||
project.plugins.withType<BasePlugin> {
|
||||
project.tasks.named(LifecycleBasePlugin.ASSEMBLE_TASK_NAME) {
|
||||
dependsOn(project.tasks.withType<TypescriptToLuaTask>())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package dev.adamko.gradle.tstl.tasks
|
||||
|
||||
import com.github.gradle.node.npm.task.*
|
||||
import org.gradle.api.file.*
|
||||
import org.gradle.api.provider.*
|
||||
import org.gradle.api.tasks.*
|
||||
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
abstract class TypescriptToLuaTask : NpmTask() {
|
||||
|
||||
@get:Internal
|
||||
val intermediateOutputDir: RegularFileProperty = project.objects.fileProperty()
|
||||
.convention { temporaryDir }
|
||||
|
||||
@get:Internal
|
||||
val intermediateOutputCanonicalPath: Provider<String> =
|
||||
intermediateOutputDir.map { it.asFile.canonicalPath }
|
||||
|
||||
@get:Input
|
||||
val identifier: Property<String> = project.objects.property<String>().convention(name)
|
||||
|
||||
@get:Internal
|
||||
val luaOutputDirConvention: Provider<Directory> =
|
||||
project.layout.buildDirectory.map { it.dir("typescriptToLua/${identifier.get()}") }
|
||||
|
||||
@get:OutputDirectory
|
||||
val luaOutputDir: DirectoryProperty = project.objects.directoryProperty()
|
||||
.convention(luaOutputDirConvention)
|
||||
|
||||
init {
|
||||
group = "typescriptToLua"
|
||||
|
||||
execOverrides { standardOutput = System.out }
|
||||
|
||||
super.dependsOn(project.tasks.withType<NpmSetupTask>())
|
||||
ignoreExitValue.set(false)
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
fun convert() {
|
||||
args.set(parseSpaceSeparatedArgs("-- --outDir ${intermediateOutputCanonicalPath.get()}"))
|
||||
|
||||
project.delete(intermediateOutputDir.get())
|
||||
|
||||
super.exec()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue