diff --git a/.github/workflows/convert-recipes.yml b/.github/workflows/convert-recipes.yml index 95c22a58..efecc9d5 100644 --- a/.github/workflows/convert-recipes.yml +++ b/.github/workflows/convert-recipes.yml @@ -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" \ diff --git a/convert-tool/app/src/main/kotlin/com/google/android/gradle_recipe/converter/LatestVersionFinder.kt b/convert-tool/app/src/main/kotlin/com/google/android/gradle_recipe/converter/LatestVersionFinder.kt index f4dd5099..d7370086 100644 --- a/convert-tool/app/src/main/kotlin/com/google/android/gradle_recipe/converter/LatestVersionFinder.kt +++ b/convert-tool/app/src/main/kotlin/com/google/android/gradle_recipe/converter/LatestVersionFinder.kt @@ -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) { if (args.size != 2 || args.contains("--help")) { @@ -31,10 +34,7 @@ fun main(args: Array) { } 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") } /**