From 85fc3e5050d74a5c10093fe9f1abc35807586527 Mon Sep 17 00:00:00 2001 From: AndroidX Test Team Date: Wed, 17 Jan 2024 14:15:08 -0800 Subject: [PATCH] internal PiperOrigin-RevId: 599286866 --- build_extensions/axt_versions.bzl | 6 ++- tools/release/BUILD | 45 +++++++++++++++++++ tools/release/settings.gradle.template | 42 +++++++++++++++++ .../validate_and_propagate_versions.sh | 18 ++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 tools/release/BUILD create mode 100644 tools/release/settings.gradle.template create mode 100644 tools/release/validate_and_propagate_versions.sh diff --git a/build_extensions/axt_versions.bzl b/build_extensions/axt_versions.bzl index 5c7acd6a3..4b4a37d31 100644 --- a/build_extensions/axt_versions.bzl +++ b/build_extensions/axt_versions.bzl @@ -1,4 +1,8 @@ -"""Defines next to be released AXT versions.""" +"""Defines next to be released AXT versions. + +Use tools/release/validate_and_propagate_versions.sh to propagate these versions to +//:axt_m2_repository and gradle-tests/settings.gradle +""" RUNNER_VERSION = "1.6.0-alpha06" RULES_VERSION = "1.6.0-alpha03" diff --git a/tools/release/BUILD b/tools/release/BUILD new file mode 100644 index 000000000..80302e1f9 --- /dev/null +++ b/tools/release/BUILD @@ -0,0 +1,45 @@ +load("@bazel_skylib//rules:expand_template.bzl", "expand_template") +load( + "//build_extensions:axt_versions.bzl", + "ANDROIDX_JUNIT_VERSION", + "ANDROIDX_TRUTH_VERSION", + "ANNOTATION_VERSION", + "CORE_VERSION", + "ESPRESSO_VERSION", + "MONITOR_VERSION", + "ORCHESTRATOR_VERSION", + "RULES_VERSION", + "RUNNER_VERSION", + "SERVICES_VERSION", +) + +package( + default_visibility = [ + "//:__subpackages__", + ], +) + +expand_template( + name = "update_settings_gradle", + out = "settings.gradle.out", + substitutions = { + "{ANDROIDX_JUNIT_VERSION}": ANDROIDX_JUNIT_VERSION, + "{ANDROIDX_TRUTH_VERSION}": ANDROIDX_TRUTH_VERSION, + "{ANNOTATION_VERSION}": ANNOTATION_VERSION, + "{CORE_VERSION}": CORE_VERSION, + "{ESPRESSO_VERSION}": ESPRESSO_VERSION, + "{MONITOR_VERSION}": MONITOR_VERSION, + "{ORCHESTRATOR_VERSION}": ORCHESTRATOR_VERSION, + "{RULES_VERSION}": RULES_VERSION, + "{RUNNER_VERSION}": RUNNER_VERSION, + "{SERVICES_VERSION}": SERVICES_VERSION, + }, + template = "settings.gradle.template", +) + +genrule( + name = "update_settings_gradle_rule", + srcs = [":update_settings_gradle"], + outs = ["settings.gradle"], + cmd = "cp $(location :update_settings_gradle) \"$@\"", +) diff --git a/tools/release/settings.gradle.template b/tools/release/settings.gradle.template new file mode 100644 index 000000000..554d7071c --- /dev/null +++ b/tools/release/settings.gradle.template @@ -0,0 +1,42 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + mavenLocal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + mavenLocal() + } + versionCatalogs { + libs { + library('core', 'androidx.test:core:{CORE_VERSION}') + library('runner', 'androidx.test:runner:{RUNNER_VERSION}') + library('ext.junit', 'androidx.test.ext:junit:{ANDROIDX_JUNIT_VERSION}') + library('ext.truth', 'androidx.test.ext:truth:{ANDROIDX_TRUTH_VERSION}') + library('espresso.accessibility', 'androidx.test.espresso:espresso-accessibility:{ESPRESSO_VERSION}') + library('espresso.contrib', 'androidx.test.espresso:espresso-contrib:{ESPRESSO_VERSION}') + library('espresso.core', 'androidx.test.espresso:espresso-core:{ESPRESSO_VERSION}') + library('espresso.idlingresource', 'androidx.test.espresso:espresso-idling-resource:{ESPRESSO_VERSION}') + library('espresso.intents', 'androidx.test.espresso:espresso-intents:{ESPRESSO_VERSION}') + library('espresso.web', 'androidx.test.espresso:espresso-web:{ESPRESSO_VERSION}') + library('orchestrator', 'androidx.test:orchestrator:{ORCHESTRATOR_VERSION}') + + } + } +} + +rootProject.name = "Gradle Tests" +include ':runner' +include ':espresso' +include ':espresso:accessibility' +include ':espresso:contrib' +include ':espresso-device' +include ':espresso:idling_resource' +include ':espresso:web' +include ':orchestrator' diff --git a/tools/release/validate_and_propagate_versions.sh b/tools/release/validate_and_propagate_versions.sh new file mode 100644 index 000000000..efc2582b4 --- /dev/null +++ b/tools/release/validate_and_propagate_versions.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will do the following: +# +# 1) Validate that the version numbers in axt_versions.bzl were incremented +# correctly +# 2) Update //:axt_m2repository based off of axt_versions.bzl +# 3) Update gradle-tests/settings.gradle using axt_versions.bzl +# +# To run, execute this script from the repository root: +# +# cd $REPOSITORY_ROOT +# bash tools/release/validate_and_propagate_versions.sh +# + +bazelisk run //tools/release/java/androidx/test/tools/releaseupdater:releaseupdater | xargs buildozer +bazelisk build //tools/release:update_settings_gradle_rule +cp bazel-bin/tools/release/settings.gradle gradle-tests/settings.gradle