Skip to content

Commit

Permalink
Merge "Handle case when there's no released AGP version for major.min…
Browse files Browse the repository at this point in the history
…or version" into studio-main
  • Loading branch information
scott-pollom authored and Android (Google) Code Review committed Jan 30, 2024
2 parents c11d2db + 3b782b6 commit a1b61a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/convert-recipes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
AGP_VERSION=$(java -cp "$RECIPES_CONVERTER_JAR" \
com.google.android.gradle_recipe.converter.LatestVersionFinderKt \
$RUNNER_TEMP/maven_metadata.xml $AGP_MAJOR_MINOR)
if [ "$AGP_VERSION" = "NA" ]; then
echo "No released version available for AGP $AGP_MAJOR_MINOR."
continue
fi
STANDALONE_JAR=true java -jar "$RECIPES_CONVERTER_JAR" \
convert --sourceAll recipes \
--destination "$BRANCH_DIR" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import kotlin.system.exitProcess

/**
* Entry point to call [findLatestVersion]
*
* Prints the latest version that begins with majorMinorVersion, or "NA" if no released version
* begins with majorMinorVersion.
*/
fun main(args: Array<String>) {
if (args.size != 2 || args.contains("--help")) {
Expand All @@ -31,10 +34,7 @@ fun main(args: Array<String>) {
}
val mavenMetadataFile = args[0]
val majorMinorVersion = args[1]
val latestVersion =
findLatestVersion(File(mavenMetadataFile), majorMinorVersion)
?: throw RuntimeException("Unable to find any version starting with $majorMinorVersion")
println(latestVersion)
println(findLatestVersion(File(mavenMetadataFile), majorMinorVersion) ?: "NA")
}

/**
Expand Down

0 comments on commit a1b61a1

Please sign in to comment.