Skip to content

Commit c5fcd65

Browse files
committed
fix: tweak proto setup to fix model generation
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent d213c63 commit c5fcd65

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ buildscript {
1717
classpath(Classpath.firebase_perf)
1818
classpath(Classpath.secrets_gradle_plugin)
1919
classpath(Classpath.kotlin_serialization_plugin)
20+
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.14")
2021
}
2122
}
2223

@@ -33,5 +34,5 @@ allprojects {
3334
}
3435

3536
tasks.register("clean", Delete::class) {
36-
delete(rootProject.buildDir)
37+
delete(rootProject.layout.buildDirectory)
3738
}

model/build.gradle

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
import org.apache.tools.ant.taskdefs.condition.Os
22

3-
apply plugin: "java-library"
4-
apply plugin: "com.google.protobuf"
5-
apply plugin: "maven-publish"
3+
plugins {
4+
id 'java-library'
5+
id 'com.google.protobuf'
6+
id 'maven-publish'
7+
}
68

79
def archSuffix = Os.isFamily(Os.FAMILY_MAC) ? ':osx-x86_64' : ''
810

911
version = '0.0.1'
1012
group = 'com.codeinc.gen'
1113

12-
buildscript {
13-
repositories {
14-
mavenCentral()
15-
}
16-
dependencies {
17-
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
18-
}
19-
}
20-
2114
def grpcVersion = "1.49.0"
2215
def protocVersion = "3.12.0"
2316
dependencies {
@@ -30,14 +23,14 @@ dependencies {
3023

3124
// Kotlin Generation
3225
implementation "io.grpc:grpc-kotlin-stub-lite:1.0.0"
33-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
26+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
3427
implementation 'javax.annotation:javax.annotation-api:1.3.2'
3528

3629
}
3730

38-
def generatedSrcRoot = file("${buildDir}/generated/source/proto/main/java")
39-
def generatedSrcRoot2 = file("${buildDir}/generated/source/proto/main/grpc")
40-
def generatedSrcRoot3 = file("${buildDir}/generated/source/proto/main/grpcKt")
31+
def generatedSrcRoot = file("${layout.buildDirectory}/generated/source/proto/main/java")
32+
def generatedSrcRoot2 = file("${layout.buildDirectory}/generated/source/proto/main/grpc")
33+
def generatedSrcRoot3 = file("${layout.buildDirectory}/generated/source/proto/main/grpcKt")
4134
sourceSets.main {
4235
proto {
4336
srcDir "${rootDir}/model/proto"
@@ -48,7 +41,7 @@ sourceSets.main {
4841
}
4942

5043
compileJava {
51-
options.annotationProcessorGeneratedSourcesDirectory generatedSrcRoot
44+
options.generatedSourceOutputDirectory.set(generatedSrcRoot)
5245
}
5346

5447
protobuf {
@@ -94,7 +87,7 @@ jar {
9487
exclude "**/*agora*/**"
9588
}
9689

97-
task sourcesJar(type: Jar) {
90+
tasks.register('sourcesJar', Jar) {
9891
from sourceSets.main.allSource
9992
archiveClassifier = 'sources'
10093
from generatedSrcRoot, generatedSrcRoot2, generatedSrcRoot3
@@ -103,4 +96,9 @@ task sourcesJar(type: Jar) {
10396

10497
artifacts {
10598
archives sourcesJar
99+
}
100+
101+
java {
102+
sourceCompatibility = JavaVersion.VERSION_1_8
103+
targetCompatibility = JavaVersion.VERSION_1_8
106104
}

0 commit comments

Comments
 (0)