Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: gradle task for updating submodules with specific commit #4

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Build, CI

* (build) [\#4](https://github.com/line/finschia-kt/pull/4) Add gradle `updateSubmodule` task and `checkoutSubModule` task to run `git submodule update --init --remote` with specific version before `build task`

### Document Updates

<!-- Release links -->
Expand Down
10 changes: 10 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ repositories {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
}

tasks.named("build") {
dependsOn("updateSubmodule")
}

tasks.register("updateSubmodule") {
exec {
commandLine("git", "submodule", "update", "--init", "--remote")
}
}
24 changes: 24 additions & 0 deletions protobuf/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,30 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
}
}

tasks.named("build") {
dependsOn("checkoutSubModules")
}

tasks.register("checkoutSubModules") {
var subModules = mapOf(
// {moduleName} to {version}
"lbm-sdk" to "v0.47.0-alpha1",
"ibc-go" to "v3.3.2",
"wasmd" to "v0.1.0"
)
for ((name, version) in subModules.entries) {
var submoduleProjectDir = "repositories/" + name
println("Updating submodule $name to version $version in directory $submoduleProjectDir")
var result = exec {
workingDir = File(submoduleProjectDir)
commandLine("git", "checkout", version)
}
if (result.exitValue != 0) {
throw GradleException("Failed to update submodule $name to version $version")
}
}
}

dependencies {
api(libs.grpc.protobuf)
api(libs.grpc.kotlin.stub)
Expand Down
2 changes: 1 addition & 1 deletion protobuf/repositories/ibc-go
2 changes: 1 addition & 1 deletion protobuf/repositories/wasmd
Submodule wasmd updated from 577e45 to 5c78b2