dart-sdk/build/fuchsia/with_envs.py
Zijie He 476ed37a25 Reland "[Fuchsia] Remove the legacy gn build rules for fuchsia"
This change may require a codereview from flutter side before moving
forward. See https://github.com/flutter/engine/pull/51072.

This reverts commit 283051acba.

Reason for revert: Redo the change with the similar one in flutter.

After this change, the next dart -> flutter roll needs extra cares
in https://github.com/flutter/engine/pull/51072. It also contains
more details about the reason why it could not be two-way
compatible.

Original change's description:
> Revert "[Fuchsia] Remove the legacy gn build rules for fuchsia"
>
> This reverts commit 094202bb91.
>
> Reason for revert: Break flutter, this change should happen after
> flutter being migrated to the same gn-sdk.
>
> Original change's description:
> > [Fuchsia] Remove the legacy gn build rules for fuchsia
> >
> > The updated test-scripts contains https://crrev.com/c/5341620 which
> > allows to generate fidl apis with an env var controlled location
> > rather than a hard-coded one. So the existing fuchsia gn build rules
> > in dart/sdk become obsolete and can be fully removed in favor of the
> > one in //third_party/fuchsia/gn-sdk/.
> >
> > Meanwhile the gn-sdk has been updated with
> > https://crrev.com/c/5325282 to use api-level version'ed idk but not
> > the ones in arch/.
> >
> > Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
> > Tested: ^^^^^
> > Bug: 40935282
> > Change-Id: I2ce958e6db1ff8221beef7b7ff953c32bb4525ba
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355283
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> > Reviewed-by: Alexander Thomas <athom@google.com>
> > Commit-Queue: Zijie He <zijiehe@google.com>
>
> Bug: 40935282
> Change-Id: I7c455d1d362210523671c97d99ef018ede1743f4
> Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356307
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Zijie He <zijiehe@google.com>
> Reviewed-by: Derek Xu <derekx@google.com>
> Commit-Queue: Zijie He <zijiehe@google.com>

Bug: 40935282
Change-Id: Id5a9a98013350359037b19f8506f24158c9a3120
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356924
Commit-Queue: Zijie He <zijiehe@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-03-14 20:22:12 +00:00

60 lines
2 KiB
Python
Executable file

#!/usr/bin/env python3
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import platform
import subprocess
import sys
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__),
'../../third_party/fuchsia/test_scripts/test/')))
from common import catch_sigterm, wait_for_sigterm
def Main():
"""
Execute the test-scripts with required environment variables. It acts like
/usr/bin/env, but provides some extra functionality to dynamically set up
the environment variables.
"""
# Ensures the signals can be correctly forwarded to the subprocesses.
catch_sigterm()
os.environ['SRC_ROOT'] = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
os.environ['FUCHSIA_IMAGES_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'images')
sdk_dir = ''
if platform.system() == 'Linux':
sdk_dir = 'linux'
elif platform.system() == 'Darwin':
sdk_dir = 'mac'
else:
assert False, 'Unsupported OS'
os.environ['FUCHSIA_SDK_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'sdk', sdk_dir)
os.environ['FUCHSIA_GN_SDK_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'gn-sdk', 'src')
with subprocess.Popen(sys.argv[1:]) as proc:
try:
proc.wait()
except:
# Use terminate / SIGTERM to allow the subprocess exiting cleanly.
proc.terminate()
return proc.returncode
if __name__ == '__main__':
sys.exit(Main())