Skip to content

Commit

Permalink
Use official Kotlin/Protobuf generator
Browse files Browse the repository at this point in the history
Previously, we used an unmaintained Kotlin protobuf generator, which
didn't support Apple M1 chips. This commit replaces this dependency with
the official Protobuf generator, which works on Apple M1.
  • Loading branch information
olafurpg committed Jul 17, 2023
1 parent aa72546 commit dc0cfeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 50 deletions.
32 changes: 3 additions & 29 deletions semanticdb-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import com.google.protobuf.gradle.*
plugins {
kotlin("jvm")
id("com.google.protobuf") version "0.8.17"
id("com.github.marcoferrer.kroto-plus") version "0.6.1"
}

repositories {
Expand All @@ -23,7 +22,7 @@ buildscript {
dependencies {
implementation(kotlin("stdlib"))
implementation("com.google.protobuf:protobuf-java:3.17.3")
compileOnly("com.sourcegraph", "semanticdb-javac", "0.6.12")
compileOnly("com.sourcegraph", "semanticdb-javac", "0.8.23")
}


Expand All @@ -45,41 +44,16 @@ afterEvaluate {
}
}

krotoPlus {
config {
create("main") {
builder.protoBuilders {
useDslMarkers = true
unwrapBuilders = true
}
}
}
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.15.7"
artifact = "com.google.protobuf:protoc:3.17.3"
}

generatedFilesBaseDir = kotlin.sourceSets.main.get().kotlin.srcDirs.first().path.split(":")[0].removeSuffix("main/kotlin")

plugins {
id("kroto") {
artifact = "com.github.marcoferrer.krotoplus:protoc-gen-kroto-plus:0.6.1"
}
kotlin { }
}

generateProtoTasks {
val krotoConfig = file("${projectDir}/krotoconfig.json")
all().forEach { task ->
task.inputs.files(krotoConfig)

task.plugins {
id("kroto") {
outputSubDir = "java"
option("ConfigPath=${krotoConfig}")
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc0cfeb

Please sign in to comment.