Merge "auto-version-updates: including tracing-perfetto-*" into androidx-main
diff --git a/development/auto-version-updater/update_tracing_perfetto.sh b/development/auto-version-updater/update_tracing_perfetto.sh
new file mode 100755
index 0000000..654f20b
--- /dev/null
+++ b/development/auto-version-updater/update_tracing_perfetto.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+#
+# Usage:
+# ./update_perfetto.sh ANDROIDX_CHECKOUT CURRENT_VERSION NEW_VERSION
+#
+# Example:
+# ./update_perfetto.sh /Volumes/android/androidx-main/frameworks/support 1.0.0-alpha04 1.0.0-alpha05
+#
+
+set -euo pipefail
+
+ANDROIDX_CHECKOUT="$(cd "$1"; pwd -P .)" # gets absolute path of root dir
+CURRENT_VERSION="$2"
+NEW_VERSION="$3"
+
+OUT_DIR="$ANDROIDX_CHECKOUT/../../out"
+OUT_DIR_PROJECT_ZIPS="$OUT_DIR/dist/per-project-zips"
+
+PREBUILTS="$ANDROIDX_CHECKOUT/../../prebuilts"
+PREBUILTS_TRACING_PERFETTO_BINARY="$PREBUILTS/androidx/internal/androidx/tracing/tracing-perfetto-binary"
+
+function echo_colour() {
+ ORANGE='\033[0;33m'
+ NO_COLOUR='\033[0m'
+ echo -e "${ORANGE}${*}${NO_COLOUR}"
+}
+
+function do_update() {
+ # update version in code
+ cd "$ANDROIDX_CHECKOUT"
+ echo_colour "Updating version in code..."
+ sed -r -i "" "s/tracingPerfettoVersion = \"$CURRENT_VERSION\"/tracingPerfettoVersion = \"$NEW_VERSION\"/" \
+ benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/PerfettoSdkHandshakeTest.kt
+ sed -r -i "" "s/TRACING_PERFETTO = \"$CURRENT_VERSION\"/TRACING_PERFETTO = \"$NEW_VERSION\"/" \
+ libraryversions.toml
+ sed -r -i "" "s/#define VERSION \"$CURRENT_VERSION\"/#define VERSION \"$NEW_VERSION\"/" \
+ tracing/tracing-perfetto-binary/src/main/cpp/tracing_perfetto.cc
+ sed -r -i "" "s/const val libraryVersion = \"$CURRENT_VERSION\"/const val libraryVersion = \"$NEW_VERSION\"/" \
+ tracing/tracing-perfetto/src/androidTest/java/androidx/tracing/perfetto/jni/test/PerfettoNativeTest.kt
+ sed -r -i "" "s/const val version = \"$CURRENT_VERSION\"/const val version = \"$NEW_VERSION\"/" \
+ tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/jni/PerfettoNative.kt
+ echo_colour "Updating version in code... ✓"
+
+ # build new binaries
+ echo_colour "Building new binaries..."
+ ./gradlew :tracing:tracing-perfetto-binary:createProjectZip -DTRACING_PERFETTO_REUSE_PREBUILTS_AAR=false
+ echo_colour "Building new binaries... ✓"
+
+ # copy binaries to prebuilts
+ echo_colour "Copying files to prebuilts..."
+ project_zip=$(find "$OUT_DIR_PROJECT_ZIPS" -type f -maxdepth 1 -name "*tracing*perfetto*binary*$NEW_VERSION*.zip")
+ dst_dir="$PREBUILTS_TRACING_PERFETTO_BINARY/$NEW_VERSION"
+ if [ -a "$dst_dir" ]; then rm -rf "$dst_dir"; fi
+ mkdir "$dst_dir"
+ unzip -xjqq "$project_zip" "**/$NEW_VERSION/**" -d "$dst_dir"
+ echo_colour "Copying files to prebuilts... ✓"
+
+ # update SHA
+ echo_colour "Updating binary checksums..."
+ for arch in armeabi-v7a arm64-v8a x86 x86_64; do
+ cd "$dst_dir"
+ checksum=$(unzip -cxqq "*tracing*binary*$NEW_VERSION*.aar" "**/$arch/libtracing_perfetto.so" | shasum -a256 | awk '{print $1}')
+ cd "$ANDROIDX_CHECKOUT"
+ sed -r -i "" "s/\"$arch\" to \"[a-z0-9]{64}\"/\"$arch\" to \"$checksum\"/" \
+ tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/jni/PerfettoNative.kt
+ done
+ echo_colour "Updating binary checksums... ✓"
+
+ # all done
+ echo_colour "UPDATE SUCCESSFUL"
+}
+
+do_update
diff --git a/development/auto-version-updater/update_versions_for_release.py b/development/auto-version-updater/update_versions_for_release.py
index 0cbf544..74ee348 100755
--- a/development/auto-version-updater/update_versions_for_release.py
+++ b/development/auto-version-updater/update_versions_for_release.py
@@ -35,6 +35,8 @@
COMPOSE_VERSION_FP = os.path.join(FRAMEWORKS_SUPPORT_FP, COMPOSE_VERSION_REL)
VERSION_CHECKER_REL = './compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/VersionChecker.kt'
VERSION_CHECKER_FP = os.path.join(FRAMEWORKS_SUPPORT_FP, VERSION_CHECKER_REL)
+PREBUILTS_ANDROIDX_INTERNAL_REL = '../../prebuilts/androidx/internal'
+PREBUILTS_ANDROIDX_INTERNAL_FP = os.path.join(FRAMEWORKS_SUPPORT_FP, PREBUILTS_ANDROIDX_INTERNAL_REL)
# Set up input arguments
parser = argparse.ArgumentParser(
@@ -432,16 +434,36 @@
return
+def update_tracing_perfetto_version(old_version):
+ """Updates tracing-perfetto version and artifacts (including building new binaries)
+
+ Args:
+ old_version: old version of the existing library
+ Returns:
+ `True` if the version was updated, `False` otherwise.
+ """
+ new_version = increment_version(old_version)
+ cmd = "update_tracing_perfetto.sh %s %s %s" % (FRAMEWORKS_SUPPORT_FP, old_version, new_version)
+ try:
+ subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError:
+ print_e("FAIL: Error while running: '%s'" % cmd)
+ return False
+ return True
def commit_updates(release_date):
- subprocess.check_call(['git', 'add', FRAMEWORKS_SUPPORT_FP])
- # ensure that we've actually made a change:
- staged_changes = subprocess.check_output('git diff --cached', stderr=subprocess.STDOUT, shell=True)
- if not staged_changes:
- return
- msg = "'Update versions for release id %s\n\nThis commit was generated from the command:\n%s\n\n%s'" % (release_date, " ".join(sys.argv), "Test: ./gradlew checkApi")
- subprocess.check_call(['git', 'commit', '-m', msg])
- subprocess.check_output('yes | repo upload . --current-branch --no-verify --label Presubmit-Ready+1', stderr=subprocess.STDOUT, shell=True)
+ should_upload = False
+ for dir in [FRAMEWORKS_SUPPORT_FP, PREBUILTS_ANDROIDX_INTERNAL_FP]:
+ subprocess.check_call("cd %s && git add ." % dir)
+ # ensure that we've actually made a change:
+ staged_changes = subprocess.check_output("cd %s && git diff --cached" % dir, stderr=subprocess.STDOUT, shell=True)
+ if not staged_changes:
+ continue
+ msg = "'Update versions for release id %s\n\nThis commit was generated from the command:\n%s\n\n%s'" % (release_date, " ".join(sys.argv), "Test: ./gradlew checkApi")
+ subprocess.check_call("cd %s && git commit -m \"%s\"" % (dir, msg))
+ should_upload = True
+ if should_upload:
+ subprocess.check_output('repo upload --cbr -t -y --label Presubmit-Ready+1', stderr=subprocess.STDOUT, shell=True)
def main(args):
# Parse arguments and check for existence of build ID or file
@@ -465,6 +487,10 @@
update_compose_runtime_version(group_id,
artifact["artifactId"],
artifact["version"])
+ if (group_id == "androidx.tracing" and
+ artifact["artifactId"] == "tracing-perfetto"):
+ updated = update_tracing_perfetto_version(artifact["version"])
+
if not updated:
non_updated_libraries.append("%s:%s:%s" % (group_id,
artifact["artifactId"],