Skip to content

Commit

Permalink
Merge pull request #88 from azrael8576/feat/datastore-proto-module
Browse files Browse the repository at this point in the history
Moved protobuf to separate module
  • Loading branch information
azrael8576 authored Jan 22, 2024
2 parents 2fdb487 + a3e4ac9 commit 4fe9e96
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .github/ci-gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ org.gradle.workers.max=2
# Disables the incremental compilation feature of Kotlin. With incremental compilation, only the changed source files get recompiled.
kotlin.incremental=false

# Determines how the Kotlin compiler runs. 'in-process' means the compiler runs inside the Gradle process, not as a separate process.
kotlin.compiler.execution.strategy=in-process

# Controls whether warnings in Kotlin code should be treated as errors during the compilation process.
# This setting is useful for CI environments where you might not want a build to fail just because of warnings.
# Set to true if you want to treat warnings as errors in your local setup.
Expand Down
1 change: 1 addition & 0 deletions core/datastore-proto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions core/datastore-proto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
plugins {
alias(libs.plugins.at.android.library)
alias(libs.plugins.protobuf)
}

android {
namespace = "com.wei.amazingtalker.core.datastore.proto"
}

// Setup protobuf configuration, generating lite Java and Kotlin classes
protobuf {
protoc {
artifact = libs.protobuf.protoc.get().toString()
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
register("java") {
option("lite")
}
register("kotlin") {
option("lite")
}
}
}
}
}

androidComponents.beforeVariants {
android.sourceSets.register(it.name) {
val buildDir = layout.buildDirectory.get().asFile
java.srcDir(buildDir.resolve("generated/source/proto/${it.name}/java"))
kotlin.srcDir(buildDir.resolve("generated/source/proto/${it.name}/kotlin"))
}
}

dependencies {
implementation(libs.protobuf.kotlin.lite)
}
28 changes: 1 addition & 27 deletions core/datastore/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
alias(libs.plugins.at.android.library)
alias(libs.plugins.at.android.hilt)
alias(libs.plugins.protobuf)
}

android {
Expand All @@ -18,33 +17,8 @@ android {
}
}

// Setup protobuf configuration, generating lite Java and Kotlin classes
protobuf {
protoc {
artifact = libs.protobuf.protoc.get().toString()
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
register("java") {
option("lite")
}
register("kotlin") {
option("lite")
}
}
}
}
}

androidComponents.beforeVariants {
android.sourceSets.register(it.name) {
java.srcDir(buildDir.resolve("generated/source/proto/${it.name}/java"))
kotlin.srcDir(buildDir.resolve("generated/source/proto/${it.name}/kotlin"))
}
}

dependencies {
api(project(":core:datastore-proto"))
implementation(project(":core:common"))
implementation(project(":core:model"))

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include(":core:domain")
include(":core:designsystem")
include(":core:testing")
include(":core:datastore")
include(":core:datastore-proto")
include(":core:datastore-test")
include(":core:data-test")

Expand Down

0 comments on commit 4fe9e96

Please sign in to comment.