Skip to content

Exclude protolite well known types from version bump. #6909

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

Merged
merged 4 commits into from
Apr 28, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ class PostReleasePlugin : Plugin<Project> {
* @see VersionBumpTask
*/
fun registerVersionBumpTask(project: Project) =
project.tasks.register<VersionBumpTask>("versionBump")
project.tasks.register<VersionBumpTask>("versionBump") {
// TODO(b/285892320): Remove condition when bug fixed
bumpVersion.set(project.firebaseLibrary.artifactId.map {
it !== "protolite-well-known-types"
})
}

/**
* Registers the `moveUnreleasedChanges` task for the provided [Project].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import org.gradle.kotlin.dsl.provideDelegate
* @property releasedVersion A [ModuleVersion] of what to bump from. Defaults to the project
* version.
* @property newVersion A [ModuleVersion] of what to set the version to. Defaults to one patch
* higher than [releasedVersion]
* higher than [releasedVersion].
* @property bumpVersion If set, then the default provided by [newVersion] will be bumped by one patch. Defaults to `true`.
* @see PostReleasePlugin
*/
abstract class VersionBumpTask : DefaultTask() {
Expand All @@ -52,16 +53,22 @@ abstract class VersionBumpTask : DefaultTask() {
@get:[Optional Input]
abstract val newVersion: Property<ModuleVersion>

@get:[Optional Input]
abstract val bumpVersion: Property<Boolean>

init {
configure()
}

@TaskAction
fun build() {
val latestVersion = releasedVersion.get()
val version = newVersion.orNull ?: if(bumpVersion.get()) latestVersion.bump() else latestVersion

versionFile.get().asFile.rewriteLines {
when {
it.startsWith("version=") -> "version=${newVersion.get()}"
it.startsWith("latestReleasedVersion") -> "latestReleasedVersion=${releasedVersion.get()}"
it.startsWith("version=") -> "version=${version}"
it.startsWith("latestReleasedVersion") -> "latestReleasedVersion=${latestVersion}"
else -> it
}
}
Expand All @@ -70,7 +77,7 @@ abstract class VersionBumpTask : DefaultTask() {
fun configure() {
versionFile.convention(project.layout.projectDirectory.file("gradle.properties"))
releasedVersion.convention(computeReleasedVersion())
newVersion.convention(releasedVersion.map { it.bump() })
bumpVersion.convention(true)
}

fun computeReleasedVersion(): ModuleVersion? {
Expand Down
Loading