-
Notifications
You must be signed in to change notification settings - Fork 617
Add GMaven Version test #5257
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
Add GMaven Version test #5257
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b9155e
Add GMaven Version test
emilypgoogle 0f45c6c
Adjust based on comments
emilypgoogle f2b101d
Merge version checking task initialization
emilypgoogle dca1bb6
Factor out document creation
emilypgoogle 2be3b30
Style comments
emilypgoogle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Version Check | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- 'releases/**' | ||
|
||
jobs: | ||
version-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Build | ||
run: | | ||
./gradlew gmavenVersionCheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
buildSrc/src/main/java/com/google/firebase/gradle/plugins/GmavenVersionChecker.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.google.firebase.gradle.plugins | ||
emilypgoogle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.GradleException | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
abstract class GmavenVersionChecker : DefaultTask() { | ||
|
||
@get:Input abstract val groupId: Property<String> | ||
|
||
@get:Input abstract val artifactId: Property<String> | ||
|
||
@get:Input abstract val latestReleasedVersion: Property<String> | ||
|
||
@get:Input abstract val version: Property<String> | ||
|
||
@TaskAction | ||
fun run() { | ||
rlazo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
val mavenHelper = GmavenHelper(groupId.get(), artifactId.get()) | ||
val latestMavenVersion = mavenHelper.getLatestReleasedVersion() | ||
// Either the Maven metadata does not exist, or the library hasn't been released | ||
if (latestMavenVersion.isEmpty()) { | ||
return | ||
} | ||
if (version.get() == latestReleasedVersion.get()) { | ||
throw GradleException( | ||
"Current and latest released versions from gradle.properties are the same (${version.get()})" + | ||
emilypgoogle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"\nLatest release should be ${latestMavenVersion}" | ||
) | ||
} | ||
if (latestMavenVersion == version.get()) { | ||
throw GradleException( | ||
"Current version from gradle.properties (${version.get()}) is already the latest release on GMaven" | ||
emilypgoogle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
} else if (mavenHelper.hasReleasedVersion(version.get())) { | ||
throw GradleException( | ||
"Current version from gradle.properties (${version.get()}) has already been released on GMaven" + | ||
"\nThe latest released version on GMaven ${latestMavenVersion}" | ||
) | ||
} | ||
if (latestMavenVersion != latestReleasedVersion.get()) { | ||
if (mavenHelper.hasReleasedVersion(latestReleasedVersion.get())) { | ||
throw GradleException( | ||
"Latest released version from gradle.properties (${latestReleasedVersion.get()}) is not the latest released on GMaven (${latestMavenVersion})" | ||
) | ||
} else { | ||
throw GradleException( | ||
"Latest released version from gradle.properties (${latestReleasedVersion.get()}) has not been released on GMaven" + | ||
"\nThe latest released version on GMaven ${latestMavenVersion}" | ||
) | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
version=23.2.2 | ||
latestReleasedVersion=23.2.2 | ||
latestReleasedVersion=23.2.1 | ||
android.enableUnitTestBinaryResources=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# IMPORTANT (b/285892320) Keep version and latestReleasedVersion in sync | ||
# unless you are releasing a new version of the library to prevent issues | ||
# with transitive dependencies. | ||
version=18.0.0 | ||
version=18.0.1 | ||
emilypgoogle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
latestReleasedVersion=18.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.