diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/BUILD.gn b/BUILD.gn index 133f8e43f98e..3c906d1b2a9e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2,7 +2,11 @@ # 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("build/config/gclient_args.gni") +targeting_packaging = target_os == "linux_packaged" + +if (!targeting_packaging) { + import("build/config/gclient_args.gni") +} import("sdk_args.gni") targeting_fuchsia = target_os == "fuchsia" @@ -44,19 +48,30 @@ group("runtime") { # Fuchsia has run_vm_tests marked testonly. testonly = true } - - deps = [ - "runtime/bin:dart", - "runtime/bin:ffi_test_dynamic_library", - "runtime/bin:ffi_test_functions", - "runtime/bin:process_test", - "runtime/bin:run_vm_tests", - "runtime/vm:kernel_platform_files($host_toolchain)", - "samples/embedder:all", - "samples/ffi/http:fake_http", - "utils/dartdev:dartdev", - "utils/kernel-service:kernel-service", - ] + if (!targeting_packaging) { + deps = [ + "runtime/bin:dart", + "runtime/bin:ffi_test_dynamic_library", + "runtime/bin:ffi_test_functions", + "runtime/bin:process_test", + "runtime/bin:run_vm_tests", + "runtime/vm:kernel_platform_files($host_toolchain)", + "samples/embedder:all", + "samples/ffi/http:fake_http", + "utils/dartdev:dartdev", + "utils/kernel-service:kernel-service", + ] + } + if (targeting_packaging) { + deps = [ + "runtime/bin:dart", + "runtime/vm:kernel_platform_files($host_toolchain)", + "samples/embedder:all", + "samples/ffi/http:fake_http", + "utils/dartdev:dartdev", + "utils/kernel-service:kernel-service", + ] + } # The following dependencies allow dartdev to start the resident frontend # server. @@ -386,82 +401,84 @@ if (is_fuchsia) { test_deps = [] test_resources = [] - foreach(test_source, test_sources) { - label = string_replace(test_source, "/", "_") - - application_snapshot(label) { - dart_snapshot_kind = "kernel" - main_dart = test_source - training_args = [] # Not used - output = "$target_gen_dir/$test_source.dill" + if (!targeting_packaging) { + foreach(test_source, test_sources) { + label = string_replace(test_source, "/", "_") + + application_snapshot(label) { + dart_snapshot_kind = "kernel" + main_dart = test_source + training_args = [] # Not used + output = "$target_gen_dir/$test_source.dill" + } + + test_deps += [ ":$label" ] + test_resources += [ + { + path = rebase_path("$target_gen_dir/$test_source.dill") + dest = "data/$test_source" + }, + ] } - test_deps += [ ":$label" ] - test_resources += [ - { - path = rebase_path("$target_gen_dir/$test_source.dill") - dest = "data/$test_source" - }, + test_binaries = [ + "dart", + "dartaotruntime", + "run_vm_tests", ] - } - test_binaries = [ - "dart", - "dartaotruntime", - "run_vm_tests", - ] - - foreach(binary, test_binaries) { - fuchsia_component("${binary}_test_component") { - testonly = true - manifest = "runtime/bin/${binary}_test_component.cml" - data_deps = [ - "runtime/bin:${binary}", - "runtime/bin:ffi_test_dynamic_library", - "runtime/bin:ffi_test_functions", - ] - library_files = [ - "libffi_test_dynamic_library.so", - "libffi_test_functions.so", - ] - resource_files = [ - ".dart_tool/package_config.json", - "tools/addlatexhash.dart", - ] - resources = [] - foreach(file, library_files) { - resources += [ - { - path = root_out_dir + "/" + file - dest = "lib/" + file - }, + foreach(binary, test_binaries) { + fuchsia_component("${binary}_test_component") { + testonly = true + manifest = "runtime/bin/${binary}_test_component.cml" + data_deps = [ + "runtime/bin:${binary}", + "runtime/bin:ffi_test_dynamic_library", + "runtime/bin:ffi_test_functions", ] - } - foreach(file, resource_files) { - resources += [ - { - path = file - dest = "data/" + file - }, + library_files = [ + "libffi_test_dynamic_library.so", + "libffi_test_functions.so", + ] + resource_files = [ + ".dart_tool/package_config.json", + "tools/addlatexhash.dart", ] + resources = [] + foreach(file, library_files) { + resources += [ + { + path = root_out_dir + "/" + file + dest = "lib/" + file + }, + ] + } + foreach(file, resource_files) { + resources += [ + { + path = file + dest = "data/" + file + }, + ] + } + deps = test_deps + resources += test_resources } - deps = test_deps - resources += test_resources } - } - fuchsia_package("fuchsia_test_package") { - testonly = true - if (is_debug) { - package_name = "dart_test_debug" - } else if (is_release) { - package_name = "dart_test_release" - } else if (is_product) { - package_name = "dart_test_product" - } - deps = [] - foreach(binary, test_binaries) { - deps += [ ":${binary}_test_component" ] + fuchsia_package("fuchsia_test_package") { + testonly = true + if (is_debug) { + package_name = "dart_test_debug" + } else if (is_release) { + package_name = "dart_test_release" + } else if (is_product) { + package_name = "dart_test_product" + } + deps = [] + foreach(binary, test_binaries) { + deps += [ ":${binary}_test_component" ] + } } } -} +} \ No newline at end of file diff --git a/tools/build.py b/tools/build.py index c6bab348bd6f..d248645e4e7f 100755 --- a/tools/build.py +++ b/tools/build.py @@ -165,7 +165,10 @@ def BuildOneConfig(options, targets, target_os, mode, arch, sanitizer, env): build_config = utils.GetBuildConf(mode, arch, target_os, sanitizer) out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os, sanitizer) using_rbe = False - command = ['buildtools/ninja/ninja', '-C', out_dir] + if os.path.isfile('buildtools/ninja/ninja'): + command = ['buildtools/ninja/ninja', '-C', out_dir] + elif os.path.isfile(os.path.join('/usr', 'bin', 'ninja')): + command = [os.path.join('/usr', 'bin', 'ninja'), '-C', out_dir] if options.verbose: command += ['-v'] if UseRBE(out_dir): @@ -213,7 +216,16 @@ def CheckCleanBuild(build_config, args, env): def SanitizerEnvironmentVariables(): - with io.open('tools/bots/test_matrix.json', encoding='utf-8') as fd: + if os.path.isfile('tools/bots/test_matrix.json'): + _test_matrix_path = 'tools/bots/test_matrix.json' + else: + if os.path.isfile(os.path.join(DART_ROOT, 'tools/bots/test_matrix.json')): + _test_matrix_path = os.path.join(DART_ROOT, 'tools/bots/test_matrix.json') + else: + _test_matrix_path = os.path.join( + os.path.join(os.getcwd(), 'tools/bots/test_matrix.json') + ) + with io.open(_test_matrix_path, encoding='utf-8') as fd: config = json.loads(fd.read()) env = dict() for k, v in config['sanitizer_options'].items(): diff --git a/tools/gn.py b/tools/gn.py index 905c82baec2d..4bb0e3b56871 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -174,7 +174,7 @@ def ParseStringMap(key, string_map): def UseSysroot(args, gn_args): # Don't try to use a Linux sysroot if we aren't on Linux. - if gn_args['target_os'] != 'linux' and HOST_OS != 'linux': + if gn_args['target_os'] != 'linux' and HOST_OS != 'linux' or gn_args['target_os'] != 'linux_packaged' and HOST_OS != 'linux': return False # Don't use the sysroot if we're given another sysroot. if TargetSysroot(args): @@ -225,9 +225,11 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash, # We only want the fallback root certs in the standalone VM on # Linux and Windows. if gn_args['target_os'] in ['linux', 'win']: + # This condition also covers the case of 'linux_packaged', which is a special case to cater for + # the needs of Linux distributions, which do not accept packages with prebuilt binary contents gn_args['dart_use_fallback_root_certificates'] = True - if gn_args['target_os'] == 'linux': + if gn_args['target_os'] == 'linux' or gn_args['target_os'] == 'linux_packaged': if gn_args['target_cpu'] == 'arm': # Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're # specifying a gnueabihf compiler in //build/toolchain/linux/BUILD.gn. @@ -354,7 +356,7 @@ def ProcessOptions(args): for os_name in oses: if not os_name in [ 'android', 'freebsd', 'linux', 'macos', 'win32', 'fuchsia', - 'ios', 'ios_simulator' + 'ios', 'ios_simulator', 'linux_packaged' ]: print("Unknown os %s" % os_name) return False @@ -561,7 +563,7 @@ def AddCommonConfigurationArgs(parser): parser.add_argument('--os', type=str, help='Target OSs (comma-separated).', - metavar='[all,host,android,fuchsia,ios,ios_simulator]', + metavar='[all,host,android,fuchsia,ios,ios_simulator,linux_packaged]', default='host') parser.add_argument('--sanitizer', type=str, @@ -635,7 +637,12 @@ def BuildGnCommand(args, mode, arch, target_os, sanitizer, out_dir): if utils.IsWindows(): gn = os.path.join(DART_ROOT, 'buildtools', 'win', 'gn.exe') else: - gn = os.path.join(DART_ROOT, 'buildtools', 'gn') + _gn = os.path.join(DART_ROOT, 'buildtools', 'gn') + if os.path.isfile(_gn): + gn = os.path.join(DART_ROOT, 'buildtools', 'gn') + else: + gn = os.path.join('/usr', 'bin', 'gn') + del _gn if not os.path.isfile(gn): raise Exception("Couldn't find the gn binary at path: " + gn)