Run local_engine.json builds in prod (flutter/engine#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.
This commit is contained in:
Zachary Anderson
2024-04-08 20:01:42 +00:00
committed by GitHub
parent 4aeeff0c3c
commit 5f5f524f33
4 changed files with 34 additions and 10 deletions

View File

@@ -50,7 +50,6 @@ platform_properties:
# 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

View File

@@ -118,10 +118,14 @@
}
},
{
"cas_archive": false,
"drone_dimensions": [
"os=Mac-13",
"device_type=none"
],
"gclient_variables": {
"use_rbe": true
},
"gn": [
"--runtime-mode",
"profile",

View File

@@ -64,7 +64,8 @@ shared_library("flutter_shell_native") {
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") {

View File

@@ -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 @@ def main():
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 @@ def main():
'-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 @@ def main():
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