delete protobuf stuff, and unused code

This commit is contained in:
Adam 2021-11-03 17:07:59 +01:00
parent 16d382db11
commit 7dd7baef34
132 changed files with 16 additions and 57708 deletions

View file

@ -1,12 +1,6 @@
import dev.adamko.gradle.pbandg.task.ProtobufCompileTask
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
plugins {
id("dev.adamko.factoriowebmap.archetype.base")
kotlin("multiplatform")
id("dev.adamko.gradle.pbandg.pb-and-g")
}
val projectId: String by project.extra
@ -43,9 +37,6 @@ kotlin {
sourceSets {
val jsMain by getting {
dependencies {
implementation(npm("ts-proto", "1.83.3"))
}
}
val jsTest by getting {
@ -69,86 +60,3 @@ kotlin {
}
}
}
dependencies {
protobufLibrary("com.google.protobuf:protobuf-javalite:3.19.1")
}
val rootPackageJson by rootProject.tasks.getting(RootPackageJsonTask::class)
val nodePath: Directory by extra {
val file = rootPackageJson.rootPackageJson.parentFile.normalize()
logger.lifecycle("Kotlin/JS NODE_PATH: $file")
project.layout.dir(provider { file }).get()
}
val nodeModulesDir: Directory by extra {
val file = nodePath.dir(NpmProject.NODE_MODULES)
logger.lifecycle("Kotlin/JS NODE_MODULES: $file")
file
}
afterEvaluate {
val protobufJava by tasks.creating(ProtobufCompileTask::class) {
description = "proto2java"
protoFile.set(file("$projectDir/src/proto/FactorioServerLogRecord.proto"))
cliArgs.add("--java_out=lite:${project.mkdir("$temporaryDir/java").canonicalPath}")
}
val protobufKotlin by tasks.creating(ProtobufCompileTask::class) {
description = "proto2kotlin"
protoFile.set(file("$projectDir/src/proto/FactorioServerLogRecord.proto"))
cliArgs.add("--kotlin_out=lite:${project.mkdir("$temporaryDir/kotlin").canonicalPath}")
}
val ktProto by configurations.creating {
isCanBeResolved = false
isCanBeConsumed = true
}
artifacts {
add(ktProto.name, protobufJava.outputDir) {
builtBy(protobufJava)
}
add(ktProto.name, protobufKotlin.outputDir) {
builtBy(protobufKotlin)
}
}
val protobufTypescript by tasks.creating(ProtobufCompileTask::class) {
description = "proto2typescript"
// linux:
// cliArgs.add("--plugin=${rootProject.buildDir}/js/packages/factorio-web-map-factorio-events-data-model/node_modules/.bin/protoc-gen-ts_proto.cmd")
// windows:
cliArgs.add("--plugin=protoc-gen-ts_proto=${rootProject.buildDir}/js/packages/factorio-web-map-factorio-events-data-model/node_modules/.bin/protoc-gen-ts_proto.cmd")
cliArgs.add("--ts_proto_out=${project.mkdir("$temporaryDir/typescript").canonicalPath}")
cliArgs.addAll(
"--ts_proto_opt=useOptionals=true",
"--ts_proto_opt=outputServices=false",
"--ts_proto_opt=outputJsonMethods=false",
// "--ts_proto_opt=outputEncodeMethods=false",
"--ts_proto_opt=forceLong=string",
"--ts_proto_opt=forceLong=number",
"--ts_proto_opt=esModuleInterop=true",
"--ts_proto_opt=exportCommonSymbols=false",
// "--proto_path=${rootProject.rootDir}",
)
protoFile.set(file("$projectDir/src/proto/FactorioServerLogRecord.proto"))
}
val tsProto by configurations.creating {
isCanBeResolved = false
isCanBeConsumed = true
}
artifacts {
add(tsProto.name, protobufTypescript.outputDir) {
builtBy(protobufTypescript)
}
}
}