dart-sdk/build/fuchsia/with_envs.py
Zijie He 283051acba 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>
2024-03-08 20:50:31 +00:00

56 lines
1.8 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)
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())