Skip to content

Commit

Permalink
Add new gradle tasks.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Sep 21, 2023
1 parent 03f3d6a commit d5b96d3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions java/jabushka/jabushka/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.nio.file.Paths

plugins {
id 'java-library'
}
Expand All @@ -9,3 +11,36 @@ repositories {
dependencies {
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.24.3'
}

tasks.register('protobuf', Exec) {
doFirst {
project.mkdir(Paths.get(project.projectDir.path, 'src/main/java/org/babushka/jabushka/generated').toString())
}
commandLine 'protoc',
'-Iprotobuf=babushka-core/src/protobuf/',
'--java_out=java/jabushka/jabushka/src/main/java/org/babushka/jabushka/generated',
'babushka-core/src/protobuf/connection_request.proto',
'babushka-core/src/protobuf/redis_request.proto',
'babushka-core/src/protobuf/response.proto'
workingDir Paths.get(project.rootDir.path, '../..').toFile()
}

tasks.register('buildRust', Exec) {
commandLine 'cargo', 'build'
workingDir project.rootDir
}

tasks.register('buildWithRust') {
dependsOn 'buildRust'
finalizedBy 'build'
}

tasks.register('buildWithProto') {
dependsOn 'protobuf'
finalizedBy 'build'
}

tasks.register('buildAll') {
dependsOn 'protobuf', 'buildRust'
finalizedBy 'build'
}

0 comments on commit d5b96d3

Please sign in to comment.