- change from Kotlin multi-platform to two subprojects.
- set up ts->lua generation
This commit is contained in:
parent
18dfc3ebdb
commit
ec94c68187
11 changed files with 1699 additions and 0 deletions
143
gradle/libs.versions.toml
Normal file
143
gradle/libs.versions.toml
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
# @formatter:off
|
||||||
|
|
||||||
|
##########
|
||||||
|
[versions]
|
||||||
|
##########
|
||||||
|
|
||||||
|
## compilation ##
|
||||||
|
jvm = "11"
|
||||||
|
kotlin = "1.5.31"
|
||||||
|
|
||||||
|
## libs ##
|
||||||
|
http4k = "4.13.1.0"
|
||||||
|
slf4j = "1.7.30"
|
||||||
|
log4j2 = "2.14.1"
|
||||||
|
qosLogback = "1.2.5"
|
||||||
|
|
||||||
|
## test ##
|
||||||
|
junit = "5.8.0"
|
||||||
|
kotest = "4.6.3"
|
||||||
|
|
||||||
|
|
||||||
|
#########
|
||||||
|
[plugins]
|
||||||
|
#########
|
||||||
|
|
||||||
|
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
kotlinJs = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
||||||
|
kotlinSerialization = { id = "org.jetbrains.kotlin.kotlin-serialization", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
loggingCapabilities = { id = "dev.jacomet.logging-capabilities", version = "0.9.0" }
|
||||||
|
shadowJar = { id = "com.github.jengelman.gradle.plugins.shadow", version = "6.1.0" }
|
||||||
|
dependencyCheck = { id = "com.github.ben-manes.versions", version = "0.39.0" }
|
||||||
|
axionRelease = { id = "pl.allegro.tech.build.axion-release", version = "1.13.3" }
|
||||||
|
|
||||||
|
|
||||||
|
###########
|
||||||
|
[libraries]
|
||||||
|
###########
|
||||||
|
|
||||||
|
twilio-sdk = { group = "com.twilio.sdk", name = "twilio", version = "8.19.1" }
|
||||||
|
faker = { group = "com.github.javafaker", name = "javafaker", version = "1.0.2" }
|
||||||
|
sendgrid = { group = "com.sendgrid", name = "sendgrid-java", version = "4.7.4" }
|
||||||
|
|
||||||
|
## kotlin ##
|
||||||
|
kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
kotlinx-serde = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.2.2" }
|
||||||
|
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" }
|
||||||
|
|
||||||
|
## http4k ##
|
||||||
|
http4k-bom = { group = "org.http4k", name = "http4k-bom", version.ref = "http4k" }
|
||||||
|
http4k-core = { group = "org.http4k", name = "http4k-core" }
|
||||||
|
http4k-contract = { group = "org.http4k", name = "http4k-contract" }
|
||||||
|
http4k-client = { group = "org.http4k", name = "http4k-client-okhttp" }
|
||||||
|
http4k-server = { group = "org.http4k", name = "http4k-server-undertow" }
|
||||||
|
http4k-cloudnative = { group = "org.http4k", name = "http4k-cloudnative" }
|
||||||
|
#http4k-kotlinx = { group = "org.http4k", name = "http4k-format-kotlinx-serialization" }
|
||||||
|
http4k-format-json = { group = "org.http4k", name = "http4k-format-jackson" }
|
||||||
|
http4k-format-xml = { group = "org.http4k", name = "http4k-format-jackson-xml" }
|
||||||
|
http4k-format-yaml = { group = "org.http4k", name = "http4k-format-jackson-yaml" }
|
||||||
|
|
||||||
|
## logging ##
|
||||||
|
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
|
||||||
|
kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging-jvm", version = "2.0.11" }
|
||||||
|
logback-core = { group = "ch.qos.logback", name = "logback-core", version.ref = "qosLogback" }
|
||||||
|
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "qosLogback" }
|
||||||
|
logback-encoder = { group = "net.logstash.logback", name = "logstash-logback-encoder", version = "6.6" }
|
||||||
|
|
||||||
|
## gcp ##
|
||||||
|
gcp-bom = { group = "com.google.cloud", name = "libraries-bom", version = "23.1.0" }
|
||||||
|
gcp-pubsub = { group = "com.google.cloud", name = "google-cloud-pubsub" }
|
||||||
|
gcp-speech = { group = "com.google.cloud", name = "google-cloud-speech" }
|
||||||
|
|
||||||
|
|
||||||
|
#############
|
||||||
|
### test ###
|
||||||
|
#############
|
||||||
|
|
||||||
|
mockk = { group = "io.mockk", name = "mockk", version = "1.12.0" }
|
||||||
|
|
||||||
|
## junit ##
|
||||||
|
junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
|
||||||
|
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
|
||||||
|
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }
|
||||||
|
junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version = "1.7.2" }
|
||||||
|
|
||||||
|
## kotest ##
|
||||||
|
kotest-core = { group = "io.kotest", name = "kotest-assertions-core-jvm", version.ref = "kotest" }
|
||||||
|
kotest-datatest = { group = "io.kotest", name = "kotest-framework-datatest", version.ref = "kotest" }
|
||||||
|
kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5-jvm", version.ref = "kotest" }
|
||||||
|
kotest-prop = { group = "io.kotest", name = "kotest-property-jvm", version.ref = "kotest" }
|
||||||
|
kotest-json = { group = "io.kotest", name = "kotest-assertions-json", version.ref = "kotest" }
|
||||||
|
|
||||||
|
## http4k ##
|
||||||
|
http4k-test-chaos = { group = "org.http4k", name = "http4k-testing-chaos", version.ref = "http4k" }
|
||||||
|
http4k-test-approval = { group = "org.http4k", name = "http4k-testing-approval", version.ref = "http4k" }
|
||||||
|
http4k-test-kotest = { group = "org.http4k", name = "http4k-testing-kotest", version.ref = "http4k" }
|
||||||
|
|
||||||
|
|
||||||
|
#########
|
||||||
|
[bundles]
|
||||||
|
#########
|
||||||
|
|
||||||
|
logging = [
|
||||||
|
"slf4j-api",
|
||||||
|
"kotlin-logging",
|
||||||
|
"logback-core",
|
||||||
|
"logback-classic",
|
||||||
|
"logback-encoder",
|
||||||
|
]
|
||||||
|
|
||||||
|
kt-testing = [
|
||||||
|
"kotest-core",
|
||||||
|
"kotest-datatest",
|
||||||
|
"kotest-runner",
|
||||||
|
"kotest-prop",
|
||||||
|
"kotest-json",
|
||||||
|
"mockk",
|
||||||
|
]
|
||||||
|
|
||||||
|
junit-runtime = [
|
||||||
|
"junit-engine",
|
||||||
|
"junit-launcher",
|
||||||
|
]
|
||||||
|
|
||||||
|
http4k = [
|
||||||
|
"http4k-core",
|
||||||
|
"http4k-contract",
|
||||||
|
"http4k-client",
|
||||||
|
"http4k-server",
|
||||||
|
# "http4k-kotlinx",
|
||||||
|
"http4k-cloudnative",
|
||||||
|
"http4k-format-xml",
|
||||||
|
"http4k-format-json",
|
||||||
|
"http4k-format-yaml",
|
||||||
|
]
|
||||||
|
|
||||||
|
http4k-test = [
|
||||||
|
"http4k-test-chaos",
|
||||||
|
"http4k-test-approval",
|
||||||
|
"http4k-test-kotest",
|
||||||
|
]
|
||||||
151
modules/mod/build.gradle.kts
Normal file
151
modules/mod/build.gradle.kts
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
// kotlin("js")
|
||||||
|
id("com.github.node-gradle.node")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "${rootProject.group}.mod"
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
node {
|
||||||
|
download.set(true)
|
||||||
|
version.set("14.18.0")
|
||||||
|
// version.set("16.10.0")
|
||||||
|
}
|
||||||
|
// "@types/node": "ts4.4",
|
||||||
|
// 16.10.3 = ts4.4, see https://www.npmjs.com/package/@types/node
|
||||||
|
|
||||||
|
|
||||||
|
//repositories {
|
||||||
|
// mavenCentral()
|
||||||
|
// maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
|
||||||
|
// maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
|
||||||
|
//}
|
||||||
|
|
||||||
|
//kotlin {
|
||||||
|
// js(IR) {
|
||||||
|
//
|
||||||
|
// binaries.executable()
|
||||||
|
//
|
||||||
|
// browser {
|
||||||
|
// commonWebpackConfig {
|
||||||
|
// cssSupport.enabled = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// useCommonJs()
|
||||||
|
// nodejs()
|
||||||
|
//
|
||||||
|
// compilations["main"].apply {
|
||||||
|
// packageJson {
|
||||||
|
// customField(
|
||||||
|
// "scripts",
|
||||||
|
// mapOf(
|
||||||
|
// "build" to "tstl",
|
||||||
|
// "dev" to "tstl --watch",
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// sourceSets {
|
||||||
|
// val main by getting {
|
||||||
|
//// kotlin.srcDir("externals02")
|
||||||
|
//// kotlin.srcDir("externals")
|
||||||
|
//
|
||||||
|
// dependencies {
|
||||||
|
//
|
||||||
|
// val kotlinWrappersVersion = "0.0.1-pre.254-kotlin-1.5.31"
|
||||||
|
// implementation(
|
||||||
|
// project.dependencies.enforcedPlatform(
|
||||||
|
// "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
|
||||||
|
// implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
|
||||||
|
// implementation(npm("react", "17.0.2"))
|
||||||
|
// implementation(npm("react-dom", "17.0.2"))
|
||||||
|
//
|
||||||
|
//// implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7") {
|
||||||
|
//// because("https://github.com/Kotlin/kotlinx-nodejs")
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// val generateExternals = false
|
||||||
|
// implementation(npm("typescript-to-lua", "1.0.1", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("typed-factorio", "0.7.1", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("lua-types", "2.11.0", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("typescript", "4.4.3", generateExternals = generateExternals))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// val test by getting {
|
||||||
|
// dependencies {
|
||||||
|
// implementation(kotlin("test-js"))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
val tstlTask = tasks.register<com.github.gradle.node.npm.task.NpmTask>("tstl") {
|
||||||
|
description = "Typescript To Lua"
|
||||||
|
group = "${rootProject.group}"
|
||||||
|
dependsOn(tasks.npmInstall)
|
||||||
|
|
||||||
|
npmCommand.set(listOf("run", "build"))
|
||||||
|
args.set(listOf("--", "--outDir", "$buildDir/npm-output"))
|
||||||
|
// args.set(listOf("test"))
|
||||||
|
ignoreExitValue.set(false)
|
||||||
|
// environment.set(mapOf("MY_CUSTOM_VARIABLE" to "hello"))
|
||||||
|
workingDir.set(projectDir)
|
||||||
|
execOverrides {
|
||||||
|
standardOutput = System.out
|
||||||
|
}
|
||||||
|
inputs.dir("node_modules")
|
||||||
|
inputs.dir(fileTree("src/main/typescript"))
|
||||||
|
inputs.files(
|
||||||
|
"tsconfig.json",
|
||||||
|
"package.json",
|
||||||
|
)
|
||||||
|
outputs.dir("$buildDir/factorio-web-map/")
|
||||||
|
// outputs.dir("$buildDir/npm-output")
|
||||||
|
// outputs.upToDateWhen { true }
|
||||||
|
}
|
||||||
|
|
||||||
|
//sourceSets {
|
||||||
|
// val typescript by creating {
|
||||||
|
// setBuildDir("src/main/typescript")
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//dependencies {
|
||||||
|
// val kotlinWrappersVersion = "0.0.1-pre.254-kotlin-1.5.31"
|
||||||
|
// implementation(
|
||||||
|
// project.dependencies.enforcedPlatform(
|
||||||
|
// "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
|
||||||
|
// implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
|
||||||
|
// implementation(npm("react", "17.0.2"))
|
||||||
|
// implementation(npm("react-dom", "17.0.2"))
|
||||||
|
//
|
||||||
|
// // @types/node
|
||||||
|
|
||||||
|
//// implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7") {
|
||||||
|
//// because("https://github.com/Kotlin/kotlinx-nodejs")
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// val generateExternals = false
|
||||||
|
// implementation(npm("typescript-to-lua", "1.0.1", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("typed-factorio", "0.7.1", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("lua-types", "2.11.0", generateExternals = generateExternals))
|
||||||
|
// implementation(npm("typescript", "4.4.3", generateExternals = generateExternals))
|
||||||
|
//
|
||||||
|
// testImplementation(kotlin("test-js"))
|
||||||
|
//}
|
||||||
9
modules/mod/events.lua
Normal file
9
modules/mod/events.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||||||
|
script.on_event(
|
||||||
|
{defines.events.on_pre_build, defines.events.on_player_dropped_item},
|
||||||
|
function(e)
|
||||||
|
log(
|
||||||
|
(("player " .. tostring(e.player_index)) .. " dropped item, tick:") .. tostring(e.tick)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
1329
modules/mod/package-lock.json
generated
Normal file
1329
modules/mod/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
28
modules/mod/package.json
Normal file
28
modules/mod/package.json
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"name": "factorio-web-map-mod",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "tstl",
|
||||||
|
"dev": "tstl --watch"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"webpack": "5.38.1",
|
||||||
|
"webpack-cli": "4.7.1",
|
||||||
|
"format-util": "1.0.5",
|
||||||
|
"source-map-loader": "3.0.0",
|
||||||
|
"css-loader": "5.2.6",
|
||||||
|
"style-loader": "2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "17.0.2",
|
||||||
|
"react-dom": "17.0.2",
|
||||||
|
"typescript-to-lua": "1.0.1",
|
||||||
|
"typed-factorio": "0.7.1",
|
||||||
|
"lua-types": "2.11.0",
|
||||||
|
"typescript": "4.4.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {},
|
||||||
|
"optionalDependencies": {},
|
||||||
|
"bundledDependencies": []
|
||||||
|
}
|
||||||
3
modules/mod/settings.gradle.kts
Normal file
3
modules/mod/settings.gradle.kts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
rootProject.name = "factorio-web-map-mod"
|
||||||
|
|
||||||
|
rootProject.description = "Factorio Web Map mod"
|
||||||
6
modules/mod/src/main/typescript/events.ts
Normal file
6
modules/mod/src/main/typescript/events.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
script.on_event(
|
||||||
|
[defines.events.on_pre_build, defines.events.on_player_dropped_item],
|
||||||
|
(e: OnPreBuildEvent | OnPlayerDroppedItemEvent) => {
|
||||||
|
log("player " + e.player_index + " dropped item, tick:" + e.tick)
|
||||||
|
}
|
||||||
|
)
|
||||||
17
modules/mod/tsconfig.json
Normal file
17
modules/mod/tsconfig.json
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": [
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"types": [
|
||||||
|
"typed-factorio/runtime"
|
||||||
|
],
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"tstl": {
|
||||||
|
"luaTarget": "JIT",
|
||||||
|
"tstlVerbose": true
|
||||||
|
}
|
||||||
|
}
|
||||||
7
modules/server/build.gradle.kts
Normal file
7
modules/server/build.gradle.kts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
kotlin("jvm")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "${rootProject.group}.server"
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
3
modules/server/settings.gradle.kts
Normal file
3
modules/server/settings.gradle.kts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
rootProject.name = "factorio-web-map-server"
|
||||||
|
|
||||||
|
rootProject.description = "Factorio Web Map server"
|
||||||
3
src/jsMain/kotlin/factorio.kt
Normal file
3
src/jsMain/kotlin/factorio.kt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue