kotlin 1.6, gradle tidying
This commit is contained in:
parent
b3af697636
commit
d6a9a58dc9
14 changed files with 74 additions and 295 deletions
|
|
@ -6,7 +6,7 @@
|
|||
1. converts data to images
|
||||
2. hosts a web map
|
||||
|
||||
todo
|
||||
## todo
|
||||
|
||||
* add settings
|
||||
* is active - whether files are exported or not
|
||||
|
|
@ -15,7 +15,7 @@ todo
|
|||
* requires on some sort of in-mod cache of map<entity-id, event>)
|
||||
* also divide by game-speed? to keep ratio the same
|
||||
|
||||
to investigate:
|
||||
### to investigate:
|
||||
|
||||
* https://github.com/starwing/lua-protobuf
|
||||
* https://github.com/grafi-tt/lunajson
|
||||
|
|
@ -29,3 +29,8 @@ to investigate:
|
|||
* https://github.com/YousefED/typescript-json-schema
|
||||
|
||||
* https://jbrandhorst.com/post/go-protobuf-tips/
|
||||
|
||||
#### CBOR
|
||||
|
||||
https://www.zash.se/lua-cbor.html
|
||||
https://code.zash.se/lua-cbor/archive/68b3a36d0816.tar.gz
|
||||
|
|
@ -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()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
## compilation ##
|
||||
jvm = "11"
|
||||
kotlin = "1.5.31"
|
||||
kotlin = "1.6.0"
|
||||
|
||||
## libs ##
|
||||
http4k = "4.16.1.0"
|
||||
|
|
@ -45,9 +45,9 @@ sendgrid = { group = "com.sendgrid", name = "sendgrid-java", version
|
|||
## kotlin ##
|
||||
kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" }
|
||||
|
||||
kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.3.0" }
|
||||
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.5.2" }
|
||||
kotlinx-html = { group = "org.jetbrains.kotlinx", name = "kotlinx-html", version = "0.7.3" }
|
||||
kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.3.0" }
|
||||
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.6.0-RC" }
|
||||
kotlinx-html = { group = "org.jetbrains.kotlinx", name = "kotlinx-html", version = "0.7.3" }
|
||||
|
||||
## http4k ##
|
||||
http4k-bom = { group = "org.http4k", name = "http4k-bom", version.ref = "http4k" }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import org.gradle.process.internal.DefaultExecSpec
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||
|
|
@ -21,8 +20,8 @@ kotlin {
|
|||
compilations.configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
apiVersion = "1.5"
|
||||
languageVersion = "1.5"
|
||||
apiVersion = "1.6"
|
||||
languageVersion = "1.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -76,7 +75,7 @@ kotlin {
|
|||
|
||||
sourceSets.all {
|
||||
languageSettings.apply {
|
||||
languageVersion = "1.5"
|
||||
languageVersion = "1.6"
|
||||
// enableLanguageFeature("InlineClasses") // language feature name
|
||||
optIn("kotlin.OptIn")
|
||||
optIn("kotlin.RequiresOptIn")
|
||||
|
|
@ -91,25 +90,8 @@ kotlin {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//kotlin.js()
|
||||
// .compilations
|
||||
// .getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
||||
// .npmProject
|
||||
// .useTool()
|
||||
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
// val nodeJsExecTstl by tasks.creating(NodeJsExec::class) {
|
||||
// group = project.name
|
||||
//
|
||||
// nodeArgs += listOf(
|
||||
// "tstl",
|
||||
// )
|
||||
// }
|
||||
|
||||
val kotlinJsCompilation: KotlinJsCompilation =
|
||||
kotlin.targets
|
||||
.flatMap { it.compilations }
|
||||
|
|
@ -124,8 +106,7 @@ afterEvaluate {
|
|||
errorOutput = System.err
|
||||
|
||||
workingDir = npmProject.dir
|
||||
executable =
|
||||
when (npmProject.nodeJs.requireConfigured().isWindows) {
|
||||
executable = when (npmProject.nodeJs.requireConfigured().isWindows) {
|
||||
true -> "npx.cmd"
|
||||
false -> "npx"
|
||||
}
|
||||
|
|
@ -134,58 +115,6 @@ afterEvaluate {
|
|||
|
||||
}
|
||||
|
||||
tasks.create("asd") {
|
||||
group = project.name
|
||||
|
||||
doLast {
|
||||
|
||||
val execSpec =
|
||||
project.objects.newInstance(DefaultExecSpec::class.java).apply {
|
||||
isIgnoreExitValue = false
|
||||
standardOutput = System.out
|
||||
errorOutput = System.err
|
||||
}
|
||||
|
||||
kotlin.targets
|
||||
.flatMap { it.compilations }
|
||||
.filterIsInstance<KotlinJsCompilation>()
|
||||
.filter { it.name == KotlinCompilation.MAIN_COMPILATION_NAME }
|
||||
.forEach {
|
||||
|
||||
org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec.create(it, "blahDeBlah") {
|
||||
|
||||
}
|
||||
|
||||
execSpec.workingDir = it.npmProject.dir
|
||||
|
||||
execSpec.executable =
|
||||
when (it.npmProject.nodeJs.requireConfigured().isWindows) {
|
||||
true -> "npx.cmd"
|
||||
false -> "npx"
|
||||
}
|
||||
|
||||
execSpec.args("tstl", "--version")
|
||||
|
||||
// execSpec.commandLine
|
||||
|
||||
|
||||
// it.npmProject.useTool(
|
||||
// execSpec,
|
||||
// "typescript-to-lua/dist/tstl.js",
|
||||
// listOf(),
|
||||
// listOf( "--outDir","$buildDir/testAsd"),
|
||||
// listOf("--version"),
|
||||
// listOf(),
|
||||
// )
|
||||
}
|
||||
|
||||
exec {
|
||||
execSpec.copyTo(this)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
package dev.adamko.factorioevents.model
|
||||
|
||||
import dev.adamko.factorioevents.model.FBuiltInType.FNumber.F_float
|
||||
import dev.adamko.factorioevents.model.FBuiltInType.FNumber.F_int
|
||||
import dev.adamko.factorioevents.model.FBuiltInType.FNumber.F_uint
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.*
|
||||
import kotlinx.serialization.json.*
|
||||
import kotlinx.serialization.modules.*
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonClassDiscriminator
|
||||
|
||||
|
||||
@Serializable
|
||||
|
|
@ -44,7 +39,6 @@ data class EntityData(
|
|||
val player_index: UInt?,
|
||||
) : FactorioObjectData
|
||||
|
||||
|
||||
data class SurfaceData(
|
||||
override val objectName: String,
|
||||
val name: String,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
|||
plugins {
|
||||
idea
|
||||
id("dev.adamko.factoriowebmap.archetype.node")
|
||||
id("dev.adamko.tstl")
|
||||
}
|
||||
|
||||
val projectId: String by project.extra
|
||||
|
|
|
|||
|
|
@ -1,58 +1,14 @@
|
|||
rootProject.name = "factorio-web-map"
|
||||
|
||||
|
||||
//includeBuild("modules/protoc-gradle-plugin")
|
||||
|
||||
include(
|
||||
":modules:mod",
|
||||
// ":modules:server",
|
||||
":modules:kt-rcon",
|
||||
":modules:factorio-events-data-model",
|
||||
// ":modules:factorio-events-data-model2",
|
||||
":modules:factorio-events-processor",
|
||||
":modules:factorio-events-kafka-pipe",
|
||||
)
|
||||
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
||||
@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()
|
||||
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") }
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
apply(from = "./buildSrc/repositories.settings.gradle.kts")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue