Run local_engine.json builds in prod (#51931)
Finishes part 2 of https://github.com/flutter/flutter/issues/145263.
This required fixing a python script to use the version of Java obtained
through the DEPS file rather than one assumed to exist in the
environment.
diff --git a/.ci.yaml b/.ci.yaml
index 45fa508..d3a83a9 100644
--- a/.ci.yaml
+++ b/.ci.yaml
@@ -50,7 +50,6 @@
# You may use those names for the android_virtual_device version.
targets:
- name: Linux local_engine_builds
- bringup: true
enabled_branches:
- main
recipe: engine_v2/engine_v2
diff --git a/ci/builders/local_engine.json b/ci/builders/local_engine.json
index 679b566..a499692 100644
--- a/ci/builders/local_engine.json
+++ b/ci/builders/local_engine.json
@@ -118,10 +118,14 @@
}
},
{
+ "cas_archive": false,
"drone_dimensions": [
"os=Mac-13",
"device_type=none"
],
+ "gclient_variables": {
+ "use_rbe": true
+ },
"gn": [
"--runtime-mode",
"profile",
diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn
index 4b537f4..28c78d3 100644
--- a/shell/platform/android/BUILD.gn
+++ b/shell/platform/android/BUILD.gn
@@ -64,7 +64,8 @@
inputs = [ "android_exports.lst" ]
output_name = "flutter"
deps = [ ":flutter_shell_native_src" ]
- ldflags = [ "-Wl,--version-script=" + rebase_path("android_exports.lst") ]
+ ldflags = [ "-Wl,--version-script=" +
+ rebase_path("android_exports.lst", root_build_dir) ]
}
bin_to_assembly("icudtl_asm") {
diff --git a/testing/android/native_activity/native_activity_apk.py b/testing/android/native_activity/native_activity_apk.py
index 23813ab..2286d86 100644
--- a/testing/android/native_activity/native_activity_apk.py
+++ b/testing/android/native_activity/native_activity_apk.py
@@ -2,22 +2,39 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import sys
-
import argparse
import os
-import zipfile
import subprocess
+import sys
+import zipfile
-def run_command_checked(command):
+def run_command_checked(command, env=None):
try:
- subprocess.check_output(command, stderr=subprocess.STDOUT, text=True)
+ env = env if env is not None else os.environ
+ subprocess.check_output(command, stderr=subprocess.STDOUT, text=True, env=env)
except subprocess.CalledProcessError as cpe:
print(cpe.output)
raise cpe
+def is_mac():
+ return sys.platform == 'darwin'
+
+
+def java_home():
+ script_path = os.path.dirname(os.path.realpath(__file__))
+ if is_mac():
+ return os.path.join(
+ script_path, '..', '..', '..', '..', 'third_party', 'java', 'openjdk', 'Contents', 'Home'
+ )
+ return os.path.join(script_path, '..', '..', 'third_party', 'java', 'openjdk')
+
+
+def java_bin():
+ return os.path.join(java_home(), 'bin')
+
+
def main():
parser = argparse.ArgumentParser()
@@ -55,6 +72,9 @@
unsigned_apk_path = os.path.join(args.gen_dir, '%s.unsigned' % apk_name)
apk_path = args.output_path
+ java_path = ':'.join([java_bin(), os.environ['PATH']])
+ env = dict(os.environ, PATH=java_path, JAVA_HOME=java_home())
+
# Create the skeleton of the APK using aapt2.
aapt2_command = [
args.aapt2_bin,
@@ -66,7 +86,7 @@
'-o',
unaligned_apk_path,
]
- run_command_checked(aapt2_command)
+ run_command_checked(aapt2_command, env=env)
# Stuff the library in the APK which is just a regular ZIP file. Libraries are not compressed.
with zipfile.ZipFile(unaligned_apk_path, 'a', compression=zipfile.ZIP_STORED) as zipf:
@@ -81,14 +101,14 @@
unaligned_apk_path,
unsigned_apk_path,
]
- run_command_checked(zipalign_command)
+ run_command_checked(zipalign_command, env=env)
# Sign the APK.
apksigner_command = [
args.apksigner_bin, 'sign', '--ks', args.keystore, '--ks-pass', 'pass:android', '--out',
apk_path, unsigned_apk_path
]
- run_command_checked(apksigner_command)
+ run_command_checked(apksigner_command, env=env)
return 0