Deprecate obsolete repository Change-Id: If849c8ad558f0d74fb3d87ebc57e1606c26c4adb Reviewed-on: https://fuchsia-review.googlesource.com/c/build/+/418344 Reviewed-by: Mahesh Saripalli <maheshsr@google.com> Commit-Queue: Mahesh Saripalli <maheshsr@google.com>
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index de820df..0000000 --- a/.gitignore +++ /dev/null
@@ -1,22 +0,0 @@ -/.jiri/ -*.pyc - -*~ -*.DS_Store - -# Thumbnails -._* - -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ - -cipd.gni -.cipd/* -last-update -third_party/
diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 4c61558..0000000 --- a/AUTHORS +++ /dev/null
@@ -1,9 +0,0 @@ -# This is the list of Fuchsia Authors. - -# Names should be added to this file as one of -# Organization's name -# Individual's name <submission email address> -# Individual's name <submission email address> <email2> <emailN> - -Google Inc. -The Chromium Authors
diff --git a/BUILD.gn b/BUILD.gn deleted file mode 100644 index 11fc83b..0000000 --- a/BUILD.gn +++ /dev/null
@@ -1,283 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# - -group("bare_package_url_whitelist") { - # ________ _________ ________ ________ - # |\ ____\|\___ ___\\ __ \|\ __ \ - # \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ - # \ \_____ \ \ \ \ \ \ \\\ \ \ ____\ - # \|____|\ \ \ \ \ \ \ \\\ \ \ \___| - # ____\_\ \ \ \__\ \ \_______\ \__\ - # |\_________\ \|__| \|_______|\|__| - # \|_________| - # This is a whitelist of packages that have components that launch with legacy - # bare package URLs. Do not add to this list. Please launch your components - # with fuchsia-pkg URLs instead. - visibility = [ - "//garnet/bin/appmgr/integration_tests:*", - "//garnet/bin/appmgr/integration_tests/components:*", - "//garnet/bin/appmgr/integration_tests/inspect:*", - "//garnet/bin/appmgr/integration_tests/mock_runner:*", - "//garnet/bin/appmgr/integration_tests/sandbox/features/build-info:*", - "//garnet/bin/appmgr/integration_tests/sandbox/features/persistent-storage:*", - "//garnet/bin/appmgr/integration_tests/sandbox/features/shell:*", - "//garnet/bin/appmgr/integration_tests/sandbox/features/system-temp:*", - "//garnet/bin/appmgr/integration_tests/sandbox/services:*", - "//garnet/bin/auth:*", - "//garnet/bin/auth/testing/account_manager_integration:*", - "//garnet/bin/bluetooth/bt-gap:*", - "//garnet/bin/bluetooth/bt-mgr:*", - "//garnet/bin/bluetooth/bt-snoop:*", - "//garnet/bin/bluetooth/profiles/bt-a2dp-sink:*", - "//garnet/bin/bluetooth/tools/bt-snoop-cli:*", - "//garnet/bin/catapult_converter:*", - "//garnet/bin/chrealm/integration_tests:*", - "//garnet/bin/cobalt/app:*", - "//garnet/bin/cobalt/system-metrics:*", - "//garnet/bin/cpuperf/tests:*", - "//garnet/bin/cpuperf_provider:*", - "//garnet/bin/crashpad:*", - "//garnet/bin/crashpad/test:*", - "//garnet/bin/debug_agent:*", - "//garnet/bin/developer/tiles:*", - "//garnet/bin/developer/tiles_ctl:*", - "//garnet/bin/device_settings:*", - "//garnet/bin/dhcpd:*", - "//garnet/bin/dhcpd_test_client:*", - "//garnet/bin/display_capture_test:*", - "//garnet/bin/display_manager:*", - "//garnet/bin/fidl_compatibility_test:*", - "//garnet/bin/fonts:*", - "//garnet/bin/glob:*", - "//garnet/bin/guest/integration:*", - "//garnet/bin/guest/manager:*", - "//garnet/bin/guest/pkg/linux_guest:*", - "//garnet/bin/guest/pkg/zircon_guest:*", - "//garnet/bin/guest/runner:*", - "//garnet/bin/guest/vmm:*", - "//garnet/bin/guest/vmm/device:*", - "//garnet/bin/http:*", - "//garnet/bin/iquery:*", - "//garnet/bin/iquery/testing:*", - "//garnet/bin/kernel_crash_checker:*", - "//garnet/bin/ktrace_provider:*", - "//garnet/bin/logger:*", - "//garnet/bin/logger/tests:*", - "//garnet/bin/mdns/service:*", - "//garnet/bin/mdns/util:*", - "//garnet/bin/media:*", - "//garnet/bin/media/audio_core/mixer:*", - "//garnet/bin/media/audio_core/test:*", - "//garnet/bin/media/camera_manager:*", - "//garnet/bin/mediaplayer:*", - "//garnet/bin/memory_monitor:*", - "//garnet/bin/memory_monitor/test:*", - "//garnet/bin/net-cli:*", - "//garnet/bin/netcfg:*", - "//garnet/bin/netconnector:*", - "//garnet/bin/netstack_tests:*", - "//garnet/bin/netstack_tests/test_filter_client:*", - "//garnet/bin/network-speed-test:*", - "//garnet/bin/network_loader:*", - "//garnet/bin/network_settings_server:*", - "//garnet/bin/network_time:*", - "//garnet/bin/network_time/test:*", - "//garnet/bin/network_time_service:*", - "//garnet/bin/overnet/onet:*", - "//garnet/bin/overnet/overnetstack:*", - "//garnet/bin/pkg_ctl:*", - "//garnet/bin/pkg_resolver:*", - "//garnet/bin/power_manager:*", - "//garnet/bin/recovery_netstack:*", - "//garnet/bin/rolldice:*", - "//garnet/bin/run:*", - "//garnet/bin/run/test:*", - "//garnet/bin/run_test_component:*", - "//garnet/bin/run_test_component/test:*", - "//garnet/bin/scpi:*", - "//garnet/bin/sl4f:*", - "//garnet/bin/sshd-host:*", - "//garnet/bin/stash:*", - "//garnet/bin/stash_ctl:*", - "//garnet/bin/sysmgr/integration_tests:*", - "//garnet/bin/telephony/ril-qmi:*", - "//garnet/bin/terminal:*", - "//garnet/bin/thermd:*", - "//garnet/bin/timezone:*", - "//garnet/bin/timezone/test:*", - "//garnet/bin/trace/tests:*", - "//garnet/bin/trace_manager:*", - "//garnet/bin/trace_stress:*", - "//garnet/bin/tts:*", - "//garnet/bin/ui:*", - "//garnet/bin/ui/benchmarks/image_grid_cpp:*", - "//garnet/bin/ui/recovery_ui:*", - "//garnet/bin/ui/sketchy:*", - "//garnet/bin/ui/tests/performance:*", - "//garnet/bin/vulkan_loader:*", - "//garnet/bin/wayland:*", - "//garnet/bin/wayland/bridge:*", - "//garnet/bin/wlan/wlan-hw-sim:*", - "//garnet/bin/wlan/wlan-smoke-test:*", - "//garnet/bin/wlan/wlan-stress-test:*", - "//garnet/bin/wlan/wlancfg:*", - "//garnet/bin/wlan/wlanstack:*", - "//garnet/bin/xi_core:*", - "//garnet/examples/benchmark:*", - "//garnet/examples/camera/camera_client:*", - "//garnet/examples/components:*", - "//garnet/examples/escher:*", - "//garnet/examples/fidl/echo2_client_cpp:*", - "//garnet/examples/fidl/echo2_client_go:*", - "//garnet/examples/fidl/echo2_client_rust:*", - "//garnet/examples/fidl/echo2_client_rust_synchronous:*", - "//garnet/examples/fidl/echo2_server_c:*", - "//garnet/examples/fidl/echo2_server_cpp:*", - "//garnet/examples/fidl/echo2_server_go:*", - "//garnet/examples/fidl/echo2_server_rust:*", - "//garnet/examples/fidl/heartbeat_client_go:*", - "//garnet/examples/fidl/heartbeat_server_go:*", - "//garnet/examples/http/example_http_server:*", - "//garnet/examples/http/httpget_cpp:*", - "//garnet/examples/http/httpget_rust:*", - "//garnet/examples/intl:*", - "//garnet/examples/intl/test:*", - "//garnet/examples/media:*", - "//garnet/examples/overnet/echo/client:*", - "//garnet/examples/overnet/echo/server:*", - "//garnet/examples/overnet/interface_passing/client:*", - "//garnet/examples/overnet/interface_passing/server:*", - "//garnet/examples/profiler:*", - "//garnet/examples/rust/eth-rs:*", - "//garnet/examples/rust/staticlib:*", - "//garnet/examples/tcp/tcp_file_sender:*", - "//garnet/examples/testing/test_with_environment:*", - "//garnet/examples/ui:*", - "//garnet/go/src/amber:*", - "//garnet/go/src/fidl/compatibility_test:*", - "//garnet/go/src/netstack:*", - "//garnet/go/src/pmd:*", - "//garnet/go/src/system_update_package:*", - "//garnet/lib/magma:*", - "//garnet/lib/magma/tests:*", - "//garnet/lib/media/camera/simple_camera_server:*", - "//garnet/lib/rust/escaped-cstring:*", - "//garnet/lib/rust/fuchsia-pkg-uri:*", - "//garnet/lib/ui/gfx/tests:*", - "//garnet/lib/vulkan:*", - "//garnet/public/lib/escher:*", - "//garnet/public/lib/media/audio_dfx:*", - "//garnet/public/lib/media/timeline:*", - "//garnet/public/lib/media/transport:*", - "//garnet/public/lib/pkg_url:*", - "//peridot/bin/acquirers/story_info:*", - "//peridot/bin/agents/clipboard:*", - "//peridot/bin/basemgr:*", - "//peridot/bin/cloud_provider_firestore:*", - "//peridot/bin/context_engine:*", - "//peridot/bin/ledger:*", - "//peridot/bin/ledger/tests/benchmark:*", - "//peridot/bin/module_resolver:*", - "//peridot/bin/module_resolver/module_package_indexer:*", - "//peridot/bin/sessionmgr:*", - "//peridot/bin/sessionmgr/story_runner:*", - "//peridot/bin/suggestion_engine:*", - "//peridot/bin/token_manager:*", - "//peridot/examples/simple:*", - "//peridot/examples/swap_cpp:*", - "//peridot/examples/todo_cpp:*", - "//peridot/tests/benchmarks/story:*", - "//peridot/tests/chain:*", - "//peridot/tests/clipboard:*", - "//peridot/tests/common:*", - "//peridot/tests/component_context:*", - "//peridot/tests/embed_shell:*", - "//peridot/tests/intents:*", - "//peridot/tests/last_focus_time:*", - "//peridot/tests/link_context_entities:*", - "//peridot/tests/link_data:*", - "//peridot/tests/link_passing:*", - "//peridot/tests/module_context:*", - "//peridot/tests/parent_child:*", - "//peridot/tests/queue_persistence:*", - "//peridot/tests/session_shell:*", - "//peridot/tests/story_shell:*", - "//peridot/tests/suggestion:*", - "//peridot/tests/trigger:*", - "//topaz/app/dashboard:*", - "//topaz/app/infinite_scroller:*", - "//topaz/app/latin-ime:*", - "//topaz/app/ledger/ledger_dashboard:*", - "//topaz/app/maxwell/agents/module_suggester_dart:*", - "//topaz/app/maxwell/agents/usage_log:*", - "//topaz/app/perspective:*", - "//topaz/app/spinning_cube:*", - "//topaz/app/term:*", - "//topaz/auth_providers/google:*", - "//topaz/bin/accessibility_settings:*", - "//topaz/bin/bluetooth_settings:*", - "//topaz/bin/crasher_dart:*", - "//topaz/bin/device_settings:*", - "//topaz/bin/display_settings:*", - "//topaz/bin/fidl_bindings_test/server:*", - "//topaz/bin/fidl_bindings_test/test:*", - "//topaz/bin/fidl_compatibility_test/dart:*", - "//topaz/bin/flutter_screencap_test:*", - "//topaz/bin/session_shell/capybara_session_shell:*", - "//topaz/bin/session_shell/ermine_session_shell:*", - "//topaz/bin/system_dashboard:*", - "//topaz/bin/ui/benchmarks/image_grid_flutter:*", - "//topaz/bin/userpicker_base_shell:*", - "//topaz/bin/wifi_settings:*", - "//topaz/bin/xi/xi_embeddable:*", - "//topaz/bin/xi/xi_mod:*", - "//topaz/bin/xi/xi_session_agent:*", - "//topaz/bin/xi/xi_session_demo:*", - "//topaz/examples/bluetooth/ble_scanner:*", - "//topaz/examples/example_manual_relationships:*", - "//topaz/examples/fidl:*", - "//topaz/examples/fidl/echo_client_async_dart:*", - "//topaz/examples/fidl/echo_server_async_dart:*", - "//topaz/examples/fidl/fidl_bindings_performance:*", - "//topaz/examples/ledger/todo_list:*", - "//topaz/examples/ledger/todo_list_sledge:*", - "//topaz/examples/ledger/vote_list_sledge:*", - "//topaz/examples/mediaplayer/mediaplayer_flutter:*", - "//topaz/examples/mine_digger:*", - "//topaz/examples/modular/fibonacci_agent:*", - "//topaz/examples/modular/multilevel_mod:*", - "//topaz/examples/modular/shapes_mod:*", - "//topaz/examples/modular/slider_mod:*", - "//topaz/examples/mondrian_test:*", - "//topaz/examples/story_shell_test:*", - "//topaz/examples/test/driver_example_mod:*", - "//topaz/examples/tictactoe/bin/tictactoe/game_board_mod:*", - "//topaz/examples/tictactoe/bin/tictactoe/game_tracker_agent:*", - "//topaz/examples/tictactoe/bin/tictactoe/scoreboard_mod:*", - "//topaz/examples/ui/async_hello_mod:*", - "//topaz/examples/ui/hello_mod:*", - "//topaz/examples/ui/noodles:*", - "//topaz/examples/ui/simple_flutter:*", - "//topaz/examples/ui/sketchy_flutter:*", - "//topaz/examples/ui/text_flutter:*", - "//topaz/public/dart-pkg/zircon:*", - "//topaz/public/dart/fuchsia_modular:*", - "//topaz/public/dart/fuchsia_services:*", - "//topaz/public/dart/fuchsia_vfs:*", - "//topaz/runtime/dart:*", - "//topaz/runtime/dart_runner:*", - "//topaz/runtime/dart_runner/examples/goodbye_dart:*", - "//topaz/runtime/dart_runner/examples/hello_app_dart:*", - "//topaz/runtime/dart_runner/examples/hello_dart:*", - "//topaz/runtime/dart_runner/integration:*", - "//topaz/runtime/dart_runner/vmservice:*", - "//topaz/runtime/flutter_runner:*", - "//topaz/runtime/web_runner_prototype:*", - "//topaz/runtime/web_view:*", - "//topaz/shell/agents/home_work_agent:*", - "//topaz/shell/kernel_panic:*", - "//topaz/shell/mondrian_story_shell:*", - ] -}
diff --git a/Fuchsia.cmake b/Fuchsia.cmake deleted file mode 100644 index daabba8..0000000 --- a/Fuchsia.cmake +++ /dev/null
@@ -1,49 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Need support for CMAKE_C_COMPILER_TARGET -cmake_minimum_required(VERSION 3.0) - -set(CMAKE_SYSTEM_NAME Fuchsia) - -set(CMAKE_SYSROOT ${FUCHSIA_SYSROOT}) - -if(NOT DEFINED FUCHSIA_TOOLCHAIN) - string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} HOST_SYSTEM_PROCESSOR) - if(HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") - set(HOST_SYSTEM_PROCESSOR "x64") - elseif(HOST_SYSTEM_PROCESSOR STREQUAL "aarch64") - set(HOST_SYSTEM_PROCESSOR "arm64") - endif() - string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_SYSTEM_NAME) - if(HOST_SYSTEM_NAME STREQUAL "darwin") - set(HOST_SYSTEM_NAME "mac") - endif() - set(FUCHSIA_TOOLCHAIN "${CMAKE_CURRENT_LIST_DIR}/../buildtools/${HOST_SYSTEM_NAME}-${HOST_SYSTEM_PROCESSOR}/clang") -endif() - -if(NOT DEFINED FUCHSIA_COMPILER_TARGET) - set(FUCHSIA_COMPILER_TARGET "${FUCHSIA_SYSTEM_PROCESSOR}-fuchsia") -endif() - -set(CMAKE_C_COMPILER "${FUCHSIA_TOOLCHAIN}/bin/clang") -set(CMAKE_C_COMPILER_TARGET ${FUCHSIA_COMPILER_TARGET} CACHE STRING "") -set(CMAKE_CXX_COMPILER "${FUCHSIA_TOOLCHAIN}/bin/clang++") -set(CMAKE_CXX_COMPILER_TARGET ${FUCHSIA_COMPILER_TARGET} CACHE STRING "") -set(CMAKE_ASM_COMPILER "${FUCHSIA_TOOLCHAIN}/bin/clang") -set(CMAKE_ASM_COMPILER_TARGET ${FUCHSIA_COMPILER_TARGET} CACHE STRING "") - -set(CMAKE_LINKER "${FUCHSIA_TOOLCHAIN}/bin/ld.lld" CACHE PATH "") -set(CMAKE_AR "${FUCHSIA_TOOLCHAIN}/bin/llvm-ar" CACHE PATH "") -set(CMAKE_RANLIB "${FUCHSIA_TOOLCHAIN}/bin/llvm-ranlib" CACHE PATH "") -set(CMAKE_NM "${FUCHSIA_TOOLCHAIN}/bin/llvm-nm" CACHE PATH "") -set(CMAKE_OBJCOPY "${FUCHSIA_TOOLCHAIN}/bin/llvm-objcopy" CACHE PATH "") -set(CMAKE_OBJDUMP "${FUCHSIA_TOOLCHAIN}/bin/llvm-objdump" CACHE PATH "") -set(CMAKE_STRIP "${FUCHSIA_TOOLCHAIN}/bin/llvm-strip" CACHE PATH "") - -set(CMAKE_FIND_ROOT_PATH ${FUCHSIA_SYSROOT}) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/LICENSE b/LICENSE deleted file mode 100644 index ac6402f..0000000 --- a/LICENSE +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index eec9ade..0000000 --- a/MAINTAINERS +++ /dev/null
@@ -1,4 +0,0 @@ -jamesr@google.com -mcgrathr@google.com -phosek@google.com -pylaligand@google.com
diff --git a/PATENTS b/PATENTS deleted file mode 100644 index 2746e78..0000000 --- a/PATENTS +++ /dev/null
@@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Fuchsia project. - -Google hereby grants to you a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this -section) patent license to make, have made, use, offer to sell, sell, -import, transfer, and otherwise run, modify and propagate the contents -of this implementation of Fuchsia, where such license applies only to -those patent claims, both currently owned by Google and acquired in -the future, licensable by Google that are necessarily infringed by -this implementation. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute -or order or agree to the institution of patent litigation or any other -patent enforcement activity against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that this -implementation of Fuchsia constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of -Fuchsia shall terminate as of the date such litigation is filed.
diff --git a/README.md b/README.md index ad26bed..07f3c01 100644 --- a/README.md +++ b/README.md
@@ -1,3 +1,5 @@ -# Build +# Obsolete -Shared build configuration for Fuchsia. +This repository has moved into Fuchsia's main repository: +https://fuchsia.googlesource.com/fuchsia/+/master/build. +
diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/__init__.py +++ /dev/null
diff --git a/assert_cmx.gni b/assert_cmx.gni deleted file mode 100644 index e08fb69..0000000 --- a/assert_cmx.gni +++ /dev/null
@@ -1,60 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# - -template("assert_cmx") { - package_meta = [] - if (defined(invoker.meta)) { - package_meta = invoker.meta - } - - found_cmx = false - - # deprecated_system_image are not fuchsia packages. Skip. - if (invoker.deprecated_system_image) { - found_cmx = true - } - - # Tests don't launch as components by default, so no cmx is required. - if (defined(invoker.testonly) && invoker.testonly) { - found_cmx = true - } - - # Unmigrated targets are whitelisted. - if (defined(invoker.deprecated_no_cmx)) { - found_cmx = true - } - - # Packages that only contain shell binaries are allowed. - if (defined(invoker.binaries)) { - bins = [] - foreach(binary, invoker.binaries) { - if (defined(binary.shell) && binary.shell) { - bins += [ binary ] - } - } - if (bins == invoker.binaries) { - found_cmx = true - } - } - - # Packages that only contain data are allowed. - if (!defined(invoker.binaries) && !defined(invoker.binary)) { - found_cmx = true - } - - foreach(item, package_meta) { - dest = item.path - if (defined(item.dest)) { - dest = item.dest - } - if (get_path_info(dest, "extension") == "cmx") { - found_cmx = true - } - } - - assert( - found_cmx == true, - "No cmx found in package $target_name. Please add cmx to your component. " + "See https://fuchsia.googlesource.com/docs/+/master/the-book/" + "package_metadata.md#Component-manifest. " + "Also see go/cmx-everywhere for the migration design.") -}
diff --git a/banjo/BUILD.gn b/banjo/BUILD.gn deleted file mode 100644 index 6ae9239..0000000 --- a/banjo/BUILD.gn +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -# A toolchain dedicated to processing Banjo libraries. -# The only targets in this toolchain are action() targets, so it -# has no real tools. But every toolchain needs stamp and copy. -toolchain("banjoing") { - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } - - toolchain_args = { - toolchain_variant = { - } - toolchain_variant = { - base = get_label_info(":banjoing", "label_no_toolchain") - } - } -}
diff --git a/banjo/banjo.gni b/banjo/banjo.gni deleted file mode 100644 index 98f3046..0000000 --- a/banjo/banjo.gni +++ /dev/null
@@ -1,71 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/banjo/toolchain.gni") - -# Declares a BANJO library. -# -# Depending on the toolchain in which this targets is expanded, it will yield -# different results: -# - in the BANJO toolchain, it will compile its source files into an -# intermediate representation consumable by language bindings generators; -# - in the target or shared toolchain, this will produce a source_set -# containing C/C++ bindings. -# -# Parameters -# -# sources (required) -# List of paths to library source files. -# -# name (optional) -# Name of the library. -# Defaults to the target's name. -# -# sdk_category (optional) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. - -template("banjo") { - if (defined(invoker.sdk_category)) { - not_needed(invoker, [ "sdk_category" ]) - } - if (current_toolchain == banjo_toolchain) { - import("//build/banjo/banjo_library.gni") - - banjo_library(target_name) { - forward_variables_from(invoker, "*") - } - } else if (is_fuchsia) { - import("//build/c/banjo_c.gni") - - banjo_c_target(target_name) { - forward_variables_from(invoker, "*") - } - } else { - assert(false, - "Unable to process BANJO target in toolchain $current_toolchain.") - } -} - -template("banjo_dummy") { - if (defined(invoker.sdk_category)) { - not_needed(invoker, [ "sdk_category" ]) - } - if (current_toolchain == banjo_toolchain) { - import("//build/banjo/banjo_library.gni") - - banjo_dummy_library(target_name) { - forward_variables_from(invoker, "*") - } - } else if (is_fuchsia) { - import("//build/c/banjo_c.gni") - - banjo_dummy_c_target(target_name) { - forward_variables_from(invoker, "*") - } - } else { - assert(false, - "Unable to process BANJO target in toolchain $current_toolchain.") - } -}
diff --git a/banjo/banjo_library.gni b/banjo/banjo_library.gni deleted file mode 100644 index 9ce9225..0000000 --- a/banjo/banjo_library.gni +++ /dev/null
@@ -1,305 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/banjo/toolchain.gni") -import("//build/compiled_action.gni") -import("//build/sdk/sdk_atom.gni") - -# Private template to generate an SDK Atom for banjo_library and -# banjo_dummy_library targets. -# - -template("_banjo_library_sdk") { - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - # Process sources. - file_base = "banjo/$library_name" - all_files = [] - sdk_sources = [] - foreach(source, invoker.sources) { - relative_source = rebase_path(source, ".") - if (string_replace(relative_source, "..", "bogus") != relative_source) { - # If the source file is not within the same directory, just use the file - # name. - relative_source = get_path_info(source, "file") - } - destination = "$file_base/$relative_source" - sdk_sources += [ destination ] - all_files += [ - { - source = rebase_path(source) - dest = destination - }, - ] - } - - # Identify metadata for dependencies. - sdk_metas = [] - sdk_deps = [] - all_deps = [] - if (defined(invoker.deps)) { - all_deps = invoker.deps - } - foreach(dep, all_deps) { - full_label = get_label_info(dep, "label_no_toolchain") - sdk_dep = "${full_label}_sdk" - sdk_deps += [ sdk_dep ] - gen_dir = get_label_info(sdk_dep, "target_gen_dir") - name = get_label_info(sdk_dep, "name") - sdk_metas += [ rebase_path("$gen_dir/$name.meta.json") ] - } - - # Generate the library metadata. - meta_file = "$target_gen_dir/${target_name}.sdk_meta.json" - meta_target_name = "${target_name}_meta" - - action(meta_target_name) { - script = "//build/banjo/gen_sdk_meta.py" - - inputs = sdk_metas - - outputs = [ - meta_file, - ] - - args = [ - "--out", - rebase_path(meta_file), - "--name", - library_name, - "--root", - file_base, - "--specs", - ] + sdk_metas + [ "--sources" ] + sdk_sources - - deps = sdk_deps - } - - sdk_atom("${target_name}_sdk") { - id = "sdk://banjo/$library_name" - - category = invoker.sdk_category - - meta = { - source = meta_file - dest = "$file_base/meta.json" - schema = "banjo_library" - } - - files = all_files - - non_sdk_deps = [ ":$meta_target_name" ] - - deps = [] - foreach(dep, all_deps) { - label = get_label_info(dep, "label_no_toolchain") - deps += [ "${label}_sdk" ] - } - } -} - -# Generates some representation of a Banjo library that's consumable by Language -# bindings generators. -# -# The parameters for this template are defined in //build/banjo/banjo.gni. The -# relevant parameters in this template are: -# - name; -# - sources; -# - sdk_category. - -template("banjo_library") { - assert( - current_toolchain == banjo_toolchain, - "This template can only be used in the Banjo toolchain $banjo_toolchain.") - - assert(defined(invoker.sources), "A Banjo library requires some sources.") - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - response_file = "$target_gen_dir/$target_name.args" - ddk_root = string_replace(string_replace(library_name, ".", "/"), "_", "-") - ddktl_root = string_replace(ddk_root, "ddk", "ddktl") - ddk_header = "$root_gen_dir/$ddk_root.h" - ddktl_header = "$root_gen_dir/$ddktl_root.h" - ddktl_internal_header = "$root_gen_dir/$ddktl_root-internal.h" - - main_target_name = target_name - response_file_target_name = "${target_name}_response_file" - compilation_target_name = "${target_name}_compile" - - all_deps = [] - if (defined(invoker.deps)) { - all_deps += invoker.deps - } - if (defined(invoker.public_deps)) { - all_deps += invoker.public_deps - } - - action(response_file_target_name) { - visibility = [ ":*" ] - - script = "//build/banjo/gen_response_file.py" - - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "sources", - "testonly", - ]) - - libraries = "$target_gen_dir/$main_target_name.libraries" - - outputs = [ - response_file, - libraries, - ] - - args = [ - "--out-response-file", - rebase_path(response_file, root_build_dir), - "--out-libraries", - rebase_path(libraries, root_build_dir), - "--ddk-header", - rebase_path(ddk_header, root_build_dir), - "--ddktl-header", - rebase_path(ddktl_header, root_build_dir), - "--name", - library_name, - "--sources", - ] + rebase_path(sources, root_build_dir) - - if (all_deps != []) { - dep_libraries = [] - - foreach(dep, all_deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - dep_libraries += [ "$gen_dir/$name.libraries" ] - } - - inputs = dep_libraries - - args += [ "--dep-libraries" ] + rebase_path(dep_libraries, root_build_dir) - } - } - - compiled_action(compilation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - visibility = [ ":*" ] - - tool = "//zircon/public/tool/banjoc" - - inputs = [ - response_file, - ] - - outputs = [ - ddk_header, - ddktl_header, - ddktl_internal_header, - ] - - rebased_response_file = rebase_path(response_file, root_build_dir) - - args = [ "@$rebased_response_file" ] - - deps = [ - ":$response_file_target_name", - ] - } - - group(main_target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - public_deps = [ - ":$compilation_target_name", - ":$response_file_target_name", - ] - } - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - _banjo_library_sdk("$target_name") { - forward_variables_from(invoker, "*") - } - } -} - -template("banjo_dummy_library") { - assert( - current_toolchain == banjo_toolchain, - "This template can only be used in the Banjo toolchain $banjo_toolchain.") - - assert(defined(invoker.sources), - "A Banjo dummy library requires some sources.") - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - main_target_name = target_name - response_file_target_name = "${target_name}_response_file" - - action(response_file_target_name) { - visibility = [ ":*" ] - - script = "//build/banjo/gen_response_file.py" - - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "sources", - "testonly", - ]) - - response_file = "$target_gen_dir/$main_target_name.args" - libraries = "$target_gen_dir/$main_target_name.libraries" - - outputs = [ - response_file, - libraries, - ] - - args = [ - "--out-response-file", - rebase_path(response_file, root_build_dir), - "--out-libraries", - rebase_path(libraries, root_build_dir), - "--name", - library_name, - "--sources", - ] + rebase_path(sources, root_build_dir) - } - - group(main_target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - public_deps = [ - ":$response_file_target_name", - ] - } - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - _banjo_library_sdk("$target_name") { - forward_variables_from(invoker, "*") - } - } -}
diff --git a/banjo/gen_response_file.py b/banjo/gen_response_file.py deleted file mode 100755 index 0d3dea5..0000000 --- a/banjo/gen_response_file.py +++ /dev/null
@@ -1,71 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import string -import sys - - -def read_libraries(libraries_path): - with open(libraries_path) as f: - lines = f.readlines() - return [l.rstrip("\n") for l in lines] - - -def write_libraries(libraries_path, libraries): - directory = os.path.dirname(libraries_path) - if not os.path.exists(directory): - os.makedirs(directory) - with open(libraries_path, "w+") as f: - for library in libraries: - f.write(library) - f.write("\n") - - -def main(): - parser = argparse.ArgumentParser(description="Generate response file for Banjo frontend") - parser.add_argument("--out-response-file", help="The path for for the response file to generate", required=True) - parser.add_argument("--out-libraries", help="The path for for the libraries file to generate", required=True) - parser.add_argument("--ddk-header", help="The path for the C simple client file to generate, if any") - parser.add_argument("--ddktl-header", help="The path for the C header file to generate, if any") - parser.add_argument("--name", help="The name for the generated Banjo library, if any") - parser.add_argument("--sources", help="List of Banjo source files", nargs="*") - parser.add_argument("--dep-libraries", help="List of dependent libraries", nargs="*") - args = parser.parse_args() - - target_libraries = [] - - for dep_libraries_path in args.dep_libraries or []: - dep_libraries = read_libraries(dep_libraries_path) - for library in dep_libraries: - if library in target_libraries: - continue - target_libraries.append(library) - - target_libraries.append(" ".join(sorted(args.sources))) - - write_libraries(args.out_libraries, target_libraries) - - response_file = [] - - if args.name: - response_file.append("--name %s" % args.name) - - if args.ddk_header: - response_file.append("--ddk-header %s" % args.ddk_header) - - if args.ddktl_header: - response_file.append("--ddktl-header %s" % args.ddktl_header) - - response_file.extend(["--files %s" % library for library in target_libraries]) - - with open(args.out_response_file, "w+") as f: - f.write(" ".join(response_file)) - f.write("\n") - - -if __name__ == "__main__": - sys.exit(main())
diff --git a/banjo/gen_sdk_meta.py b/banjo/gen_sdk_meta.py deleted file mode 100755 index 6fb4509..0000000 --- a/banjo/gen_sdk_meta.py +++ /dev/null
@@ -1,58 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--name', - help='Name of the library', - required=True) - parser.add_argument('--root', - help='Root of the library in the SDK', - required=True) - parser.add_argument('--specs', - help='Path to spec files of dependencies', - nargs='*') - parser.add_argument('--sources', - help='List of library sources', - nargs='+') - args = parser.parse_args() - - metadata = { - 'type': 'banjo_library', - 'name': args.name, - 'root': args.root, - 'sources': args.sources, - 'files': args.sources, - } - - deps = [] - for spec in args.specs: - with open(spec, 'r') as spec_file: - data = json.load(spec_file) - type = data['type'] - name = data['name'] - if type == 'banjo_library' or type == 'banjo_dummy_library': - deps.append(name) - else: - raise Exception('Unsupported dependency type: %s' % type) - metadata['deps'] = deps - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/banjo/toolchain.gni b/banjo/toolchain.gni deleted file mode 100644 index 493dbed..0000000 --- a/banjo/toolchain.gni +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -banjo_toolchain = "//build/banjo:banjoing"
diff --git a/c/BUILD.gn b/c/BUILD.gn deleted file mode 100644 index 56e1322..0000000 --- a/c/BUILD.gn +++ /dev/null
@@ -1,11 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/banjo/toolchain.gni") - -config("banjo_gen_config") { - banjo_root_gen_dir = - get_label_info("//bogus($banjo_toolchain)", "root_gen_dir") - include_dirs = [ banjo_root_gen_dir ] -}
diff --git a/c/banjo_c.gni b/c/banjo_c.gni deleted file mode 100644 index 9fc8416..0000000 --- a/c/banjo_c.gni +++ /dev/null
@@ -1,81 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/banjo/toolchain.gni") -import("//build/compiled_action.gni") - -# C/C++ bindings for a Banjo protocol. -# -# The parameters for this template are defined in //build/banjo/banjo.gni. The -# relevant parameters in this template are: -# name: string, name of the Banjo protocol - -template("banjo_c_target") { - assert(is_fuchsia, "This template can only be used in $target_toolchain.") - - not_needed(invoker, [ "sources" ]) - - main_target_name = target_name - - library_name = invoker.name - - ddk_root = string_replace(string_replace(library_name, ".", "/"), "_", "-") - ddktl_root = string_replace(ddk_root, "ddk", "ddktl") - banjo_root_gen_dir = - get_label_info(":$target_name($banjo_toolchain)", "root_gen_dir") - ddk_header = "$banjo_root_gen_dir/$ddk_root.h" - ddktl_header = "$banjo_root_gen_dir/$ddktl_root.h" - ddktl_internal_header = "$banjo_root_gen_dir/$ddktl_root-internal.h" - - # The C/C++ headers are generated by the frontend, so we just need to - # produce a target with the generated file name and configuration information. - source_set(main_target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - public = [ - ddk_header, - ddktl_header, - ddktl_internal_header, - ] - - # Let dependencies use `#include "$file_stem.h"`. - public_configs = [ "//build/c:banjo_gen_config" ] - - deps += [ ":${main_target_name}_compile($banjo_toolchain)" ] - - libs = [ "zircon" ] - } -} - -template("banjo_dummy_c_target") { - assert(is_fuchsia, "This template can only be used in $target_toolchain.") - - not_needed(invoker, - [ - "sources", - "name", - ]) - - main_target_name = target_name - - # The headers referenced by a dummy target all exist in the sysroot. - source_set(main_target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - public_deps = [ - "//zircon/public/sysroot", - ] - libs = [ "zircon" ] - } -}
diff --git a/c/fidl_c.gni b/c/fidl_c.gni deleted file mode 100644 index 0fc6c15..0000000 --- a/c/fidl_c.gni +++ /dev/null
@@ -1,120 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") - -template("fidl_tables") { - main_target_name = target_name - - fidl_target_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "target_gen_dir") - coding_tables = "$fidl_target_gen_dir/$target_name.fidl.tables.cc" - - # The C simple $type code is generated by the frontend, so we just need to - # produce a target with the generated file name and configuration information. - source_set(main_target_name + "_tables") { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - sources = [ - coding_tables, - ] - - deps = [ - ":${main_target_name}_compile($fidl_toolchain)", - ] - public_deps = [ - "//zircon/public/lib/fidl", - ] - } -} - -# C simple client bindings for a FIDL library. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# name: string, name of the FIDL library -# type: string, 'client' or 'server' - -template("fidl_c_target") { - assert(is_fuchsia, "This template can only be used in $target_toolchain.") - - type = invoker.type - main_target_name = target_name - - library_name = invoker.name - - c_stem = string_replace(library_name, ".", "/") + "/c/fidl" - fidl_root_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "root_gen_dir") - c_header = "$fidl_root_gen_dir/$c_stem.h" - c_file = "$fidl_root_gen_dir/$c_stem.$type.c" - - # The C simple $type code is generated by the frontend, so we just need to - # produce a target with the generated file name and configuration information. - source_set(main_target_name + "_c_" + type) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - sources = [ - c_file, - ] - public = [ - c_header, - ] - - # Let dependencies use `#include "$file_stem.h"`. - public_configs = [ "//build/cpp:fidl_gen_config" ] - - deps = [ - ":${main_target_name}_compile($fidl_toolchain)", - ":${main_target_name}_tables", - ] - public_deps = [ - "//zircon/public/lib/fidl", - ] - libs = [ "zircon" ] - } -} - -template("fidl_c_client") { - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - fidl_c_target(target_name) { - name = library_name - type = "client" - } -} - -template("fidl_c_server") { - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - fidl_c_target(target_name) { - name = library_name - type = "server" - } -}
diff --git a/cat.py b/cat.py deleted file mode 100755 index 2e0c1a8..0000000 --- a/cat.py +++ /dev/null
@@ -1,26 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import sys - -def parse_args(): - parser = argparse.ArgumentParser(description='Concat files.') - parser.add_argument('-i', action='append', dest='inputs', default=[], - help='Input files', required=True) - parser.add_argument('-o', dest='output', help='Output file', required=True) - args = parser.parse_args() - return args - -def main(): - args = parse_args() - with open(args.output, 'w') as outfile: - for fname in args.inputs: - with open(fname) as infile: - outfile.write(infile.read()) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/cat.sh b/cat.sh deleted file mode 100755 index 9c9428b..0000000 --- a/cat.sh +++ /dev/null
@@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# cat.sh output_file [file, ...] -# cat.sh concatenates all file arguments into output_file, separated by lines. -# cat.sh elides empty lines (in order to avoid breaking the symbolizer) - -# Note: `cat $output $@` is not equivalent - that does not produce new lines -# between inputs. - -readonly output="$1" -shift 1 -for file in "$@" -do - val="$(<"${file}")" - if [ -n "${val}" ]; then - echo "${val}" - fi -done > "${output}"
diff --git a/cipd-update.sh b/cipd-update.sh deleted file mode 100755 index 01049bd..0000000 --- a/cipd-update.sh +++ /dev/null
@@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -set -ex - -readonly SCRIPT_ROOT="$(cd $(dirname ${BASH_SOURCE[0]} ) && pwd)" -readonly FUCHSIA_ROOT="${SCRIPT_ROOT}/.." -readonly BUILD_ROOT="${FUCHSIA_ROOT}/build" -readonly BUILDTOOLS_DIR="${FUCHSIA_ROOT}/buildtools" -readonly CIPD="${BUILDTOOLS_DIR}/cipd" - -INTERNAL_ACCESS=false -if [[ "$(${CIPD} ls fuchsia_internal)" != "No matching packages." ]]; then - INTERNAL_ACCESS=true -fi -echo "internal_access = ${INTERNAL_ACCESS}" > "${SCRIPT_ROOT}/cipd.gni" - -declare -a ENSURE_FILES=("${SCRIPT_ROOT}/cipd.ensure") -if $INTERNAL_ACCESS; then - ENSURE_FILES+=("${SCRIPT_ROOT}/cipd_internal.ensure") -fi - -(sed '/^\$/!d' "${ENSURE_FILES[@]}" && sed '/^\$/d' "${ENSURE_FILES[@]}") | - ${CIPD} ensure -ensure-file - -root ${BUILD_ROOT} -log-level warning
diff --git a/cipd.ensure b/cipd.ensure deleted file mode 100644 index 47b60ae..0000000 --- a/cipd.ensure +++ /dev/null
@@ -1,22 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Note: changes to this file will require updating cipd.versions, which -# can be done by running `./cipd ensure-file-resolve -ensure-file cipd.ensure` -# from this directory. - -$ResolvedVersions cipd.versions - -# This tells CIPD to fix up manually deleted files. -$ParanoidMode CheckPresence - -$VerifiedPlatform linux-amd64 -$VerifiedPlatform mac-amd64 - -# Linux sysroot -@Subdir third_party/sysroot/linux-x64 -fuchsia/sysroot/linux-amd64 git_revision:a4aaacde9d37ccf91a0f8dc8267cb7ad5d9be283 - -@Subdir third_party/sysroot/linux-arm64 -fuchsia/sysroot/linux-arm64 git_revision:a4aaacde9d37ccf91a0f8dc8267cb7ad5d9be283
diff --git a/cipd.versions b/cipd.versions deleted file mode 100644 index b7b165f..0000000 --- a/cipd.versions +++ /dev/null
@@ -1,10 +0,0 @@ -# This file is auto-generated by 'cipd ensure-file-resolve'. -# Do not modify manually. All changes will be overwritten. - -fuchsia/sysroot/linux-amd64 - git_revision:a4aaacde9d37ccf91a0f8dc8267cb7ad5d9be283 - qIDZyI1rOQR7INRUL5vxltcQ9sAmdu3-FrI-Wcf_OVwC - -fuchsia/sysroot/linux-arm64 - git_revision:a4aaacde9d37ccf91a0f8dc8267cb7ad5d9be283 - B1w-KMj3c3107ZQ3i05ID0Keq_kDPXLmwAkwzn2LmTIC
diff --git a/cipd_internal.ensure b/cipd_internal.ensure deleted file mode 100644 index 8e27530..0000000 --- a/cipd_internal.ensure +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -$ParanoidMode CheckPresence
diff --git a/cmx/cmx.gni b/cmx/cmx.gni deleted file mode 100644 index f6bd428..0000000 --- a/cmx/cmx.gni +++ /dev/null
@@ -1,261 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/json/validate_json.gni") - -# Given a .cmx file, validates the module facet of it -# -# Parameters -# cmx (required) -# This is the .cmx file that wants to be validated. -# -# deps (optional) -template("cmx_module_validate") { - module_facet_validation = target_name + "_module_facet" - - # Validate the |fuchsia.module| facet schema. - validate_json(module_facet_validation) { - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "testonly", - "visibility", - ]) - - data = invoker.cmx - schema = "//build/cmx/facets/module_facet_schema.json" - } -} - -# Validates a cmx file -# -# The cmx_validate template will ensure that a given cmx file is conformant to -# the cmx schema, as defined by //garnet/bin/cmc/schema.json. A stamp file is -# generated to mark that a given cmx file has passed. -# -# Parameters -# -# data (required) -# [file] The path to the cmx file that is to be validated -# -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# cmx_validate(format) { -# data = meta.path -# } -template("cmx_validate") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "sources", - "public_deps", - "testonly", - "visibility", - ]) - - tool = "//garnet/bin/cmc" - tool_output_name = "cmc" - - stamp_file = "$target_gen_dir/$target_name.verified" - - inputs = [ - invoker.data, - ] - - outputs = [ - stamp_file, - ] - - args = [ - "--stamp", - rebase_path(stamp_file), - "validate", - rebase_path(invoker.data), - ] - } - cmx_module_validate("module_" + target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - cmx = invoker.data - } -} - -# Compiles a cml file -# -# The cm_compile template will compile a cml file into a cm file. It will -# pretty-print the given cm file if is_debug is set to true. -# -# Parameters -# -# data (required) -# [file] The path to the cml file that is to be compiled. -# -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# cm_compile(format) { -# data = rebase_path(meta.path) -# } -template("cm_compile") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "testonly", - "visibility", - ]) - tool = "//garnet/bin/cmc/" - tool_output_name = "cmc" - - compiled_output = "$target_out_dir/$target_name" - inputs = [ - invoker.data, - ] - outputs = [ - compiled_output, - ] - - args = [ - "compile", - "--output", - rebase_path(compiled_output), - invoker.data, - ] - - if (is_debug) { - args += [ "--pretty" ] - } - } -} - -# Merges together cmx files -# -# The cmx_merge template will combine the given cmx files into a single cmx -# file. -# -# Parameters -# -# sources (required) -# [list of files] A list of cmx files that are to be merged. -# -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# cmx_merge(format) { -# sources = [ -# rebase_path(meta.path), -# rebase_path( -# "//topaz/runtime/dart_runner/meta/aot${product_suffix}_runtime"), -# ] -# } -template("cmx_merge") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "sources", - "public_deps", - "testonly", - "visibility", - ]) - - tool = "//garnet/bin/cmc" - tool_output_name = "cmc" - - merged_output = "$target_out_dir/$target_name" - inputs = invoker.sources - outputs = [ - merged_output, - ] - - args = [ - "merge", - "--output", - rebase_path(merged_output), - ] - - foreach(source, sources) { - args += [ rebase_path(source, root_build_dir) ] - } - } -} - -# Formats a cmx file -# -# The cmx_format template will minify the given cmx file if is_debug is set to -# false, and will pretty-print the given cmx file if is_debug is set to true. -# -# Parameters -# -# data (required) -# [file] The path to the cmx file that is to be formatted -# -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# cmx_format(format) { -# data = rebase_path(meta.path) -# } -template("cmx_format") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "testonly", - "visibility", - ]) - - tool = "//garnet/bin/cmc" - tool_output_name = "cmc" - - formatted_output = "$target_out_dir/$target_name" - inputs = [ - invoker.data, - ] - outputs = [ - formatted_output, - ] - - args = [ - "format", - "--output", - rebase_path(formatted_output), - invoker.data, - ] - - if (is_debug) { - args += [ "--pretty" ] - } - } -}
diff --git a/cmx/facets/module_facet_schema.json b/cmx/facets/module_facet_schema.json deleted file mode 100644 index 16acc51..0000000 --- a/cmx/facets/module_facet_schema.json +++ /dev/null
@@ -1,121 +0,0 @@ -{ - "$schema": "http://json-schema.org/schema#", - "title": "Schema for a .cmx's `fuchsia.module` facet", - "definitions": { - "facets": { - "type": "object", - "properties": { - "fuchsia.module": { - "$ref": "#/definitions/moduleFacet" - } - } - }, - "moduleFacet": { - "type": "object", - "properties": { - "suggestion_headline": { - "type": "string" - }, - "intent_filters": { - "$ref": "#/definitions/intentFilterArray" - }, - "composition_pattern": { - "$ref": "#/definitions/compositionPattern" - }, - "action": { - "type": "string" - }, - "parameters": { - "$ref": "#/definitions/parameterArray" - }, - "@version": { - "type": "integer" - }, - "placeholder_color": { - "$ref": "#definitions/hexColor" - } - }, - "dependencies": { - "intent_filters": { - "required": [ - "@version" - ] - } - }, - "additionalProperties": false - }, - "intentFilterArray": { - "type": "array", - "items": { - "$ref": "#/definitions/intentFilter" - }, - "additionalItems": false, - "uniqueItems": true, - "minItems": 1 - }, - "intentFilter": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "parameters": { - "$ref": "#/definitions/parameterArray" - } - }, - "required": [ - "action", - "parameters" - ] - }, - "parameterArray": { - "type": "array", - "items": { - "$ref": "#/definitions/parameter" - }, - "additionalItems": false, - "uniqueItems": true - }, - "parameter": { - "type": "object", - "properties": { - "name": { - "$ref": "#/definitions/alphaNumString" - }, - "type": { - "type": "string" - }, - "required": { - "type": "boolean" - } - }, - "required": [ - "name", - "type" - ], - "additionalProperties": false - }, - "alphaNumString": { - "type": "string", - "pattern": "^[a-zA-Z0-9_]+$" - }, - "compositionPattern": { - "type": "string", - "enum": [ - "ticker", - "comments-right" - ] - }, - "hexColor": { - "type": "string", - "pattern": "^#([A-Fa-f0-9]{6})$" - } - }, - "type": "object", - "properties": { - "facets": { - "$ref": "#/definitions/facets" - } - }, - "additionalProperties": true -} \ No newline at end of file
diff --git a/compiled_action.gni b/compiled_action.gni deleted file mode 100644 index 4a5b8c8..0000000 --- a/compiled_action.gni +++ /dev/null
@@ -1,146 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/clang/clang.gni") - -# This file introduces two related templates that act like action and -# action_foreach but instead of running a script, it will compile a given tool -# in the host toolchain and run that (either once or over the list of inputs, -# depending on the variant). -# -# Parameters -# -# tool (required) -# [label] Label of the tool to run. This should be an executable, and -# this label should not include a toolchain (anything in parens). The -# host compile of this tool will be used. -# -# tool_output_name (optional) -# [string] The `output_name` in the `executable()` for `tool`. -# This default's to the `tool` target's name. -# -# outputs (required) -# [list of files] Like the outputs of action (if using "compiled_action", -# this would be just the list of outputs), or action_foreach (if using -# "compiled_action_foreach", this would contain source expansions mapping -# input to output files). -# -# args (required) -# [list of strings] Same meaning as action/action_foreach. -# -# inputs (optional) -# sources (optional) -# Files the binary takes as input. The step will be re-run whenever any -# of these change. If inputs is empty, the step will run only when the -# binary itself changes. -# -# args (all optional) -# depfile -# deps -# public_deps -# testonly -# visibility -# Same meaning as action/action_foreach. -# -# Example of usage: -# -# compiled_action("run_my_tool") { -# tool = "//tools/something:mytool" -# outputs = [ -# "$target_gen_dir/mysource.cc", -# "$target_gen_dir/mysource.h", -# ] -# -# # The tool takes this input. -# sources = [ "my_input_file.idl" ] -# -# # In this case, the tool takes as arguments the input file and the output -# # build dir (both relative to the "cd" that the script will be run in) -# # and will produce the output files listed above. -# args = [ -# rebase_path("my_input_file.idl", root_build_dir), -# "--output-dir", rebase_path(target_gen_dir, root_build_dir), -# ] -# } -# -# You would typically declare your tool like this: -# if (host_toolchain == current_toolchain) { -# executable("mytool") { -# ... -# } -# } -# -# The if statement around the executable is optional. That says "I only care -# about this target in the host toolchain". Usually this is what you want, and -# saves unnecessarily compiling your tool for the target platform. But if you -# need a target build of your tool as well, just leave off the if statement. -template("_compiled_action_target") { - assert(defined(invoker.tool), "tool must be defined for $target_name") - assert(defined(invoker.outputs), "outputs must be defined for $target_name") - assert(defined(invoker.args), "args must be defined for $target_name") - - target(invoker._target_type, target_name) { - forward_variables_from(invoker, - [ - "depfile", - "deps", - "inputs", - "outputs", - "public_deps", - "sources", - "testonly", - "tool_output_name", - "visibility", - ]) - if (!defined(deps)) { - deps = [] - } - if (!defined(inputs)) { - inputs = [] - } - - script = "//build/gn_run_binary.sh" - - # Constuct the host toolchain version of the tool. - host_tool = "${invoker.tool}($host_toolchain)" - - # Get the path to the executable. - if (!defined(tool_output_name)) { - tool_output_name = get_label_info(host_tool, "name") - } - tool_out_dir = get_label_info(host_tool, "root_out_dir") - host_executable = "$tool_out_dir/$tool_output_name" - - # Add the executable itself as an input. - inputs += [ host_executable ] - - deps += [ host_tool ] - - # The script takes as arguments Clang bin directory (for passing - # llvm-symbolizer to runtimes), the binary to run, and then the - # arguments to pass it. - args = [ - clang_prefix, - rebase_path(host_executable, root_build_dir), - ] + invoker.args - } -} - -# See _compiled_action_target(). -template("compiled_action") { - _compiled_action_target(target_name) { - _target_type = "action" - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - } -} - -# See _compiled_action_target(). -template("compiled_action_foreach") { - _compiled_action_target(target_name) { - _target_type = "action_foreach" - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - } -}
diff --git a/config/BUILD.gn b/config/BUILD.gn deleted file mode 100644 index b086555..0000000 --- a/config/BUILD.gn +++ /dev/null
@@ -1,252 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/compiler.gni") - -declare_args() { - if (is_fuchsia) { - # Controls whether the compiler emits full stack frames for function calls. - # This reduces performance but increases the ability to generate good - # stack traces, especially when we have bugs around unwind table generation. - # It applies only for Fuchsia targets (see below where it is unset). - # - # TODO(ZX-2361): Theoretically unwind tables should be good enough so we can - # remove this option when the issues are addressed. - enable_frame_pointers = is_debug - } -} - -# No frame pointers for host compiles. -if (!is_fuchsia) { - enable_frame_pointers = false -} - -config("compiler") { - asmflags = [] - cflags = [ "-fcolor-diagnostics" ] - cflags_c = [] - cflags_cc = [ "-fvisibility-inlines-hidden" ] - cflags_objc = [] - cflags_objcc = [ "-fvisibility-inlines-hidden" ] - ldflags = [] - defines = [] - configs = [] - - if (current_os == "fuchsia") { - configs += [ "//build/config/fuchsia:compiler" ] - } else { - cflags_c += [ "-std=c11" ] - cflags_cc += [ - "-std=c++17", - "-stdlib=libc++", - ] - if (current_os == "linux") { - configs += [ "//build/config/linux:compiler" ] - } else if (current_os == "mac") { - configs += [ "//build/config/mac:compiler" ] - } - } - - # Linker on macOS does not support `color-diagnostics` - if (current_os != "mac") { - ldflags += [ "-Wl,--color-diagnostics" ] - } - - asmflags += cflags - asmflags += cflags_c -} - -config("relative_paths") { - # Make builds independent of absolute file path. The file names - # embedded in debugging information will be expressed as relative to - # the build directory, e.g. "../.." for an "out/subdir" under //. - # This is consistent with the file names in __FILE__ expansions - # (e.g. in assertion messages), which the compiler doesn't provide a - # way to remap. That way source file names in logging and - # symbolization can all be treated the same way. This won't go well - # if root_build_dir is not a subdirectory //, but there isn't a better - # option to keep all source file name references uniformly relative to - # a single root. - absolute_path = rebase_path("//.") - relative_path = rebase_path("//.", root_build_dir) - cflags = [ - # This makes sure that the DW_AT_comp_dir string (the current - # directory while running the compiler, which is the basis for all - # relative source file names in the DWARF info) is represented as - # relative to //. - "-fdebug-prefix-map=$absolute_path=$relative_path", - - # This makes sure that include directories in the toolchain are - # represented as relative to the build directory (because that's how - # we invoke the compiler), rather than absolute. This can affect - # __FILE__ expansions (e.g. assertions in system headers). We - # normally run a compiler that's someplace within the source tree - # (//buildtools/...), so its absolute installation path will have a - # prefix matching absolute_path and hence be mapped to relative_path - # in the debugging information, so this should actually be - # superfluous for purposes of the debugging information. - "-no-canonical-prefixes", - ] -} - -config("debug") { - cflags = [ "-O0" ] - ldflags = cflags -} - -config("release") { - defines = [ "NDEBUG=1" ] - cflags = [ - "-O3", - "-fdata-sections", - "-ffunction-sections", - ] - ldflags = cflags - if (current_os == "mac") { - ldflags += [ "-Wl,-dead_strip" ] - } else { - ldflags += [ "-Wl,--gc-sections" ] - } -} - -config("exceptions") { - cflags_cc = [ "-fexceptions" ] - cflags_objcc = cflags_cc -} - -config("no_exceptions") { - cflags_cc = [ "-fno-exceptions" ] - cflags_objcc = cflags_cc -} - -config("rtti") { - cflags_cc = [ "-frtti" ] - cflags_objcc = cflags_cc -} - -config("no_rtti") { - cflags_cc = [ "-fno-rtti" ] - cflags_objcc = cflags_cc -} - -config("default_include_dirs") { - include_dirs = [ - "//", - root_gen_dir, - ] -} - -config("minimal_symbols") { - cflags = [ "-gline-tables-only" ] - asmflags = cflags - ldflags = cflags -} - -config("symbols") { - cflags = [ "-g3" ] - asmflags = cflags - ldflags = cflags -} - -config("no_symbols") { - cflags = [ "-g0" ] - asmflags = cflags - ldflags = cflags -} - -# Default symbols. -config("default_symbols") { - if (symbol_level == 0) { - configs = [ ":no_symbols" ] - } else if (symbol_level == 1) { - configs = [ ":minimal_symbols" ] - } else if (symbol_level == 2) { - configs = [ ":symbols" ] - } else { - assert(symbol_level >= 0 && symbol_level <= 2) - } -} - -config("default_frame_pointers") { - if (enable_frame_pointers) { - configs = [ ":frame_pointers" ] - } else { - configs = [ ":no_frame_pointers" ] - } -} - -config("frame_pointers") { - cflags = [ "-fno-omit-frame-pointer" ] -} - -config("no_frame_pointers") { - cflags = [ "-fomit-frame-pointer" ] -} - -config("default_warnings") { - cflags = [ - "-Wall", - "-Wextra", - "-Wno-unused-parameter", - ] - if (current_os == "fuchsia") { - cflags += [ - # TODO(TO-99): Remove once all the cases of unused 'this' lamda capture - # have been removed from our codebase. - "-Wno-unused-lambda-capture", - - # TODO(TO-100): Remove once comparator types provide const call operator. - "-Wno-user-defined-warnings", - ] - } -} - -config("symbol_visibility_hidden") { - cflags = [ "-fvisibility=hidden" ] -} - -config("symbol_no_undefined") { - if (current_os == "mac") { - ldflags = [ "-Wl,-undefined,error" ] - } else { - ldflags = [ "-Wl,--no-undefined" ] - } -} - -config("shared_library_config") { - configs = [] - cflags = [] - - if (current_os == "fuchsia") { - configs += [ "//build/config/fuchsia:shared_library_config" ] - } else if (current_os == "linux") { - cflags += [ "-fPIC" ] - } else if (current_os == "mac") { - configs += [ "//build/config/mac:mac_dynamic_flags" ] - } -} - -config("executable_config") { - configs = [] - - if (current_os == "fuchsia") { - configs += [ - "//build/config/fuchsia:executable_config", - "//build/config/fuchsia:fdio_config", - ] - } else if (current_os == "mac") { - configs += [ - "//build/config/mac:mac_dynamic_flags", - "//build/config/mac:mac_executable_flags", - ] - } -} - -config("default_libs") { - configs = [] - - if (current_os == "mac") { - configs += [ "//build/config/mac:default_libs" ] - } -}
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn deleted file mode 100644 index b837b29..0000000 --- a/config/BUILDCONFIG.gn +++ /dev/null
@@ -1,983 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# The GN files in //third_party/flutter all use $flutter_root/ -# in place of // to refer to the root of the flutter source tree. -flutter_root = "//third_party/flutter" - -declare_args() { - # Debug build. - is_debug = true -} - -if (target_os == "") { - target_os = "fuchsia" -} -if (target_cpu == "") { - target_cpu = host_cpu -} -target_platform = "${target_os}-${target_cpu}" -if (current_cpu == "") { - current_cpu = target_cpu -} -if (current_os == "") { - current_os = target_os -} -current_platform = "${current_os}-${current_cpu}" - -host_platform = "${host_os}-${host_cpu}" - -if (target_os == "fuchsia") { - target_toolchain = "//build/toolchain/fuchsia:${target_cpu}" -} else { - assert(false, "Target OS not supported") -} - -if (host_os == "linux" || host_os == "mac") { - host_toolchain = "//build/toolchain:host_${host_cpu}" -} else { - assert(false, "Host OS not supported") -} - -set_default_toolchain(target_toolchain) - -# Some projects expect a default value for sources_assignment_filter. -sources_assignment_filter = [] - -declare_args() { - # *This should never be set as a build argument.* - # It exists only to be set in `toolchain_args`. - # See //build/toolchain/clang_toolchain.gni for details. - # This variable is a scope giving details about the current toolchain: - # `toolchain_variant.base` - # [label] The "base" toolchain for this variant, *often the - # right thing to use in comparisons, not `current_toolchain`.* - # This is the toolchain actually referenced directly in GN - # source code. If the current toolchain is not - # `shlib_toolchain` or a variant toolchain, this is the same - # as `current_toolchain`. In one of those derivative - # toolchains, this is the toolchain the GN code probably - # thought it was in. This is the right thing to use in a test - # like `toolchain_variant.base == target_toolchain`, rather - # rather than comparing against `current_toolchain`. - # `toolchain_variant.name` - # [string] The name of this variant, as used in `variant` fields - # in [`select_variant`](#select_variant) clauses. In the base - # toolchain and its `shlib_toolchain`, this is `""`. - # `toolchain_variant.suffix` - # [string] This is "-${toolchain_variant.name}", "" if name is empty. - # `toolchain_variant.is_pic_default` - # [bool] This is true in `shlib_toolchain`. - # The other fields are the variant's effects as defined in - # [`known_variants`](#known_variants). - toolchain_variant = { - base = target_toolchain # default toolchain - } -} - -if (!defined(toolchain_variant.name)) { - # Default values describe the "null variant". - # All the optional fields (except `toolchain_args`) are canonicalized - # to their default/empty values so the code below doesn't need to have - # `defined(toolchain_variant.field)` checks all over. - toolchain_variant.name = "" - toolchain_variant.suffix = "" - toolchain_variant.configs = [] - toolchain_variant.remove_common_configs = [] - toolchain_variant.remove_shared_configs = [] - toolchain_variant.deps = [] - toolchain_variant.is_pic_default = false -} - -is_android = false -is_fuchsia = false -is_fuchsia_host = false -is_ios = false -is_linux = false -is_mac = false -is_win = false -is_clang = true -is_component_build = false -is_official_build = false - -# This is set to allow third party projects to configure their GN build based -# on the knowledge that they're being built in the Fuchsia tree. In the -# subproject this can be tested with -# `if (defined(is_fuchsia_tree) && is_fuchsia_tree) { ... }` -# thus allowing configuration without requiring all users of the subproject to -# set this variable. -is_fuchsia_tree = true - -if (current_os == "fuchsia") { - is_fuchsia = true -} else if (current_os == "linux") { - is_linux = true -} else if (current_os == "mac") { - is_mac = true -} - -# Some library targets may be built as different type depending on the target -# platform. This variable specifies the default library type for each target. -if (is_fuchsia) { - default_library_type = "shared_library" -} else { - default_library_type = "static_library" -} - -# When we are in a variant of host_toolchain, change the value of -# host_toolchain so that `if (current_toolchain == host_toolchain)` tests -# still match, since that is the conventional way to detect being in host -# context. This means that any "...($host_toolchain)" label references -# from inside a variant of host_toolchain will refer to the variant -# (current_toolchain rather than host_toolchain). To handle this, the -# `executable()` template below will define its target in other variant -# toolchains as a copy of the real executable. -if (toolchain_variant.base == host_toolchain) { - is_fuchsia_host = true - host_toolchain += toolchain_variant.suffix -} - -# References should use `"label($shlib_toolchain)"` rather than -# `"label(${target_toolchain}-shared)"` or anything else. -shlib_toolchain = "${toolchain_variant.base}${toolchain_variant.suffix}-shared" - -# All binary targets will get this list of configs by default. -default_common_binary_configs = [ - "//build/config:compiler", - "//build/config:relative_paths", - "//build/config:default_frame_pointers", - "//build/config:default_include_dirs", - "//build/config:default_symbols", - "//build/config:default_warnings", - "//build/config:no_exceptions", - "//build/config:no_rtti", - "//build/config:symbol_visibility_hidden", -] - -if (is_debug) { - default_common_binary_configs += [ "//build/config:debug" ] -} else { - default_common_binary_configs += [ "//build/config:release" ] -} - -if (is_fuchsia) { - default_common_binary_configs += [ - "//build/config/fuchsia:icf", - "//build/config/fuchsia:thread_safety_annotations", - "//build/config/fuchsia:werror", - - # TODO(mcgrathr): Perhaps restrict this to only affected code. - # For now, safest to do it everywhere. - "//build/config/fuchsia:zircon_asserts", - ] -} - -default_common_binary_configs += [ "//build/config/lto:default" ] - -# Add and remove configs specified by the variant. -default_common_binary_configs += toolchain_variant.configs -default_common_binary_configs -= toolchain_variant.remove_common_configs - -default_shared_library_configs = default_common_binary_configs + [ - "//build/config:shared_library_config", - "//build/config:symbol_no_undefined", - ] -default_shared_library_configs -= toolchain_variant.remove_shared_configs - -default_executable_configs = default_common_binary_configs + [ - "//build/config:executable_config", - "//build/config:default_libs", - ] -default_executable_deps = [ "//build/config/scudo:default_for_executable" ] - -if (toolchain_variant.is_pic_default) { - default_common_binary_configs += [ "//build/config:shared_library_config" ] -} - -# Apply that default list to the binary target types. -set_defaults("source_set") { - configs = default_common_binary_configs -} -set_defaults("static_library") { - configs = default_common_binary_configs -} -set_defaults("shared_library") { - configs = default_shared_library_configs -} -set_defaults("loadable_module") { - configs = default_shared_library_configs -} -set_defaults("executable") { - configs = default_executable_configs -} - -if (is_fuchsia) { - if (!toolchain_variant.is_pic_default) { - # In the main toolchain, shared_library just redirects to the same - # target in the -shared toolchain. - template("shared_library") { - group(target_name) { - public_deps = [ - ":$target_name(${current_toolchain}-shared)", - ] - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - # Mark all variables as not needed to suppress errors for unused - # variables. The other variables normally passed to shared_library - # are actually used by the shared_library instantiation in the - # -shared toolchain, so any going truly unused will be caught there. - not_needed(invoker, "*") - } - } - } else { - # In the -shared toolchain, shared_library is just its normal self, - # but if the invoker constrained the visibility, we must make sure - # the dependency from the main toolchain is still allowed. - template("shared_library") { - shared_library(target_name) { - # Explicitly forward visibility, implicitly forward everything - # else. Forwarding "*" doesn't recurse into nested scopes (to - # avoid copying all globals into each template invocation), so - # won't pick up file-scoped variables. Normally this isn't too - # bad, but visibility is commonly defined at the file scope. - # Explicitly forwarding visibility and then excluding it from the - # "*" set works around this problem. See http://crbug.com/594610 - # for rationale on why this GN behavior is not considered a bug. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - if (defined(visibility)) { - visibility += [ ":$target_name" ] - } - } - } - } -} - -# This is the basic "asan" variant. Others start with this and modify. -# See `known_variants` (below) for the meaning of fields in this scope. -_asan_variant = { - configs = [ "//build/config/sanitizers:asan" ] - if (host_os != "fuchsia") { - host_only = { - # On most systems (not Fuchsia), the sanitizer runtimes are normally - # linked statically and so `-shared` links do not include them. - # Using `-shared --no-undefined` with sanitized code will get - # undefined references for the sanitizer runtime calls generated by - # the compiler. It shouldn't do much harm, since the non-variant - # builds will catch the real undefined reference bugs. - remove_shared_configs = [ "//build/config:symbol_no_undefined" ] - } - } - toolchain_args = { - # -fsanitize=scudo is incompatible with -fsanitize=address. - use_scudo = false - } -} - -declare_args() { - # List of variants that will form the basis for variant toolchains. - # To make use of a variant, set [`select_variant`](#select_variant). - # - # Normally this is not set as a build argument, but it serves to - # document the available set of variants. - # See also [`universal_variants`](#universal_variants). - # Only set this to remove all the default variants here. - # To add more, set [`extra_variants`](#extra_variants) instead. - # - # Each element of the list is one variant, which is a scope defining: - # - # `configs` (optional) - # [list of labels] Each label names a config that will be - # automatically used by every target built in this variant. - # For each config `${label}`, there must also be a target - # `${label}_deps`, which each target built in this variant will - # automatically depend on. The `variant()` template is the - # recommended way to define a config and its `_deps` target at - # the same time. - # - # `remove_common_configs` (optional) - # `remove_shared_configs` (optional) - # [list of labels] This list will be removed (with `-=`) from - # the `default_common_binary_configs` list (or the - # `default_shared_library_configs` list, respectively) after - # all other defaults (and this variant's configs) have been - # added. - # - # `deps` (optional) - # [list of labels] Added to the deps of every target linked in - # this variant (as well as the automatic `${label}_deps` for - # each label in configs). - # - # `name` (required if configs is omitted) - # [string] Name of the variant as used in - # [`select_variant`](#select_variant) elements' `variant` fields. - # It's a good idea to make it something concise and meaningful when - # seen as e.g. part of a directory name under `$root_build_dir`. - # If name is omitted, configs must be nonempty and the simple names - # (not the full label, just the part after all `/`s and `:`s) of these - # configs will be used in toolchain names (each prefixed by a "-"), - # so the list of config names forming each variant must be unique - # among the lists in `known_variants + extra_variants`. - # - # `toolchain_args` (optional) - # [scope] Each variable defined in this scope overrides a - # build argument in the toolchain context of this variant. - # - # `host_only` (optional) - # `target_only` (optional) - # [scope] This scope can contain any of the fields above. - # These values are used only for host or target, respectively. - # Any fields included here should not also be in the outer scope. - # - known_variants = [ - { - configs = [ "//build/config/lto" ] - }, - { - configs = [ "//build/config/lto:thinlto" ] - }, - - { - configs = [ "//build/config/profile" ] - }, - - { - configs = [ "//build/config/scudo" ] - }, - - { - configs = [ "//build/config/sanitizers:ubsan" ] - }, - { - configs = [ - "//build/config/sanitizers:ubsan", - "//build/config/sanitizers:sancov", - ] - }, - - _asan_variant, - { - forward_variables_from(_asan_variant, "*") - configs += [ "//build/config/sanitizers:sancov" ] - }, - { - name = "asan_no_detect_leaks" - forward_variables_from(_asan_variant, "*", [ "toolchain_args" ]) - toolchain_args = { - forward_variables_from(_asan_variant.toolchain_args, "*") - asan_default_options = "detect_leaks=0" - } - }, - - # Fuzzer variants for various sanitizers, -fsanitize=fuzzer results - # in undefined symbols in shared objects that are satisfied in the final, - # statically linked fuzzer. - { - # TODO(aarongreen): TC-264: Clang emits new/new[]/delete/delete[] into - # libfuzzer's static libc++. Remove this when fixed. - forward_variables_from(_asan_variant, "*", [ "toolchain_args" ]) - toolchain_args = { - forward_variables_from(_asan_variant.toolchain_args, "*") - asan_default_options = "alloc_dealloc_mismatch=0" - } - configs += [ "//build/config/sanitizers:fuzzer" ] - remove_shared_configs = [ "//build/config:symbol_no_undefined" ] - }, - { - configs = [ - "//build/config/sanitizers:ubsan", - "//build/config/sanitizers:fuzzer", - ] - remove_shared_configs = [ "//build/config:symbol_no_undefined" ] - }, - ] - - # Additional variant toolchain configs to support. - # This is just added to [`known_variants`](#known_variants). - extra_variants = [] - - # List of "universal" variants, in addition to - # [`known_variants`](#known_variants). Normally this is not set as a - # build argument, but it serves to document the available set of - # variants. These are treated just like - # [`known_variants`](#known_variants), but as well as being variants by - # themselves, these are also combined with each of - # [`known_variants`](#known_variants) to form additional variants, - # e.g. "asan-debug" or "ubsan-sancov-release". - universal_variants = [] - - # Only one of "debug" and "release" is really available as a universal - # variant in any given build (depending on the global setting of - # `is_debug`). But this gets evaluated separately in every toolchain, so - # e.g. in the "release" toolchain the sense of `if (is_debug)` tests is - # inverted and this would list only "debug" as an available variant. The - # selection logic in `variant_target()` can only work if the value of - # `universal_variants` it sees includes the current variant. - if (is_debug) { - universal_variants += [ - { - name = "release" - configs = [] - toolchain_args = { - is_debug = false - } - }, - ] - } else { - universal_variants += [ - { - name = "debug" - configs = [] - toolchain_args = { - is_debug = true - } - }, - ] - } - - # List of short names for commonly-used variant selectors. Normally this - # is not set as a build argument, but it serves to document the available - # set of short-cut names for variant selectors. Each element of this list - # is a scope where `.name` is the short name and `.select_variant` is a - # a list that can be spliced into [`select_variant`](#select_variant). - select_variant_shortcuts = [ - { - name = "host_asan" - select_variant = [] - select_variant = [ - { - variant = "asan_no_detect_leaks" - host = true - dir = [ - # TODO(TO-565): The yasm host tools have leaks. - "//third_party/yasm", - - # TODO(TO-666): replace futiltiy & cgpt with 1p tools - "//third_party/vboot_reference", - "//garnet/tools/vboot_reference", - ] - }, - { - variant = "asan" - host = true - }, - ] - }, - - # TODO(TC-241): Remove this when TC-241 is fixed. For now, don't - # apply ASan to drivers because all drivers (and nothing else) - # use -static-libstdc++ and so hit the TC-241 problem. - { - name = "asan" - select_variant = [] - select_variant = [ - { - target_type = [ "driver_module" ] - variant = false - }, - { - variant = "asan" - host = false - }, - ] - }, - ] -} - -# Now elaborate the fixed shortcuts with implicit shortcuts for -# each known variant. The shortcut is just the name of the variant -# and selects for `host=false`. -_select_variant_shortcuts = select_variant_shortcuts -foreach(variant, known_variants) { - if (defined(variant.name)) { - variant = variant.name - } else { - # This is how GN spells "let". - foreach(configs, [ variant.configs ]) { - variant = "" - foreach(config, configs) { - config = get_label_info(config, "name") - if (variant == "") { - variant = config - } else { - variant += "-$config" - } - } - } - } - _select_variant_shortcuts += [ - { - name = variant - select_variant = [] - select_variant = [ - { - variant = name - host = false - }, - ] - }, - ] - foreach(universal_variant, universal_variants) { - _select_variant_shortcuts += [ - { - name = "${variant}-${universal_variant.name}" - select_variant = [] - select_variant = [ - { - variant = name - host = false - }, - ] - }, - ] - } -} -foreach(variant, universal_variants) { - variant = variant.name - _select_variant_shortcuts += [ - { - name = variant - select_variant = [] - select_variant = [ - { - variant = name - host = false - }, - ] - }, - ] -} - -declare_args() { - # List of "selectors" to request variant builds of certain targets. - # Each selector specifies matching criteria and a chosen variant. - # The first selector in the list to match a given target determines - # which variant is used for that target. - # - # Each selector is either a string or a scope. A shortcut selector is - # a string; it gets expanded to a full selector. A full selector is a - # scope, described below. - # - # A string selector can match a name in - # [`select_variant_shortcuts`](#select_variant_shortcuts). If it's not a - # specific shortcut listed there, then it can be the name of any variant - # described in [`known_variants`](#known_variants) and - # [`universal_variants`](#universal_variants) (and combinations thereof). - # A `selector` that's a simple variant name selects for every binary - # built in the target toolchain: `{ host=false variant=selector }`. - # - # If a string selector contains a slash, then it's `"shortcut/filename"` - # and selects only the binary in the target toolchain whose `output_name` - # matches `"filename"`, i.e. it adds `output_name=["filename"]` to each - # selector scope that the shortcut's name alone would yield. - # - # The scope that forms a full selector defines some of these: - # - # variant (required) - # [string or `false`] The variant that applies if this selector - # matches. This can be `false` to choose no variant, or a string - # that names the variant. See - # [`known_variants`](#known_variants) and - # [`universal_variants`](#universal_variants). - # - # The rest below are matching criteria. All are optional. - # The selector matches if and only if all of its criteria match. - # If none of these is defined, then the selector always matches. - # - # The first selector in the list to match wins and then the rest of - # the list is ignored. So construct more complex rules by using a - # "blacklist" selector with `variant=false` before a catch-all or - # "whitelist" selector that names a variant. - # - # Each "[strings]" criterion is a list of strings, and the criterion - # is satisfied if any of the strings matches against the candidate string. - # - # host - # [boolean] If true, the selector matches in the host toolchain. - # If false, the selector matches in the target toolchain. - # - # testonly - # [boolean] If true, the selector matches targets with testonly=true. - # If false, the selector matches in targets without testonly=true. - # - # target_type - # [strings]: `"executable"`, `"loadable_module"`, or `"driver_module"` - # - # output_name - # [strings]: target's `output_name` (default: its `target name`) - # - # label - # [strings]: target's full label with `:` (without toolchain suffix) - # - # name - # [strings]: target's simple name (label after last `/` or `:`) - # - # dir - # [strings]: target's label directory (`//dir` for `//dir:name`). - select_variant = [] - - # *This should never be set as a build argument.* - # It exists only to be set in `toolchain_args`. - # See //build/toolchain/clang_toolchain.gni for details. - select_variant_canonical = [] -} - -# Do this only once, in the default toolchain context. Then -# clang_toolchain_suite will just pass the results through to every -# other toolchain via toolchain_args so the work is not repeated. -if (toolchain_variant.base == target_toolchain && current_cpu == target_cpu && - current_os == target_os && toolchain_variant.name == "" && - !toolchain_variant.is_pic_default) { - assert(select_variant_canonical == [], - "`select_variant_canonical` cannot be set as a build argument") - - foreach(selector, select_variant) { - if (selector != "$selector") { - # It's a scope, not a string. Just use it as is. - select_variant_canonical += [ selector ] - } else { - # It's a string, not a scope. Expand the shortcut. - # If there is a slash, this is "shortcut/output_name". - # If not, it's just "shortcut". - foreach(file, [ get_path_info(selector, "file") ]) { - if (file == selector) { - file = "" - } else { - selector = get_path_info(selector, "dir") - } - foreach(shortcut, _select_variant_shortcuts) { - # file=true stands in for "break". - if (file != true && selector == shortcut.name) { - # Found the matching shortcut. - if (file == "") { - # It applies to everything, so just splice it in directly. - select_variant_canonical += shortcut.select_variant - } else { - # Add each of the shortcut's clauses amended with the - # output_name constraint. - foreach(clause, shortcut.select_variant) { - select_variant_canonical += [ - { - forward_variables_from(clause, "*") - output_name = [ file ] - }, - ] - } - } - file = true - } - } - assert(file == true, - "unknown shortcut `${selector}` used in `select_variant`") - } - } - } -} - -template("variant_target") { - target_type = target_name - target_name = invoker.target_name - target_invoker = { - # Explicitly forward visibility, implicitly forward everything else. - # See comment in template("shared_library") above for details. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, - "*", - [ - "_target_type", - "target_name", - "visibility", - ]) - - if (!defined(output_name)) { - output_name = target_name - } - } - - # target_type is the real GN target type that builds the thing. - # selector_target_type is the name matched against target_type selectors. - if (defined(invoker._target_type)) { - selector_target_type = invoker._target_type - } else { - selector_target_type = target_type - } - - target_label = get_label_info(":$target_name", "label_no_toolchain") - - # These are not actually used in all possible if branches below, - # so defang GN's extremely sensitive "unused variable" errors. - not_needed([ - "selector_target_type", - "target_invoker", - "target_label", - "target_type", - ]) - - target_variant = false - if (select_variant_canonical != []) { - # See if there is a selector that matches this target. - selected = false - foreach(selector, select_variant_canonical) { - # The first match wins. - # GN's loops don't have "break", so do nothing on later iterations. - if (!selected) { - # Expand the selector so we don't have to do a lot of defined(...) - # tests below. - select = { - } - select = { - target_type = [] - output_name = [] - label = [] - name = [] - dir = [] - forward_variables_from(selector, "*") - } - - selected = true - if (selected && defined(selector.host)) { - selected = current_toolchain == host_toolchain == selector.host - } - - if (selected && defined(selector.testonly)) { - selected = (defined(target_invoker.testonly) && - target_invoker.testonly) == selector.testonly - } - - if (selected && select.target_type != []) { - selected = false - candidate = selector_target_type - foreach(try, select.target_type) { - if (try == candidate) { - selected = true - } - } - } - - if (selected && select.output_name != []) { - selected = false - candidate = target_invoker.output_name - foreach(try, select.output_name) { - if (try == candidate) { - selected = true - } - } - } - - if (selected && select.label != []) { - selected = false - candidate = target_label - foreach(try, select.label) { - if (try == candidate) { - selected = true - } - } - } - - if (selected && select.name != []) { - selected = false - candidate = get_label_info(target_label, "name") - foreach(try, select.name) { - if (try == candidate) { - selected = true - } - } - } - - if (selected && select.dir != []) { - selected = false - candidate = get_label_info(target_label, "dir") - foreach(try, select.dir) { - if (try == candidate) { - selected = true - } - } - } - - if (selected && selector.variant != false) { - target_variant = "-${selector.variant}" - } - } - } - } - if (target_variant == false) { - target_variant = "" - } - - builder_toolchain = toolchain_variant.base + target_variant - if (invoker._variant_shared) { - builder_toolchain += "-shared" - } - - if (current_toolchain == builder_toolchain) { - # This is the toolchain selected to actually build this target. - target(target_type, target_name) { - deps = [] - forward_variables_from(target_invoker, "*") - deps += toolchain_variant.deps - foreach(config, toolchain_variant.configs) { - # Expand the label so it always has a `:name` part. - config = get_label_info(config, "label_no_toolchain") - deps += [ "${config}_deps" ] - } - if (defined(visibility)) { - # Other toolchains will define this target as a group or copy - # rule that depends on this toolchain's definition. If the - # invoker constrained the visibility, make sure those - # dependencies from other toolchains are still allowed. - visibility += [ ":${target_name}" ] - } - } - } else if (current_toolchain == shlib_toolchain) { - # Don't copy from a variant into a -shared toolchain, because nobody - # looks for an executable or loadable_module there. Instead, just - # forward any deps to the real target. - group(target_name) { - forward_variables_from(target_invoker, - [ - "testonly", - "visibility", - ]) - if (defined(visibility)) { - visibility += [ ":${target_name}" ] - } - deps = [ - ":${target_name}(${builder_toolchain})", - ] - } - } else { - # When some variant was selected, then this target in all other - # toolchains is actually just this copy rule. The target is built in - # the selected variant toolchain, but then copied to its usual name in - # $root_out_dir so that things can find it there. - copy_vars = { - forward_variables_from(target_invoker, - [ - "testonly", - "visibility", - ]) - if (defined(visibility)) { - visibility += [ ":${target_name}" ] - } - - deps = [ - ":${target_name}(${builder_toolchain})", - ] - variant_out_dir = get_label_info(deps[0], "root_out_dir") - - full_output_name = target_invoker.output_name - if (defined(target_invoker.output_extension) && - target_invoker.output_extension != "") { - full_output_name += ".${target_invoker.output_extension}" - } - - sources = [ - "$variant_out_dir/$full_output_name", - ] - outputs = [ - "$root_out_dir/$full_output_name", - ] - } - - # In the host toolchain, make a symlink rather than a hard link - # (which is what "copy" rules really do). Host tools are built with - # an embedded shared library lookup path based on $ORIGIN on Linux - # (//build/config/linux:compiler) and the equivalent @loader_path on - # macOS (//build/config/mac:mac_dynamic_flags). The dynamic linker - # translates this to "the directory containing the executable". - # With hard links, this gets the directory used to invoke the - # executable, which is host_toolchain's $root_out_dir. With - # symlinks, it instead gets the directory containing the actual - # executable file, which is builder_toolchain's $root_out_dir. - # Hence the program uses the variant builds of shared libraries that - # go with the variant build of the executable, rather using than the - # vanilla host_toolchain builds with the variant executable. - if (current_toolchain == host_toolchain) { - action(target_name) { - forward_variables_from(copy_vars, "*") - script = "/bin/ln" - args = [ - "-snf", - rebase_path(sources[0], get_path_info(outputs[0], "dir")), - rebase_path(outputs[0]), - ] - } - } else { - # For Fuchsia, //build/gn/variant.py depends on hard links to - # identify the variants. - copy(target_name) { - forward_variables_from(copy_vars, "*") - } - } - } -} - -template("executable") { - _executable_name = target_name - _variant_shared = false - variant_target("executable") { - deps = [] - target_name = _executable_name - - # TODO(aarongreen): This shouldn't be required, but without it the - # fuzzers fail to link. Investigate and remove when resolved. - if (defined(invoker._target_type)) { - _target_type = invoker._target_type - } - - # Explicitly forward visibility, implicitly forward everything else. - # See comment in template("shared_library") above for details. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - - deps += default_executable_deps - } -} - -template("loadable_module") { - _module_name = target_name - _variant_shared = true - variant_target("loadable_module") { - target_name = _module_name - if (defined(invoker._target_type)) { - _target_type = invoker._target_type - } - - # Explicitly forward visibility, implicitly forward everything else. - # See comment in template("shared_library") above for details. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - if (!defined(output_extension)) { - output_extension = "so" - } - } -} - -# Some targets we share with Chromium declare themselves to be components, -# which means they can build either as shared libraries or as static libraries. -# We build them as static libraries. -template("component") { - if (!defined(invoker.sources)) { - # When there are no sources defined, use a source set to avoid creating - # an empty static library (which generally don't work). - _component_mode = "source_set" - } else { - _component_mode = "static_library" - } - - target(_component_mode, target_name) { - # Explicitly forward visibility, implicitly forward everything else. - # See comment in template("shared_library") above for details. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - } -} - -set_defaults("component") { - configs = default_common_binary_configs -}
diff --git a/config/arm.gni b/config/arm.gni deleted file mode 100644 index 36dc838..0000000 --- a/config/arm.gni +++ /dev/null
@@ -1,68 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -if (current_cpu == "arm" || current_cpu == "arm64") { - declare_args() { - # Version of the ARM processor when compiling on ARM. Ignored on non-ARM - # platforms. - if (current_cpu == "arm") { - arm_version = 7 - } else if (current_cpu == "arm64") { - arm_version = 8 - } else { - assert(false, "Unconfigured arm version") - } - - # The ARM floating point mode. This is either the string "hard", "soft", or - # "softfp". An empty string means to use the default one for the - # arm_version. - arm_float_abi = "" - - # The ARM variant-specific tuning mode. This will be a string like "armv6" - # or "cortex-a15". An empty string means to use the default for the - # arm_version. - arm_tune = "" - - # Whether to use the neon FPU instruction set or not. - arm_use_neon = true - - # Whether to enable optional NEON code paths. - arm_optionally_use_neon = false - } - - assert(arm_float_abi == "" || arm_float_abi == "hard" || - arm_float_abi == "soft" || arm_float_abi == "softfp") - - if (arm_version == 6) { - arm_arch = "armv6" - if (arm_tune != "") { - arm_tune = "" - } - if (arm_float_abi == "") { - arm_float_abi = "softfp" - } - arm_fpu = "vfp" - - # Thumb is a reduced instruction set available on some ARM processors that - # has increased code density. - arm_use_thumb = false - } else if (arm_version == 7) { - arm_arch = "armv7-a" - if (arm_tune == "") { - arm_tune = "generic-armv7-a" - } - - if (arm_float_abi == "") { - arm_float_abi = "softfp" - } - - arm_use_thumb = true - - if (arm_use_neon) { - arm_fpu = "neon" - } else { - arm_fpu = "vfpv3-d16" - } - } -}
diff --git a/config/clang/clang.gni b/config/clang/clang.gni deleted file mode 100644 index 4945ee3..0000000 --- a/config/clang/clang.gni +++ /dev/null
@@ -1,28 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # The default clang toolchain provided by the buildtools. This variable is - # additionally consumed by the Go toolchain. - clang_prefix = - rebase_path("//buildtools/${host_platform}/clang/bin", root_build_dir) -} - -if (current_cpu == "arm64") { - clang_cpu = "aarch64" -} else if (current_cpu == "x64") { - clang_cpu = "x86_64" -} else { - assert(false, "CPU not supported") -} - -if (is_fuchsia) { - clang_target = "${clang_cpu}-fuchsia" -} else if (is_linux) { - clang_target = "${clang_cpu}-linux-gnu" -} else if (is_mac) { - clang_target = "${clang_cpu}-apple-darwin" -} else { - assert(false, "OS not supported") -}
diff --git a/config/compiler.gni b/config/compiler.gni deleted file mode 100644 index 7ec3b1f..0000000 --- a/config/compiler.gni +++ /dev/null
@@ -1,14 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # How many symbols to include in the build. This affects the performance of - # the build since the symbols are large and dealing with them is slow. - # 2 means regular build with symbols. - # 1 means minimal symbols, usually enough for backtraces only. Symbols with - # internal linkage (static functions or those in anonymous namespaces) may not - # appear when using this level. - # 0 means no symbols. - symbol_level = 2 -}
diff --git a/config/fuchsia/BUILD.gn b/config/fuchsia/BUILD.gn deleted file mode 100644 index 4864667..0000000 --- a/config/fuchsia/BUILD.gn +++ /dev/null
@@ -1,153 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/fuchsia/zircon.gni") -import("//build/config/sysroot.gni") -import("//build/toolchain/ccache.gni") - -assert(current_os == "fuchsia") - -config("werror") { - if (!use_ccache) { - cflags = [ - "-Werror", - - # Declarations marked as deprecated should cause build failures, rather - # they should emit warnings to notify developers about the use of - # deprecated interfaces. - "-Wno-error=deprecated-declarations", - - # Do not add additional -Wno-error to this config. - ] - } -} - -config("icf") { - # This changes C/C++ semantics and might be incompatible with third-party - # code that relies on function pointers comparison. - ldflags = [ "-Wl,--icf=all" ] -} - -# ccache, at least in some configurations, caches preprocessed content. This -# means that by the time the compiler sees it, macros are unrolled. A number -# of gcc and clang diagnostics are conditioned on whether the source is part -# of a macro or not. This is because a "reasonable" looking macro invocation -# may end up doing something silly internally. This can mean self assignment -# and tautological comparisons, since macros are not typed. Macros also tend -# to over-parenthesize, and so on. This particular list of options was found -# via trial and error, and might be the best way of keeping the build quiet. -config("ccache") { - cflags = [ - "-Wno-error", - "-Qunused-arguments", - "-Wno-parentheses-equality", - "-Wno-self-assign", - "-Wno-tautological-compare", - "-Wno-unused-command-line-argument", - ] - asmflags = cflags -} - -config("compiler") { - cflags = [] - cflags_c = [ "-std=c11" ] - cflags_cc = [ "-std=c++17" ] - ldflags = [ - "-Wl,--threads", - "-Wl,--pack-dyn-relocs=relr", - ] - configs = [ - ":compiler_sysroot", - ":compiler_target", - ":compiler_cpu", - ":toolchain_version_stamp", - ] - if (use_ccache) { - configs += [ ":ccache" ] - } - asmflags = cflags + cflags_c -} - -config("toolchain_version_stamp") { - # We want to force a recompile and relink of the world whenever our toolchain changes since - # artifacts from an older version of the toolchain may or may not be compatible with newer ones. - # To achieve this, we insert a synthetic define into the compile line. - cipd_version = read_file( - "//buildtools/${host_platform}/clang/.versions/clang.cipd_version", - "json") - defines = [ "TOOLCHAIN_VERSION=${cipd_version.instance_id}" ] -} - -config("compiler_sysroot") { - # The sysroot for Fuchsia is part of Zircon build which is pointed to by the sysroot variable. - cflags = [ "--sysroot=${sysroot}" ] - ldflags = cflags - asmflags = cflags -} - -config("compiler_target") { - cflags = [ "--target=$clang_target" ] - asmflags = cflags - ldflags = cflags -} - -config("compiler_cpu") { - cflags = [] - if (current_cpu == "x64") { - cflags += [ - "-march=x86-64", - "-mcx16", - ] - } - ldflags = cflags - asmflags = cflags - - if (current_cpu == "arm64") { - ldflags += [ "-Wl,--fix-cortex-a53-843419" ] - } -} - -config("shared_library_config") { - cflags = [ "-fPIC" ] -} - -config("fdio_config") { - libs = [ "fdio" ] - - # TODO(pylaligand): find a better way to let executables link in fdio. - # Ideally their dependencies should be set up in such a way that it would get - # inherited from them. - lib_dirs = [ "$zircon_build_dir/system/ulib/fdio" ] -} - -config("executable_config") { -} - -config("thread_safety_annotations") { - cflags_cc = [ "-Wthread-safety" ] - defines = [ "_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS" ] -} - -config("enable_zircon_asserts") { - defines = [ "ZX_DEBUGLEVEL=2" ] -} - -declare_args() { - zircon_asserts = is_debug -} - -config("zircon_asserts") { - if (zircon_asserts) { - configs = [ ":enable_zircon_asserts" ] - } -} - -config("no_cpp_standard_library") { - ldflags = [ "-nostdlib++" ] -} - -config("static_cpp_standard_library") { - ldflags = [ "-static-libstdc++" ] -}
diff --git a/config/fuchsia/config.gni b/config/fuchsia/config.gni deleted file mode 100644 index c3c815e..0000000 --- a/config/fuchsia/config.gni +++ /dev/null
@@ -1,10 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_os == "fuchsia") - -declare_args() { - # Path to Fuchsia SDK. - fuchsia_sdk = "//buildtools" -}
diff --git a/config/fuchsia/rules.gni b/config/fuchsia/rules.gni deleted file mode 100644 index 99b431d..0000000 --- a/config/fuchsia/rules.gni +++ /dev/null
@@ -1,41 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_os == "fuchsia") - -# Declare a driver module target. -# -# This target allows you to create an object file that can be used as a driver -# that is loaded at runtime. -# -# Flags: cflags, cflags_c, cflags_cc, asmflags, defines, include_dirs, -# ldflags, lib_dirs, libs, -# Deps: data_deps, deps, public_deps -# Dependent configs: all_dependent_configs, public_configs -# General: check_includes, configs, data, inputs, output_name, -# output_extension, public, sources, testonly, visibility -template("driver_module") { - loadable_module(target_name) { - _target_type = "driver_module" - - # Explicitly forward visibility, implicitly forward everything else. - # See comment in //build/config/BUILDCONFIG.gn for details on this pattern. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, "*", [ "visibility" ]) - } -} - -set_defaults("driver_module") { - # Sets the default configs for driver_module, which can be modified later - # by the invoker. This overrides the loadable_module default. - configs = default_shared_library_configs - - # In general, drivers should not use the C++ standard library, and drivers - # cannot dynamically link against it. This config tells the linker to not - # link against the C++ standard library. - # Drivers that do require standard library functionality should remove this - # config line and add "//build/config/fuchsia:static_cpp_standard_library" to - # statically link it into the driver. - configs += [ "//build/config/fuchsia:no_cpp_standard_library" ] -}
diff --git a/config/fuchsia/sdk.gni b/config/fuchsia/sdk.gni deleted file mode 100644 index a138ee0..0000000 --- a/config/fuchsia/sdk.gni +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # The directories to search for parts of the SDK. - # - # By default, we search the public directories for the various layers. - # In the future, we'll search a pre-built SDK as well. - sdk_dirs = [ - "//garnet/public", - "//peridot/public", - "//topaz/public", - ] -}
diff --git a/config/fuchsia/zbi.gni b/config/fuchsia/zbi.gni deleted file mode 100644 index 0facf2a..0000000 --- a/config/fuchsia/zbi.gni +++ /dev/null
@@ -1,148 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zircon.gni") - -# Template for assembling a Zircon Boot Image file from various inputs. -# -# Parameters -# -# output_name (optional, default: target_name) -# output_extension (optional, default: "zbi") -# [string] These together determine the name of the output file. -# If `output_name` is omitted, then the name of the target is -# used. If `output_extension` is "" then `output_name` is the -# file name; otherwise, `${output_name}.${output_extension}`; -# the output file is always under `root_out_dir`. -# -# complete (optional, default: true) -# [Boolean] If true, then the output is intended to be a complete ZBI. -# That is, a single file that can be booted. This will make the tool -# verify it has the necessary contents and finalize it appropriately. -# -# compress (optional, default: true) -# [Boolean] If true, BOOTFS and RAMDISK payloads will be compressed. -# -# inputs (optional) -# [list of files] Input files. Each can be either a ZBI format -# file (e.g. from another `zbi` action, or the kernel ZBI), or a -# manifest file or directory to generate a `BOOTFS` filesystem -# embedded in the ZBI output. -# -# cmdline (optional) -# [list of strings] Kernel command line text. -# -# cmdline_inputs (optional) -# [list of files] Input files treated as kernel command line text. -# -# manifest (optional) -# [list of string|scope] List of individual manifest entries. -# Each entry can be a "TARGET=SOURCE" string, or it can be a scope -# with `sources` and `outputs` in the style of a copy() target: -# `outputs[0]` is used as `TARGET` (see `gn help source_expansion`). -# -# ramdisk_inputs (optional) -# [list of files] Input files treated as raw RAM disk images. -# -# deps (usually required) -# visibility (optional) -# testonly (optional) -# Same as for any GN `action` target. `deps` must list labels that -# produce all the `inputs`, `cmdline_inputs`, and `ramdisk_inputs` -# that are generated by the build (none are required for inputs that -# are part of the source tree). -# -# Each of the various kinds of input is optional, but the action will -# fail at build time (not at `gn gen` time) if there are is no input of -# any kind. -template("zbi") { - if (defined(invoker.output_name)) { - output_file = invoker.output_name - } else { - output_file = target_name - } - - if (defined(invoker.output_extension)) { - if (invoker.output_extension != "") { - output_file += ".${invoker.output_extension}" - } - } else { - output_file += ".zbi" - } - - output_file = "$root_out_dir/$output_file" - - zircon_tool_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "visibility", - "testonly", - ]) - outputs = [ - output_file, - ] - depfile = "${output_file}.d" - inputs = [] - - tool = "zbi" - args = [ - "--output=" + rebase_path(output_file, root_build_dir), - "--depfile=" + rebase_path(depfile, root_build_dir), - ] - - if (!defined(invoker.complete) || invoker.complete) { - args += [ "--complete=" + current_cpu ] - } - - if (defined(invoker.compress) && !invoker.compress) { - args += [ "--uncompressed" ] - } - - if (defined(invoker.inputs)) { - args += rebase_path(invoker.inputs, root_build_dir) - inputs += invoker.inputs - } - - if (defined(invoker.manifest)) { - foreach(entry, invoker.manifest) { - if (entry == "$entry") { - # It's a literal manifest entry string. - args += [ "--entry=$entry" ] - } else { - # It's a manifest entry in the style of a copy() target. - targets = entry.outputs - assert(targets == [ targets[0] ], - "manifest entry outputs list must have exactly one element") - foreach(source, entry.sources) { - inputs += [ source ] - source_path = rebase_path(source, root_build_dir) - foreach(target, process_file_template([ source ], targets)) { - args += [ "--entry=${target}=${source_path}" ] - } - } - } - } - } - - if (defined(invoker.ramdisk_inputs)) { - args += [ "--type=ramdisk" ] - args += rebase_path(invoker.ramdisk_inputs, root_build_dir) - inputs += invoker.ramdisk_inputs - } - - if (defined(invoker.cmdline) || defined(invoker.cmdline_inputs)) { - args += [ "--type=cmdline" ] - if (defined(invoker.cmdline)) { - foreach(cmdline, invoker.cmdline) { - args += [ "--entry=$cmdline" ] - } - } - if (defined(invoker.cmdline_inputs)) { - args += rebase_path(invoker.cmdline_inputs, root_build_dir) - inputs += invoker.cmdline_inputs - } - } - } -}
diff --git a/config/fuchsia/zircon.gni b/config/fuchsia/zircon.gni deleted file mode 100644 index 76df754..0000000 --- a/config/fuchsia/zircon.gni +++ /dev/null
@@ -1,105 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/clang/clang.gni") - -declare_args() { - # Where to find Zircon's host-side tools that are run as part of the build. - zircon_tools_dir = "//out/build-zircon/tools" - - # Zircon build directory for `target_cpu`, containing link-time `.so.abi` - # files that GN `deps` on //zircon/public libraries will link against. - # This should not be a sanitizer build. - zircon_build_abi_dir = "//out/build-zircon/build-$target_cpu" - - # Zircon build directory for `target_cpu`, containing `.manifest` and - # `.zbi` files for Zircon's BOOTFS and kernel. This provides the kernel - # and Zircon components used in the boot image. It also provides the - # Zircon shared libraries used at runtime in Fuchsia packages. - # - # If left `""` (the default), then this is computed from - # [`zircon_build_abi_dir`](#zircon_build_abi_dir) and - # [`zircon_use_asan`](#zircon_use_asan). - zircon_build_dir = "" - - # Zircon `USE_ASAN=true` build directory for `target_cpu` containing - # `bootfs.manifest` with libraries and `devhost.asan`. - # - # If left `""` (the default), then this is computed from - # [`zircon_build_dir`](#zircon_build_dir) and - # [`zircon_use_asan`](#zircon_use_asan). - zircon_asan_build_dir = "" - - # Set this if [`zircon_build_dir`](#zircon_build_dir) was built with - # `USE_ASAN=true`, e.g. `//scripts/build-zircon.sh -A`. This mainly - # affects the defaults for [`zircon_build_dir`](#zircon_build_dir) and - # [`zircon_build_abi_dir`](#zircon_build_abi_dir). It also gets noticed - # by //scripts/fx commands that rebuild Zircon so that they use `-A` - # again next time. - zircon_use_asan = false - - # Path to `make` binary. By default, `make` is assumed to be in the - # path. Used in the script that generates the Zircon build rules. N.B. this - # path is *not* rebased, just used as is. - zircon_make_path = "make" -} - -if (zircon_build_dir == "") { - zircon_build_dir = zircon_build_abi_dir - if (zircon_use_asan) { - zircon_build_dir += "-asan" - } -} - -# If zircon_use_asan is true, then zircon_build_dir has the ASan bits. -# Otherwise, they need to be found elsewhere. -if (zircon_asan_build_dir == "" && !zircon_use_asan) { - zircon_asan_build_dir = "${zircon_build_dir}-asan" -} - -# Template for running a Zircon host tool as part of the build. -# This is a thin wrapper to define an `action()` target. -# -# Parameters -# -# tool (required) -# [string] The name of the tool, like "mkbootfs". -# -# args (required) -# [list of strings] The arguments to pass the tool. -# The tool runs with `root_build_dir` as its current directory, -# so any file names should be made either absolute or relative -# to `root_build_dir` using `rebase_path()`. -# -# All other parameters are exactly as for `action()`, except -# that `script` is replaced with `tool`. -# -template("zircon_tool_action") { - assert(defined(invoker.tool), "zircon_tool_action() requires `tool`") - assert(defined(invoker.args), "zircon_tool_action() requires `args`") - _tool = "$zircon_tools_dir/${invoker.tool}" - action(target_name) { - inputs = [] - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - forward_variables_from(invoker, - "*", - [ - "args", - "script", - "tool", - "testonly", - "visibility", - ]) - script = "//build/gn_run_binary.sh" - inputs += [ _tool ] - args = [ - clang_prefix, - rebase_path(_tool, root_build_dir), - ] + invoker.args - } -}
diff --git a/config/host_byteorder.gni b/config/host_byteorder.gni deleted file mode 100644 index 7f711ce..0000000 --- a/config/host_byteorder.gni +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This header file defines the "host_byteorder" variable. -declare_args() { - host_byteorder = "undefined" -} - -# Detect host byteorder -if (host_cpu == "arm64" || host_cpu == "x64") { - host_byteorder = "little" -} else { - assert(false, "Unsupported host CPU") -}
diff --git a/config/linux/BUILD.gn b/config/linux/BUILD.gn deleted file mode 100644 index 85906d7..0000000 --- a/config/linux/BUILD.gn +++ /dev/null
@@ -1,58 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/sysroot.gni") - -config("compiler") { - cflags = [] - cflags_c = [] - cflags_cc = [] - ldflags = [ - "-static-libstdc++", - - # Generate build ID for all binaries so we can use the .build-id directory - # scheme for debugging information. This flag is enabled by default for our - # toolchain and many native host toolchains, but we set it explicitly to - # support arbitrary host toolchains. - "-Wl,--build-id", - - # Set rpath to find dynamically linked libraries placed next to executables - # in the host build directory. - "-Wl,-rpath=\$ORIGIN/", - ] - if (host_os == "mac") { - # TODO(TC-325): When building binaries for Linux on macOS, we need to use - # lld as a linker, hence this flag. This is not needed on Linux since our - # Clang is configured to use lld as a default linker, but we cannot use the - # same option on macOS since default linker is currently a per-toolchain, - # not a per-target option and on macOS, Clang should default to ld64. We - # should change Clang to make the default linker a per-target option. - ldflags += [ "-fuse-ld=lld" ] - } - configs = [ - ":sysroot", - ":target", - ] - - # TODO(TC-74) The implicitly linked static libc++.a depends on these. - libs = [ - "dl", - "pthread", - ] - lib_dirs = [ rebase_path("//buildtools/${host_platform}/clang/lib") ] - asmflags = cflags + cflags_c -} - -config("sysroot") { - cflags = [ "--sysroot=$sysroot" ] - ldflags = cflags - asmflags = cflags -} - -config("target") { - cflags = [ "--target=$clang_target" ] - asmflags = cflags - ldflags = cflags -}
diff --git a/config/lto/BUILD.gn b/config/lto/BUILD.gn deleted file mode 100644 index a654446..0000000 --- a/config/lto/BUILD.gn +++ /dev/null
@@ -1,46 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/lto/config.gni") -import("//build/toolchain/variant.gni") - -# This config is added unconditionally by BUILDCONFIG.gn to pick up the -# global `use_lto` build argument. For fine-grained control, leave -# `use_lto=false` and use `select_variant` to choose the `lto` or `thinlto` -# variant for some components. -config("default") { - if (use_lto) { - if (use_thinlto) { - configs = [ ":thinlto" ] - } else { - configs = [ ":lto" ] - } - } -} - -variant("lto") { - common_flags = [ - "-flto", - - # Enable whole-program devirtualization and virtual constant propagation. - "-fwhole-program-vtables", - ] -} - -variant("thinlto") { - common_flags = [ "-flto=thin" ] - ldflags = [ - # The ThinLTO driver launches a number of threads in parallel whose - # number is by default equivalent to the number of cores. We need - # to limit the parallelism to avoid aggressive competition between - # different linker jobs. - "-Wl,--thinlto-jobs=$thinlto_jobs", - - # Set the ThinLTO cache directory which is used to cache native - # object files for ThinLTO incremental builds. This directory is - # not managed by Ninja and has to be cleaned manually, but it is - # periodically garbage-collected by the ThinLTO driver. - "-Wl,--thinlto-cache-dir=$thinlto_cache_dir", - ] -}
diff --git a/config/lto/config.gni b/config/lto/config.gni deleted file mode 100644 index f439ada..0000000 --- a/config/lto/config.gni +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Use link time optimization (LTO). - use_lto = false - - # Use ThinLTO variant of LTO if use_lto = true. - use_thinlto = true - - # Number of parallel ThinLTO jobs. - thinlto_jobs = 8 - - # ThinLTO cache directory path. - thinlto_cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir) -}
diff --git a/config/mac/BUILD.gn b/config/mac/BUILD.gn deleted file mode 100644 index fd0686d..0000000 --- a/config/mac/BUILD.gn +++ /dev/null
@@ -1,54 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/sysroot.gni") - -config("compiler") { - cflags_objcc = [ - "-std=c++14", - "-stdlib=libc++", - ] - configs = [ ":sysroot" ] -} - -config("sysroot") { - cflags = [ "--sysroot=$sysroot" ] - ldflags = cflags - asmflags = cflags -} - -# On Mac, this is used for everything except static libraries. -config("mac_dynamic_flags") { - ldflags = [ - "-Wl,-search_paths_first", - "-L.", - - # Path for loading shared libraries for unbundled binaries. - "-Wl,-rpath,@loader_path/.", - - # Path for loading shared libraries for bundled binaries. - # Get back from Binary.app/Contents/MacOS. - "-Wl,-rpath,@loader_path/../../..", - ] -} - -# On Mac, this is used only for executables. -config("mac_executable_flags") { - ldflags = [ "-Wl,-pie" ] # Position independent. -} - -# Standard libraries. -config("default_libs") { - libs = [ - "AppKit.framework", - "ApplicationServices.framework", - "Carbon.framework", - "CoreFoundation.framework", - "CoreVideo.framework", - "Foundation.framework", - "OpenGL.framework", - "Security.framework", - "IOKit.framework", - ] -}
diff --git a/config/mac/config.gni b/config/mac/config.gni deleted file mode 100644 index c8d2ffd..0000000 --- a/config/mac/config.gni +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_os == "mac") - -declare_args() { - # Minimum supported version of Mac SDK. - mac_sdk_min = "10.13" - - # Path to Mac SDK. - mac_sdk_path = "" -} - -find_sdk_args = [ - "--print-sdk-path", - mac_sdk_min, -] -find_sdk_lines = - exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines") -mac_sdk_version = find_sdk_lines[1] - -if (mac_sdk_path == "") { - mac_sdk_path = find_sdk_lines[0] -}
diff --git a/config/profile/BUILD.gn b/config/profile/BUILD.gn deleted file mode 100644 index 2f1d14c..0000000 --- a/config/profile/BUILD.gn +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/toolchain/variant.gni") - -variant("profile") { - common_flags = [ - "-fprofile-instr-generate", - "-fcoverage-mapping", - ] - - # The statically-linked profiling runtime depends on libzircon. - libs = [ "zircon" ] -}
diff --git a/config/sanitizers/BUILD.gn b/config/sanitizers/BUILD.gn deleted file mode 100644 index 5749324..0000000 --- a/config/sanitizers/BUILD.gn +++ /dev/null
@@ -1,68 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/toolchain/variant.gni") - -config("frame_pointers") { - cflags = [ "-fno-omit-frame-pointer" ] - ldflags = cflags -} - -declare_args() { - # Default [AddressSanitizer](https://llvm.org/docs/AddressSanitizer.html) - # options (before the `ASAN_OPTIONS` environment variable is read at - # runtime). This can be set as a build argument to affect most "asan" - # variants in `known_variants` (which see), or overridden in - # toolchain_args in one of those variants. Note that setting this - # nonempty may conflict with programs that define their own - # `__asan_default_options` C function. - asan_default_options = "" -} - -variant("asan") { - common_flags = [ "-fsanitize=address" ] - - # ASan wants frame pointers because it captures stack traces - # on allocations and such, not just on errors. - configs = [ ":frame_pointers" ] - - if (asan_default_options != "") { - deps = [ - ":asan_default_options", - ] - } -} - -if (asan_default_options != "") { - source_set("asan_default_options") { - visibility = [ ":*" ] - sources = [ - "asan_default_options.c", - ] - defines = [ "ASAN_DEFAULT_OPTIONS=\"${asan_default_options}\"" ] - - # On Fuchsia, the ASan runtime is dynamically linked and needs to have - # the __asan_default_options symbol exported. On systems where the - # ASan runtime is statically linked, it doesn't matter either way. - configs -= [ "//build/config:symbol_visibility_hidden" ] - } -} - -variant("ubsan") { - common_flags = [ "-fsanitize=undefined" ] -} - -variant("fuzzer") { - common_flags = [ "-fsanitize=fuzzer" ] - - # TODO (TC-251): This shouldn't be necessary, but libzircon isn't currently - # linked into libFuzzer on Fuchsia. - if (is_fuchsia) { - libs = [ "zircon" ] - } -} - -variant("sancov") { - common_flags = [ "-fsanitize-coverage=trace-pc-guard" ] -}
diff --git a/config/sanitizers/asan_default_options.c b/config/sanitizers/asan_default_options.c deleted file mode 100644 index f8d9d3b..0000000 --- a/config/sanitizers/asan_default_options.c +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2017 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <sanitizer/asan_interface.h> - -// This exists to be built into every executable selected to use the -// asan_no_detect_leaks variant. ASan applies the options here before -// looking at the ASAN_OPTIONS environment variable. -const char* __asan_default_options(void) { - // This macro is defined by BUILD.gn from the `asan_default_options` GN - // build argument. - return ASAN_DEFAULT_OPTIONS; -}
diff --git a/config/scudo/BUILD.gn b/config/scudo/BUILD.gn deleted file mode 100644 index 5e2ddf0..0000000 --- a/config/scudo/BUILD.gn +++ /dev/null
@@ -1,54 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/scudo/scudo.gni") -import("//build/toolchain/variant.gni") - -# This group is added unconditionally by BUILDCONFIG.gn to pick up the -# global `use_scudo` build argument. For fine-grained control, leave -# `use_scudo=false` and use `select_variant` to choose the `scudo` -# variant for some components. -# This configuration will apply to the executable alone, and not any of its -# deps. (So most code will not be compiled with Scudo, but executables will -# be *linked* with it, which is the important thing.) -# Enabling Scudo requires both a configuration change and an additional -# dependency; we group them together here. -group("default_for_executable") { - if (use_scudo && is_fuchsia) { - public_configs = [ ":scudo" ] - deps = [ - ":scudo_default_options", - ] - } -} - -# This defines the //build/config/scudo config that's used separately -# when `use_scudo` is set, as well as making that config (along with -# the deps to propagate `scudo_default_options`) into a variant. -variant("scudo") { - # The variant only works by linking Scudo in. - # i.e., we don't support code that relies on `#if __has_feature(scudo)`. - ldflags = [ "-fsanitize=scudo" ] - deps = [ - ":scudo_default_options", - ] -} - -source_set("scudo_default_options") { - visibility = [ ":*" ] - if (scudo_default_options != []) { - sources = [ - "scudo_default_options.c", - ] - options_string = "" - foreach(option, scudo_default_options) { - options_string += ":$option" - } - defines = [ "SCUDO_DEFAULT_OPTIONS=\"${options_string}\"" ] - - # The Scudo runtime is dynamically linked and needs to have - # the __scudo_default_options symbol exported. - configs -= [ "//build/config:symbol_visibility_hidden" ] - } -}
diff --git a/config/scudo/scudo.gni b/config/scudo/scudo.gni deleted file mode 100644 index 7b3d586..0000000 --- a/config/scudo/scudo.gni +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Enable the [Scudo](https://llvm.org/docs/ScudoHardenedAllocator.html) - # memory allocator. - use_scudo = true - - # Default [Scudo](https://llvm.org/docs/ScudoHardenedAllocator.html) - # options (before the `SCUDO_OPTIONS` environment variable is read at - # runtime). *NOTE:* This affects only components using the `scudo` - # variant (see GN build argument `select_variant`), and does not affect - # anything when the `use_scudo` build flag is set instead. - scudo_default_options = [ - "abort_on_error=1", # get stacktrace on error - "QuarantineSizeKb=0", # disables quarantine - "ThreadLocalQuarantineSizeKb=0", # disables quarantine - "DeallocationTypeMismatch=false", # TODO(flowerhack) re-enable when US-495 - # is resolved - - "DeleteSizeMismatch=false", # TODO(flowerhack) re-enable when US-495 - # is resolved - - "allocator_may_return_null=true", - ] -}
diff --git a/config/scudo/scudo_default_options.c b/config/scudo/scudo_default_options.c deleted file mode 100644 index 0fac868..0000000 --- a/config/scudo/scudo_default_options.c +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <sanitizer/scudo_interface.h> - -// This exists to be built into every executable selected to use the -// scudo variant. Scudo applies the options here before -// looking at the SCUDO_OPTIONS environment variable. -const char* __scudo_default_options(void) { - // This macro is defined by BUILD.gn from the `scudo_default_options` GN - // build argument. - return SCUDO_DEFAULT_OPTIONS; -}
diff --git a/config/sysroot.gni b/config/sysroot.gni deleted file mode 100644 index 1595e84..0000000 --- a/config/sysroot.gni +++ /dev/null
@@ -1,24 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # The absolute path of the sysroot that is used with the target toolchain. - target_sysroot = "" -} - -if (current_os == target_os && target_sysroot != "") { - sysroot = target_sysroot -} else if (is_fuchsia) { - _out_dir = - get_label_info("//zircon/public/sysroot(//build/zircon:zircon_toolchain)", - "target_out_dir") - sysroot = rebase_path("$_out_dir/sysroot") -} else if (is_linux) { - sysroot = rebase_path("//build/third_party/sysroot/${current_platform}") -} else if (is_mac) { - import("//build/config/mac/config.gni") - sysroot = mac_sdk_path -} else { - sysroot = "" -}
diff --git a/cpp/BUILD.gn b/cpp/BUILD.gn deleted file mode 100644 index 5b5fb9b..0000000 --- a/cpp/BUILD.gn +++ /dev/null
@@ -1,12 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fidl/toolchain.gni") - -# See fidl_cpp.gni:fidl_cpp. Its generated `source_set`s should be the -# only users of this config (in their public_configs). -config("fidl_gen_config") { - fidl_root_gen_dir = get_label_info("//bogus($fidl_toolchain)", "root_gen_dir") - include_dirs = [ fidl_root_gen_dir ] -}
diff --git a/cpp/binaries.py b/cpp/binaries.py deleted file mode 100755 index aa2e8f0..0000000 --- a/cpp/binaries.py +++ /dev/null
@@ -1,28 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. 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 sys - -sys.path.append(os.path.join( - os.path.dirname(__file__), - os.pardir, - "images", -)) -import elfinfo - - -def get_sdk_debug_path(binary): - build_id = elfinfo.get_elf_info(binary).build_id - return '.build-id/' + build_id[:2] + '/' + build_id[2:] + '.debug' - - -# For testing. -def main(): - print(get_sdk_debug_path(sys.argv[1])) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/cpp/fidl_cpp.gni b/cpp/fidl_cpp.gni deleted file mode 100644 index f236f36..0000000 --- a/cpp/fidl_cpp.gni +++ /dev/null
@@ -1,136 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") -import("//build/sdk/sdk_atom_alias.gni") - -# Generates some C++ bindings for a FIDL library. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# - name; -# - sources; -# - cpp_legacy_callbacks. - -template("fidl_cpp_codegen") { - not_needed(invoker, [ "sources" ]) - - main_target_name = target_name - generation_target_name = "${target_name}_cpp_generate" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - fidl_root_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "root_gen_dir") - - include_stem = string_replace(library_name, ".", "/") + "/cpp/fidl" - file_stem = "$fidl_root_gen_dir/$include_stem" - - fidl_target_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "target_gen_dir") - json_representation = "$fidl_target_gen_dir/$target_name.fidl.json" - - fidl_root_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "root_gen_dir") - - compiled_action(generation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - visibility = [ ":$main_target_name" ] - - tool = "//garnet/go/src/fidl:fidlgen" - - inputs = [ - json_representation, - ] - - outputs = [ - "$file_stem.h", - "$file_stem.cc", - ] - - args = [ - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(file_stem, root_build_dir), - "--include-base", - rebase_path(fidl_root_gen_dir, root_build_dir), - "--generators", - "cpp", - ] - - if (defined(invoker.cpp_legacy_callbacks) && invoker.cpp_legacy_callbacks) { - args += [ "--cpp-legacy-callbacks" ] - } - - deps = [ - ":$main_target_name($fidl_toolchain)", - ] - } -} - -template("fidl_cpp") { - not_needed(invoker, "*") - - main_target_name = target_name - generation_target_name = "${target_name}_cpp_generate" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - fidl_root_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "root_gen_dir") - - include_stem = string_replace(library_name, ".", "/") + "/cpp/fidl" - file_stem = "$fidl_root_gen_dir/$include_stem" - - source_set(main_target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - sources = [ - "$file_stem.cc", - "$file_stem.h", - ] - - # Let dependencies use `#include "$file_stem.h"`. - public_configs = [ "//build/cpp:fidl_gen_config" ] - - public_deps = [ - ":$generation_target_name($fidl_toolchain)", - ":$main_target_name($fidl_toolchain)", - ":${main_target_name}_tables", - ] - - if (is_fuchsia) { - public_deps += [ "//garnet/public/lib/fidl/cpp" ] - } else { - public_deps += [ "//garnet/public/lib/fidl/cpp:cpp_base" ] - } - - if (defined(invoker.public_deps)) { - public_deps += invoker.public_deps - } - } - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - # Instead of depending on the generated bindings, set up a dependency on the - # original library. - sdk_target_name = "${main_target_name}_sdk" - sdk_atom_alias(sdk_target_name) { - atom = ":$sdk_target_name($fidl_toolchain)" - } - } -}
diff --git a/cpp/fidlmerge_cpp.gni b/cpp/fidlmerge_cpp.gni deleted file mode 100644 index 5529030..0000000 --- a/cpp/fidlmerge_cpp.gni +++ /dev/null
@@ -1,146 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") - -# Declares a source_set that contains code generated by fidlmerge from a -# template and a FIDL JSON file. -# -# Parameters -# -# fidl_target (required) -# Specifies the fidl target from which to read fidl json. For example, -# "//zircon/public/fidl/fuchsia-mem" for fuchsia.mem or -# "//garnet/public/fidl/fuchsia.sys" for fuchsia.sys. -# -# template_path (required) -# Specifies the template to use to generate the source code for the -# source_set. For example, "//garnet/public/build/fostr/fostr.fidlmerge". -# -# generated_source_base (required) -# The base file name from which the source_set's 'source' file names are -# generated. For example, "formatting". -# -# generated_source_extensions (optional) -# The list of extensions of source_set 'source' files that will be generated -# and included in the source set. By default, this is [ ".cc", ".h" ] -# -# options (optional) -# A single string with comma-separated key=value pairs. -# -# amendments_path (optional) -# Specifies a JSON file that contains amendments to be made to the fidl -# model before the template is applied. For example, -# "//garnet/public/build/fostr/fidl/fuchsia.media/amendments.fidlmerge". -# See the fidlmerge README for details. -# -# deps, public_deps, test_only, visibility (optional) -# These parameters are forwarded to the source_set. -# - -template("fidlmerge_cpp") { - assert(defined(invoker.fidl_target), - "fidlmerge_cpp requires parameter fidl_target.") - - assert(defined(invoker.template_path), - "fidlmerge_cpp requires parameter template_path.") - - assert(defined(invoker.generated_source_base), - "fidlmerge_cpp requires parameter generated_source_base.") - - fidl_target = invoker.fidl_target - template_path = invoker.template_path - source_base = invoker.generated_source_base - - if (defined(invoker.generated_source_extensions)) { - generated_source_extensions = invoker.generated_source_extensions - } else { - generated_source_extensions = [ - ".cc", - ".h", - ] - } - - main_target_name = target_name - generation_target_name = "${target_name}_generate" - - fidl_target_gen_dir = - get_label_info("$fidl_target($fidl_toolchain)", "target_gen_dir") - fidl_target_name = get_path_info(fidl_target_gen_dir, "file") - json_representation = "$fidl_target_gen_dir/$fidl_target_name.fidl.json" - - include_stem = string_replace(target_gen_dir, ".", "/") - file_stem = "$include_stem/$source_base" - - compiled_action(generation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - visibility = [ ":$main_target_name" ] - - tool = "//garnet/go/src/fidlmerge" - - inputs = [ - json_representation, - template_path, - ] - - outputs = [] - foreach(ext, generated_source_extensions) { - outputs += [ "$file_stem$ext" ] - } - - args = [ - "--template", - rebase_path(template_path, root_build_dir), - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(file_stem, root_build_dir), - ] - - if (defined(invoker.options)) { - args += [ - "--options", - invoker.options, - ] - } - - if (defined(invoker.amendments_path)) { - args += [ - "--amend", - rebase_path(invoker.amendments_path, root_build_dir), - ] - } - - deps = [ - "$fidl_target($fidl_toolchain)", - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - } - - source_set(main_target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - sources = [] - foreach(ext, generated_source_extensions) { - sources += [ "$file_stem$ext" ] - } - - public_deps = [ - ":$generation_target_name", - ] - if (defined(invoker.public_deps)) { - public_deps += invoker.public_deps - } - } -}
diff --git a/cpp/gen_sdk_prebuilt_meta_file.py b/cpp/gen_sdk_prebuilt_meta_file.py deleted file mode 100755 index cc9f47f..0000000 --- a/cpp/gen_sdk_prebuilt_meta_file.py +++ /dev/null
@@ -1,98 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -sys.path.append(os.path.join( - os.path.dirname(__file__), - os.pardir, - "cpp", -)) -import binaries - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--name', - help='Name of the library', - required=True) - parser.add_argument('--root', - help='Root of the library in the SDK', - required=True) - parser.add_argument('--deps', - help='Path to metadata files of dependencies', - nargs='*') - parser.add_argument('--headers', - help='List of public headers', - nargs='*') - parser.add_argument('--include-dir', - help='Path to the include directory', - required=True) - parser.add_argument('--arch', - help='Name of the target architecture', - required=True) - parser.add_argument('--lib-link', - help='Path to the link-time library in the SDK', - required=True) - parser.add_argument('--lib-dist', - help='Path to the library to add to Fuchsia packages in the SDK', - required=True) - parser.add_argument('--lib-debug-file', - help='Path to the source debug version of the library', - required=True) - parser.add_argument('--debug-mapping', - help='Path to the file where to write the file mapping for the debug library', - required=True) - args = parser.parse_args() - - # The path of the debug file in the SDK depends on its build id. - debug_path = binaries.get_sdk_debug_path(args.lib_debug_file) - with open(args.debug_mapping, 'w') as mappings_file: - mappings_file.write(debug_path + '=' + args.lib_debug_file + '\n') - - metadata = { - 'type': 'cc_prebuilt_library', - 'name': args.name, - 'root': args.root, - 'format': 'shared', - 'headers': args.headers, - 'include_dir': args.include_dir, - } - metadata['binaries'] = { - args.arch: { - 'link': args.lib_link, - 'dist': args.lib_dist, - 'debug': debug_path, - }, - } - - deps = [] - fidl_deps = [] - for spec in args.deps: - with open(spec, 'r') as spec_file: - data = json.load(spec_file) - type = data['type'] - name = data['name'] - # TODO(DX-498): verify that source libraries are header-only. - if type == 'cc_source_library' or type == 'cc_prebuilt_library': - deps.append(name) - else: - raise Exception('Unsupported dependency type: %s' % type) - metadata['deps'] = deps - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/cpp/gen_sdk_sources_meta_file.py b/cpp/gen_sdk_sources_meta_file.py deleted file mode 100755 index 243573c..0000000 --- a/cpp/gen_sdk_sources_meta_file.py +++ /dev/null
@@ -1,69 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--name', - help='Name of the library', - required=True) - parser.add_argument('--root', - help='Root of the library in the SDK', - required=True) - parser.add_argument('--deps', - help='Path to metadata files of dependencies', - nargs='*') - parser.add_argument('--sources', - help='List of library sources', - nargs='+') - parser.add_argument('--headers', - help='List of public headers', - nargs='*') - parser.add_argument('--include-dir', - help='Path to the include directory', - required=True) - args = parser.parse_args() - - metadata = { - 'type': 'cc_source_library', - 'name': args.name, - 'root': args.root, - 'sources': args.sources, - 'headers': args.headers, - 'include_dir': args.include_dir, - } - - deps = [] - fidl_deps = [] - for spec in args.deps: - with open(spec, 'r') as spec_file: - data = json.load(spec_file) - type = data['type'] - name = data['name'] - if type == 'cc_source_library' or type == 'cc_prebuilt_library': - deps.append(name) - elif type == 'fidl_library': - fidl_deps.append(name) - else: - raise Exception('Unsupported dependency type: %s' % type) - metadata['deps'] = deps - metadata['fidl_deps'] = fidl_deps - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/cpp/sdk_executable.gni b/cpp/sdk_executable.gni deleted file mode 100644 index 85b1840..0000000 --- a/cpp/sdk_executable.gni +++ /dev/null
@@ -1,68 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/sdk/sdk_atom.gni") - -# An executable which can be bundled in an SDK. -# -# An equivalent to the built-in executable which adds an SDK atom declaration to -# allow the resulting binary to be included in an SDK. -# -# category (required) -# Publication level of the executable in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# sdk_deps (optional) -# List of labels representing elements that should be added to SDKs -# alongside the present binary. -# Labels in the list must represent SDK-ready targets. - -template("sdk_executable") { - assert(defined(invoker.category), "Must define an SDK category") - - main_target_name = target_name - - executable(main_target_name) { - forward_variables_from(invoker, "*", [ "category" ]) - } - - output_name = target_name - if (defined(invoker.output_name)) { - output_name = invoker.output_name - } - - if (!is_fuchsia) { - file_base = "tools/$output_name" - - sdk_atom("${target_name}_sdk") { - id = "sdk://tools/$output_name" - - category = invoker.category - - meta = { - dest = "$file_base-meta.json" - schema = "host_tool" - value = { - type = "host_tool" - name = output_name - root = "tools" - files = [ file_base ] - } - } - - files = [ - { - source = "$root_out_dir/$output_name" - dest = file_base - }, - ] - - if (defined(invoker.sdk_deps)) { - deps = invoker.sdk_deps - } - - non_sdk_deps = [ ":$main_target_name" ] - } - } -}
diff --git a/cpp/sdk_shared_library.gni b/cpp/sdk_shared_library.gni deleted file mode 100644 index 32cf233..0000000 --- a/cpp/sdk_shared_library.gni +++ /dev/null
@@ -1,293 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/sdk/sdk_atom.gni") -import("//build/sdk/sdk_atom_alias.gni") - -# A shared library that can be exported to an SDK in binary form. -# -# Parameters -# -# category (required) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# no_headers (optional) -# Whether to include the library's headers in the SDK. -# Defaults to false. -# -# sdk_name (optional) -# Name of the library in the SDK. -# Defaults to the library's output name. -# -# include_base (optional) -# Path to the root directory for includes. -# Defaults to ".". -# -# runtime_deps (optional) -# List of labels representing the library's runtime dependencies. This is -# only needed for runtime dependencies inherited from private dependencies. -# Note that these labels should represent SDK targets. - -# The defaults for a sdk_shared_library should match that of a shared_library. -set_defaults("sdk_shared_library") { - configs = default_shared_library_configs -} - -template("sdk_shared_library") { - assert(defined(invoker.category), "Must define an SDK category") - - main_target_name = target_name - metadata_target_name = "${target_name}_sdk_metadata" - manifest_target_name = "${target_name}_sdk_manifest" - sdk_target_name = "${target_name}_sdk" - - shared_library(main_target_name) { - forward_variables_from(invoker, - "*", - [ - "category", - "include_base", - "no_headers", - "runtime_deps", - "sdk_name", - ]) - - if (defined(visibility)) { - visibility += [ ":$manifest_target_name" ] - } - - # Prebuilt shared libraries are eligible for inclusion in the SDK. We do not - # want to dynamically link against libc++.so because we let clients bring - # their own toolchain, which might have a different C++ Standard Library or - # a different C++ ABI entirely. - # - # Adding this linker flag keeps us honest about not commiting to a specific - # C++ ABI. If this flag is causing your library to not to compile, consider - # whether your library really ought to be in the SDK. If so, consider - # including your library in the SDK as source rather than precompiled. If - # you do require precompilation, you probably need to find a way not to - # depend on dynamically linking C++ symbols because C++ does not have a - # sufficiently stable ABI for the purposes of our SDK. - # TODO(TC-46): statically link against libc++ if necessary. - if (!defined(ldflags)) { - ldflags = [] - } - ldflags += [ "-nostdlib++" ] - - # Request that the runtime deps be written out to a file. This file will be - # used later to verify that all runtime deps are available in the SDK. - write_runtime_deps = "$target_out_dir/$target_name.runtime_deps" - } - - output_name = target_name - if (defined(invoker.output_name)) { - output_name = invoker.output_name - } - - if (defined(invoker.sdk_name)) { - atom_name = invoker.sdk_name - } else { - atom_name = output_name - } - - no_headers = defined(invoker.no_headers) && invoker.no_headers - - # Base path for source files of this library in SDKs. - file_base = "pkg/$atom_name" - - # Base path for binaries of this library in SDKs. - prebuilt_base = "arch/$target_cpu" - - # Identify dependencies and their metadata files. - sdk_deps = [] - sdk_metas = [] - - # If a prebuilt library is only provided for packaging purposes (by not - # exposing headers) then its dependencies need not be included in an SDK. - if (defined(invoker.public_deps) && !no_headers) { - foreach(dep, invoker.public_deps) { - full_label = get_label_info(dep, "label_no_toolchain") - sdk_dep = "${full_label}_sdk" - sdk_deps += [ sdk_dep ] - } - } - - # Runtime deps are already SDK targets. - if (defined(invoker.runtime_deps)) { - sdk_deps += invoker.runtime_deps - } - foreach(sdk_dep, sdk_deps) { - gen_dir = get_label_info(sdk_dep, "target_gen_dir") - name = get_label_info(sdk_dep, "name") - sdk_metas += [ rebase_path("$gen_dir/$name.meta.json") ] - } - - # Process headers. - all_headers = [] - if ((defined(invoker.public) || defined(invoker.sources)) && !no_headers) { - if (defined(invoker.public)) { - all_headers += invoker.public - } else { - foreach(source_file, invoker.sources) { - extension = get_path_info(source_file, "extension") - if (extension == "h") { - all_headers += [ source_file ] - } - } - } - } - sdk_headers = [] - sdk_files = [] - foreach(header, all_headers) { - include_base = "include" - if (defined(invoker.include_base)) { - include_base = invoker.include_base - } - destination = rebase_path(header, include_base) - header_dest = "$file_base/include/$destination" - sdk_headers += [ header_dest ] - sdk_files += [ - { - source = header - dest = header_dest - }, - ] - } - - # Add binaries. - shared_out_dir = get_label_info(":bogus($shlib_toolchain)", "root_out_dir") - lib_name = "lib$output_name.so" - link_lib = "$prebuilt_base/lib/$lib_name" - dist_lib = "$prebuilt_base/dist/$lib_name" - sdk_files += [ - { - # TODO(TO-791): put ABI stubs under lib/, not the full thing. - source = "$shared_out_dir/$lib_name" - dest = link_lib - }, - { - source = "$shared_out_dir/$lib_name" - dest = dist_lib - }, - ] - - metadata_file = "$target_gen_dir/$metadata_target_name.sdk_meta.json" - debug_mapping_file = "$target_gen_dir/$metadata_target_name.mappings.txt" - debug_lib_file = "$shared_out_dir/lib.unstripped/$lib_name" - - action(metadata_target_name) { - script = "//build/cpp/gen_sdk_prebuilt_meta_file.py" - - inputs = sdk_metas + [ debug_lib_file ] - - outputs = [ - debug_mapping_file, - metadata_file, - ] - - args = [ - "--out", - rebase_path(metadata_file), - "--name", - atom_name, - "--root", - file_base, - "--include-dir", - "$file_base/include", - "--deps", - ] + sdk_metas + [ "--headers" ] + sdk_headers + - [ - "--arch", - target_cpu, - "--lib-link", - link_lib, - "--lib-dist", - dist_lib, - "--lib-debug-file", - rebase_path(debug_lib_file), - "--debug-mapping", - rebase_path(debug_mapping_file), - ] - - deps = sdk_deps + [ ":$main_target_name" ] - } - - sdk_atom(manifest_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - id = "sdk://pkg/$atom_name" - - category = invoker.category - - meta = { - source = metadata_file - dest = "$file_base/meta.json" - schema = "cc_prebuilt_library" - } - - files = sdk_files - - file_list = debug_mapping_file - - deps = sdk_deps - - non_sdk_deps = [ - ":$main_target_name", - ":$metadata_target_name", - ] - - # Explicitly add non-public dependencies, in case some of the source files - # are generated. - if (defined(invoker.deps)) { - non_sdk_deps += invoker.deps - } - } - - shared_gen_dir = get_label_info(":bogus($shlib_toolchain)", "target_out_dir") - runtime_deps_file = "$shared_gen_dir/$target_name.runtime_deps" - sdk_manifest_file = "$target_gen_dir/$manifest_target_name.sdk" - verify_target_name = "${target_name}_verify" - - # Verify that the SDK manifest for this target includes all of the expected - # runtime dependencies. - # TODO(DX-498): also check that everything in there is either prebuilt or - # headers only. - action(verify_target_name) { - script = "//build/cpp/verify_runtime_deps.py" - - inputs = [ - sdk_manifest_file, - runtime_deps_file, - ] - - stamp_file = "$target_gen_dir/$target_name.stamp" - - outputs = [ - stamp_file, - ] - - args = [ - "--stamp", - rebase_path(stamp_file), - "--manifest", - rebase_path(sdk_manifest_file), - "--runtime-deps-file", - rebase_path(runtime_deps_file), - "--root-out-dir", - rebase_path(root_out_dir), - ] - - deps = [ - ":$main_target_name", - ":$manifest_target_name", - ] - } - - sdk_atom_alias(sdk_target_name) { - atom = ":$manifest_target_name" - - non_sdk_deps = [ ":$verify_target_name" ] - } -}
diff --git a/cpp/sdk_source_set.gni b/cpp/sdk_source_set.gni deleted file mode 100644 index 35ef4c4..0000000 --- a/cpp/sdk_source_set.gni +++ /dev/null
@@ -1,178 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/sdk/sdk_atom.gni") - -# A source set that can be exported to an SDK. -# -# An equivalent to the built-in source_set which adds an SDK atom declaration to -# allow the set to be included in an SDK as sources. -# -# Parameters -# -# category (required) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# sdk_name (required) -# Name of the library in the SDK. -# -# source_dir (optional) -# If set, path to the base directory of the sources. -# This is useful if the sources are generated and therefore not hosted -# directly under the directory where the GN rules are declared. -# -# include_base (optional) -# Path to the root directory for includes. -# Defaults to "include". - -template("sdk_source_set") { - assert(defined(invoker.category), "Must define an SDK category") - assert(defined(invoker.sdk_name), "Must define an SDK name") - - main_target_name = target_name - sdk_target_name = "${target_name}_sdk" - - source_set(main_target_name) { - forward_variables_from(invoker, - "*", - [ - "category", - "include_base", - "sdk_name", - "source_dir", - ]) - - if (defined(visibility)) { - visibility += [ ":$sdk_target_name" ] - } - } - - # Identify dependencies and their metadata files. - sdk_metas = [] - sdk_deps = [] - if (defined(invoker.public_deps)) { - foreach(dep, invoker.public_deps) { - full_label = get_label_info(dep, "label_no_toolchain") - sdk_dep = "${full_label}_sdk" - sdk_deps += [ sdk_dep ] - - gen_dir = get_label_info(sdk_dep, "target_gen_dir") - name = get_label_info(sdk_dep, "name") - sdk_metas += [ rebase_path("$gen_dir/$name.meta.json") ] - } - } - - # Sort headers vs. sources. - all_headers = [] - all_sources = [] - source_headers_are_public = true - if (defined(invoker.public)) { - source_headers_are_public = false - all_headers += invoker.public - } - if (defined(invoker.sources)) { - foreach(source_file, invoker.sources) { - extension = get_path_info(source_file, "extension") - if (source_headers_are_public && extension == "h") { - all_headers += [ source_file ] - } else { - all_sources += [ source_file ] - } - } - } else { - not_needed([ "source_headers_are_public" ]) - } - - # Determine destinations in the SDK for headers and sources. - file_base = "pkg/${invoker.sdk_name}" - sdk_headers = [] - sdk_sources = [] - sdk_files = [] - foreach(header, all_headers) { - include_base = "include" - if (defined(invoker.include_base)) { - include_base = invoker.include_base - } - relative_destination = rebase_path(header, include_base) - destination = "$file_base/include/$relative_destination" - sdk_headers += [ destination ] - sdk_files += [ - { - source = header - dest = destination - }, - ] - } - foreach(source, all_sources) { - sdk_sources += [ "$file_base/$source" ] - sdk_files += [ - { - source = source - dest = "$file_base/$source" - }, - ] - } - - metadata_target_name = "${target_name}_sdk_metadata" - metadata_file = "$target_gen_dir/$target_name.sdk_meta.json" - - action(metadata_target_name) { - script = "//build/cpp/gen_sdk_sources_meta_file.py" - - inputs = sdk_metas - - outputs = [ - metadata_file, - ] - - args = [ - "--out", - rebase_path(metadata_file), - "--name", - invoker.sdk_name, - "--root", - file_base, - "--include-dir", - "$file_base/include", - ] - args += [ "--deps" ] + sdk_metas - args += [ "--sources" ] + sdk_sources - args += [ "--headers" ] + sdk_headers - - deps = sdk_deps - } - - sdk_atom(sdk_target_name) { - forward_variables_from(invoker, - [ - "source_dir", - "testonly", - ]) - - id = "sdk://pkg/${invoker.sdk_name}" - category = invoker.category - - meta = { - source = metadata_file - dest = "$file_base/meta.json" - schema = "cc_source_library" - } - - files = sdk_files - - deps = sdk_deps - - non_sdk_deps = [ - ":$main_target_name", - ":$metadata_target_name", - ] - - # Explicitly add non-public dependencies, in case some of the source files - # are generated. - if (defined(invoker.deps)) { - non_sdk_deps += invoker.deps - } - } -}
diff --git a/cpp/verify_runtime_deps.py b/cpp/verify_runtime_deps.py deleted file mode 100755 index 43d8088..0000000 --- a/cpp/verify_runtime_deps.py +++ /dev/null
@@ -1,76 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - - -def has_packaged_file(needed_file, deps): - """Returns true if the given file could be found in the given deps.""" - for dep in deps: - for file in dep['files']: - if needed_file == os.path.normpath(file['source']): - return True - return False - - -def has_missing_files(runtime_files, package_deps): - """Returns true if a runtime file is missing from the given deps.""" - has_missing_files = False - for file in runtime_files: - # Some libraries are only known to GN as ABI stubs, whereas the real - # runtime dependency is generated in parallel as a ".so.impl" file. - if (not has_packaged_file(file, package_deps) and - not has_packaged_file('%s.impl' % file, package_deps)): - print('No package dependency generates %s' % file) - has_missing_files = True - return has_missing_files - - -def main(): - parser = argparse.ArgumentParser( - "Verifies a prebuilt library's runtime dependencies") - parser.add_argument('--root-out-dir', - help='Path to the root output directory', - required=True) - parser.add_argument('--runtime-deps-file', - help='Path to the list of runtime deps', - required=True) - parser.add_argument('--manifest', - help='Path to the target\'s SDK manifest file', - required=True) - parser.add_argument('--stamp', - help='Path to the stamp file to generate', - required=True) - args = parser.parse_args() - - # Read the list of runtime dependencies generated by GN. - def normalize_dep(dep): - return os.path.normpath(os.path.join(args.root_out_dir, dep.strip())) - with open(args.runtime_deps_file, 'r') as runtime_deps_file: - runtime_files = map(normalize_dep, runtime_deps_file.readlines()) - - # Read the list of package dependencies for the library's SDK incarnation. - with open(args.manifest, 'r') as manifest_file: - manifest = json.load(manifest_file) - atom_id = manifest['ids'][0] - def find_atom(id): - return next(a for a in manifest['atoms'] if a['id'] == id) - atom = find_atom(atom_id) - deps = map(lambda a: find_atom(a), atom['deps']) - deps += [atom] - - # Check whether all runtime files are available for packaging. - if has_missing_files(runtime_files, deps): - return 1 - - with open(args.stamp, 'w') as stamp: - stamp.write('Success!') - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/BUILD.gn b/dart/BUILD.gn deleted file mode 100644 index fd21b52..0000000 --- a/dart/BUILD.gn +++ /dev/null
@@ -1,35 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/toolchain.gni") - -if (current_toolchain == dart_toolchain) { - pool("dart_pool") { - depth = dart_pool_depth - } -} else { - import("//build/toolchain/clang_toolchain.gni") - - # A toolchain dedicated to processing and analyzing Dart packages. - # The only targets in this toolchain are action() targets, so it - # has no real tools. But every toolchain needs stamp and copy. - toolchain("dartlang") { - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } - - toolchain_args = { - toolchain_variant = { - } - toolchain_variant = { - base = get_label_info(":dartlang", "label_no_toolchain") - } - } - } -}
diff --git a/dart/MAINTAINERS b/dart/MAINTAINERS deleted file mode 100644 index 055197d..0000000 --- a/dart/MAINTAINERS +++ /dev/null
@@ -1,2 +0,0 @@ -pylaligand@google.com -zra@google.com
diff --git a/dart/dart.gni b/dart/dart.gni deleted file mode 100644 index a4d7ff2..0000000 --- a/dart/dart.gni +++ /dev/null
@@ -1,50 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Directory containing prebuilt Dart SDK. - # This must have in its `bin/` subdirectory `gen_snapshot.OS-CPU` binaries. - # Set to empty for a local build. - prebuilt_dart_sdk = "//topaz/tools/prebuilt-dart-sdk/${host_platform}" - - # Whether to use the prebuilt Dart SDK for everything. - # When setting this to false, the preubilt Dart SDK will not be used in - # situations where the version of the SDK matters, but may still be used as an - # optimization where the version does not matter. - use_prebuilt_dart_sdk = true -} - -# For using the prebuilts even when use_prebuilt_dart_sdk is false. -prebuilt_dart = "${prebuilt_dart_sdk}/bin/dart" -prebuilt_gen_snapshot = - "${prebuilt_dart_sdk}/bin/gen_snapshot.${current_os}-${current_cpu}" -prebuilt_gen_snapshot_product = - "${prebuilt_dart_sdk}/bin/gen_snapshot_product.${current_os}-${current_cpu}" - -if (use_prebuilt_dart_sdk) { - dart_sdk = "${prebuilt_dart_sdk}" - dart_sdk_deps = [] - - gen_snapshot = prebuilt_gen_snapshot - gen_snapshot_product = prebuilt_gen_snapshot_product - gen_snapshot_deps = [] -} else { - _dart_sdk_label = "//third_party/dart:create_sdk($host_toolchain)" - dart_sdk = get_label_info(_dart_sdk_label, "root_out_dir") + "/dart-sdk" - dart_sdk_deps = [ _dart_sdk_label ] - - _gen_snapshot_label = - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)" - _gen_snapshot_product_label = - "//third_party/dart/runtime/bin:gen_snapshot_product($host_toolchain)" - gen_snapshot = - get_label_info(_gen_snapshot_label, "root_out_dir") + "/gen_snapshot" - gen_snapshot_product = - get_label_info(_gen_snapshot_product_label, "root_out_dir") + - "/gen_snapshot_product" - gen_snapshot_deps = [ - _gen_snapshot_label, - _gen_snapshot_product_label, - ] -}
diff --git a/dart/dart_fuchsia_test.gni b/dart/dart_fuchsia_test.gni deleted file mode 100644 index 4cca90f..0000000 --- a/dart/dart_fuchsia_test.gni +++ /dev/null
@@ -1,145 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/toolchain.gni") -import("//topaz/runtime/dart_runner/dart_app.gni") - -# Defines a device-side test binary -# -# Bundles a set of `package:test` tests into a single Fuchsia application -# with generated helper code to invoke the tests appropriately. -# -# Parameters -# -# sources (optional) -# The list of test sources. These sources must be within source_dir. -# -# source_dir (optional) -# Directory containing the test sources. -# Defaults to "test". -# -# deps (optional) -# List of labels for Dart packages this package depends on. -# -# disable_analysis (optional) -# Prevents analysis from being run on this target. -# -# package_only (optional) -# Prevents creation of a sh file, which in turn prevents the test from -# being run automatically. -# Defaults to False. -# -# environments (optional) -# Device environments this test should run in. Passed through to -# package.tests.environments in //build/package.gni. -# -# Example of usage: -# -# dart_fuchsia_test("some_tests") { -# tests = [ "test_foo.dart", "test_bar.dart" ] -# } -# -# TODO: -# -# - Implement reporting so that tests can integrate into the waterfall / CQ. -# - Support AOT and Flutter based tests. -# - Get a public API into `package:test` for what we're doing. -# -template("dart_fuchsia_test") { - if (defined(invoker.source_dir)) { - test_source_dir = invoker.source_dir - } else { - test_source_dir = "test" - } - - if (defined(invoker.package_only)) { - test_package_only = invoker.package_only - } else { - test_package_only = false - } - - generated_test_main_target = target_name + "__test_main" - - # The generated code needs to be installed under the Dart toolchain directory - # so that it can be found by the dart_library target powering the JIT app. - dart_gen_dir = get_label_info(":bogus($dart_toolchain)", "target_gen_dir") - generated_test_main = "$dart_gen_dir/${target_name}__test_main.dart" - - action(generated_test_main_target) { - script = "//build/dart/gen_fuchsia_test_main.py" - outputs = [ - generated_test_main, - ] - args = [ - "--out=" + rebase_path(generated_test_main), - "--source-dir=" + rebase_path(test_source_dir), - ] - } - - if (!test_package_only) { - generated_run_test_sh_target = "${root_build_dir}/${target_name}" - - action(generated_run_test_sh_target) { - script = "//build/dart/gen_run_sh.py" - outputs = [ - generated_run_test_sh_target, - ] - args = [ - "--out=" + rebase_path(generated_run_test_sh_target), - "--to_be_run=${invoker.target_name}", - ] - } - } - - dart_jit_app(target_name) { - forward_variables_from(invoker, - [ - "disable_analysis", - "sandbox", - "meta", - ]) - source_dir = test_source_dir - - testonly = true - - if (!test_package_only) { - tests = [ - { - name = generated_run_test_sh_target - dest = target_name - if (defined(invoker.environments)) { - environments = invoker.environments - } - }, - ] - } - - deps = [ - "//topaz/lib/fuchsia_test_helper", - ] - if (defined(invoker.deps)) { - deps += invoker.deps - } - - non_dart_deps = [ ":$generated_test_main_target($target_toolchain)" ] - if (!test_package_only) { - non_dart_deps += [ ":$generated_run_test_sh_target($target_toolchain)" ] - } - - if (defined(invoker.non_dart_deps)) { - non_dart_deps += invoker.non_dart_deps - } - - main_dart = generated_test_main - - sources = [] - if (defined(invoker.sources)) { - sources = invoker.sources - } - meta = [] - if (defined(invoker.meta)) { - meta = invoker.meta - } - } -}
diff --git a/dart/dart_library.gni b/dart/dart_library.gni deleted file mode 100644 index b334109..0000000 --- a/dart/dart_library.gni +++ /dev/null
@@ -1,400 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/fuchsia/sdk.gni") -import("//build/dart/dart.gni") -import("//build/dart/toolchain.gni") -import("//build/sdk/sdk_atom.gni") -import("//third_party/flutter/lib/ui/dart_ui.gni") -import("//topaz/public/dart-pkg/fuchsia/sdk_ext.gni") -import("//topaz/public/dart-pkg/zircon/sdk_ext.gni") -import("//topaz/public/lib/ui/flutter/sdk_ext/sdk_ext.gni") - -# Defines a Dart library -# -# Parameters -# -# sources -# The list of all sources in this library. -# These sources must be within source_dir. -# -# package_root (optional) -# Path to the directory hosting the library. -# This is useful for generated content, and can be ignored otherwise. -# Defaults to ".". -# -# package_name (optional) -# Name of the Dart package. This is used as an identifier in code that -# depends on this library. -# -# infer_package_name (optional) -# Infer the package name based on the path to the package. -# -# NOTE: Exactly one of package_name or infer_package_name must be set. -# -# source_dir (optional) -# Path to the directory containing the package sources, relative to -# package_root. -# Defaults to "lib". -# -# deps (optional) -# List of labels for Dart libraries this library depends on. -# -# non_dart_deps (optional) -# List of labels this library depends on that are not Dart libraries. This -# includes things like actions that generate Dart code. It typically doesn't -# need to be set. -# Note that these labels *must* have an explicit toolchain attached. -# -# disable_analysis (optional) -# Prevents analysis from being run on this target. -# -# sdk_category (optional) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# extra_sources (optional) -# Additional sources to consider for analysis. -# -# Example of usage: -# -# dart_library("baz") { -# package_name = "foo.bar.baz" -# -# sources = [ -# "blah.dart", -# ] -# -# deps = [ -# "//foo/bar/owl", -# ] -# } - -if (current_toolchain == dart_toolchain) { - template("dart_library") { - forward_variables_from(invoker, [ "testonly" ]) - - if (defined(invoker.package_name)) { - package_name = invoker.package_name - } else if (defined(invoker.infer_package_name) && - invoker.infer_package_name) { - # Compute a package name from the label: - # //foo/bar --> foo.bar - # //foo/bar:blah --> foo.bar._blah - # //garnet/public/foo/bar --> foo.bar - # Strip public directories. - full_dir = get_label_info(":$target_name", "dir") - foreach(sdk_dir, sdk_dirs) { - full_dir = string_replace(full_dir, "$sdk_dir/", "") - } - package_name = full_dir - package_name = string_replace(package_name, "//", "") - package_name = string_replace(package_name, "/", ".") - - # If the last directory name does not match the target name, add the - # target name to the resulting package name. - name = get_label_info(":$target_name", "name") - last_dir = get_path_info(full_dir, "name") - if (last_dir != name) { - package_name = "$package_name._$name" - } - } else { - assert(false, "Must specify either a package_name or infer_package_name") - } - - dart_deps = [] - if (defined(invoker.deps)) { - foreach(dep, invoker.deps) { - dart_deps += [ get_label_info(dep, "label_no_toolchain") ] - } - } - - package_root = "." - if (defined(invoker.package_root)) { - package_root = invoker.package_root - } - - source_dir = "$package_root/lib" - if (defined(invoker.source_dir)) { - source_dir = "$package_root/${invoker.source_dir}" - } - - assert(defined(invoker.sources), "Sources must be defined") - source_file = "$target_gen_dir/$target_name.sources" - rebased_sources = [] - foreach(source, invoker.sources) { - rebased_source_dir = rebase_path(source_dir) - rebased_sources += [ "$rebased_source_dir/$source" ] - } - if (defined(invoker.extra_sources)) { - foreach(source, invoker.extra_sources) { - rebased_sources += [ rebase_path(source) ] - } - } - write_file(source_file, rebased_sources, "list lines") - - # Dependencies of the umbrella group for the targets in this file. - group_deps = [] - - dot_packages_file = "$target_gen_dir/$target_name.packages" - dot_packages_target_name = "${target_name}_dot_packages" - group_deps += [ ":$dot_packages_target_name" ] - - # Creates a .packages file listing dependencies of this library. - action(dot_packages_target_name) { - script = "//build/dart/gen_dot_packages.py" - - deps = [] - package_files = [] - foreach(dep, dart_deps) { - deps += [ "${dep}_dot_packages" ] - dep_gen_dir = get_label_info(dep, "target_gen_dir") - dep_name = get_label_info(dep, "name") - package_files += [ "$dep_gen_dir/$dep_name.packages" ] - } - if (defined(invoker.non_dart_deps)) { - public_deps = invoker.non_dart_deps - } - - sources = package_files + [ - # Require a manifest file, allowing the analysis service to identify the - # package. - "$package_root/pubspec.yaml", - ] - - outputs = [ - dot_packages_file, - ] - - args = [ - "--out", - rebase_path(dot_packages_file), - "--source-dir", - rebase_path(source_dir), - "--package-name", - package_name, - "--deps", - ] + rebase_path(package_files) - } - - # Don't run the analyzer if it is explicitly disabled or if we are using - # a custom-built Dart SDK in a cross-build. - with_analysis = - (!defined(invoker.disable_analysis) || !invoker.disable_analysis) && - (use_prebuilt_dart_sdk || host_cpu == target_cpu) - if (with_analysis) { - options_file = "$package_root/analysis_options.yaml" - invocation_file = "$target_gen_dir/$target_name.analyzer.sh" - invocation_target_name = "${target_name}_analysis_runner" - group_deps += [ ":$invocation_target_name" ] - - dart_analyzer_binary = "$dart_sdk/bin/dartanalyzer" - - # Creates a script which can be used to manually perform analysis. - # TODO(BLD-256): remove this target. - action(invocation_target_name) { - script = "//build/dart/gen_analyzer_invocation.py" - - deps = dart_sdk_deps + [ ":$dot_packages_target_name" ] - - inputs = [ - dart_analyzer_binary, - dot_packages_file, - options_file, - source_file, - ] - - outputs = [ - invocation_file, - ] - - args = [ - "--out", - rebase_path(invocation_file), - "--source-file", - rebase_path(source_file), - "--dot-packages", - rebase_path(dot_packages_file), - "--dartanalyzer", - rebase_path(dart_analyzer_binary), - "--dart-sdk", - rebase_path(dart_sdk), - "--options", - rebase_path(options_file), - "--package-name", - package_name, - ] - } - - analysis_target_name = "${target_name}_analysis" - group_deps += [ ":$analysis_target_name" ] - - # Runs analysis on the sources. - action(analysis_target_name) { - script = "//build/dart/run_analysis.py" - - depfile = "$target_gen_dir/$target_name.analysis.d" - - output_file = "$target_gen_dir/$target_name.analyzed" - - pool = "//build/dart:dart_pool($dart_toolchain)" - - inputs = [ - dart_analyzer_binary, - dot_packages_file, - options_file, - source_file, - ] + rebased_sources - - outputs = [ - output_file, - ] - - args = [ - "--source-file", - rebase_path(source_file), - "--dot-packages", - rebase_path(dot_packages_file), - "--dartanalyzer", - rebase_path(dart_analyzer_binary), - "--dart-sdk", - rebase_path(dart_sdk), - "--options", - rebase_path(options_file), - "--stamp", - rebase_path(output_file), - "--depname", - rebase_path(output_file, root_build_dir), - "--depfile", - rebase_path(depfile), - ] - - deps = dart_sdk_deps + [ ":$dot_packages_target_name" ] - } - } - - group(target_name) { - # dart_deps are added here to ensure they are fully built. - # Up to this point, only the targets generating .packages had been - # depended on. - deps = dart_deps - - public_deps = group_deps - } - - ################################################ - # SDK support - # - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - assert( - defined(invoker.package_name), - "Dart libraries published in SDKs must have an explicit package name") - - assert( - !defined(invoker.extra_sources), - "Extra sources can not be included in SDKs: put them in source_dir") - - # Dependencies that should normally be included in any SDK containing this - # target. - sdk_deps = [] - - # Path to SDK metadata files for first-party dependencies. - sdk_metas = [] - - # Path to Dart manifest files for third-party dependencies. - third_party_pubspecs = [] - if (defined(invoker.deps)) { - sorted_deps = - exec_script("//build/dart/sdk/sort_deps.py", invoker.deps, "scope") - foreach(dep, sorted_deps.local) { - full_label = get_label_info(dep, "label_no_toolchain") - sdk_dep = "${full_label}_sdk" - sdk_deps += [ sdk_dep ] - - gen_dir = get_label_info(sdk_dep, "target_gen_dir") - name = get_label_info(sdk_dep, "name") - sdk_metas += [ rebase_path("$gen_dir/$name.meta.json") ] - } - foreach(dep, sorted_deps.third_party) { - path = get_label_info(dep, "dir") - third_party_pubspecs += [ rebase_path("$path/pubspec.yaml") ] - } - } - - file_base = "dart/${invoker.package_name}" - - sdk_sources = [] - sdk_source_mappings = [] - foreach(source, rebased_sources) { - relative_source = rebase_path(source, source_dir) - dest = "$file_base/lib/$relative_source" - sdk_sources += [ dest ] - sdk_source_mappings += [ - { - source = source - dest = dest - }, - ] - } - - metadata_target_name = "${target_name}_sdk_metadata" - metadata_file = "$target_gen_dir/$target_name.sdk_meta.json" - action(metadata_target_name) { - script = "//build/dart/sdk/gen_meta_file.py" - - inputs = sdk_metas + third_party_pubspecs - - outputs = [ - metadata_file, - ] - - args = [ - "--out", - rebase_path(metadata_file), - "--name", - package_name, - "--root", - file_base, - ] - args += [ "--specs" ] + sdk_metas - args += [ "--sources" ] + sdk_sources - args += [ "--third-party-specs" ] + third_party_pubspecs - - deps = sdk_deps - } - - sdk_atom("${target_name}_sdk") { - id = "sdk://dart/${invoker.package_name}" - - category = invoker.sdk_category - - meta = { - source = metadata_file - dest = "$file_base/meta.json" - schema = "dart_library" - } - - deps = sdk_deps - - non_sdk_deps = [ ":$metadata_target_name" ] - if (defined(invoker.non_dart_deps)) { - non_sdk_deps += invoker.non_dart_deps - } - - files = sdk_source_mappings - } - } - } -} else { # Not the Dart toolchain. - template("dart_library") { - group(target_name) { - not_needed(invoker, "*") - - public_deps = [ - ":$target_name($dart_toolchain)", - ] - } - } -}
diff --git a/dart/dart_remote_test.gni b/dart/dart_remote_test.gni deleted file mode 100644 index 5d96d1e..0000000 --- a/dart/dart_remote_test.gni +++ /dev/null
@@ -1,96 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/dart/dart.gni") -import("//build/dart/dart_library.gni") -import("//build/dart/toolchain.gni") - -# Defines a Dart test suite that requires connecting to a remote target. -# -# Parameters -# -# sources (required) -# The list of test files, which must be within source_dir. -# -# source_dir (optional) -# Directory containing the test sources. Defaults to "test". -# -# deps (optional) -# List of labels for Dart libraries this suite depends on. -# -# disable_analysis (optional) -# Prevents analysis from being run on this target. -# -# Example of usage: -# -# dart_host_to_target_test("baz_test") { -# source_dir = "." -# sources = [ "foo_bar_baz_test.dart" ] -# deps = [ -# "//foo/baz", -# "//third_party/dart-pkg/pub/test", -# ] -# } -template("dart_remote_test") { - main_target_name = target_name - library_target_name = "${target_name}_library" - - sources_dir = "test" - if (defined(invoker.source_dir)) { - sources_dir = invoker.source_dir - } - - dart_library(library_target_name) { - forward_variables_from(invoker, - [ - "deps", - "disable_analysis", - ]) - - infer_package_name = true - - source_dir = sources_dir - - assert(defined(invoker.sources)) - - sources = invoker.sources - } - - dart_target_gen_dir = - get_label_info(":bogus($dart_toolchain)", "target_gen_dir") - - dot_packages_file = "$dart_target_gen_dir/$library_target_name.packages" - - if (current_toolchain == host_toolchain) { - invocation_file = "$root_out_dir/$target_name" - } else { - invocation_file = "$target_gen_dir/$target_name" - } - - action(main_target_name) { - script = "//build/dart/gen_remote_test_invocation.py" - - testonly = true - - outputs = [ - invocation_file, - ] - - args = [ - "--out", - rebase_path(invocation_file), - "--sources", - ] + rebase_path(invoker.sources, "", sources_dir) + - [ - "--dot-packages", - rebase_path(dot_packages_file), - "--dart-binary", - rebase_path(prebuilt_dart), - ] - - deps = [ - ":$library_target_name", - ] - } -}
diff --git a/dart/dart_tool.gni b/dart/dart_tool.gni deleted file mode 100644 index d79aced..0000000 --- a/dart/dart_tool.gni +++ /dev/null
@@ -1,200 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") -import("//build/dart/toolchain.gni") - -# Defines a Dart application that can be run on the host -# -# Parameters -# -# sources (optional) -# The list of public sources in this library, i.e. Dart files in lib/ but -# not in lib/src/. These sources must be within lib/. -# -# package_name (optional) -# Name of the dart package. -# -# main_dart (required) -# File containing the main function of the application. -# -# deps (optional) -# Dependencies of this application -# -# non_dart_deps (optional) -# List of labels this package depends on that are not Dart packages. It -# typically doesn't need to be set. -# -# output_name (optional) -# Name of the output file to generate. Defaults to $target_name. -# -# disable_analysis (optional) -# Prevents analysis from being run on this target. -# -# force_prebuilt_dart (optional) -# Forces using the prebuilt Dart binary even when use_prebuilt_dart_sdk is -# false. Defaults to true in a cross-build, and false otherwise. -template("dart_tool") { - assert(defined(invoker.main_dart), "Must specify main_dart file") - - dart_library_target_name = target_name + "_dart_library" - - if (defined(invoker.package_name)) { - package_name = invoker.package_name - } else if (!defined(invoker.infer_package_name) || - invoker.infer_package_name) { - # Compute a package name from the label: - # //foo/bar --> foo.bar - # //foo/bar:blah --> foo.bar._blah - # //garnet/public/foo/bar --> foo.bar - # Strip public directories. - full_dir = get_label_info(":$dart_library_target_name", "dir") - foreach(sdk_dir, sdk_dirs) { - full_dir = string_replace(full_dir, "$sdk_dir/", "") - } - package_name = full_dir - package_name = string_replace(package_name, "//", "") - package_name = string_replace(package_name, "/", ".") - - # If the last directory name does not match the target name, add the - # target name to the resulting package name. - name = get_label_info(":$dart_library_target_name", "name") - last_dir = get_path_info(full_dir, "name") - if (last_dir != name) { - package_name = "$package_name._$name" - } - } else { - assert(false, "Must specify either a package_name or infer_package_name") - } - - package_root = "." - if (defined(invoker.package_root)) { - package_root = invoker.package_root - } - - source_dir = "$package_root/lib" - if (defined(invoker.source_dir)) { - source_dir = "$package_root/${invoker.source_dir}" - } - - dart_library(dart_library_target_name) { - forward_variables_from(invoker, - [ - "deps", - "disable_analysis", - ]) - package_name = package_name - package_root = package_root - source_dir = source_dir - - sources = [] - if (defined(invoker.sources)) { - sources += invoker.sources - } - source_base = "lib" - if (defined(invoker.source_dir)) { - source_base = invoker.source_dir - } - sources += [ rebase_path(invoker.main_dart, source_base) ] - } - - # Avoid using a custom-built Dart VM in a cross-build. The Dart VM would run - # the Dart code and front-end in a simulator, and it would be prohibitively - # slow. - force_prebuilt_dart = host_cpu != target_cpu - if (defined(invoker.force_prebuilt_dart)) { - force_prebuilt_dart = invoker.force_prebuilt_dart - } - if (force_prebuilt_dart) { - dart_binary = prebuilt_dart - sdk_deps = [] - } else { - dart_binary = "$dart_sdk/bin/dart" - sdk_deps = dart_sdk_deps - } - - snapshot_path = "$target_gen_dir/${target_name}.snapshot" - depfile_path = "${snapshot_path}.d" - dart_target_gen_dir = - get_label_info(":bogus($dart_toolchain)", "target_gen_dir") - packages_path = "$dart_target_gen_dir/$dart_library_target_name.packages" - - snapshot_target_name = target_name + "_snapshot" - - # Creates a snapshot file. - # The main advantage of snapshotting is that it sets up source dependencies - # via a depfile so that a Dart app gets properly rebuilt when one of its - # sources is modified. - action(snapshot_target_name) { - if (defined(invoker.testonly)) { - testonly = invoker.testonly - } - - depfile = depfile_path - - outputs = [ - snapshot_path, - ] - - script = dart_binary - - # The snapshot path needs to be rebased on top of the root build dir so - # that the resulting depfile gets properly formatted. - rebased_snapshot_path = rebase_path(snapshot_path, root_build_dir) - rebased_depfile_path = rebase_path(depfile_path) - rebased_packages_path = rebase_path(packages_path) - - main_uri = rebase_path(invoker.main_dart) - package_relative = rebase_path(invoker.main_dart, source_dir) - - # Approximation for source_dir contains main_dart. - if (get_path_info(get_path_info(package_relative, "dir"), "file") != "bin") { - main_uri = "package:" + package_name + "/" + package_relative - } - - args = [ - "--snapshot=$rebased_snapshot_path", - "--snapshot-depfile=$rebased_depfile_path", - "--packages=$rebased_packages_path", - main_uri, - ] - - deps = sdk_deps + [ ":$dart_library_target_name" ] - } - - if (defined(invoker.output_name)) { - app_name = invoker.output_name - } else { - app_name = target_name - } - - # Builds a convenience script to invoke the app. - action(target_name) { - script = "//build/dart/gen_app_invocation.py" - - app_path = "$root_out_dir/dart-tools/$app_name" - - inputs = [ - dart_binary, - snapshot_path, - ] - outputs = [ - app_path, - ] - - args = [ - "--out", - rebase_path(app_path), - "--dart", - rebase_path(dart_binary), - "--snapshot", - rebase_path(snapshot_path), - ] - - deps = sdk_deps + [ ":$snapshot_target_name" ] - if (defined(invoker.non_dart_deps)) { - deps += invoker.non_dart_deps - } - } -}
diff --git a/dart/empty_pubspec.yaml b/dart/empty_pubspec.yaml deleted file mode 100644 index 5e04884..0000000 --- a/dart/empty_pubspec.yaml +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# An empty manifest file used as a package marker.
diff --git a/dart/fidl_dart.gni b/dart/fidl_dart.gni deleted file mode 100644 index e99f772..0000000 --- a/dart/fidl_dart.gni +++ /dev/null
@@ -1,146 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/dart/dart_library.gni") -import("//build/dart/toolchain.gni") -import("//build/fidl/toolchain.gni") -import("//build/sdk/sdk_atom_alias.gni") - -# Generates some Dart bindings for a FIDL library. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# - name; -# - sdk_category. - -template("fidl_dart") { - assert(current_toolchain == dart_toolchain, - "This template can only be used in the $dart_toolchain toolchain.") - - not_needed(invoker, [ "sources" ]) - - main_target_name = target_name - generation_target_name = "${target_name}_dart_generate" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - root_dir = "$target_gen_dir/${library_name}_package" - bindings_dir = "$root_dir/lib" - bindings_file = "$bindings_dir/fidl.dart" - async_bindings_file = "$bindings_dir/fidl_async.dart" - test_bindings_file = "$bindings_dir/fidl_test.dart" - - fidl_target_gen_dir = - get_label_info(":bogus($fidl_toolchain)", "target_gen_dir") - json_representation = "$fidl_target_gen_dir/$target_name.fidl.json" - - compiled_action(generation_target_name) { - visibility = [ ":*" ] - - tool = "//topaz/bin/fidlgen_dart" - - inputs = [ - json_representation, - ] - - outputs = [ - bindings_file, - async_bindings_file, - test_bindings_file, - ] - - args = [ - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(bindings_dir, root_build_dir), - "--include-base", - rebase_path(root_gen_dir, root_build_dir), - ] - - # Don't run the formatter if we are using a custom-built Dart SDK in a - # cross-build. - deps = [ - ":$main_target_name($fidl_toolchain)", - ] - if (use_prebuilt_dart_sdk || host_cpu == target_cpu) { - args += [ - "--dartfmt", - rebase_path("$dart_sdk/bin/dartfmt"), - ] - deps += dart_sdk_deps - } - } - - copy_pubspec_target_name = "${target_name}_dart_pubspec" - copy_options_target_name = "${target_name}_dart_options" - - copy(copy_pubspec_target_name) { - sources = [ - "//build/dart/empty_pubspec.yaml", - ] - - outputs = [ - "$root_dir/pubspec.yaml", - ] - } - - copy(copy_options_target_name) { - sources = [ - "//topaz/tools/analysis_options.yaml", - ] - - outputs = [ - "$root_dir/analysis_options.yaml", - ] - } - - dart_library(main_target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - package_root = root_dir - - package_name = "fidl_" + string_replace(library_name, ".", "_") - - sources = [ - rebase_path(bindings_file, bindings_dir), - rebase_path(async_bindings_file, bindings_dir), - rebase_path(test_bindings_file, bindings_dir), - ] - - deps = [ - "//topaz/public/dart/fidl", - "//topaz/public/dart/zircon", - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - if (defined(invoker.public_deps)) { - deps += invoker.public_deps - } - - non_dart_deps = [ - ":$copy_options_target_name", - ":$copy_pubspec_target_name", - ":$generation_target_name", - ] - } - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - # Instead of depending on the generated bindings, set up a dependency on the - # original library. - sdk_target_name = "${main_target_name}_sdk" - sdk_atom_alias(sdk_target_name) { - atom = ":$sdk_target_name($fidl_toolchain)" - } - } -}
diff --git a/dart/fidlmerge_dart.gni b/dart/fidlmerge_dart.gni deleted file mode 100644 index ff546b9..0000000 --- a/dart/fidlmerge_dart.gni +++ /dev/null
@@ -1,181 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/dart/dart_library.gni") -import("//build/fidl/toolchain.gni") - -# Declares a source_set that contains code generated by fidlmerge from a -# template and a FIDL JSON file. -# -# Parameters -# -# fidl_target (required) -# Specifies the fidl target from which to read fidl json. For example, -# "//zircon/public/fidl/fuchsia-mem" for fuchsia.mem or -# "//garnet/public/fidl/fuchsia.sys" for fuchsia.sys. -# -# template_path (required) -# Specifies the template to use to generate the source code for the -# source_set. For example, "//garnet/public/build/fostr/fostr.fidlmerge". -# -# generated_source_base (required) -# The base file name from which the source_set's 'source' file names are -# generated. For example, "formatting". -# -# options (optional) -# A single string with comma-separated key=value pairs. -# -# amendments_path (optional) -# Specifies a JSON file that contains amendments to be made to the fidl -# model before the template is applied. For example, -# "//garnet/public/build/fostr/fidl/fuchsia.media/amendments.fidlmerge". -# See the fidlmerge README for details. -# -# deps, public_deps, test_only, visibility (optional) -# These parameters are forwarded to the source_set. -# - -template("fidlmerge_dart") { - assert(defined(invoker.fidl_target), - "fidlmerge_dart requires parameter fidl_target.") - - assert(defined(invoker.template_path), - "fidlmerge_dart requires parameter template_path.") - - assert(defined(invoker.generated_source_base), - "fidlmerge_dart requires parameter generated_source_base.") - - fidl_target = invoker.fidl_target - template_path = invoker.template_path - source_base = invoker.generated_source_base - - generation_target_name = "${target_name}_generate" - - fidl_target_gen_dir = - get_label_info("$fidl_target($fidl_toolchain)", "target_gen_dir") - fidl_target_name = get_path_info(fidl_target_gen_dir, "file") - json_representation = "$fidl_target_gen_dir/$fidl_target_name.fidl.json" - - include_stem = string_replace(target_gen_dir, ".", "/") - file_stem = "$include_stem/$source_base" - - compiled_action(generation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - visibility = [ ":*" ] - - tool = "//garnet/go/src/fidlmerge" - - inputs = [ - json_representation, - template_path, - ] - - outputs = [ - "$file_stem.dart", - ] - - args = [ - "--template", - rebase_path(template_path, root_build_dir), - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(file_stem, root_build_dir), - ] - - if (defined(invoker.options)) { - args += [ - "--options", - invoker.options, - ] - } - - if (defined(invoker.amendments_path)) { - args += [ - "--amend", - rebase_path(invoker.amendments_path, root_build_dir), - ] - } - - deps = [ - "$fidl_target($fidl_toolchain)", - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - } - - copy_pubspec_target_name = "${target_name}_dart_pubspec" - copy_options_target_name = "${target_name}_dart_options" - copy_source_target_name = "${target_name}_dart_sources" - - library_name = target_name - root_dir = "$target_gen_dir/${library_name}_package" - - copy(copy_pubspec_target_name) { - sources = [ - "//build/dart/empty_pubspec.yaml", - ] - - outputs = [ - "$root_dir/pubspec.yaml", - ] - } - - copy(copy_options_target_name) { - sources = [ - "//topaz/tools/analysis_options.yaml", - ] - - outputs = [ - "$root_dir/analysis_options.yaml", - ] - } - - copy(copy_source_target_name) { - sources = [ - "$file_stem.dart", - ] - outputs = [ - "$root_dir/lib/$source_base.dart", - ] - - deps = [ - ":$generation_target_name", - ] - } - - dart_library(library_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - package_root = root_dir - - package_name = "fidl_" + string_replace(library_name, ".", "_") - - sources = [ - "$source_base.dart", - ] - - deps = [] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - if (defined(invoker.public_deps)) { - deps += invoker.public_deps - } - - non_dart_deps = [ - ":$copy_options_target_name", - ":$copy_pubspec_target_name", - ":$copy_source_target_name", - ] - } -}
diff --git a/dart/gen_analyzer_invocation.py b/dart/gen_analyzer_invocation.py deleted file mode 100755 index 0dc059b..0000000 --- a/dart/gen_analyzer_invocation.py +++ /dev/null
@@ -1,65 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import stat -import string -import sys - -def main(): - parser = argparse.ArgumentParser( - description='Generate a script that invokes the Dart analyzer') - parser.add_argument('--out', help='Path to the invocation file to generate', - required=True) - parser.add_argument('--source-file', help='Path to the list of sources', - required=True) - parser.add_argument('--dot-packages', help='Path to the .packages file', - required=True) - parser.add_argument('--dartanalyzer', - help='Path to the Dart analyzer executable', - required=True) - parser.add_argument('--dart-sdk', help='Path to the Dart SDK', - required=True) - parser.add_argument('--package-name', help='Name of the analyzed package', - required=True) - parser.add_argument('--options', help='Path to analysis options') - args = parser.parse_args() - - with open(args.source_file, 'r') as source_file: - sources = source_file.read().strip().split('\n') - - analyzer_file = args.out - analyzer_path = os.path.dirname(analyzer_file) - if not os.path.exists(analyzer_path): - os.makedirs(analyzer_path) - - script_template = string.Template('''#!/bin/sh - -echo "Package : $package_name" -$dartanalyzer \\ - --packages=$dot_packages \\ - --dart-sdk=$dart_sdk \\ - --fatal-warnings \\ - --fatal-hints \\ - --fatal-lints \\ - $options_argument \\ - $sources_argument \\ - "$$@" -''') - with open(analyzer_file, 'w') as file: - file.write(script_template.substitute( - args.__dict__, - package_name = args.package_name, - sources_argument = ' '.join(sources), - options_argument = '--options='+args.options if args.options else '')) - permissions = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | - stat.S_IROTH) - os.chmod(analyzer_file, permissions) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/gen_app_invocation.py b/dart/gen_app_invocation.py deleted file mode 100755 index 7c4c2d3..0000000 --- a/dart/gen_app_invocation.py +++ /dev/null
@@ -1,46 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import stat -import string -import sys - -def main(): - parser = argparse.ArgumentParser( - description='Generate a script that invokes a Dart application') - parser.add_argument('--out', - help='Path to the invocation file to generate', - required=True) - parser.add_argument('--dart', - help='Path to the Dart binary', - required=True) - parser.add_argument('--snapshot', - help='Path to the app snapshot', - required=True) - args = parser.parse_args() - - app_file = args.out - app_path = os.path.dirname(app_file) - if not os.path.exists(app_path): - os.makedirs(app_path) - - script_template = string.Template('''#!/bin/sh - -$dart \\ - $snapshot \\ - "$$@" -''') - with open(app_file, 'w') as file: - file.write(script_template.substitute(args.__dict__)) - permissions = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | - stat.S_IROTH) - os.chmod(app_file, permissions) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/gen_dot_packages.py b/dart/gen_dot_packages.py deleted file mode 100755 index b87eb8f..0000000 --- a/dart/gen_dot_packages.py +++ /dev/null
@@ -1,75 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import string -import sys - -def parse_dot_packages(dot_packages_path): - deps = {} - with open(dot_packages_path) as dot_packages: - for line in dot_packages: - if line.startswith('#'): - continue - delim = line.find(':file://') - if delim == -1: - continue - name = line[:delim] - path = os.path.abspath(line[delim + 8:].strip()) - if name in deps: - raise Exception('%s contains multiple entries for package %s' % - (dot_packages_path, name)) - deps[name] = path - return deps - - -def create_base_directory(file): - path = os.path.dirname(file) - if not os.path.exists(path): - os.makedirs(path) - - -def main(): - parser = argparse.ArgumentParser( - description="Generate .packages file for dart package") - parser.add_argument("--out", help="Path to .packages file to generate", - required=True) - parser.add_argument("--package-name", help="Name of this package", - required=True) - parser.add_argument("--source-dir", help="Path to package source", - required=True) - parser.add_argument("--deps", help="List of dependencies' package file", - nargs="*") - args = parser.parse_args() - - dot_packages_file = args.out - create_base_directory(dot_packages_file) - - package_deps = { - args.package_name: args.source_dir, - } - - for dep in args.deps: - dependent_packages = parse_dot_packages(dep) - for name, path in dependent_packages.iteritems(): - if name in package_deps: - if path != package_deps[name]: - print "Error, conflicting entries for %s: %s and %s from %s" % (name, - path, package_deps[name], dep) - return 1 - else: - package_deps[name] = path - - with open(dot_packages_file, "w") as dot_packages: - names = package_deps.keys() - names.sort() - for name in names: - dot_packages.write('%s:file://%s/\n' % (name, package_deps[name])) - - return 0 - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/gen_fuchsia_test_main.py b/dart/gen_fuchsia_test_main.py deleted file mode 100755 index d4df897..0000000 --- a/dart/gen_fuchsia_test_main.py +++ /dev/null
@@ -1,64 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import re -import sys - - -def main(): - parser = argparse.ArgumentParser( - sys.argv[0], - description="Generate main file for Fuchsia dart test") - parser.add_argument("--out", - help="Path to .dart file to generate", - required=True) - parser.add_argument('--source-dir', - help='Path to test sources', - required=True) - args = parser.parse_args() - - out_dir = os.path.dirname(args.out) - test_files = [] - for root, dirs, files in os.walk(args.source_dir): - for f in files: - if not f.endswith('_test.dart'): - continue - test_files.append(os.path.relpath(os.path.join(root, f), out_dir)) - - outfile = open(args.out, 'w') - outfile.write('''// Generated by generate_test_main.py - - // ignore_for_file: directives_ordering - - import 'dart:async'; - import 'package:fuchsia_test_helper/fuchsia_test_helper.dart'; - ''') - - for i, path in enumerate(test_files): - outfile.write("import '%s' as test_%d;\n" % (path, i)) - - outfile.write(''' - Future<int> main(List<String> args) async { - await runFuchsiaTests(<MainFunction>[ - ''') - - for i in range(len(test_files)): - outfile.write('test_%d.main,\n' % i) - - outfile.write(''']); - - // Quit. - exitFuchsiaTest(0); - return 0; - } - ''') - - outfile.close() - - -if __name__ == '__main__': - main()
diff --git a/dart/gen_remote_test_invocation.py b/dart/gen_remote_test_invocation.py deleted file mode 100755 index 15a2fcf..0000000 --- a/dart/gen_remote_test_invocation.py +++ /dev/null
@@ -1,63 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import stat -import string -import sys - - -def main(): - parser = argparse.ArgumentParser( - description='Generate a script that invokes the Dart tester') - parser.add_argument('--out', - help='Path to the invocation file to generate', - required=True) - parser.add_argument('--sources', - help='Path to test files', - required=True, - nargs='+') - parser.add_argument('--dart-binary', - help='Path to the dart binary.', - required=True) - parser.add_argument('--dot-packages', - help='Path to the .packages file', - required=True) - args = parser.parse_args() - - test_file = args.out - test_path = os.path.dirname(test_file) - if not os.path.exists(test_path): - os.makedirs(test_path) - - sources_string = ' '.join(args.sources) - script_template = string.Template('''#!/bin/sh -# This artifact was generated by //build/dart/gen_remote_test_invocation.py -# Expects arg 1 to be the fuchsia remote address, and arg 2 to be the (optional) -# SSH config path. - -set -e - -export FUCHSIA_DEVICE_URL="$$1" -if [[ ! -z "$$2" ]]; then - export FUCHSIA_SSH_CONFIG="$$2" -fi - -for TEST in $sources_string; do - $dart_binary --packages="$dot_packages" "$$TEST" -done -''') - with open(test_file, 'w') as file: - file.write(script_template.substitute(args.__dict__, - sources_string=sources_string)) - permissions = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | - stat.S_IROTH) - os.chmod(test_file, permissions) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/gen_run_sh.py b/dart/gen_run_sh.py deleted file mode 100755 index d76c744..0000000 --- a/dart/gen_run_sh.py +++ /dev/null
@@ -1,39 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import stat -import sys - -def main(): - parser = argparse.ArgumentParser( - description='Generate a script that runs something') - parser.add_argument('--out', - help='Path to the file to generate', - required=True) - parser.add_argument('--to_be_run', - help='The argument to `run`', - required=True) - args = parser.parse_args() - - script_file = args.out - script_path = os.path.dirname(script_file) - if not os.path.exists(script_path): - os.makedirs(script_path) - - script = ( - '#!/boot/bin/sh\n\n' - 'run %s\n' % args.to_be_run) - with open(script_file, 'w') as file: - file.write(script) - permissions = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | - stat.S_IROTH) - os.chmod(script_file, permissions) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/gen_test_invocation.py b/dart/gen_test_invocation.py deleted file mode 100755 index 673c775..0000000 --- a/dart/gen_test_invocation.py +++ /dev/null
@@ -1,55 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import stat -import string -import sys - - -def main(): - parser = argparse.ArgumentParser( - description='Generate a script that invokes the Dart tester') - parser.add_argument('--out', - help='Path to the invocation file to generate', - required=True) - parser.add_argument('--source-dir', - help='Path to test sources', - required=True) - parser.add_argument('--dot-packages', - help='Path to the .packages file', - required=True) - parser.add_argument('--test-runner', - help='Path to the test runner', - required=True) - parser.add_argument('--flutter-shell', - help='Path to the Flutter shell', - required=True) - args = parser.parse_args() - - test_file = args.out - test_path = os.path.dirname(test_file) - if not os.path.exists(test_path): - os.makedirs(test_path) - - script_template = string.Template('''#!/bin/sh - -$test_runner \\ - --packages=$dot_packages \\ - --shell=$flutter_shell \\ - --test-directory=$source_dir \\ - "$$@" -''') - with open(test_file, 'w') as file: - file.write(script_template.substitute(args.__dict__)) - permissions = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | - stat.S_IROTH) - os.chmod(test_file, permissions) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/label_to_package_name.py b/dart/label_to_package_name.py deleted file mode 100755 index ffe7734..0000000 --- a/dart/label_to_package_name.py +++ /dev/null
@@ -1,49 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import string -import sys - -# TODO(abarth): Base these paths on the sdk_dirs variable in gn. -_SDK_DIRS = [ - "garnet/public/", - "peridot/public/", - "topaz/public/", -] - - -# Strip the sdk dirs from the given label, if necessary. -def _remove_sdk_dir(label): - for prefix in _SDK_DIRS: - if label.startswith(prefix): - return label[len(prefix):] - return label - - -# For target //foo/bar:blah, the package name will be foo.bar._blah. -# For default targets //foo/bar:bar, the package name will be foo.bar. -def convert(label): - if not label.startswith("//"): - sys.stderr.write("expected label to start with //, got %s\n" % label) - return 1 - base = _remove_sdk_dir(label[2:]) - separator_index = string.rfind(base, ":") - if separator_index < 0: - sys.stderr.write("could not find target name in label %s\n" % label) - return 1 - path = base[:separator_index].split("/") - name = base[separator_index+1:] - if path[-1] == name: - return ".".join(path) - else: - return "%s._%s" % (".".join(path), name) - - -def main(): - print convert(sys.argv[1]) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/run_analysis.py b/dart/run_analysis.py deleted file mode 100755 index 0b18281..0000000 --- a/dart/run_analysis.py +++ /dev/null
@@ -1,87 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import subprocess -import sys - -FUCHSIA_ROOT = os.path.dirname( # $root - os.path.dirname( # build - os.path.dirname( # dart - os.path.abspath(__file__)))) - -sys.path += [os.path.join(FUCHSIA_ROOT, 'third_party', 'pyyaml', 'lib')] -import yaml - -def main(): - parser = argparse.ArgumentParser('Runs analysis on a given package') - parser.add_argument('--source-file', help='Path to the list of sources', - required=True) - parser.add_argument('--dot-packages', help='Path to the .packages file', - required=True) - parser.add_argument('--dartanalyzer', - help='Path to the Dart analyzer executable', - required=True) - parser.add_argument('--dart-sdk', help='Path to the Dart SDK', - required=True) - parser.add_argument('--options', help='Path to analysis options', - required=True) - parser.add_argument('--stamp', help='File to touch when analysis succeeds', - required=True) - parser.add_argument('--depname', help='Name of the depfile target', - required=True) - parser.add_argument('--depfile', help='Path to the depfile to generate', - required=True) - args = parser.parse_args() - - with open(args.source_file, 'r') as source_file: - sources = source_file.read().strip().split('\n') - - with open(args.depfile, 'w') as depfile: - depfile.write('%s: ' % args.depname) - def add_dep(path): - depfile.write('%s ' % path) - options = args.options - while True: - if not os.path.isabs(options): - print('Expected absolute path, got %s' % options) - return 1 - if not os.path.exists(options): - print('Could not find options file: %s' % options) - return 1 - add_dep(options) - with open(options, 'r') as options_file: - content = yaml.safe_load(options_file) - if not 'include' in content: - break - included = content['include'] - if not os.path.isabs(included): - included = os.path.join(os.path.dirname(options), included) - options = included - - call_args = [ - args.dartanalyzer, - '--packages=%s' % args.dot_packages, - '--dart-sdk=%s' % args.dart_sdk, - '--options=%s' % args.options, - '--fatal-warnings', - '--fatal-hints', - '--fatal-lints', - ] + sources - - call = subprocess.Popen(call_args, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = call.communicate() - if call.returncode: - print(stdout + stderr) - return 1 - - with open(args.stamp, 'w') as stamp: - stamp.write('Success!') - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/sdk/gen_meta_file.py b/dart/sdk/gen_meta_file.py deleted file mode 100755 index 95d74ed..0000000 --- a/dart/sdk/gen_meta_file.py +++ /dev/null
@@ -1,100 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -FUCHSIA_ROOT = os.path.dirname( # $root - os.path.dirname( # build - os.path.dirname( # dart - os.path.dirname( # sdk - os.path.abspath(__file__))))) - -sys.path += [os.path.join(FUCHSIA_ROOT, 'third_party', 'pyyaml', 'lib')] -import yaml - - -# The list of packages that should be pulled from a Flutter SDK instead of pub. -FLUTTER_PACKAGES = [ - 'flutter', - 'flutter_driver', - 'flutter_test', - 'flutter_tools', -] - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--name', - help='Name of the original package', - required=True) - parser.add_argument('--root', - help='Root of the package in the SDK', - required=True) - parser.add_argument('--specs', - help='Path to spec files of dependencies', - nargs='*') - parser.add_argument('--third-party-specs', - help='Path to pubspec files of 3p dependencies', - nargs='*') - parser.add_argument('--sources', - help='List of library sources', - nargs='+') - args = parser.parse_args() - - metadata = { - 'type': 'dart_library', - 'name': args.name, - 'root': args.root, - 'sources': args.sources, - 'files': args.sources, - } - - third_party_deps = [] - for spec in args.third_party_specs: - with open(spec, 'r') as spec_file: - manifest = yaml.safe_load(spec_file) - name = manifest['name'] - dep = { - 'name': name, - } - if name in FLUTTER_PACKAGES: - dep['version'] = 'flutter_sdk' - else: - if 'version' not in manifest: - raise Exception('%s does not specify a version.' % spec) - dep['version'] = manifest['version'] - third_party_deps.append(dep) - metadata['third_party_deps'] = third_party_deps - - deps = [] - fidl_deps = [] - for spec in args.specs: - with open(spec, 'r') as spec_file: - data = json.load(spec_file) - type = data['type'] - name = data['name'] - if type == 'dart_library': - deps.append(name) - elif type == 'fidl_library': - fidl_deps.append(name) - else: - raise Exception('Unsupported dependency type: %s' % type) - metadata['deps'] = deps - metadata['fidl_deps'] = fidl_deps - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/sdk/sort_deps.py b/dart/sdk/sort_deps.py deleted file mode 100755 index 8699e28..0000000 --- a/dart/sdk/sort_deps.py +++ /dev/null
@@ -1,23 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import sys - - -def print_list(name, content): - quoted = map(lambda c: '"%s"' % c, content) - print('%s = [%s]' % (name, ', '.join(quoted))) - -def main(): - deps = sys.argv[1:] - def is_3p(dep): - return dep.startswith('//third_party') - print_list('third_party', filter(is_3p, deps)) - print_list('local', filter(lambda d: not is_3p(d), deps)) - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/dart/toolchain.gni b/dart/toolchain.gni deleted file mode 100644 index 1d015f7..0000000 --- a/dart/toolchain.gni +++ /dev/null
@@ -1,19 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Maximum number of Dart processes to run in parallel. - # - # Dart analyzer uses a lot of memory which may cause issues when building - # with many parallel jobs e.g. when using goma. To avoid out-of-memory - # errors we explicitly reduce the number of jobs. - dart_pool_depth = 16 -} - -dart_toolchain = "//build/dart:dartlang" - -dart_root_gen_dir = get_label_info("//bogus($dart_toolchain)", "root_gen_dir") -# In order to access the target_gen_dir in the Dart toolchain from some location -# in the source tree, use the following: -# dart_target_gen_dir = get_label_info(":bogus($dart_toolchain)", "target_gen_dir")
diff --git a/deprecated_bare_package_url b/deprecated_bare_package_url deleted file mode 100644 index 7c2f38a..0000000 --- a/deprecated_bare_package_url +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "deprecated-bare-package-url": true -}
diff --git a/development.key b/development.key deleted file mode 100644 index 3aa7e16..0000000 --- a/development.key +++ /dev/null Binary files differ
diff --git a/dot_gn_symlink.sh b/dot_gn_symlink.sh deleted file mode 100755 index b756a0e..0000000 --- a/dot_gn_symlink.sh +++ /dev/null
@@ -1,8 +0,0 @@ -#!/bin/bash -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -FUCHSIA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" - -exec ln -snf build/gn/dotfile.gn "${FUCHSIA_DIR}/.gn"
diff --git a/fidl/BUILD.gn b/fidl/BUILD.gn deleted file mode 100644 index 54f86b4..0000000 --- a/fidl/BUILD.gn +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -# A toolchain dedicated to processing FIDL libraries. -# The only targets in this toolchain are action() targets, so it -# has no real tools. But every toolchain needs stamp and copy. -toolchain("fidling") { - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } - - toolchain_args = { - toolchain_variant = { - } - toolchain_variant = { - base = get_label_info(":fidling", "label_no_toolchain") - } - } -}
diff --git a/fidl/fidl.gni b/fidl/fidl.gni deleted file mode 100644 index 195d0b5..0000000 --- a/fidl/fidl.gni +++ /dev/null
@@ -1,132 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/cpp/fidl_cpp.gni") -import("//build/dart/toolchain.gni") -import("//build/fidl/toolchain.gni") -import("//build/go/toolchain.gni") -import("//build/rust/toolchain.gni") - -# Declares a FIDL library. -# -# Depending on the toolchain in which this targets is expanded, it will yield -# different results: -# - in the FIDL toolchain, it will compile its source files into an -# intermediate representation consumable by language bindings generators; -# - in the target or shared toolchain, this will produce a source_set -# containing C++ bindings. -# -# Parameters -# -# sources (required) -# List of paths to library source files. -# -# name (optional) -# Name of the library. -# Defaults to the target's name. -# -# sdk_category (optional) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# cpp_legacy_callbacks (optional) -# If true, uses std::function instead of fit::function. -# Defaults to true while migration is in progress. - -template("fidl") { - if (defined(invoker.sdk_category)) { - not_needed(invoker, [ "sdk_category" ]) - } - if (defined(invoker.cpp_legacy_callbacks)) { - not_needed(invoker, [ "cpp_legacy_callbacks" ]) - } - - if (current_toolchain == fidl_toolchain) { - import("//build/fidl/fidl_library.gni") - - fidl_library(target_name) { - forward_variables_from(invoker, "*") - } - - fidl_cpp_codegen(target_name) { - forward_variables_from(invoker, "*") - } - } else if (current_toolchain == dart_toolchain) { - import("//build/dart/fidl_dart.gni") - - fidl_dart(target_name) { - forward_variables_from(invoker, "*") - } - } else if (current_toolchain == rust_toolchain) { - import("//build/rust/fidl_rust.gni") - - fidl_rust(target_name) { - forward_variables_from(invoker, "*") - } - } else if (current_toolchain == go_toolchain) { - import("//build/go/fidl_go.gni") - - fidl_go(target_name) { - forward_variables_from(invoker, "*") - } - } else if (is_fuchsia) { - import("//build/c/fidl_c.gni") - import("//build/rust/fidl_rust_library.gni") - - fidl_tables(target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - } - - # TODO(cramertj): remove pending TC-81. - fidl_rust_library(target_name) { - forward_variables_from(invoker, "*") - } - - fidl_cpp(target_name) { - forward_variables_from(invoker, "*") - } - - fidl_c_client(target_name) { - forward_variables_from(invoker, "*") - } - - fidl_c_server(target_name) { - forward_variables_from(invoker, "*") - } - - group("${target_name}_c") { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - public_deps = [ - ":${target_name}_client", - ":${target_name}_server", - ] - } - } else { - # TODO(ctiller): this case is for host-side FIDL, and ultimately - # should be identical to the previous case (once C & Rust are usable from - # host) - import("//build/c/fidl_c.gni") - - fidl_tables(target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - } - - fidl_cpp(target_name) { - forward_variables_from(invoker, "*") - } - } -}
diff --git a/fidl/fidl_library.gni b/fidl/fidl_library.gni deleted file mode 100644 index 1ca02c7..0000000 --- a/fidl/fidl_library.gni +++ /dev/null
@@ -1,250 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") -import("//build/json/validate_json.gni") -import("//build/sdk/sdk_atom.gni") - -# Generates some representation of a FIDL library that's consumable by Language -# bindings generators. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# - name; -# - sdk_category; -# - sources. - -template("fidl_library") { - assert( - current_toolchain == fidl_toolchain, - "This template can only be used in the FIDL toolchain $fidl_toolchain.") - - assert(defined(invoker.sources), "A FIDL library requires some sources.") - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - response_file = "$target_gen_dir/$target_name.args" - fidl_stem = "$target_gen_dir/$target_name.fidl" - json_representation = "$fidl_stem.json" - c_stem = string_replace(library_name, ".", "/") + "/c/fidl" - c_client = "$root_gen_dir/$c_stem.client.c" - c_header = "$root_gen_dir/$c_stem.h" - c_server = "$root_gen_dir/$c_stem.server.c" - coding_tables = "$fidl_stem.tables.cc" - - main_target_name = target_name - response_file_target_name = "${target_name}_response_file" - compilation_target_name = "${target_name}_compile" - verification_target_name = "${target_name}_verify" - - all_deps = [] - if (defined(invoker.deps)) { - all_deps += invoker.deps - } - if (defined(invoker.public_deps)) { - all_deps += invoker.public_deps - } - - action(response_file_target_name) { - visibility = [ ":*" ] - - script = "//build/fidl/gen_response_file.py" - - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "sources", - "testonly", - ]) - - libraries = "$target_gen_dir/$main_target_name.libraries" - - outputs = [ - response_file, - libraries, - ] - - args = [ - "--out-response-file", - rebase_path(response_file, root_build_dir), - "--out-libraries", - rebase_path(libraries, root_build_dir), - "--json", - rebase_path(json_representation, root_build_dir), - "--c-client", - rebase_path(c_client, root_build_dir), - "--c-header", - rebase_path(c_header, root_build_dir), - "--c-server", - rebase_path(c_server, root_build_dir), - "--tables", - rebase_path(coding_tables, root_build_dir), - "--name", - library_name, - "--sources", - ] + rebase_path(sources, root_build_dir) - - if (all_deps != []) { - dep_libraries = [] - - foreach(dep, all_deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - dep_libraries += [ "$gen_dir/$name.libraries" ] - } - - inputs = dep_libraries - - args += [ "--dep-libraries" ] + rebase_path(dep_libraries, root_build_dir) - } - } - - compiled_action(compilation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - visibility = [ ":*" ] - - tool = "//zircon/public/tool/fidlc" - - inputs = [ - response_file, - ] - - outputs = [ - c_client, - c_header, - c_server, - coding_tables, - json_representation, - ] - - rebased_response_file = rebase_path(response_file, root_build_dir) - - args = [ "@$rebased_response_file" ] - - deps = [ - ":$response_file_target_name", - ] - } - - validate_json(verification_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - visibility = [ ":*" ] - data = json_representation - schema = "//zircon/system/host/fidl/schema.json" - deps = [ - ":$compilation_target_name", - ] - } - - group(main_target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - public_deps = [ - ":$compilation_target_name", - ":$response_file_target_name", - ] - - deps = [ - ":$verification_target_name", - ] - } - - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - # Process sources. - file_base = "fidl/$library_name" - all_files = [] - sdk_sources = [] - foreach(source, invoker.sources) { - relative_source = rebase_path(source, ".") - if (string_replace(relative_source, "..", "bogus") != relative_source) { - # If the source file is not within the same directory, just use the file - # name. - relative_source = get_path_info(source, "file") - } - destination = "$file_base/$relative_source" - sdk_sources += [ destination ] - all_files += [ - { - source = rebase_path(source) - dest = destination - }, - ] - } - - # Identify metadata for dependencies. - sdk_metas = [] - sdk_deps = [] - foreach(dep, all_deps) { - full_label = get_label_info(dep, "label_no_toolchain") - sdk_dep = "${full_label}_sdk" - sdk_deps += [ sdk_dep ] - gen_dir = get_label_info(sdk_dep, "target_gen_dir") - name = get_label_info(sdk_dep, "name") - sdk_metas += [ rebase_path("$gen_dir/$name.meta.json") ] - } - - # Generate the library metadata. - meta_file = "$target_gen_dir/${target_name}.sdk_meta.json" - meta_target_name = "${target_name}_meta" - - action(meta_target_name) { - script = "//build/fidl/gen_sdk_meta.py" - - inputs = sdk_metas - - outputs = [ - meta_file, - ] - - args = [ - "--out", - rebase_path(meta_file), - "--name", - library_name, - "--root", - file_base, - "--specs", - ] + sdk_metas + [ "--sources" ] + sdk_sources - - deps = sdk_deps - } - - sdk_atom("${target_name}_sdk") { - id = "sdk://fidl/$library_name" - - category = invoker.sdk_category - - meta = { - source = meta_file - dest = "$file_base/meta.json" - schema = "fidl_library" - } - - files = all_files - - non_sdk_deps = [ ":$meta_target_name" ] - - deps = [] - foreach(dep, all_deps) { - label = get_label_info(dep, "label_no_toolchain") - deps += [ "${label}_sdk" ] - } - } - } -}
diff --git a/fidl/gen_response_file.py b/fidl/gen_response_file.py deleted file mode 100755 index 582a58b..0000000 --- a/fidl/gen_response_file.py +++ /dev/null
@@ -1,82 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import string -import sys - - -def read_libraries(libraries_path): - with open(libraries_path) as f: - lines = f.readlines() - return [l.rstrip("\n") for l in lines] - - -def write_libraries(libraries_path, libraries): - directory = os.path.dirname(libraries_path) - if not os.path.exists(directory): - os.makedirs(directory) - with open(libraries_path, "w+") as f: - for library in libraries: - f.write(library) - f.write("\n") - - -def main(): - parser = argparse.ArgumentParser(description="Generate response file for FIDL frontend") - parser.add_argument("--out-response-file", help="The path for for the response file to generate", required=True) - parser.add_argument("--out-libraries", help="The path for for the libraries file to generate", required=True) - parser.add_argument("--json", help="The path for the JSON file to generate, if any") - parser.add_argument("--tables", help="The path for the tables file to generate, if any") - parser.add_argument("--c-client", help="The path for the C simple client file to generate, if any") - parser.add_argument("--c-header", help="The path for the C header file to generate, if any") - parser.add_argument("--c-server", help="The path for the C simple server file to generate, if any") - parser.add_argument("--name", help="The name for the generated FIDL library, if any") - parser.add_argument("--sources", help="List of FIDL source files", nargs="*") - parser.add_argument("--dep-libraries", help="List of dependent libraries", nargs="*") - args = parser.parse_args() - - target_libraries = [] - - for dep_libraries_path in args.dep_libraries or []: - dep_libraries = read_libraries(dep_libraries_path) - for library in dep_libraries: - if library in target_libraries: - continue - target_libraries.append(library) - - target_libraries.append(" ".join(sorted(args.sources))) - write_libraries(args.out_libraries, target_libraries) - - response_file = [] - - if args.json: - response_file.append("--json %s" % args.json) - - if args.tables: - response_file.append("--tables %s" % args.tables) - - if args.c_client: - response_file.append("--c-client %s" % args.c_client) - - if args.c_header: - response_file.append("--c-header %s" % args.c_header) - - if args.c_server: - response_file.append("--c-server %s" % args.c_server) - - if args.name: - response_file.append("--name %s" % args.name) - - response_file.extend(["--files %s" % library for library in target_libraries]) - - with open(args.out_response_file, "w+") as f: - f.write(" ".join(response_file)) - f.write("\n") - - -if __name__ == "__main__": - sys.exit(main())
diff --git a/fidl/gen_sdk_meta.py b/fidl/gen_sdk_meta.py deleted file mode 100755 index 86bf26b..0000000 --- a/fidl/gen_sdk_meta.py +++ /dev/null
@@ -1,58 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--name', - help='Name of the library', - required=True) - parser.add_argument('--root', - help='Root of the library in the SDK', - required=True) - parser.add_argument('--specs', - help='Path to spec files of dependencies', - nargs='*') - parser.add_argument('--sources', - help='List of library sources', - nargs='+') - args = parser.parse_args() - - metadata = { - 'type': 'fidl_library', - 'name': args.name, - 'root': args.root, - 'sources': args.sources, - 'files': args.sources, - } - - deps = [] - for spec in args.specs: - with open(spec, 'r') as spec_file: - data = json.load(spec_file) - type = data['type'] - name = data['name'] - if type == 'fidl_library': - deps.append(name) - else: - raise Exception('Unsupported dependency type: %s' % type) - metadata['deps'] = deps - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/fidl/toolchain.gni b/fidl/toolchain.gni deleted file mode 100644 index aedf348..0000000 --- a/fidl/toolchain.gni +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -fidl_toolchain = "//build/fidl:fidling"
diff --git a/fuzzing/BUILD.gn b/fuzzing/BUILD.gn deleted file mode 100644 index 6554929..0000000 --- a/fuzzing/BUILD.gn +++ /dev/null
@@ -1,7 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("fuzzing_build_mode_unsafe_for_production") { - defines = [ "FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" ] -}
diff --git a/fuzzing/fuzzer.gni b/fuzzing/fuzzer.gni deleted file mode 100644 index d37f35b..0000000 --- a/fuzzing/fuzzer.gni +++ /dev/null
@@ -1,370 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -# Declare a fuzzed executable target. -# -# Creates an instrumented executable file for fuzzing with a sanitizer. Do not -# use directly; instead, use `fuzz_target` with an associated `fuzz_package` -# specifying the supported sanitizers. -# -# Takes all the same parameters as executable(). -template("_fuzzed_executable") { - executable(target_name) { - _target_type = "fuzzed_executable" - - # Explicitly forward visibility, implicitly forward everything else. - # See comment in //build/config/BUILDCONFIG.gn for details on this pattern. - forward_variables_from(invoker, [ "visibility" ]) - forward_variables_from(invoker, - "*", - [ - "visibility", - "_target_type", - ]) - } -} - -# Declares a resource needed by the fuzzer. -# -# Creates a (potentially empty) resource file for use by a `fuzz_target`. Do -# not use directly; instead, use `fuzz_target` with an associated -# `fuzz_package` specifying the supported sanitizers. -# -# Parameters: -# -# fuzz_name (required) -# [string] Name of the associated `fuzz_target`. -# -# resource (required) -# [string] Base file name of the resource to produce. -# -# script (optional) -# [file] Script that produces the resources. Defaults to -# //build/fuzzing/gen_fuzzer_resource.py -# -# args (optional) -# [list of strings] Additional arguments to append to the script command -# line. -# -template("_fuzz_resource") { - assert(defined(invoker.fuzz_name), - "`fuzz_name` must be defined for $target_name") - assert(defined(invoker.resource), - "`resource` must be defined for $target_name") - action(target_name) { - if (defined(invoker.script)) { - script = invoker.script - } else { - script = "//build/fuzzing/gen_fuzzer_resource.py" - } - output = "${target_gen_dir}/${invoker.fuzz_name}/${invoker.resource}" - outputs = [ - output, - ] - args = [ - "--out", - rebase_path(output), - ] - if (defined(invoker.args)) { - args += invoker.args - } - } -} - -# Defines a fuzz target binary -# -# The fuzz_target template is used to create binaries which leverage LLVM's -# libFuzzer to perform fuzz testing. -# -# Parameters -# -# options (optional) -# [list of strings] Each option is of the form "key=value" and indicates -# command line options that the fuzzer should be invoked with. Valid keys -# are libFuzzer options (https://llvm.org/docs/LibFuzzer.html#options). -# -# dictionary (optional) -# [file] If specified, a file containing inputs, one per line, that the -# fuzzer will use to generate new mutations. -# -# corpora (optional) -# [list of strings] One or more locations from which to get a fuzzing -# corpus, e.g. a project path to a directory of artifacts, a project -# path to a CIPD ensure file, or a GCS URL. -# -# sources (optional) -# [list of files] The C++ sources required to build the fuzzer binary. With -# the exception of the "zircon_fuzzers" targets, this list must be present -# and include a file defining `LLVMFuzzerTestOneInput`. It will typically -# be a single file (with deps including the software under test). -# -template("fuzz_target") { - assert(defined(invoker.sources), "`sources` must be defined for $target_name") - _fuzzed_executable(target_name) { - forward_variables_from(invoker, - "*", - [ - "corpora", - "dictionary", - "options", - "output_name", - ]) - testonly = true - } - - # The following rules ensure the fuzzer resources are present (even if empty) - # and in known locations. This is needed as the fuzz_package has no way of - # knowing the original file names when building the package manifest. These - # files only need to be written once, so only do it in the base toolchain. - if (current_toolchain == toolchain_variant.base) { - fuzz_name = target_name - - # Copy the corpora available for the fuzzer - _fuzz_resource("${fuzz_name}_corpora") { - resource = "corpora" - if (defined(invoker.corpora)) { - args = invoker.corpora - } - } - - # Copy the fuzzer dictionary - _fuzz_resource("${fuzz_name}_dictionary") { - resource = "dictionary" - if (defined(invoker.dictionary)) { - args = read_file(invoker.dictionary, "list lines") - } - } - - # Copy the options the fuzzer should be invoked with - _fuzz_resource("${fuzz_name}_options") { - resource = "options" - if (defined(invoker.options)) { - args = invoker.options - } - } - - # Create a component manifest - _fuzz_resource("${fuzz_name}_cmx") { - script = "//build/fuzzing/gen_fuzzer_manifest.py" - resource = "${fuzz_name}.cmx" - args = [ - "--bin", - "${fuzz_name}", - ] - if (defined(invoker.cmx)) { - args += [ - "--cmx", - rebase_path(invoker.cmx), - ] - } - } - } else { - not_needed(invoker, "*") - } -} - -set_defaults("fuzz_target") { - configs = default_executable_configs + - [ "//build/fuzzing:fuzzing_build_mode_unsafe_for_production" ] -} - -# Defines a package of fuzz target binaries -# -# The fuzz_package template is used to bundle several fuzz_targets and their -# associated data into a single Fuchsia package. -# -# Parameters -# -# targets (required) -# [list of labels] The fuzz_target() targets to include in this package. -# -# sanitizers (required) -# [list of variants] A set of sanitizer variants. The resulting package -# will contain binaries for each sanitizer/target combination. -# -# binaries (optional) -# data_deps (optional) -# deps (optional) -# public_deps (optional) -# extra (optional) -# loadable_modules (optional) -# meta (optional) -# resources (optional) -# Passed through to the normal package template. -# -# fuzz_host (optional) -# [boolean] Indicates whether to also build fuzzer binaries on host. -# Defaults to false. -# -# omit_binaries (optional) -# [bool] If true, indicates the fuzz target binaries will be provided by -# a non-GN build, e.g. the Zircon build. The package will contain the -# resources needed by the fuzzer, but no binaries or component manifests. -# Defaults to false. -# -template("fuzz_package") { - assert(defined(invoker.targets), "targets must be defined for $target_name}") - assert(defined(invoker.sanitizers), - "sanitizers must be defined for $target_name") - - # Only assemble the package once; handle the specific sanitizers in the loop below - if (current_toolchain == toolchain_variant.base) { - fuzz = { - binaries = [] - deps = [] - resources = [] - meta = [] - host = false - host_binaries = [] - omit_binaries = false - forward_variables_from(invoker, - [ - "binaries", - "data_deps", - "deps", - "public_deps", - "extra", - "loadable_modules", - "meta", - "resources", - "targets", - "sanitizers", - ]) - } - if (defined(invoker.fuzz_host)) { - fuzz.host = invoker.fuzz_host - } - if (defined(invoker.omit_binaries)) { - fuzz.omit_binaries = invoker.omit_binaries - } - - # It's possible (although unusual) that targets could be empty, e.g. a placeholder package - if (fuzz.targets == []) { - not_needed(fuzz, [ "sanitizers" ]) - } - - foreach(fuzz_target, fuzz.targets) { - fuzz_name = get_label_info(fuzz_target, "name") - - # Find the executable variant for the sanitized fuzzer - selected = false - sanitized_target = "" - host_target = "" - foreach(sanitizer, fuzz.sanitizers) { - if (!selected) { - foreach(selector, select_variant_canonical) { - if (selector.variant == "${sanitizer}-fuzzer") { - if (defined(selector.target_type)) { - selector_target_type = [] - selector_target_type = selector.target_type - if (selector_target_type[0] == "fuzzed_executable") { - selected = true - } - } - if (defined(selector.name)) { - selector_name = [] - selector_name = selector.name - if (selector_name[0] == fuzz_name) { - selected = true - } - } - if (defined(selector.output_name)) { - selector_output_name = [] - selector_output_name = selector.output_name - if (selector_output_name[0] == fuzz_name) { - selected = true - } - } - if (selected) { - sanitized_target = "${fuzz_target}(${toolchain_variant.base}-${sanitizer}-fuzzer)" - host_target = - "${fuzz_target}(${host_toolchain}-${sanitizer}-fuzzer)" - } - } - } - } - } - - # If enabled, add fuzz target to package - if (sanitized_target != "") { - fuzz_label = get_label_info(sanitized_target, "label_no_toolchain") - fuzz_gen_dir = - get_label_info(fuzz_target, "target_gen_dir") + "/${fuzz_name}" - - if (!fuzz.omit_binaries) { - fuzz.deps += [ sanitized_target ] - fuzz_out_dir = get_label_info(sanitized_target, "root_out_dir") - fuzz.binaries += [ - { - name = fuzz_name - source = "${fuzz_out_dir}/${fuzz_name}" - dest = fuzz_name - }, - ] - - fuzz.deps += [ "${fuzz_label}_cmx(${toolchain_variant.base})" ] - fuzz.meta += [ - { - path = "${fuzz_gen_dir}/${fuzz_name}.cmx" - dest = "${fuzz_name}.cmx" - }, - ] - - fuzz.host_binaries += [ "$host_target" ] - } - - fuzz.deps += [ - "${fuzz_label}_corpora(${toolchain_variant.base})", - "${fuzz_label}_dictionary(${toolchain_variant.base})", - "${fuzz_label}_options(${toolchain_variant.base})", - ] - fuzz.resources += [ - { - path = "${fuzz_gen_dir}/corpora" - dest = "${fuzz_name}/corpora" - }, - { - path = "${fuzz_gen_dir}/dictionary" - dest = "${fuzz_name}/dictionary" - }, - { - path = "${fuzz_gen_dir}/options" - dest = "${fuzz_name}/options" - }, - ] - } else { - not_needed([ - "fuzz_name", - "host_target", - ]) - not_needed(fuzz, "*") - } - } - - group("host_${target_name}") { - testonly = true - if (fuzz.host) { - deps = fuzz.host_binaries - } - } - - # Build the actual package - package(target_name) { - testonly = true - forward_variables_from(fuzz, - "*", - [ - "targets", - "sanitizers", - "host", - "host_binaries", - "omit_binaries", - ]) - } - } else { - not_needed(invoker, "*") - } -}
diff --git a/fuzzing/gen_fuzzer_manifest.py b/fuzzing/gen_fuzzer_manifest.py deleted file mode 100755 index 5812273..0000000 --- a/fuzzing/gen_fuzzer_manifest.py +++ /dev/null
@@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import sys -from collections import defaultdict - - -def main(): - parser = argparse.ArgumentParser("Creates a component manifest for a fuzzer") - parser.add_argument("--out", help="Path to the output file", required=True) - parser.add_argument( - "--bin", help="Package relative path to the binary", required=True) - parser.add_argument("--cmx", help="Optional starting manifest") - args = parser.parse_args() - - cmx = defaultdict(dict) - if args.cmx: - with open(args.cmx, "r") as f: - cmx = json.load(f) - - cmx["program"]["binary"] = "bin/" + args.bin - - if "services" not in cmx["sandbox"]: - cmx["sandbox"]["services"] = [] - cmx["sandbox"]["services"].append("fuchsia.process.Launcher") - - if "features" not in cmx["sandbox"]: - cmx["sandbox"]["features"] = [] - if "persistent-storage" not in cmx["sandbox"]["features"]: - cmx["sandbox"]["features"].append("persistent-storage") - - with open(args.out, "w") as f: - f.write(json.dumps(cmx, sort_keys=True, indent=4)) - - -if __name__ == "__main__": - sys.exit(main())
diff --git a/fuzzing/gen_fuzzer_resource.py b/fuzzing/gen_fuzzer_resource.py deleted file mode 100755 index 4820ebc..0000000 --- a/fuzzing/gen_fuzzer_resource.py +++ /dev/null
@@ -1,20 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import sys - -def main(): - parser = argparse.ArgumentParser("Creates a resource file for a fuzzer") - parser.add_argument("--out", help="Path to the output file", required=True) - args, extra = parser.parse_known_args() - - with open(args.out, "w") as f: - for item in extra: - f.write(item) - f.write("\n") - -if __name__ == "__main__": - sys.exit(main())
diff --git a/gn/BUILD.gn b/gn/BUILD.gn deleted file mode 100644 index 678bcaa..0000000 --- a/gn/BUILD.gn +++ /dev/null
@@ -1,233 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/config/fuchsia/zircon.gni") -import("//build/gn/packages.gni") -import("//build/package.gni") -import("//build/testing/platforms.gni") -import("//build/toolchain/goma.gni") - -# Permit dependencies on testonly targets from packages. -testonly = true - -group("packages") { - deps = available_packages - data_deps = package_data_deps -} - -group("default") { - deps = [ - ":host_tests", - ":packages", - ] - if (preinstall_packages != [] || monolith_packages != []) { - deps += [ "//build/images" ] - } - if (available_packages != []) { - deps += [ "//build/images:updates" ] - } -} - -# Instantiate the packages synthesized from the build argument. -foreach(pkg, synthesize_packages) { - package(pkg.name) { - forward_variables_from(pkg, "*", [ "name" ]) - } -} - -# Copy host test binaries to $root_build_dir/host_tests. -# TODO(IN-819): Delete this copy target once host tests are no longer run out -# of a single directory. -if (package_host_tests != []) { - copy("host_tests") { - deps = [] - sources = [] - bindir = get_label_info("//anything($host_toolchain)", "root_out_dir") - - # package_host_tests may contain duplicate entries. Those entries must be - # de-duplicated here to avoid output collisions. - foreach(label, package_host_tests) { - _full_label = "$label($host_toolchain)" - deps += [ _full_label ] - binary = get_label_info(label, "name") - sources += [ "$bindir/$binary" ] - } - - outputs = [ - "$root_build_dir/host_tests/{{source_file_part}}", - ] - } -} else { - group("host_tests") { - } -} - -# Write a JSON metadata file about the host tests in the build. -host_tests = [] -foreach(label, package_host_tests) { - host_label = "$label($host_toolchain)" - host_tests += [ - { - dir = get_label_info(host_label, "dir") - name = get_label_info(host_label, "name") - build_dir = rebase_path(get_label_info(host_label, "target_out_dir"), - root_build_dir) - }, - ] -} -write_file("$root_build_dir/host_tests.json", host_tests, "json") - -# Collect the source files that are dependencies of the create_gn_rules.py -# script, below. Unfortunately, exec_script cannot use a depfile produced -# by the script and only supports a separately computed list of dependencies. -zircon_files = - exec_script("//build/zircon/list_source_files.py", [], "list lines") - -supporting_templates = [ - "//build/zircon/boards.mako", - "//build/zircon/header.mako", - "//build/zircon/host_tool.mako", - "//build/zircon/main.mako", - "//build/zircon/shared_library.mako", - "//build/zircon/source_library.mako", - "//build/zircon/static_library.mako", - "//build/zircon/sysroot.mako", -] - -# The following script generates GN build files for Zircon objects. It is -# placed before everything else so that //zircon targets are available in -# due time. See //build/zircon/README.md for more details. -exec_script("//build/zircon/create_gn_rules.py", - [ - "--out", - rebase_path("//zircon/public"), - "--staging", - rebase_path("$root_out_dir/zircon-gn"), - "--zircon-user-build", - rebase_path(zircon_build_abi_dir), - "--zircon-tool-build", - rebase_path("$zircon_tools_dir/.."), - "--make", - zircon_make_path, - ], - "", - zircon_files + supporting_templates) - -# Write a file that can be sourced by `fx`. This file is produced -# by `gn gen` and is not known to Ninja at all, so it has nothing to -# do with the build itself. Its sole purpose is to leave bread -# crumbs about the settings `gn gen` used for `fx` to use later. -_relative_build_dir = rebase_path(root_build_dir, "//", "//") -_fx_config_lines = [ - "# Generated by `gn gen`.", - "FUCHSIA_BUILD_DIR='${_relative_build_dir}'", - "FUCHSIA_ARCH='${target_cpu}'", -] -if (use_goma) { - _fx_config_lines += [ - "# This will affect Zircon's make via //scripts/build-zircon.sh.", - "export GOMACC='${goma_dir}/gomacc'", - ] -} -_fx_build_zircon_args = "" -if (zircon_use_asan) { - _fx_build_zircon_args += " -A" -} -foreach(selector, select_variant) { - if (selector == "host_asan") { - _fx_build_zircon_args += " -H" - } -} -if (_fx_build_zircon_args != "") { - _fx_config_lines += [ "FUCHSIA_BUILD_ZIRCON_ARGS=($_fx_build_zircon_args)" ] -} -write_file("$root_build_dir/fx.config", _fx_config_lines) - -# Generates breakpad symbol data for unstripped binaries. -# -# This symbol data is consumed by infrastructure tools and uploaded to Crash -# servers to enable crash reporting. These files are uniquely important for -# release builds and this step may take a few minutes to complete, so it is -# not recommended that this be included in the default build. -action("breakpad_symbols") { - testonly = true - script = "//buildtools/${host_platform}/dump_breakpad_symbols" - - deps = [ - "//build/images:ids.txt", - ] - - inputs = [ - "//buildtools/${host_platform}/dump_syms/dump_syms", - ] - sources = [ - "$root_out_dir/ids.txt", - ] - - # This action generates a single xxx.sym file for each binary in the ids file - # and produces an archived output of them all. - outputs = [ - "$root_out_dir/breakpad_symbols/breakpad_symbols.tar.gz", - ] - - depfile = "${outputs[0]}.d" - - args = [ - "-out-dir", - rebase_path("$root_out_dir/breakpad_symbols"), - "-dump-syms-path", - rebase_path("//buildtools/${host_platform}/dump_syms/dump_syms"), - "-depfile", - rebase_path(depfile, root_build_dir), - "-tar-file", - rebase_path(outputs[0], root_build_dir), - ] + rebase_path(sources, root_build_dir) -} - -# Generates an archive of package metadata. -amber_files = rebase_path("$root_build_dir/amber-files") -host_out_dir = get_label_info("//anything($host_toolchain)", "root_out_dir") -pm_tool = rebase_path("$host_out_dir/pm") -pkg_archive_contents = [ - "amber-files/repository=$amber_files/repository", - # TODO(IN-915): this should never contain the root key. In the future, this - # should contain no keys, once infra is managing key material itself. - # These keys are consumed by the infra train promote scripts. - "amber-files/keys=$amber_files/keys", - "pm=$pm_tool", -] -pkg_archive_manifest = "$target_gen_dir/package_archive_manifest" -write_file(pkg_archive_manifest, pkg_archive_contents) - -pkg_archive = "$root_build_dir/packages.tar.gz" -compiled_action("package_archive") { - testonly = true - tool = "//build/tools/tar_maker" - inputs = [ - pkg_archive_manifest, - ] - outputs = [ - pkg_archive, - ] - args = [ - "-manifest", - rebase_path(pkg_archive_manifest), - "-output", - rebase_path(pkg_archive), - ] - deps = [ - "//build/images:updates", - ] -} - -# Generates a JSON manifest of the platforms available for testing, along with -# their properties. -target_platforms = [] -foreach(platform, test_platforms) { - if (!defined(platform.cpu) || platform.cpu == current_cpu) { - target_platforms += [ platform ] - } -} -write_file("$root_build_dir/platforms.json", target_platforms, "json")
diff --git a/gn/check-layer-dependencies.py b/gn/check-layer-dependencies.py deleted file mode 100755 index 8d40019..0000000 --- a/gn/check-layer-dependencies.py +++ /dev/null
@@ -1,74 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import subprocess -import sys - -FUCHSIA_ROOT = os.path.dirname( # $root - os.path.dirname( # build - os.path.dirname( # gn - os.path.abspath(__file__)))) -GN = os.path.join(FUCHSIA_ROOT, "buildtools", "gn") - -# The layers of the Fuchsia cake -# Note that these must remain ordered by increasing proximity to the silicon. -LAYERS = [ - 'topaz', - 'peridot', - 'garnet', - 'zircon', -] - -def main(): - parser = argparse.ArgumentParser('check-layer-dependencies', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('--layer', - help='[required] Name of the layer to inspect', - choices=LAYERS) - parser.add_argument('--out', - help='Build output directory', - default='out/debug-x64') - args = parser.parse_args() - layer = args.layer - out = args.out - if not layer: - parser.print_help() - return 1 - - layer_index = LAYERS.index(layer) - create_labels = lambda layers: list(map(lambda l: '//%s' % l, layers)) - upper_layers = create_labels(LAYERS[0:layer_index]) - lower_layers = create_labels(LAYERS[layer_index:]) - public_labels = subprocess.check_output( - [GN, 'ls', out, '//%s/public/*' % layer]).splitlines() - is_valid = True - - for label in public_labels: - deps = subprocess.check_output( - [GN, 'desc', out, label, 'deps']).splitlines() - for dep in deps: - # We should never depend on upper layers. - for upper_layer in upper_layers: - if dep.startswith(upper_layer): - is_valid = False - print('Upper layer violation') - print(' Label %s' % label) - print(' Dep %s' % dep) - # If we depend on the same layer or a layer below, that dependency - # should be located in its layer's public directory. - for lower_layer in lower_layers: - if (dep.startswith(lower_layer) - and not dep.startswith('%s/public' % lower_layer)): - is_valid = False - print('Lower layer violation') - print(' Label %s' % label) - print(' Dep %s' % dep) - return 0 if is_valid else 1 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/gn/dotfile.gn b/gn/dotfile.gn deleted file mode 100644 index 4eec209..0000000 --- a/gn/dotfile.gn +++ /dev/null
@@ -1,44 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This file lives at //build/gn/dotfile.gn for maintenance purposes. -# It's actually used by GN via a symlink at //.gn, which is installed -# by a jiri hook. This file directs GN to all the other key files. - -# The location of the build configuration file. -buildconfig = "//build/config/BUILDCONFIG.gn" - -# The secondary source root is a parallel directory tree where -# GN build files are placed when they can not be placed directly -# in the source tree, e.g. for third party source trees. -secondary_source = "//build/secondary/" - -# The source root location. -root = "//build/gn" - -# The executable used to execute scripts in action and exec_script. -script_executable = "/usr/bin/env" - -# These arguments override the default values for items in a declare_args -# block. "gn args" in turn can override these. -default_args = { - # Disable Skia settings not needed for host builds. - skia_enable_flutter_defines = true - skia_enable_pdf = false - skia_use_dng_sdk = false - skia_use_expat = false - skia_use_fontconfig = false - skia_use_libwebp = false - skia_use_sfntly = false - skia_use_x11 = false -} - -# Enable checking for the layers. -check_targets = [ - "//garnet/*", - "//peridot/*", - "//topaz/*", - "//vendor/*", - "//zircon/*", -]
diff --git a/gn/gen_persistent_log_config.py b/gn/gen_persistent_log_config.py deleted file mode 100755 index 198c518..0000000 --- a/gn/gen_persistent_log_config.py +++ /dev/null
@@ -1,43 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import sys - - -def main(): - parser = argparse.ArgumentParser('Generate a sysmgr config to persist logs') - parser.add_argument('name', help='Name of the config') - parser.add_argument('path', help='Path to the package file') - parser.add_argument('--tags', help='Tag to filter for', nargs='+') - parser.add_argument('--ignore-tags', help='Tag to ignore', nargs='+') - parser.add_argument('--file-capacity', help='max allowed disk usage', - type=int) - args = parser.parse_args() - - tag_args = [] - if args.tags: - for t in args.tags: - tag_args += [ '--tag', t ] - - ignore_tag_args = [] - if args.ignore_tags: - for t in args.ignore_tags: - ignore_tag_args += [ '--ignore-tag', t ] - - file_cap_args = [] - if args.file_capacity != None: - file_cap_args = [ '--file_capacity', str(args.file_capacity) ] - - with open(args.path, 'w') as f: - json.dump({'apps':[["fuchsia-pkg://fuchsia.com/log_listener#meta/log_listener.cmx", "--file", "/data/logs."+args.name] + - file_cap_args + tag_args + ignore_tag_args] }, f) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/gn/guess_layer.py b/gn/guess_layer.py deleted file mode 100755 index 70b1b74..0000000 --- a/gn/guess_layer.py +++ /dev/null
@@ -1,71 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# TOOD(TO-908): This script should be replaced with a jiri feature: -# `jiri import -json-output` to yield imports in some JSON schema. -# That could be parsed directly from GN. - -from __future__ import absolute_import -from __future__ import print_function - -import argparse -import os -import re -import sys -import xml.etree.ElementTree - - -LAYERS_RE = re.compile('^(garnet|peridot|topaz|vendor/.*)$') - - -# Returns True iff LAYERS_RE matches name. -def print_if_layer_name(name): - if LAYERS_RE.match(name): - print(name) - return True - return False - - -def main(): - parser = argparse.ArgumentParser( - description='Guess the current cake layer from the Jiri manifest file', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument( - 'manifest', type=argparse.FileType('r'), nargs='?', - default=os.path.normpath( - os.path.join(os.path.dirname(__file__), - os.path.pardir, os.path.pardir, '.jiri_manifest'))) - args = parser.parse_args() - - tree = xml.etree.ElementTree.parse(args.manifest) - - if tree.find('overrides') is None: - sys.stderr.write('found no overrides. guessing project from imports\n') - for elt in tree.iter('import'): - # manifest can be something like garnet/garnet in which case we want - # garnet or internal/vendor/foo/bar in which case we want vendor/foo. - head, name = os.path.split(elt.attrib['manifest']) - if 'vendor/' in head: - head, name = os.path.split(head) - name = os.path.join('vendor', name) - if print_if_layer_name(name): - return 0 - - # Guess the layer from the name of the <project> that is overriden in the - # current manifest. - for elt in tree.iter('overrides'): - for project in elt.findall('project'): - if print_if_layer_name(project.attrib.get('name', '')): - return 0 - - sys.stderr.write("ERROR: Could not guess petal from %s. " - "Ensure 'boards' and either 'products' or 'packages' is set.\n" - % args.manifest.name) - - return 2 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/gn/packages.gni b/gn/packages.gni deleted file mode 100644 index ebc715f..0000000 --- a/gn/packages.gni +++ /dev/null
@@ -1,148 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # If a package is referenced in monolith and in preinstall, monolith takes - # priority, and the package will be added to OTA images as part of the - # verified boot set of static packages. - - # These arguments should be set by the product definition gni file. - - # a list of packages included in OTA images, base system images, and the - # distribution repository. - monolith = [] - - # a list of packages pre-installed on the system (also added to the - # distribution repository) - preinstall = [] - - # a list of packages only added to the distribution repository) - available = [] - - # These arguments should be set by the board definition gni file. - - # A list of packages included in the monolith from the board definition. - # This list is appended with the list from the product definition and any - # additional specified packages - board_packages = [] - - # List of packages (a GN list of strings). - # This list of packages is currently added to the set of "monolith" packages, - # see `products` for more information; in the future, these packages will be - # added to the "preinstall". - # If unset, layer will be guessed using //.jiri_manifest and - # //{layer}/products/default.gni will be used. - fuchsia_packages = [] - - # Legacy product definitions. - fuchsia_products = [] - - # List of extra packages to synthesize on the fly. This is only for - # things that do not appear normally in the source tree. Synthesized - # packages can contain build artifacts only if they already exist in some - # part of the build. They can contain arbitrary verbatim files. - # Synthesized packages can't express dependencies on other packages. - # - # Each element of this list is a scope that is very much like the body of - # a package() template invocation (see //build/package.gni). That scope - # must set `name` to the string naming the package, as would be the name - # in the package() target written in a GN file. This must be unique - # among all package names. - synthesize_packages = [] -} - -monolith += board_packages -monolith += fuchsia_packages - -# Print a warning message if the legacy fuchsia_products field is set. -# Only print in the default toolchain so the warning only shows up once. -if (fuchsia_products != [] && current_toolchain == default_toolchain) { - print("WARNING! Deprecated fuchsia product specification detected") - print("Please re-run 'fx set' to update your build configuration") - print("See https://fuchsia.googlesource.com/docs/+/master/development/build/") - print("or BLD-240 for more details") -} - -if (monolith == [] && preinstall == [] && available == [] && - fuchsia_packages == []) { - _jiri_manifest = "//.jiri_manifest" - _layers = exec_script("//build/gn/guess_layer.py", - [ rebase_path(_jiri_manifest) ], - "list lines", - [ _jiri_manifest ]) - foreach(layer, _layers) { - import("//$layer/products/default.gni") - } -} - -# Resolve all the `fuchsia_products` JSON files and their dependencies -# into lists of GN labels: -# monolith - package labels for base system and verified boot image -# preinstall - package labels for preinstall, but not OTA -# available - package labels for the install and update repository -# host_tests - labels for host tests -# data_deps - labels for host tools and non-package build targets -_preprocessed_products = exec_script("preprocess_products.py", - [ - # A list of strings in GN syntax is - # valid JSON too. - "--monolith=$monolith", - "--preinstall=$preinstall", - "--available=$available", - "--legacy-products=$fuchsia_products", - ], - "json") - -# Tell GN that the files preprocess_products.py ran are inputs to the -# generation step, by declaring them as file inputs to a (silly) exec_script -# invocation. -exec_script("/bin/sh", - [ - "-c", - ":", - ], - "", - _preprocessed_products.files_read) - -monolith_packages = [] -foreach(pkg, _preprocessed_products.monolith) { - monolith_packages += [ get_label_info(pkg, "label_no_toolchain") ] -} -preinstall_packages = [] -foreach(pkg, _preprocessed_products.preinstall) { - preinstall_packages += [ get_label_info(pkg, "label_no_toolchain") ] -} -available_packages = [] -foreach(pkg, _preprocessed_products.available) { - available_packages += [ get_label_info(pkg, "label_no_toolchain") ] -} - -# Every extra GN target the package JSON requests be built on the side. -# This is for things like install_host_tools() targets whose output should -# be on hand for a developer to use in conjuction with a Fuchsia package. -package_data_deps = [] -foreach(pkg, _preprocessed_products.data_deps) { - package_data_deps += [ get_label_info(pkg, "label_no_toolchain") ] -} - -# Labels of test() targets to be copied into $root_build_dir/host_tests. -package_host_tests = [] -foreach(label, _preprocessed_products.host_tests) { - package_host_tests += [ get_label_info(label, "label_no_toolchain") ] -} - -# Synthesized packages are instantiated in //build/gn/BUILD.gn, -# so the package() target is //build/gn:package_name. -_synthesized_packages = [] -foreach(pkg, synthesize_packages) { - pkg = "//build/gn:${pkg.name}" - _synthesized_packages += [ get_label_info(pkg, "label_no_toolchain") ] -} - -# Note: currently the infrastructure recipes require infra synthesized -# packages to become members of the monolith set. The +,-,+ dance is to ensure -# the list contains no duplicates. -monolith_packages += _synthesized_packages -monolith_packages -= _synthesized_packages -monolith_packages += _synthesized_packages
diff --git a/gn/paths.py b/gn/paths.py deleted file mode 100644 index a50d9eb..0000000 --- a/gn/paths.py +++ /dev/null
@@ -1,37 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Fuchsia Authors. 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 - -SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) -FUCHSIA_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir)) -GN_PATH = os.path.join(FUCHSIA_ROOT, "buildtools", "gn") -BUILDTOOLS_PATH = os.path.join(FUCHSIA_ROOT, "buildtools", '%s-%s' % ( - platform.system().lower().replace('darwin', 'mac'), - { - 'x86_64': 'x64', - 'aarch64': 'arm64', - }[platform.machine()], -)) -DEBUG_OUT_DIR = os.path.join(FUCHSIA_ROOT, "out", "debug-x64") -RELEASE_OUT_DIR = os.path.join(FUCHSIA_ROOT, "out", "release-x64") - -_BUILD_TOOLS = {} - -def build_tool(package, tool): - """Return the full path of TOOL binary in PACKAGE. - - This will raise an assertion failure if the binary doesn't exist. - This function memoizes its results, so there's not much need to - cache its results in calling code. - """ - - path = _BUILD_TOOLS.get((package, tool)) - if path is None: - path = os.path.join(BUILDTOOLS_PATH, package, 'bin', tool) - assert os.path.exists(path), "No '%s' tool in '%s'" % (tool, package) - _BUILD_TOOLS[package, tool] = path - return path
diff --git a/gn/prepreprocess_build_packages.py b/gn/prepreprocess_build_packages.py deleted file mode 100755 index 287efa3..0000000 --- a/gn/prepreprocess_build_packages.py +++ /dev/null
@@ -1,124 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os.path -import paths -import sys - - -class PackageImportsResolver: - """Recursively resolves imports in build packages. See - https://fuchsia.googlesource.com/docs/+/master/development/build/packages.md - for more information about build packages. - - An observer may be used to perform additional work whenever an - import is resolved. This observer needs to implement a method with this - signature: - - def import_resolved(self, config, config_path) - - where config is the JSON file representing the build package. - - If there was an error reading some of the input files, `None` will be - returned. - """ - - def __init__(self, observer=None): - self.observer = observer - self._errored = False - - def resolve(self, imports): - return self.resolve_imports(imports) - - def errored(self): - return self._errored - - def resolve_imports(self, import_queue): - - def detect_duplicate_keys(pairs): - keys = set() - result = {} - for k, v in pairs: - if k in keys: - raise Exception("Duplicate key %s" % k) - keys.add(k) - result[k] = v - return result - - imported = set(import_queue) - while import_queue: - config_name = import_queue.pop() - config_path = os.path.join(paths.FUCHSIA_ROOT, config_name) - try: - with open(config_path) as f: - try: - config = json.load(f, - object_pairs_hook=detect_duplicate_keys) - self.observer.import_resolved(config, config_path) - for i in config.get("imports", []): - if i not in imported: - import_queue.append(i) - imported.add(i) - except Exception as e: - import traceback - traceback.print_exc() - sys.stderr.write( - "Failed to parse config %s, error %s\n" % - (config_path, str(e))) - self._errored = True - return None - except IOError, e: - self._errored = True - sys.stderr.write("Failed to read package '%s' from '%s'.\n" % - (config_name, config_path)) - if "/" not in config_name: - sys.stderr.write(""" -Package names are relative to the root of the source tree but the requested -path did not contain a '/'. Did you mean 'build/gn/%s' instead? - """ % config_name) - return None - return imported - - -class PackageLabelObserver: - def __init__(self): - self.json_result = { - 'targets': [], - 'data_deps': [], - 'host_tests': [], - 'files_read': [], - } - - def import_resolved(self, config, config_path): - self.json_result['targets'] += config.get('packages', []) - self.json_result['data_deps'] += config.get('labels', []) - self.json_result['host_tests'] += config.get('host_tests', []) - self.json_result['files_read'].append(config_path) - - -def main(): - parser = argparse.ArgumentParser(description=''' -Determine labels and Fuchsia packages included in the current build. -''') - parser.add_argument('--packages', - help='JSON list of packages', - required=True) - args = parser.parse_args() - - observer = PackageLabelObserver() - imports_resolver = PackageImportsResolver(observer) - imported = imports_resolver.resolve_imports(json.loads(args.packages)) - - if imported == None: - return 1 - - json.dump(observer.json_result, sys.stdout, sort_keys=True) - - return 0 - -if __name__ == "__main__": - sys.exit(main())
diff --git a/gn/preprocess_products.py b/gn/preprocess_products.py deleted file mode 100755 index 57297fc..0000000 --- a/gn/preprocess_products.py +++ /dev/null
@@ -1,132 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os.path -import paths -import sys -from prepreprocess_build_packages import PackageImportsResolver, PackageLabelObserver - -def parse_product(product, build_packages): - """ - product - a path to a JSON product file to parse - build_packages - a dict that collects merged sets - """ - product = os.path.join(paths.FUCHSIA_ROOT, product) - build_packages["files_read"].add(product) - - with open(product) as f: - for k, v in json.load(f).items(): - if k == "monolith": - build_packages[k].update(v) - continue - if k == "preinstall": - build_packages[k].update(v) - continue - if k == "available": - build_packages[k].update(v) - continue - sys.stderr.write("Invalid product key in %s: %s\n" % (product, k)) - - -def preprocess_packages(packages): - observer = PackageLabelObserver() - imports_resolver = PackageImportsResolver(observer) - imported = imports_resolver.resolve_imports(packages) - - if imports_resolver.errored(): - raise ImportError - - if imported == None: - return None - - return observer.json_result - - -def main(): - parser = argparse.ArgumentParser(description=""" -Merge a list of product definitions to unique lists of GN labels: - -monolith - the list of packages included in the base system images -preinstall - the list of packages preinstall, but not part of OTA -available - the list of packages installable and updatable -host_tests - host tests collected from all above package sets -data_deps - additional labels to build, such as host tools -files_read - a list of files used to compute all of the above -""") - parser.add_argument("--monolith", - help="List of package definitions for the monolith", - required=True) - parser.add_argument("--preinstall", - help="List of package definitions for preinstalled packages", - required=True) - parser.add_argument("--available", - help="List of package definitions for available packages", - required=True) - parser.add_argument("--legacy-products", - help="List of legacy product definitions", - required=False) - args = parser.parse_args() - - build_packages = { - "monolith": set(), - "preinstall": set(), - "available": set(), - "files_read": set(), - } - - - # Parse monolith, preinstall, and available sets. - build_packages["monolith"].update(json.loads(args.monolith)) - build_packages["preinstall"].update(json.loads(args.preinstall)) - build_packages["available"].update(json.loads(args.available)) - - # Merge in the legacy product configurations, if set - [parse_product(product, build_packages) for product in - json.loads(args.legacy_products)] - - try: - monolith_results = preprocess_packages(list(build_packages["monolith"])) - preinstall_results = preprocess_packages(list(build_packages["preinstall"])) - available_results = preprocess_packages(list(build_packages["available"])) - except ImportError: - return 1 - - host_tests = set() - data_deps = set() - for res in (monolith_results, preinstall_results, available_results): - if res is None: - continue - if res["host_tests"]: - host_tests.update(res["host_tests"]) - if res["data_deps"]: - data_deps.update(res["data_deps"]) - if res["files_read"]: - build_packages["files_read"].update(res["files_read"]) - - monolith_targets = set(monolith_results["targets"] if monolith_results else ()) - preinstall_targets = set(preinstall_results["targets"] if preinstall_results else ()) - available_targets = set(available_results["targets"] if available_results else ()) - - # preinstall_targets must not include monolith targets - preinstall_targets -= monolith_targets - - # available_targets must include monolith and preinstall targets - available_targets |= monolith_targets | preinstall_targets - - print(json.dumps({ - "monolith": list(monolith_targets), - "preinstall": list(preinstall_targets), - "available": list(available_targets), - "host_tests": list(host_tests), - "data_deps": list(data_deps), - "files_read": list(build_packages["files_read"]), - })) - - return 0 - -if __name__ == "__main__": - sys.exit(main())
diff --git a/gn/write_package_json.py b/gn/write_package_json.py deleted file mode 100755 index 7f90a5d..0000000 --- a/gn/write_package_json.py +++ /dev/null
@@ -1,25 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import sys - - -def main(): - parser = argparse.ArgumentParser('Write a package file') - parser.add_argument('--name', help='Package name', required=True) - parser.add_argument('--version', help='Package version', required=True) - parser.add_argument('path', help='Path to the package file') - args = parser.parse_args() - - with open(args.path, 'w') as f: - json.dump({'name': args.name, 'version': args.version}, f) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/gn_helpers.py b/gn_helpers.py deleted file mode 100644 index 1beee6f..0000000 --- a/gn_helpers.py +++ /dev/null
@@ -1,351 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Helper functions useful when writing scripts that integrate with GN. - -The main functions are ToGNString and FromGNString which convert between -serialized GN veriables and Python variables. - -To use in a random python file in the build: - - import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), - os.pardir, os.pardir, "build")) - import gn_helpers - -Where the sequence of parameters to join is the relative path from your source -file to the build directory.""" - -class GNException(Exception): - pass - - -def ToGNString(value, allow_dicts = True): - """Returns a stringified GN equivalent of the Python value. - - allow_dicts indicates if this function will allow converting dictionaries - to GN scopes. This is only possible at the top level, you can't nest a - GN scope in a list, so this should be set to False for recursive calls.""" - if isinstance(value, basestring): - if value.find('\n') >= 0: - raise GNException("Trying to print a string with a newline in it.") - return '"' + \ - value.replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$') + \ - '"' - - if isinstance(value, unicode): - return ToGNString(value.encode('utf-8')) - - if isinstance(value, bool): - if value: - return "true" - return "false" - - if isinstance(value, list): - return '[ %s ]' % ', '.join(ToGNString(v) for v in value) - - if isinstance(value, dict): - if not allow_dicts: - raise GNException("Attempting to recursively print a dictionary.") - result = "" - for key in sorted(value): - if not isinstance(key, basestring): - raise GNException("Dictionary key is not a string.") - result += "%s = %s\n" % (key, ToGNString(value[key], False)) - return result - - if isinstance(value, int): - return str(value) - - raise GNException("Unsupported type when printing to GN.") - - -def FromGNString(input_string): - """Converts the input string from a GN serialized value to Python values. - - For details on supported types see GNValueParser.Parse() below. - - If your GN script did: - something = [ "file1", "file2" ] - args = [ "--values=$something" ] - The command line would look something like: - --values="[ \"file1\", \"file2\" ]" - Which when interpreted as a command line gives the value: - [ "file1", "file2" ] - - You can parse this into a Python list using GN rules with: - input_values = FromGNValues(options.values) - Although the Python 'ast' module will parse many forms of such input, it - will not handle GN escaping properly, nor GN booleans. You should use this - function instead. - - - A NOTE ON STRING HANDLING: - - If you just pass a string on the command line to your Python script, or use - string interpolation on a string variable, the strings will not be quoted: - str = "asdf" - args = [ str, "--value=$str" ] - Will yield the command line: - asdf --value=asdf - The unquoted asdf string will not be valid input to this function, which - accepts only quoted strings like GN scripts. In such cases, you can just use - the Python string literal directly. - - The main use cases for this is for other types, in particular lists. When - using string interpolation on a list (as in the top example) the embedded - strings will be quoted and escaped according to GN rules so the list can be - re-parsed to get the same result.""" - parser = GNValueParser(input_string) - return parser.Parse() - - -def FromGNArgs(input_string): - """Converts a string with a bunch of gn arg assignments into a Python dict. - - Given a whitespace-separated list of - - <ident> = (integer | string | boolean | <list of the former>) - - gn assignments, this returns a Python dict, i.e.: - - FromGNArgs("foo=true\nbar=1\n") -> { 'foo': True, 'bar': 1 }. - - Only simple types and lists supported; variables, structs, calls - and other, more complicated things are not. - - This routine is meant to handle only the simple sorts of values that - arise in parsing --args. - """ - parser = GNValueParser(input_string) - return parser.ParseArgs() - - -def UnescapeGNString(value): - """Given a string with GN escaping, returns the unescaped string. - - Be careful not to feed with input from a Python parsing function like - 'ast' because it will do Python unescaping, which will be incorrect when - fed into the GN unescaper.""" - result = '' - i = 0 - while i < len(value): - if value[i] == '\\': - if i < len(value) - 1: - next_char = value[i + 1] - if next_char in ('$', '"', '\\'): - # These are the escaped characters GN supports. - result += next_char - i += 1 - else: - # Any other backslash is a literal. - result += '\\' - else: - result += value[i] - i += 1 - return result - - -def _IsDigitOrMinus(char): - return char in "-0123456789" - - -class GNValueParser(object): - """Duplicates GN parsing of values and converts to Python types. - - Normally you would use the wrapper function FromGNValue() below. - - If you expect input as a specific type, you can also call one of the Parse* - functions directly. All functions throw GNException on invalid input. """ - def __init__(self, string): - self.input = string - self.cur = 0 - - def IsDone(self): - return self.cur == len(self.input) - - def ConsumeWhitespace(self): - while not self.IsDone() and self.input[self.cur] in ' \t\n': - self.cur += 1 - - def Parse(self): - """Converts a string representing a printed GN value to the Python type. - - See additional usage notes on FromGNString above. - - - GN booleans ('true', 'false') will be converted to Python booleans. - - - GN numbers ('123') will be converted to Python numbers. - - - GN strings (double-quoted as in '"asdf"') will be converted to Python - strings with GN escaping rules. GN string interpolation (embedded - variables preceded by $) are not supported and will be returned as - literals. - - - GN lists ('[1, "asdf", 3]') will be converted to Python lists. - - - GN scopes ('{ ... }') are not supported.""" - result = self._ParseAllowTrailing() - self.ConsumeWhitespace() - if not self.IsDone(): - raise GNException("Trailing input after parsing:\n " + - self.input[self.cur:]) - return result - - def ParseArgs(self): - """Converts a whitespace-separated list of ident=literals to a dict. - - See additional usage notes on FromGNArgs, above. - """ - d = {} - - self.ConsumeWhitespace() - while not self.IsDone(): - ident = self._ParseIdent() - self.ConsumeWhitespace() - if self.input[self.cur] != '=': - raise GNException("Unexpected token: " + self.input[self.cur:]) - self.cur += 1 - self.ConsumeWhitespace() - val = self._ParseAllowTrailing() - self.ConsumeWhitespace() - d[ident] = val - - return d - - def _ParseAllowTrailing(self): - """Internal version of Parse that doesn't check for trailing stuff.""" - self.ConsumeWhitespace() - if self.IsDone(): - raise GNException("Expected input to parse.") - - next_char = self.input[self.cur] - if next_char == '[': - return self.ParseList() - elif _IsDigitOrMinus(next_char): - return self.ParseNumber() - elif next_char == '"': - return self.ParseString() - elif self._ConstantFollows('true'): - return True - elif self._ConstantFollows('false'): - return False - else: - raise GNException("Unexpected token: " + self.input[self.cur:]) - - def _ParseIdent(self): - ident = '' - - next_char = self.input[self.cur] - if not next_char.isalpha() and not next_char=='_': - raise GNException("Expected an identifier: " + self.input[self.cur:]) - - ident += next_char - self.cur += 1 - - next_char = self.input[self.cur] - while next_char.isalpha() or next_char.isdigit() or next_char=='_': - ident += next_char - self.cur += 1 - next_char = self.input[self.cur] - - return ident - - def ParseNumber(self): - self.ConsumeWhitespace() - if self.IsDone(): - raise GNException('Expected number but got nothing.') - - begin = self.cur - - # The first character can include a negative sign. - if not self.IsDone() and _IsDigitOrMinus(self.input[self.cur]): - self.cur += 1 - while not self.IsDone() and self.input[self.cur].isdigit(): - self.cur += 1 - - number_string = self.input[begin:self.cur] - if not len(number_string) or number_string == '-': - raise GNException("Not a valid number.") - return int(number_string) - - def ParseString(self): - self.ConsumeWhitespace() - if self.IsDone(): - raise GNException('Expected string but got nothing.') - - if self.input[self.cur] != '"': - raise GNException('Expected string beginning in a " but got:\n ' + - self.input[self.cur:]) - self.cur += 1 # Skip over quote. - - begin = self.cur - while not self.IsDone() and self.input[self.cur] != '"': - if self.input[self.cur] == '\\': - self.cur += 1 # Skip over the backslash. - if self.IsDone(): - raise GNException("String ends in a backslash in:\n " + - self.input) - self.cur += 1 - - if self.IsDone(): - raise GNException('Unterminated string:\n ' + self.input[begin:]) - - end = self.cur - self.cur += 1 # Consume trailing ". - - return UnescapeGNString(self.input[begin:end]) - - def ParseList(self): - self.ConsumeWhitespace() - if self.IsDone(): - raise GNException('Expected list but got nothing.') - - # Skip over opening '['. - if self.input[self.cur] != '[': - raise GNException("Expected [ for list but got:\n " + - self.input[self.cur:]) - self.cur += 1 - self.ConsumeWhitespace() - if self.IsDone(): - raise GNException("Unterminated list:\n " + self.input) - - list_result = [] - previous_had_trailing_comma = True - while not self.IsDone(): - if self.input[self.cur] == ']': - self.cur += 1 # Skip over ']'. - return list_result - - if not previous_had_trailing_comma: - raise GNException("List items not separated by comma.") - - list_result += [ self._ParseAllowTrailing() ] - self.ConsumeWhitespace() - if self.IsDone(): - break - - # Consume comma if there is one. - previous_had_trailing_comma = self.input[self.cur] == ',' - if previous_had_trailing_comma: - # Consume comma. - self.cur += 1 - self.ConsumeWhitespace() - - raise GNException("Unterminated list:\n " + self.input) - - def _ConstantFollows(self, constant): - """Returns true if the given constant follows immediately at the current - location in the input. If it does, the text is consumed and the function - returns true. Otherwise, returns false and the current position is - unchanged.""" - end = self.cur + len(constant) - if end > len(self.input): - return False # Not enough room. - if self.input[self.cur:end] == constant: - self.cur = end - return True - return False
diff --git a/gn_run_binary.sh b/gn_run_binary.sh deleted file mode 100755 index ae932cc..0000000 --- a/gn_run_binary.sh +++ /dev/null
@@ -1,32 +0,0 @@ -#!/bin/sh - -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Helper script to run an arbitrary binary produced by the current build. -# The first argument is the bin directory of the toolchain, where -# llvm-symbolizer can be found. The second argument is the binary to run, -# and remaining arguments are passed to that binary. - -clang_bindir="$1" -shift - -binary="$1" -shift - -case "$binary" in -/*) ;; -*) binary="./$binary" ;; -esac - -# Make sure any sanitizer runtimes that might be included in the binary -# can find llvm-symbolizer. -symbolizer="${clang_bindir}/llvm-symbolizer" -export ASAN_SYMBOLIZER_PATH="$symbolizer" -export LSAN_SYMBOLIZER_PATH="$symbolizer" -export MSAN_SYMBOLIZER_PATH="$symbolizer" -export UBSAN_SYMBOLIZER_PATH="$symbolizer" -export TSAN_OPTIONS="$TSAN_OPTIONS external_symbolizer_path=$symbolizer" - -exec "$binary" ${1+"$@"}
diff --git a/go/BUILD.gn b/go/BUILD.gn deleted file mode 100644 index a7102d1..0000000 --- a/go/BUILD.gn +++ /dev/null
@@ -1,19 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -# A toolchain dedicated to processing Go code. -# The only targets in this toolchain are action() targets, so it -# has no real tools. But every toolchain needs stamp and copy. -toolchain("gopher") { - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } -}
diff --git a/go/build.py b/go/build.py deleted file mode 100755 index e892d3b..0000000 --- a/go/build.py +++ /dev/null
@@ -1,187 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Build script for a Go app. - -import argparse -import os -import subprocess -import sys -import string -import shutil -import errno - -from gen_library_metadata import get_sources - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--godepfile', help='Path to godepfile tool', required=True) - parser.add_argument('--root-out-dir', help='Path to root of build output', - required=True) - parser.add_argument('--sysroot', help='The sysroot to use', - required=False) - parser.add_argument('--depfile', help='The path to the depfile', - required=True) - parser.add_argument('--current-cpu', help='Target architecture.', - choices=['x64', 'arm64'], required=True) - parser.add_argument('--current-os', help='Target operating system.', - choices=['fuchsia', 'linux', 'mac', 'win'], required=True) - parser.add_argument('--go-root', help='The go root to use for builds.', required=True) - parser.add_argument('--go-cache', help='Cache directory to use for builds.', - required=False) - parser.add_argument('--is-test', help='True if the target is a go test', - default=False) - parser.add_argument('--go-dep-files', - help='List of files describing library dependencies', - nargs='*', - default=[]) - parser.add_argument('--binname', help='Output file', required=True) - parser.add_argument('--unstripped-binname', help='Unstripped output file') - parser.add_argument('--toolchain-prefix', help='Path to toolchain binaries', - required=False) - parser.add_argument('--verbose', help='Tell the go tool to be verbose about what it is doing', - action='store_true') - parser.add_argument('--package', help='The package name', required=True) - parser.add_argument('--shared-libs-root', help='Path to the build shared libraries', - required=False) - parser.add_argument('--fdio-include', help='Path to the FDIO include directory', - required=False) - parser.add_argument('--vet', help='Run go vet', - action='store_true') - args = parser.parse_args() - - try: - os.makedirs(args.go_cache) - except OSError as e: - if e.errno == errno.EEXIST and os.path.isdir(args.go_cache): - pass - else: - raise - - goarch = { - 'x64': 'amd64', - 'arm64': 'arm64', - }[args.current_cpu] - goos = { - 'fuchsia': 'fuchsia', - 'linux': 'linux', - 'mac': 'darwin', - 'win': 'windows', - }[args.current_os] - - output_name = os.path.join(args.root_out_dir, args.binname) - build_id_dir = os.path.join(args.root_out_dir, '.build-id') - depfile_output = output_name - if args.unstripped_binname: - stripped_output_name = output_name - output_name = os.path.join(args.root_out_dir, 'exe.unstripped', - args.binname) - - # Project path is a package specific gopath, also known as a "project" in go parlance. - project_path = os.path.join(args.root_out_dir, 'gen', 'gopaths', args.binname) - - # Clean up any old project path to avoid leaking old dependencies - shutil.rmtree(os.path.join(project_path, 'src'), ignore_errors=True) - os.makedirs(os.path.join(project_path, 'src')) - - if args.go_dep_files: - # Create a gopath for the packages dependency tree - for dst, src in get_sources(args.go_dep_files).items(): - dstdir = os.path.join(project_path, 'src', os.path.dirname(dst)) - try: - os.makedirs(dstdir) - except OSError as e: - # EEXIST occurs if two gopath entries share the same parent name - if e.errno != errno.EEXIST: - raise - # TODO(BLD-228): the following check might not be necessary anymore. - tgt = os.path.join(dstdir, os.path.basename(dst)) - # The source tree is effectively read-only once the build begins. - # Therefore it is an error if tgt is in the source tree. At first - # glance this may seem impossible, but it can happen if dst is foo/bar - # and foo is a symlink back to the source tree. - canon_root_out_dir = os.path.realpath(args.root_out_dir) - canon_tgt = os.path.realpath(tgt) - if not canon_tgt.startswith(canon_root_out_dir): - raise ValueError("Dependency destination not in --root-out-dir: provided=%s, path=%s, realpath=%s" % (dst, tgt, canon_tgt)) - os.symlink(os.path.relpath(src, os.path.dirname(tgt)), tgt) - - gopath = os.path.abspath(project_path) - build_goroot = os.path.abspath(args.go_root) - - env = {} - env['GOARCH'] = goarch - env['GOOS'] = goos - env['GOPATH'] = gopath - # Some users have GOROOT set in their parent environment, which can break - # things, so it is always set explicitly here. - env['GOROOT'] = build_goroot - env['GOCACHE'] = args.go_cache - env['CGO_CFLAGS'] = "--sysroot=" + args.sysroot - - if goos == 'fuchsia': - env['CGO_ENABLED'] = '1' - env['CC'] = os.path.join(build_goroot, 'misc', 'fuchsia', 'clangwrap.sh') - - # These are used by clangwrap.sh - env['FUCHSIA_SHARED_LIBS'] = args.shared_libs_root - env['CLANG_PREFIX'] = args.toolchain_prefix - env['FDIO_INCLUDE'] = args.fdio_include - env['ZIRCON_SYSROOT'] = args.sysroot - - # /usr/bin:/bin are required for basic things like bash(1) and env(1), but - # preference the toolchain path. Note that on Mac, ld is also found from - # /usr/bin. - env['PATH'] = args.toolchain_prefix + ":/usr/bin:/bin" - - go_tool = os.path.join(build_goroot, 'bin/go') - - if args.vet: - retcode = subprocess.call([go_tool, 'vet', args.package], env=env) - if retcode != 0: - return retcode - - cmd = [go_tool] - if args.is_test: - cmd += ['test', '-c'] - else: - cmd += ['build'] - if args.verbose: - cmd += ['-x'] - cmd += ['-pkgdir', os.path.join(project_path, 'pkg'), '-o', - output_name, args.package] - retcode = subprocess.call(cmd, env=env) - - if retcode == 0 and args.unstripped_binname: - if args.current_os == 'mac': - retcode = subprocess.call(['xcrun', 'strip', '-x', output_name, - '-o', stripped_output_name], - env=env) - else: - retcode = subprocess.call([os.path.join(args.toolchain_prefix, - 'llvm-objcopy'), - '--strip-sections', - '--build-id-link-dir=%s' % build_id_dir, - '--build-id-link-input=.debug', - '--build-id-link-output=', - output_name, - stripped_output_name], - env=env) - - if retcode == 0: - if args.depfile is not None: - with open(args.depfile, "wb") as out: - godepfile_args = [args.godepfile, '-o', depfile_output] - if args.is_test: - godepfile_args += [ '-test'] - godepfile_args += [args.package] - subprocess.Popen(godepfile_args, stdout=out, env=env) - - return retcode - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/go/fidl_go.gni b/go/fidl_go.gni deleted file mode 100644 index 4fb36fd..0000000 --- a/go/fidl_go.gni +++ /dev/null
@@ -1,84 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") -import("//build/go/go_library.gni") -import("//build/go/toolchain.gni") - -# Generates some Go bindings for a FIDL library. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# - name. - -template("fidl_go") { - assert(current_toolchain == go_toolchain, - "This template can only be used in $go_toolchain.") - - not_needed(invoker, [ "sources" ]) - - main_target_name = target_name - generation_target_name = "${target_name}_go_generate" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - fidl_target_gen_dir = - get_label_info(":$target_name($fidl_toolchain)", "target_gen_dir") - file_stem = "$fidl_target_gen_dir/$library_name.fidl" - json_representation = "$fidl_target_gen_dir/$target_name.fidl.json" - - compiled_action(generation_target_name) { - visibility = [ ":*" ] - - tool = "//garnet/go/src/fidl:fidlgen" - - inputs = [ - json_representation, - ] - - outputs = [ - "$file_stem/impl.go", - "$file_stem/pkg_name", - ] - - args = [ - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(file_stem, root_build_dir), - "--include-base", - rebase_path(root_gen_dir, root_build_dir), - "--generators", - "go", - ] - - deps = [ - ":$main_target_name($fidl_toolchain)", - ] - } - - go_library(main_target_name) { - name_file = "$file_stem/pkg_name" - - source_dir = file_stem - - sources = [ - "impl.go", - ] - - non_go_deps = [ ":$generation_target_name" ] - - deps = [] - if (defined(invoker.deps)) { - deps += invoker.deps - } - if (defined(invoker.public_deps)) { - deps += invoker.public_deps - } - } -}
diff --git a/go/gen_library_metadata.py b/go/gen_library_metadata.py deleted file mode 100755 index 325c82d..0000000 --- a/go/gen_library_metadata.py +++ /dev/null
@@ -1,95 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - - -class Source(object): - - def __init__(self, name, path, file): - self.name = name - self.path = path - self.file = file - - def __str__(self): - return '%s[%s]' % (self.name, self.path) - - def __hash__(self): - return hash((self.name, self.path)) - - def __eq__(self, other): - return self.name == other.name and self.path == other.path - - -def get_sources(dep_files, extra_sources=None): - # Aggregate source data from dependencies. - sources = set() - if extra_sources: - sources.update(extra_sources) - for dep in dep_files: - with open(dep, 'r') as dep_file: - for name, path in json.load(dep_file).iteritems(): - sources.add(Source(name, path, dep)) - - # Verify duplicates. - sources_by_name = {} - for src in sources: - sources_by_name.setdefault(src.name, []).append(src) - for name, srcs in sources_by_name.iteritems(): - if len(srcs) <= 1: - continue - print('Error: source "%s" has multiple paths.' % name) - for src in srcs: - print(' - %s (%s)' % (src.path, src.file)) - raise Exception('Could not aggregate sources') - - return dict([(s.name, s.path) for s in sources]) - - -def main(): - parser = argparse.ArgumentParser() - name_group = parser.add_mutually_exclusive_group(required=True) - name_group.add_argument('--name', - help='Name of the current library') - name_group.add_argument('--name-file', - help='Path to a file containing the name of the current library') - parser.add_argument('--source-dir', - help='Path to the library\'s source directory', - required=True) - parser.add_argument('--sources', - help='List of source files', - nargs='*') - parser.add_argument('--output', - help='Path to the file to generate', - required=True) - parser.add_argument('--deps', - help='Dependencies of the current library', - nargs='*') - args = parser.parse_args() - if args.name: - name = args.name - elif args.name_file: - with open(args.name_file, 'r') as name_file: - name = name_file.read() - - current_sources = [] - if args.sources: - # TODO(BLD-228): verify that the sources are in a single folder. - for source in args.sources: - current_sources.append(Source(os.path.join(name, source), - os.path.join(args.source_dir, source), - args.output)) - else: - current_sources.append(Source(name, args.source_dir, args.output)) - result = get_sources(args.deps, extra_sources=current_sources) - with open(args.output, 'w') as output_file: - json.dump(result, output_file, indent=2, sort_keys=True) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/go/go_binary.gni b/go/go_binary.gni deleted file mode 100644 index 5c84c91..0000000 --- a/go/go_binary.gni +++ /dev/null
@@ -1,24 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/go/go_build.gni") - -# A template for an action that creates a Fuchsia Go binary. -# -# Parameters -# -# sdk_category (optional) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# sdk_deps (optional) -# List of labels representing elements that should be added to SDKs -# alongside the present binary. -# Labels in the list must represent SDK-ready targets. - -template("go_binary") { - go_build(target_name) { - forward_variables_from(invoker, "*") - } -}
diff --git a/go/go_build.gni b/go/go_build.gni deleted file mode 100644 index 28f9c1b..0000000 --- a/go/go_build.gni +++ /dev/null
@@ -1,207 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/sysroot.gni") -import("//build/host.gni") -import("//build/sdk/sdk_atom.gni") -import("//build/testing/test_spec.gni") - -declare_args() { - # gocache_dir - # Directory GOCACHE environment variable will be set to. This directory - # will have build and test results cached, and is safe to be written to - # concurrently. If overridden, this directory must be a full path. - gocache_dir = rebase_path("$root_out_dir/.gocache") - - # go_vet_enabled - # [bool] if false, go vet invocations are disabled for all builds. - go_vet_enabled = false -} - -# A template for an action that builds a Go binary. Users should instead use the -# go_binary or go_test rules. -# -# Parameters -# -# sdk_category (optional) -# Publication level of the library in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# deps (optional) -# List of labels representing go_library targets this target depends on. -# -# non_go_deps (optional) -# List of labels this target depends on that are not Go libraries. -# -# skip_vet (optional) -# Whether to skip running go vet for this target. This flag should _only_ -# be used for packages in the Go source tree itself that otherwise match -# whitelist entries in go vet all. Go vet is only run if go_vet_enabled is -# true. - -template("go_build") { - assert(defined(invoker.gopackage), - "gopackage must be defined for $target_name") - - main_target_name = target_name - - output_name = target_name - if (defined(invoker.output_name)) { - output_name = invoker.output_name - } - output_path = "${root_out_dir}/${output_name}" - - action(main_target_name) { - deps = [] - if (defined(invoker.non_go_deps)) { - deps += invoker.non_go_deps - } - - use_strip = is_fuchsia - - outputs = [ - output_path, - ] - - if (use_strip) { - unstripped_output_path = "${root_out_dir}/exe.unstripped/${output_name}" - outputs += [ unstripped_output_path ] - } - - script = "//build/go/build.py" - depfile = "${output_path}.d" - - sources = [ - "//build/go/gen_library_metadata.py", - ] - - godepfile = "//buildtools/${host_platform}/godepfile" - inputs = [ - godepfile, - ] - - args = [ - "--godepfile", - rebase_path(godepfile, "", root_build_dir), - "--root-out-dir", - rebase_path(root_out_dir, root_build_dir), - "--depfile", - rebase_path(depfile), - "--current-cpu", - current_cpu, - "--current-os", - current_os, - "--binname", - output_name, - "--toolchain-prefix", - rebase_path(clang_prefix, "", root_build_dir), - "--shared-libs-root", - rebase_path( - get_label_info("//default($shlib_toolchain)", "root_out_dir")), - "--sysroot", - sysroot, - "--go-cache", - gocache_dir, - ] - - if (defined(invoker.skip_vet) && !invoker.skip_vet && go_vet_enabled) { - args += [ "--vet" ] - } - - if (is_fuchsia) { - deps += [ "//third_party/go:go_runtime" ] - - deps += [ - "//garnet/public/sdk:zircon_sysroot_export", - "//zircon/public/lib/fdio", - ] - - # GN provides no way to propagate include paths like this, so, this is brittle: - fdio_include = rebase_path("//zircon/system/ulib/fdio/include") - - args += [ - "--fdio-include", - fdio_include, - "--go-root", - rebase_path("$host_tools_dir/goroot"), - ] - } else { - args += [ - "--go-root", - rebase_path("//buildtools/${host_platform}/go"), - ] - } - - if (use_strip) { - args += [ - "--unstripped-binname", - "exe.unstripped/${output_name}", - ] - } - - if (defined(invoker.test) && invoker.test) { - args += [ "--is-test=true" ] - } - - if (defined(invoker.deps)) { - deps += invoker.deps - args += [ "--go-dep-files" ] - foreach(dep, invoker.deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - args += [ rebase_path("$gen_dir/$name.go_deps") ] - } - } - - args += [ - "--package", - invoker.gopackage, - ] - } - - # For linux and mac tests, record metadata for testing instruction. - if (is_linux || is_mac) { - test_spec("${target_name}_spec") { - name = invoker.target_name - location = output_path - } - } - - # Allow host binaries to be published in SDKs. - if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded" && - !is_fuchsia && (!defined(invoker.test) || !invoker.test)) { - file_base = "tools/$output_name" - - sdk_atom("${target_name}_sdk") { - id = "sdk://tools/$output_name" - - category = invoker.sdk_category - - meta = { - dest = "$file_base-meta.json" - schema = "host_tool" - value = { - type = "host_tool" - name = output_name - root = "tools" - files = [ file_base ] - } - } - - files = [ - { - source = output_path - dest = file_base - }, - ] - - if (defined(invoker.sdk_deps)) { - deps = invoker.sdk_deps - } - - non_sdk_deps = [ ":$main_target_name" ] - } - } -}
diff --git a/go/go_library.gni b/go/go_library.gni deleted file mode 100644 index 042f7ac..0000000 --- a/go/go_library.gni +++ /dev/null
@@ -1,104 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Defines a set of Go code that can be used by other Go targets -# -# Parameters -# -# name (optional) -# Name of the Go package. -# Defaults to the target name. -# -# name_file (optional) -# Path to a file containing the name of the Go package.. -# This should be used when the package's name requires some computation in -# its own build target. -# -# NOTE: Exactly one of `name` or `name_file` may be set, but not both. -# If neither is set, then the target name is used. -# -# source_dir (optional) -# Path to the root of the sources for the package. -# Defaults to the current directory. -# -# sources (optional) -# List of source files, relative to source_dir. -# TODO(BLD-228): make this attribute required. -# -# deps (optional) -# List of labels for Go libraries this target depends on. -# -# non_go_deps (optional) -# List of labels for non-Go targets this library depends on. - -template("go_library") { - assert(!(defined(invoker.name) && defined(invoker.name_file)), - "Defining both name and name_file is not allowed") - if (defined(invoker.name)) { - name_args = [ - "--name", - invoker.name, - ] - } else if (defined(invoker.name_file)) { - # Make name_file a system-absolute path and add it to args. - name_args = [ - "--name-file", - rebase_path(invoker.name_file, ""), - ] - } else { - name_args = [ - "--name", - target_name, - ] - } - - source_dir = "." - if (defined(invoker.source_dir)) { - source_dir = invoker.source_dir - } - - go_sources = [] - if (defined(invoker.sources)) { - go_sources = invoker.sources - } - - action(target_name) { - script = "//build/go/gen_library_metadata.py" - - library_file = "$target_gen_dir/$target_name.go_deps" - - outputs = [ - library_file, - ] - - deps = [] - dependent_libraries = [] - - if (defined(invoker.deps)) { - deps += invoker.deps - foreach(dep, invoker.deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - dependent_libraries += [ "$gen_dir/$name.go_deps" ] - } - } - - if (defined(invoker.non_go_deps)) { - deps += invoker.non_go_deps - } - - inputs = dependent_libraries - - args = name_args + [ - "--source-dir", - rebase_path(source_dir), - "--sources", - ] + go_sources + - [ - "--output", - rebase_path(library_file), - "--deps", - ] + rebase_path(dependent_libraries) - } -}
diff --git a/go/go_test.gni b/go/go_test.gni deleted file mode 100644 index 147c692..0000000 --- a/go/go_test.gni +++ /dev/null
@@ -1,14 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# A template for an action that creates a Fuchsia Go test binary. - -import("//build/go/go_build.gni") - -template("go_test") { - go_build(target_name) { - forward_variables_from(invoker, "*") - test = true - } -}
diff --git a/go/toolchain.gni b/go/toolchain.gni deleted file mode 100644 index 5f33282..0000000 --- a/go/toolchain.gni +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -go_toolchain = "//build/go:gopher"
diff --git a/gypi_to_gn.py b/gypi_to_gn.py deleted file mode 100755 index bbb05b1..0000000 --- a/gypi_to_gn.py +++ /dev/null
@@ -1,172 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Converts a given gypi file to a python scope and writes the result to stdout. - -HOW TO USE - -It is assumed that the file contains a toplevel dictionary, and this script -will return that dictionary as a GN "scope" (see example below). This script -does not know anything about GYP and it will not expand variables or execute -conditions. - -It will strip conditions blocks. - -A variables block at the top level will be flattened so that the variables -appear in the root dictionary. This way they can be returned to the GN code. - -Say your_file.gypi looked like this: - { - 'sources': [ 'a.cc', 'b.cc' ], - 'defines': [ 'ENABLE_DOOM_MELON' ], - } - -You would call it like this: - gypi_values = exec_script("//build/gypi_to_gn.py", - [ rebase_path("your_file.gypi") ], - "scope", - [ "your_file.gypi" ]) - -Notes: - - The rebase_path call converts the gypi file from being relative to the - current build file to being system absolute for calling the script, which - will have a different current directory than this file. - - - The "scope" parameter tells GN to interpret the result as a series of GN - variable assignments. - - - The last file argument to exec_script tells GN that the given file is a - dependency of the build so Ninja can automatically re-run GN if the file - changes. - -Read the values into a target like this: - component("mycomponent") { - sources = gypi_values.sources - defines = gypi_values.defines - } - -Sometimes your .gypi file will include paths relative to a different -directory than the current .gn file. In this case, you can rebase them to -be relative to the current directory. - sources = rebase_path(gypi_values.sources, ".", - "//path/gypi/input/values/are/relative/to") - -This script will tolerate a 'variables' in the toplevel dictionary or not. If -the toplevel dictionary just contains one item called 'variables', it will be -collapsed away and the result will be the contents of that dictinoary. Some -.gypi files are written with or without this, depending on how they expect to -be embedded into a .gyp file. - -This script also has the ability to replace certain substrings in the input. -Generally this is used to emulate GYP variable expansion. If you passed the -argument "--replace=<(foo)=bar" then all instances of "<(foo)" in strings in -the input will be replaced with "bar": - - gypi_values = exec_script("//build/gypi_to_gn.py", - [ rebase_path("your_file.gypi"), - "--replace=<(foo)=bar"], - "scope", - [ "your_file.gypi" ]) - -""" - -import gn_helpers -from optparse import OptionParser -import sys - -def LoadPythonDictionary(path): - file_string = open(path).read() - try: - file_data = eval(file_string, {'__builtins__': None}, None) - except SyntaxError, e: - e.filename = path - raise - except Exception, e: - raise Exception("Unexpected error while reading %s: %s" % (path, str(e))) - - assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path - - # Flatten any variables to the top level. - if 'variables' in file_data: - file_data.update(file_data['variables']) - del file_data['variables'] - - # Strip all elements that this script can't process. - elements_to_strip = [ - 'conditions', - 'target_conditions', - 'target_defaults', - 'targets', - 'includes', - 'actions', - ] - for element in elements_to_strip: - if element in file_data: - del file_data[element] - - return file_data - - -def ReplaceSubstrings(values, search_for, replace_with): - """Recursively replaces substrings in a value. - - Replaces all substrings of the "search_for" with "repace_with" for all - strings occurring in "values". This is done by recursively iterating into - lists as well as the keys and values of dictionaries.""" - if isinstance(values, str): - return values.replace(search_for, replace_with) - - if isinstance(values, list): - return [ReplaceSubstrings(v, search_for, replace_with) for v in values] - - if isinstance(values, dict): - # For dictionaries, do the search for both the key and values. - result = {} - for key, value in values.items(): - new_key = ReplaceSubstrings(key, search_for, replace_with) - new_value = ReplaceSubstrings(value, search_for, replace_with) - result[new_key] = new_value - return result - - # Assume everything else is unchanged. - return values - -def main(): - parser = OptionParser() - parser.add_option("-r", "--replace", action="append", - help="Replaces substrings. If passed a=b, replaces all substrs a with b.") - (options, args) = parser.parse_args() - - if len(args) != 1: - raise Exception("Need one argument which is the .gypi file to read.") - - data = LoadPythonDictionary(args[0]) - if options.replace: - # Do replacements for all specified patterns. - for replace in options.replace: - split = replace.split('=') - # Allow "foo=" to replace with nothing. - if len(split) == 1: - split.append('') - assert len(split) == 2, "Replacement must be of the form 'key=value'." - data = ReplaceSubstrings(data, split[0], split[1]) - - # Sometimes .gypi files use the GYP syntax with percents at the end of the - # variable name (to indicate not to overwrite a previously-defined value): - # 'foo%': 'bar', - # Convert these to regular variables. - for key in data: - if len(key) > 1 and key[len(key) - 1] == '%': - data[key[:-1]] = data[key] - del data[key] - - print gn_helpers.ToGNString(data) - -if __name__ == '__main__': - try: - main() - except Exception, e: - print str(e) - sys.exit(1)
diff --git a/host.gni b/host.gni deleted file mode 100644 index 559a23d..0000000 --- a/host.gni +++ /dev/null
@@ -1,94 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # This is the directory where host tools intended for manual use by - # developers get installed. It's something a developer might put - # into their shell's $PATH. Host tools that are just needed as part - # of the build do not get copied here. This directory is only for - # things that are generally useful for testing or debugging or - # whatnot outside of the GN build itself. These are only installed - # by an explicit install_host_tools() rule (see //build/host.gni). - host_tools_dir = "$root_build_dir/tools" -} - -# This declares that a host tool (a target built in host_toolchain) -# should be installed in host_tools_dir. This target can be used in -# any toolchain, and it will forward to host_toolchain. -# -# Parameters -# -# outputs (required) -# [files list] Simple file name of each tool, should be the -# same as the output_name in the executable() or similar rule -# (which is usually just that target's name). -# -# deps (recommended) -# [label list] Should list each target that actually builds each output. -# It does not need to use explicit toolchain suffixes; the only target -# using the deps will be instantiated only in host_toolchain. -# -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# executable("frob") { ... } -# install_host_tools("fiddlers") { -# deps = [ ":frob", "//some/other/dir:twiddle" ] -# outputs = [ "frob", "twiddle" ] -# } -template("install_host_tools") { - assert(defined(invoker.outputs), "install_host_tools() must define outputs") - - # There is more than one host_toolchain when variants are involved, - # but all those copy their executables to the base host_toolchain - # (which toolchain_variant.base points to in every host_toolchain). - if (current_toolchain == host_toolchain && - current_toolchain == toolchain_variant.base) { - copy(target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - if (defined(visibility)) { - visibility += [ ":$target_name" ] - } - outputs = [ - "$host_tools_dir/{{source_file_part}}", - ] - sources = [] - foreach(output_name, invoker.outputs) { - sources += [ "$root_out_dir/$output_name" ] - } - } - } else { - # Redirect to the base host_toolchain, where the copy rule above is. - # In a variant host_toolchain context, toolchain_variant.base points - # there, while host_toolchain always matches current_toolchain. - group(target_name) { - if (current_toolchain == host_toolchain) { - toolchain = toolchain_variant.base - } else { - toolchain = host_toolchain - } - deps = [ - ":$target_name($toolchain)", - ] - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - not_needed(invoker, - [ - "deps", - "outputs", - ]) - } - } -}
diff --git a/images/BUILD.gn b/images/BUILD.gn deleted file mode 100644 index 7e7a214..0000000 --- a/images/BUILD.gn +++ /dev/null
@@ -1,1679 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/fuchsia/zbi.gni") -import("//build/config/fuchsia/zircon.gni") -import("//build/gn/packages.gni") -import("//build/images/boot.gni") -import("//build/images/custom_signing.gni") -import("//build/images/fvm.gni") -import("//build/images/json.gni") -import("//build/images/manifest.gni") -import("//build/images/max_fvm_size.gni") -import("//build/package.gni") -import("//build/sdk/sdk_atom.gni") -import("//build/sdk/sdk_molecule.gni") -import("//garnet/build/pkgfs.gni") -import("//garnet/go/src/pm/pm.gni") - -declare_args() { - # Groups to include from the Zircon /boot manifest into /boot. - # This is either "all" or a comma-separated list of one or more of: - # core -- necessary to boot - # misc -- utilities in /bin - # test -- test binaries in /bin and /test - zircon_boot_groups = "core" - - # Path to manifest file containing data to place into the initial /data - # partition. - data_partition_manifest = "" -} - -declare_args() { - # Groups to include from the Zircon /boot manifest into /system - # (instead of into /boot like Zircon's own bootdata.bin does). - # Should not include any groups that are also in zircon_boot_groups, - # which see. If zircon_boot_groups is "all" then this should be "". - # **TODO(mcgrathr)**: _Could default to "" for `!is_debug`, or "production - # build". Note including `"test"` here places all of Zircon's tests into - # `/system/test`, which means that Fuchsia bots run those tests too._ - zircon_system_groups = "misc,test" - if (zircon_boot_groups == "all") { - zircon_system_groups = "" - } -} - -if (zircon_boot_groups == "all") { - assert(zircon_system_groups == "", - "zircon_boot_groups already has everything") -} else { - assert(zircon_system_groups != "all" && zircon_system_groups != "core", - "zircon_system_groups cannot include core (or all)") -} - -# This will collect a list of scopes describing each image exported. -# See json.gni. -images = [ - { - sources = [ - "$root_build_dir/args.gn", - ] - json = { - name = "buildargs" - type = "gn" - archive = true - } - deps = [] - }, - { - sources = [ - "//.jiri_root/update_history/latest", - ] - json = { - name = "jiri_snapshot" - type = "xml" - archive = true - } - deps = [] - }, - { - json = { - name = "bootserver" - type = "exe.$host_platform" - archive = true - } - sources = [ - "$zircon_tools_dir/bootserver", - ] - deps = [] - }, -] - -# Write a JSON metadata file about the packages in the build. -_packages_json = { - _all = [] - monolith = [] - foreach(pkg, monolith_packages) { - monolith += [ get_label_info(pkg, "name") ] - _all += [ pkg ] - _all -= [ pkg ] - _all += [ pkg ] - } - preinstall = [] - foreach(pkg, preinstall_packages) { - preinstall += [ get_label_info(pkg, "name") ] - _all += [ pkg ] - _all -= [ pkg ] - _all += [ pkg ] - } - available = [] - foreach(pkg, available_packages) { - available += [ get_label_info(pkg, "name") ] - _all += [ pkg ] - _all -= [ pkg ] - _all += [ pkg ] - } - packages = [] - foreach(pkg, _all) { - packages += [ - { - dir = get_label_info(pkg, "dir") - name = get_label_info(pkg, "name") - build_dir = - rebase_path(get_label_info(pkg, "target_out_dir"), root_build_dir) - }, - ] - } -} -write_file("$root_build_dir/packages.json", - { - forward_variables_from(_packages_json, "*", [ "_all" ]) - }, - "json") - -### -### shell-commands package -### -### TODO(CF-223) -### shell-commands is a Fuchsia package that aggregates all binaries from all -### "available" Fuchsia packages producing "#!resolve URI" trampolines. This -### package is a solution to enable the shell to resolve command line -### programs out of ephemeral packages. - -# create-shell-commands performs two actions: -# - create trampoline scripts ("#!resolve COMMAND-URI") for each command. -# - produce a manifest that contains references to all of the trampolines. -action("create-shell-commands") { - testonly = true - script = "create-shell-commands.py" - outputs = [ - "$target_out_dir/shell-commands-extra.manifest", - ] - args = [ - "--trampoline-dir", - rebase_path(target_out_dir + "/commands", root_build_dir), - "--output-manifest", - rebase_path(outputs[0], root_build_dir), - ] - deps = [] - sources = [] - - foreach(pkg_label, available_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - if (pkg_target_name != "shell-commands") { - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - cmd_rspfile = "$pkg_target_out_dir/${pkg_target_name}.shell_commands.rsp" - deps += [ "${pkg_label}.shell_commands.rsp" ] - sources += [ cmd_rspfile ] - args += [ "@" + rebase_path(cmd_rspfile, root_build_dir) ] - } - } -} - -package("shell-commands") { - testonly = true - extra = get_target_outputs(":create-shell-commands") - deps = [ - ":create-shell-commands", - ] -} - -### -### Fuchsia system image. This aggregates contributions from all the -### package() targets enabled in the build. -### - -pm_binary_label = "//garnet/go/src/pm:pm_bin($host_toolchain)" -pm_out_dir = get_label_info(pm_binary_label, "root_out_dir") -pm_binary = "$pm_out_dir/pm" - -# This just runs `pm -k $system_package_key genkey` if the file doesn't exist. -# Every package() target depends on this. -action("system_package_key_check") { - visibility = [ "*" ] - deps = [ - pm_binary_label, - ] - outputs = [ - "$target_out_dir/system_package_key_check_ok.stamp", - ] - script = "//build/gn_run_binary.sh" - inputs = [ - "system_package_key_check.py", - pm_binary, - ] - args = - [ clang_prefix ] + rebase_path(inputs + outputs + [ system_package_key ]) -} - -# The pkgsvr index is a manifest mapping `package_name/package_version` to -# the merkleroot of the package's meta.far file. -pkgsvr_index = "$target_out_dir/pkgsvr_index" - -action("pkgsvr_index") { - visibility = [ - ":system_image.manifest", - ":update_packages.manifest", - ] - testonly = true - - script = "manifest.py" - args = [ "--contents" ] - outputs = [ - "$target_out_dir/$target_name", - ] - args += [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - foreach(pkg_label, monolith_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.pkgsvr_index.rsp" - deps += [ "${pkg_label}.pkgsvr_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } -} - -# preinstall.manifest is a manifest of files that are a pkgfs "dynamic index" -# populated inside /pkgfs/packages that are {name}/{version} containing the -# merkleroot of the meta.far of that package. -action("preinstall.manifest") { - visibility = [ ":data.blk" ] - testonly = true - - script = "manifest.py" - args = [ "--rewrite=*=pkgfs_index/packages/{target}={source}" ] - outputs = [ - # The output is in the root build dir in order to avoid a complex rewrite - # of the source path. The minfs tool this is passed to interprets source - # locations relative to the manifest. - "$root_build_dir/$target_name", - ] - args += [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - foreach(pkg_label, preinstall_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.pkgsvr_index.rsp" - deps += [ "${pkg_label}.pkgsvr_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } - - update_meta_dir = - get_label_info(":update.meta", "target_out_dir") + "/update.meta" - update_meta_far_merkle = update_meta_dir + "/meta.far.merkle" - args += [ - "--entry", - "update/0=" + rebase_path(update_meta_far_merkle, root_build_dir), - ] - deps += [ ":update.meta" ] -} - -# The /boot and /system manifests have to be generated in concert. Things -# like drivers going into /system can affect what needs to go into /boot. -boot_manifest = "$target_out_dir/boot.manifest" - -# The system_image "package" manifest is everything that appears in /system. -generate_manifest("system_image.manifest") { - visibility = [ ":*" ] - testonly = true - - # Create the /boot manifest that gets packed into BOOTFS in the ZBI. - # /system manifest files can assume that the /boot files are visible at - # runtime, so dependencies already in /boot won't be copied into /system. - bootfs_manifest = boot_manifest - bootfs_zircon_groups = zircon_boot_groups - - # Collect whatever we want from Zircon that didn't go into /boot. - zircon_groups = zircon_system_groups - - # Now each package() target in the build contributes manifest entries. - # For system_image packages, these contain binaries that need their - # references resolved from the auxiliary manifests or /boot (above). - args = [] - deps = [] - sources = [] - foreach(pkg_label, monolith_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_system_rsp = "$pkg_target_out_dir/${pkg_target_name}.system.rsp" - deps += [ pkg_label ] - sources += [ pkg_system_rsp ] - args += [ "@" + rebase_path(pkg_system_rsp, root_build_dir) ] - } - - args += [ "--entry-manifest=" + - get_label_info(":$target_name", "label_no_toolchain") ] - - # Add the meta/package JSON file that makes this the "system_image" package. - json = "system_meta_package.json" - sources += [ json ] - args += [ "--entry=meta/package=" + rebase_path(json, root_build_dir) ] - - # Add the static packages (pkgsvr) index. - deps += [ ":pkgsvr_index" ] - sources += [ pkgsvr_index ] - args += [ "--entry=data/static_packages=" + - rebase_path(pkgsvr_index, root_build_dir) ] -} - -system_manifest_outputs = get_target_outputs(":system_image.manifest") -assert(boot_manifest == system_manifest_outputs[2]) -system_build_id_map = system_manifest_outputs[1] - -# Generate, sign, and seal the system_image package file. -pm_build_package("system_image.meta") { - visibility = [ ":*" ] - testonly = true - manifest = ":system_image.manifest" -} - -# Now generate the blob manifest. This lists all the source files -# that need to go into the blobfs image. That is everything from the -# system_image manifest, everything from each package manifest, and -# all the synthesized meta.far files. -blob_manifest = "$root_build_dir/blob.manifest" - -action("blob.manifest") { - visibility = [ ":*" ] - testonly = true - outputs = [ - blob_manifest, - ] - depfile = blob_manifest + ".d" - deps = [ - ":system_image.meta", - ":update.meta", - ] - inputs = [] - script = "blob_manifest.py" - args = [ "@{{response_file_name}}" ] - - response_file_contents = [ - "--output=" + rebase_path(blob_manifest, root_build_dir), - "--depfile=" + rebase_path(depfile, root_build_dir), - "--input=" + rebase_path("$target_out_dir/system_image.meta/blobs.json", - root_build_dir), - "--input=" + - rebase_path("$target_out_dir/update.meta/blobs.json", root_build_dir), - ] - foreach(pkg_label, monolith_packages + preinstall_packages) { - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_blobs_rsp = "${pkg_target_out_dir}/${pkg_target_name}.blobs.rsp" - deps += [ "${pkg_label}.blobs.rsp" ] - inputs += [ pkg_blobs_rsp ] - response_file_contents += - [ "@" + rebase_path(pkg_blobs_rsp, root_build_dir) ] - } -} - -# Pack up all the blobs! -zircon_tool_action("blob.blk") { - visibility = [ ":*" ] - testonly = true - deps = [ - ":blob.manifest", - ] - blob_image_path = "$target_out_dir/$target_name" - blob_size_list = "$root_build_dir/blob.sizes" - outputs = [ - blob_image_path, - # This should be an output too, but the generate_fvm template assumes that all - # outputs of these actions are inputs to the fvm tool. - # blob_size_list - ] - depfile = blob_image_path + ".d" - inputs = [ - blob_manifest, - ] - tool = "blobfs" - args = [ - "--depfile", - "--sizes", - rebase_path(blob_size_list, root_build_dir), - "--compress", - rebase_path(blob_image_path, root_build_dir), - "create", - "--manifest", - rebase_path(blob_manifest, root_build_dir), - ] -} -images += [ - { - deps = [ - ":blob.blk", - ] - public = [ - "IMAGE_BLOB_RAW", - ] - json = { - name = "blob" - type = "blk" - } - }, -] - -### -### Zircon Boot Images -### - -declare_args() { - # List of arguments to add to /boot/config/devmgr. - # These come after synthesized arguments to configure blobfs and pkgfs. - devmgr_config = [] - - # List of kernel command line arguments to bake into the boot image. - # See also //zircon/docs/kernel_cmdline.md and - # [`devmgr_config`](#devmgr_config). - kernel_cmdline_args = [] - - # Files containing additional kernel command line arguments to bake into - # the boot image. The contents of these files (in order) come after any - # arguments directly in [`kernel_cmdline_args`](#kernel_cmdline_args). - # These can be GN `//` source pathnames or absolute system pathnames. - kernel_cmdline_files = [] - - # List of extra manifest entries for files to add to the BOOTFS. - # Each entry can be a "TARGET=SOURCE" string, or it can be a scope - # with `sources` and `outputs` in the style of a copy() target: - # `outputs[0]` is used as `TARGET` (see `gn help source_expansion`). - bootfs_extra = [] - - # List of kernel images to include in the update (OTA) package. - # If no list is provided, all built kernels are included. The names in the - # list are strings that must match the filename to be included in the update - # package. - update_kernels = [] -} - -images += [ - { - # This is the file to give QEMU's `-kernel` switch with a complete - # ZBI (some `IMAGE_*_ZBI` file) for its `-initrd` switch. - public = [ - "IMAGE_QEMU_KERNEL_RAW", - ] - json = { - name = "qemu-kernel" - type = "kernel" - } - sdk = "qemu-kernel.bin" - deps = [] - if (current_cpu == "arm64") { - sources = [ - "$zircon_build_dir/qemu-boot-shim.bin", - ] - } else if (current_cpu == "x64") { - sources = [ - "$zircon_build_dir/multiboot.bin", - ] - } - }, -] - -# Generate the /boot/config/devmgr file. This looks like a kernel command -# line file, but is read by devmgr (in addition to kernel command line -# arguments), not by the kernel or boot loader. -action("devmgr_config.txt") { - visibility = [ ":fuchsia" ] - testonly = true - - script = "manifest.py" - outputs = [ - "$target_out_dir/$target_name", - ] - - pkgfs = "bin/" + pkgfs_binary_name - pkgfs_label = pkgfs_package_label + ".meta" - pkgfs_pkg_out_dir = get_label_info(pkgfs_label, "target_out_dir") + "/" + - get_label_info(pkgfs_label, "name") - pkgfs_blob_manifest = "$pkgfs_pkg_out_dir/meta/contents" - system_image_merkleroot = "$target_out_dir/system_image.meta/meta.far.merkle" - - deps = [ - ":system_image.meta", - pkgfs_label, - ] - sources = [ - pkgfs_blob_manifest, - system_image_merkleroot, - ] - - args = [ - "--output=" + rebase_path(outputs[0], root_build_dir), - - # Start with the fixed options. - "--entry=devmgr.require-system=true", - ] - - # Add the pkgfs command line, embedding the merkleroot of the system image. - args += [ - "--contents", - "--rewrite=*=zircon.system.pkgfs.cmd={target}+{source}", - "--entry=${pkgfs}=" + rebase_path(system_image_merkleroot, root_build_dir), - "--no-contents", - "--reset-rewrite", - ] - - # Embed the pkgfs blob manifest with the "zircon.system.pkgfs.file." - # prefix on target file names. - args += [ - "--rewrite=*=zircon.system.pkgfs.file.{target}={source}", - "--manifest=" + rebase_path(pkgfs_blob_manifest, root_build_dir), - "--reset-rewrite", - ] - - foreach(entry, devmgr_config) { - args += [ "--entry=$entry" ] - } - - # If there were any ASan drivers in the build, bin/devhost.asan - # should have been brought into the boot manifest. devmgr needs to - # be told to use it in case there are ASan drivers in /system but - # none in /boot. If there were any non-ASan drivers in the build, - # bin/devhost.asan will load them and needs to know to moderate the - # checking for interacting with uninstrumented code. - deps += [ ":system_image.manifest" ] - sources += [ boot_manifest ] - args += [ - "--include=bin/devhost.asan", - "--include=bin/devhost", - "--rewrite=bin/devhost.asan=devmgr.devhost.asan=true", - "--rewrite=bin/devhost=devhost.asan.strict=false", - "--manifest=" + rebase_path(boot_manifest, root_build_dir), - ] -} - -# The main bootable image, which requires `blob.blk` to appear on some -# attached storage device at runtime. -zbi("fuchsia") { - testonly = true - deps = [ - ":devmgr_config.txt", - ":system_image.manifest", - ] - inputs = [ - "${zircon_build_dir}/kernel.zbi", - boot_manifest, - ] - manifest = [ - { - outputs = [ - "config/devmgr", - ] - sources = get_target_outputs(":devmgr_config.txt") - }, - ] - cmdline = kernel_cmdline_args - cmdline_inputs = kernel_cmdline_files - manifest += bootfs_extra -} -images += [ - { - deps = [ - ":fuchsia", - ] - sdk = "fuchsia.zbi" - updater = "zbi" - json = { - name = "zircon-a" - type = "zbi" - - # TODO(IN-892): Although we wish to minimize the usage of mexec (ZX-2069), - # the infrastructure currently requires it for vim2 lifecycle management. - # (`fastboot continue` does not continue back to fuchsia after paving and - # rebooting in the case we do not mexec a kernel.) - bootserver_pave = [ "--boot" ] - - if (custom_signing_script == "") { - bootserver_pave += [ - "--zircona", - # TODO(ZX-2625): `dm reboot-recovery` boots from zircon-b instead of - # zircon-r, so for now zedboot is being paved to this slot. - # "--zirconb", - ] - } - } - public = [ - "IMAGE_ZIRCONA_ZBI", - - # TODO(mcgrathr): The complete ZBI can be used with a separate - # kernel too, the kernel image in it will just be ignored. So - # just use the primary ZBI for this until all uses are - # converted to using the ZBI alone. Then remove this as - # IMAGE_BOOT_RAM variable should no longer be in use. - "IMAGE_BOOT_RAM", - ] - }, -] - -if (custom_signing_script != "") { - custom_signed_zbi("signed") { - output_name = "fuchsia.zbi" - testonly = true - deps = [ - ":fuchsia", - ] - zbi = get_target_outputs(":fuchsia") - } - images += [ - { - deps = [ - ":signed", - ] - sdk = "fuchsia.zbi.signed" - updater = "zbi.signed" - json = { - name = "zircon-a.signed" - type = "zbi.signed" - bootserver_pave = [ "--zircona" ] - } - public = [ - "IMAGE_ZIRCONA_SIGNEDZBI", - ] - }, - ] - if (use_vbmeta) { - images += [ - { - deps = [ - ":signed", - ] - sources = [ - "$root_out_dir/fuchsia.zbi.vbmeta", - ] - json = { - name = "zircon-a.vbmeta" - type = "vbmeta" - bootserver_pave = [ "--vbmetaa" ] - } - public = [ - "IMAGE_VBMETAA_RAW", - ] - }, - ] - } -} - -# The updater also wants the zedboot zbi as recovery. -images += [ - { - deps = [ - "zedboot:zbi", - ] - sources = [ - "$root_out_dir/zedboot.zbi", - ] - updater = "zedboot" - }, -] - -if (custom_signing_script != "") { - images += [ - { - deps = [ - "zedboot:signed", - ] - sources = [ - "$root_out_dir/zedboot.zbi.signed", - ] - updater = "zedboot.signed" - }, - ] -} - -### -### Complete images for booting and installing the whole system. -### - -declare_args() { - # Build boot images that prefer Zedboot over local boot (only for EFI). - always_zedboot = false -} - -# data.blk creates minfs data partition containing the preinstall package -# index. The partition is included in fvm.blk and fvm.sparse.blk. -# To increase the size of the data partition, increase the total size of the -# fvm images using |fvm_image_size|. -zircon_tool_action("data.blk") { - testonly = true - tool = "minfs" - data_image_path = "$target_out_dir/$target_name" - outputs = [ - data_image_path, - ] - depfile = data_image_path + ".d" - deps = [ - ":preinstall.manifest", - ] - preinstall_manifest = get_target_outputs(deps[0]) - args = [ - "--depfile", - rebase_path(data_image_path, root_build_dir), - "create", - "--manifest", - rebase_path(preinstall_manifest[0], root_build_dir), - ] - if (data_partition_manifest != "") { - args += [ - "--manifest", - rebase_path(data_partition_manifest), - ] - } -} -images += [ - { - public = [ - "IMAGE_DATA_RAW", - ] - json = { - name = "data" - type = "blk" - } - deps = [ - ":data.blk", - ] - }, -] - -# Record the maximum allowable FVM size in the build directory for later steps -# to check against. -max_fvm_size_file = "$root_build_dir/max_fvm_size.txt" -write_file(max_fvm_size_file, max_fvm_size) - -# fvm.blk creates an FVM partition image containing the blob partition produced -# by blob.blk and the data partition produced by data.blk. fvm.blk is primarily -# invoked and used by the qemu run, via `fx run`. -generate_fvm("fvm.blk") { - testonly = true - output_name = "$target_out_dir/fvm.blk" - args = fvm_create_args - if (fvm_image_size != "") { - args += [ - "--length", - fvm_image_size, - ] - } - partitions = [ - { - type = "blob" - dep = ":blob.blk" - }, - { - type = "data" - dep = ":data.blk" - }, - ] -} -images += [ - { - deps = [ - ":fvm.blk", - ] - json = { - name = "storage-full" - type = "blk" - } - sdk = "fvm.blk" - public = [ - "IMAGE_FVM_RAW", - ] - }, -] - -# fvm.sparse.blk creates a sparse FVM partition image containing the blob -# partition produced by blob.blk and the data partition produced by data.blk. -# fvm.sparse.blk is primarily invoked and used by the paver boot, via `fx -# pave`. -generate_fvm("fvm.sparse.blk") { - testonly = true - output_name = "$target_out_dir/fvm.sparse.blk" - deps = [ - ":blob.blk", - ":data.blk", - ] - args = fvm_sparse_args - partitions = [ - { - type = "blob" - dep = ":blob.blk" - }, - { - type = "data" - dep = ":data.blk" - }, - ] -} -images += [ - { - deps = [ - ":fvm.sparse.blk", - ] - json = { - name = "storage-sparse" - type = "blk" - bootserver_pave = [ "--fvm" ] - } - installer = "fvm.sparse.blk" - sdk = "fvm.sparse.blk" - public = [ - "IMAGE_FVM_SPARSE", - ] - }, -] - -# This rolls the primary ZBI together with a compressed RAMDISK image of -# fvm.blk into a fat ZBI that boots the full system without using any real -# storage. The system decompresses the fvm.blk image into memory and then -# sees that RAM disk just as if it were a real disk on the device. -zbi("netboot") { - testonly = true - deps = [ - ":fuchsia", - ":fvm.blk", - ] - inputs = get_target_outputs(":fuchsia") - ramdisk_inputs = get_target_outputs(":fvm.blk") -} -images += [ - { - default = false - json = { - bootserver_netboot = [ "--boot" ] - name = "netboot" - type = "zbi" - } - public = [ - "IMAGE_NETBOOT_ZBI", - - # TODO(mcgrathr): The complete ZBI can be used with a separate kernel - # too, the kernel image in it will just be ignored. So just use the - # primary ZBI for this until all uses are converted to using the ZBI - # alone. Then remove this as IMAGE_BOOT_RAM variable should no - # longer be in use. - "IMAGE_NETBOOT_RAM", - ] - deps = [ - ":netboot", - ] - }, -] - -if (target_cpu != "arm64") { - # ChromeOS vboot images. - vboot("vboot") { - testonly = true - output_name = "fuchsia" - deps = [ - ":fuchsia", - ] - } - images += [ - { - json = { - name = "zircon-vboot" - type = "vboot" - bootserver_pave = [ "--kernc" ] - } - deps = [ - ":vboot", - ] - installer = "zircon.vboot" - sdk = "zircon.vboot" - updater = "kernc" - public = [ - "IMAGE_ZIRCON_VBOOT", - ] - }, - ] - - # The installer also wants the zedboot vboot image. - images += [ - { - deps = [ - "zedboot:vboot", - ] - sources = [ - "$root_out_dir/zedboot.vboot", - ] - installer = "zedboot.vboot" - }, - ] - - # EFI ESP images. - esp("esp") { - output_name = "fuchsia" - testonly = true - if (always_zedboot) { - cmdline = "zedboot/efi_cmdline.txt" - } else { - cmdline = "efi_local_cmdline.txt" - } - } - images += [ - { - deps = [ - ":esp", - ] - json = { - name = "efi" - type = "blk" - bootserver_pave = [ "--efi" ] - } - installer = "local.esp.blk" - sdk = "local.esp.blk" - updater = "efi" - public = [ - "IMAGE_ESP_RAW", - ] - }, - { - deps = [ - "zedboot:esp", - ] - sources = [ - "$root_out_dir/zedboot.esp.blk", - ] - installer = "zedboot.esp.blk" - }, - ] -} - -installer_label = "//garnet/bin/installer:install-fuchsia" -installer_out_dir = get_label_info(installer_label, "root_out_dir") -installer_path = "$installer_out_dir/install-fuchsia" - -action("installer.manifest") { - script = "manifest.py" - outputs = [ - "$target_out_dir/installer.manifest", - ] - args = [ - "--output=" + rebase_path(outputs[0], root_build_dir), - "--output-cwd=" + rebase_path(target_out_dir, root_build_dir), - "--entry=install-fuchsia=" + rebase_path(installer_path, root_build_dir), - ] - foreach(image, images) { - if (defined(image.installer)) { - image_sources = [] - if (defined(image.sources)) { - image_sources += image.sources - } else { - foreach(label, image.deps) { - image_sources += get_target_outputs(label) - } - } - assert(image_sources == [ image_sources[0] ]) - args += [ "--entry=${image.installer}=" + - rebase_path(image_sources[0], root_build_dir) ] - } - } -} - -# installer.blk is a minfs partition image that includes all of the -# images required to install a Fuchsia build. -zircon_tool_action("installer") { - testonly = true - tool = "minfs" - deps = [ - ":installer.manifest", - installer_label, - ] - outputs = [ - "$target_out_dir/installer.blk", - ] - sources = [] - foreach(image, images) { - if (defined(image.installer)) { - deps += image.deps - if (defined(image.sources)) { - sources += image.sources - } else { - foreach(label, image.deps) { - sources += get_target_outputs(label) - } - } - } - } - depfile = "$target_out_dir/installer.blk.d" - args = [ - "--depfile", - rebase_path(outputs[0], root_build_dir), - "create", - "--manifest", - ] - args += rebase_path(get_target_outputs(deps[0]), root_build_dir) -} -images += [ - { - default = false - public = [ - "IMAGE_INSTALLER_RAW", - ] - deps = [ - ":installer", - ] - }, -] - -group("images") { - testonly = true - deps = [ - ":ids.txt", - ":paver-script", - "zedboot", - ] -} - -group("default-images") { - testonly = true - deps = [] - foreach(image, images) { - if (!defined(image.default) || image.default) { - deps += image.deps - } - } -} - -### -### Paver script and archives using those images and zedboot's images. -### - -paver_targets = [ - { - name = "paver-script" - outputs = [ - "$root_build_dir/pave.sh", - ] - switch = "--pave=" - json = { - name = "pave" - type = "sh" - } - }, - { - name = "netboot-script" - outputs = [ - "$root_build_dir/netboot.sh", - ] - switch = "--netboot=" - json = { - name = "netboot" - type = "sh" - } - }, -] -foreach(format, - [ - "tgz", - "zip", - ]) { - paver_targets += [ - { - name = "archive-$format" - outputs = [ - "$root_build_dir/build-archive.$format", - ] - switch = "--archive=" - json = { - name = "archive" - type = "$format" - } - }, - { - name = "symbol-archive-$format" - outputs = [ - "$root_build_dir/symbol-archive.$format", - ] - switch = "--symbol-archive=" - json = { - name = "symbol-archive" - type = "$format" - } - }, - ] -} - -foreach(target, paver_targets) { - images += [ - { - path = rebase_path(target.outputs, root_build_dir) - path = path[0] - json = target.json - deps = [ - ":${target.name}", - ] - }, - ] - action(target.name) { - deps = [ - ":default-images", - ":netboot", - "zedboot", - ] - testonly = true - sources = [ - "$root_build_dir/images.json", - "$root_build_dir/zedboot_images.json", - ] - outputs = target.outputs - depfile = "${outputs[0]}.d" - script = "pack-images.py" - args = [ - "--depfile=" + rebase_path(depfile, root_build_dir), - target.switch + rebase_path(outputs[0], root_build_dir), - ] - args += rebase_path(sources, root_build_dir) - } -} - -### -### Amber updates. -### - -# update_packages.manifest contains the same entries as the pkgsvr_index but -# additionally includes the system_image package. -action("update_packages.manifest") { - visibility = [ ":update.manifest" ] - testonly = true - - script = "manifest.py" - outputs = [ - "$target_out_dir/$target_name", - ] - args = [ - "--contents", - "--output", - rebase_path(outputs[0], root_build_dir), - ] - deps = [] - sources = [] - - deps += [ ":system_image.meta" ] - args += [ "--entry=system_image/0=" + - rebase_path("$target_out_dir/system_image.meta/meta.far.merkle", - root_build_dir) ] - - foreach(pkg_label, monolith_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.pkgsvr_index.rsp" - deps += [ "${pkg_label}.pkgsvr_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } -} - -# The update package manifest contains the pkgsvr_index and the target -# system kernel images. -action("update.manifest") { - visibility = [ ":*" ] - testonly = true - - update_manifest = [ - { - target = "packages" - deps = [ - ":update_packages.manifest", - ] - }, - - # Add the meta/package JSON file that makes this the "update" package. - { - target = "meta/package" - sources = [ - "update_package.json", - ] - }, - ] - - foreach(image, images) { - if (defined(image.updater)) { - if (update_kernels == []) { - update_manifest += [ - { - target = image.updater - forward_variables_from(image, - [ - "deps", - "sources", - ]) - }, - ] - } else { - foreach(kernel, update_kernels) { - if (image.updater == kernel) { - update_manifest += [ - { - target = image.updater - forward_variables_from(image, - [ - "deps", - "sources", - ]) - }, - ] - } - } - } - } - } - - script = "manifest.py" - - outputs = [ - "$target_out_dir/$target_name", - ] - - args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - - foreach(entry, update_manifest) { - entry_source = "" - if (defined(entry.deps)) { - deps += entry.deps - } - - if (defined(entry.sources)) { - # TODO(BLD-354): We should only have single source - sources = [] - sources += entry.sources - entry_source = sources[0] - } else if (defined(entry.deps)) { - foreach(label, entry.deps) { - # TODO(BLD-354): We should only have single output - dep_outputs = [] - dep_outputs += get_target_outputs(label) - entry_source = dep_outputs[0] - } - } - entry_source = rebase_path(entry_source, root_build_dir) - args += [ "--entry=${entry.target}=${entry_source}" ] - } -} - -pm_build_package("update.meta") { - visibility = [ ":*" ] - testonly = true - manifest = ":update.manifest" -} - -# XXX(raggi): The following manifests retain the "meta/" files, resulting in -# them being added as blobs, which they should not be. A likely better solution -# here is to teach pm_build_package to produce either a blob manifest or a -# manifest.py --contents compatible response file that excludes these files. - -action("update.sources.manifest") { - visibility = [ ":*" ] - testonly = true - script = "manifest.py" - deps = [ - ":update.manifest", - ] - outputs = [ - "$target_out_dir/update.sources.manifest", - ] - update_manifests = get_target_outputs(deps[0]) - args = [ - "--sources", - "--output=" + rebase_path(outputs[0], root_build_dir), - "--manifest=" + rebase_path(update_manifests[0]), - ] -} - -# The amber index is the index of all requested packages, naming each meta.far -# file instead of its merkleroot. Additionally the amber_index has the system -# package itself, and the system update package. -amber_index = "$target_out_dir/amber_index" - -action("amber_index") { - visibility = [ ":amber_publish_index" ] - testonly = true - - script = "manifest.py" - args = [ "--absolute" ] - outputs = [ - "$target_out_dir/$target_name", - ] - args += [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - foreach(pkg_label, available_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.amber_index.rsp" - deps += [ "${pkg_label}.amber_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } - - system_image_meta_dir = - get_label_info(":system_image.meta", "target_out_dir") + - "/system_image.meta" - system_image_meta_far = system_image_meta_dir + "/meta.far" - args += [ - "--entry", - "system_image/0=" + rebase_path(system_image_meta_far, root_build_dir), - ] - deps += [ ":system_image.meta" ] - - update_meta_dir = - get_label_info(":update.meta", "target_out_dir") + "/update.meta" - update_meta_far = update_meta_dir + "/meta.far" - args += [ - "--entry", - "update/0=" + rebase_path(update_meta_far, root_build_dir), - ] - deps += [ ":update.meta" ] -} - -# The system index is the index of all available packages, naming each blobs.json -# file instead of its merkleroot, and including a tag of the package set the -# package is a part of (monolith/preinstall/available). Additionally the -# system_index has the system package itself, and the system update package. -system_index = "$target_out_dir/system_index" - -action("system_index") { - visibility = [ ":system_snapshot" ] - testonly = true - - script = "manifest.py" - args = [ "--absolute" ] - outputs = [ - "$target_out_dir/$target_name", - ] - args += [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - foreach(pkg_label, available_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.system_index.rsp" - deps += [ "${pkg_label}.system_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } - - system_image_meta_dir = - get_label_info(":system_image.meta", "target_out_dir") + - "/system_image.meta" - system_image_blobs_json = system_image_meta_dir + "/blobs.json" - args += [ - "--entry", - "system_image/0#monolith=" + - rebase_path(system_image_blobs_json, root_build_dir), - ] - deps += [ ":system_image.meta" ] - - update_meta_dir = - get_label_info(":update.meta", "target_out_dir") + "/update.meta" - update_blobs_json = update_meta_dir + "/blobs.json" - args += [ - "--entry", - "update/0#monolith=" + rebase_path(update_blobs_json, root_build_dir), - ] - deps += [ ":update.meta" ] -} - -compiled_action("system_snapshot") { - tool = "//garnet/go/src/pm:pm_bin" - tool_output_name = "pm" - - visibility = [ ":updates" ] - testonly = true - - deps = [ - ":system_index", - ] - - inputs = [ - system_index, - ] - - outputs = [ - "$target_out_dir/system.snapshot", - ] - - args = [ - "snapshot", - "--manifest", - rebase_path(inputs[0], root_build_dir), - "--output", - rebase_path(outputs[0], root_build_dir), - ] -} - -# Available blob manifest is a manifest of merkleroot=source_path for all blobs -# in all packages produced by the build, including the system image and the -# update package. -available_blob_manifest = "$root_build_dir/available_blobs.manifest" -action("available_blobs.manifest") { - visibility = [ ":*" ] - testonly = true - outputs = [ - available_blob_manifest, - ] - depfile = available_blob_manifest + ".d" - deps = [ - ":system_image.meta", - ":update.meta", - ] - inputs = [] - script = "blob_manifest.py" - args = [ "@{{response_file_name}}" ] - - response_file_contents = [ - "--output=" + rebase_path(available_blob_manifest, root_build_dir), - "--depfile=" + rebase_path(depfile, root_build_dir), - "--input=" + rebase_path("$target_out_dir/system_image.meta/blobs.json", - root_build_dir), - "--input=" + - rebase_path("$target_out_dir/update.meta/blobs.json", root_build_dir), - ] - foreach(pkg_label, available_packages) { - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_blobs_rsp = "${pkg_target_out_dir}/${pkg_target_name}.blobs.rsp" - deps += [ "${pkg_label}.blobs.rsp" ] - inputs += [ pkg_blobs_rsp ] - response_file_contents += - [ "@" + rebase_path(pkg_blobs_rsp, root_build_dir) ] - } -} - -# Populate the repository directory with content ID-named copies. -action("amber_publish_blobs") { - testonly = true - outputs = [ - "$amber_repository_dir.stamp", - ] - deps = [ - ":available_blobs.manifest", - ] - inputs = [] - foreach(dep, deps) { - inputs += get_target_outputs(dep) - } - script = "manifest.py" - args = [ - "--copy-contentaddr", - "--output=" + rebase_path(amber_repository_blobs_dir), - "--stamp=" + rebase_path("$amber_repository_dir.stamp"), - ] - foreach(manifest, inputs) { - args += [ "--manifest=" + rebase_path(manifest, root_build_dir) ] - } -} - -# Sign and publish the package index. -pm_publish("amber_publish_index") { - testonly = true - deps = [ - ":amber_index", - ] - inputs = [ - amber_index, - ] -} - -group("updates") { - testonly = true - deps = [ - ":amber_publish_blobs", - ":amber_publish_index", - ":ids.txt", - ":system_snapshot", - ] -} - -### -### Build ID maps. -### - -# Combine the /boot, /system, and package build ID maps into one. -# Nothing in the build uses this, but top-level targets always update -# it so that debugging tools can rely on it. -action("ids.txt") { - testonly = true - - deps = [ - ":kernel-ids.txt", - ":system_image.manifest", - ":zircon-asan-build-id", - ":zircon-build-id", - ] - sources = [ - "$target_out_dir/kernel-ids.txt", - system_build_id_map, - ] - - foreach(pkg_label, available_packages) { - # Find the ids.txt file written by package(). - manifest = get_label_info(pkg_label, "label_no_toolchain") + - ".final.manifest.ids.txt" - manifest_target_name = get_label_info(manifest, "name") - manifest_target_out_dir = get_label_info(manifest, "target_out_dir") - deps += [ manifest ] - sources += [ "$manifest_target_out_dir/${manifest_target_name}" ] - } - - script = "/usr/bin/sort" - outputs = [ - "$root_out_dir/ids.txt", - ] - args = [ - "-u", - "-o", - ] + rebase_path(outputs + sources, root_build_dir) -} - -# The vDSO doesn't appear in any package and so doesn't get into any -# ids.txt file produced by generate_manifest(). But it appears in memory -# at runtime and in backtraces, so it should be in the aggregated ids.txt -# for symbolization. The vDSO doesn't appear in zircon_boot_manifests, so -# fetching it out of Zircon's own ids.txt by name is the only thing to do. -# Likewise for the kernel itself, whose build ID is useful to have in the map. -action("kernel-ids.txt") { - script = "manifest.py" - sources = [ - "$zircon_build_dir/ids.txt", - ] - outputs = [ - "$target_out_dir/kernel-ids.txt", - ] - args = [ - "--separator= ", - "--output=" + rebase_path(outputs[0], root_build_dir), - "--include-source=*/libzircon.so", - "--include-source=*/zircon.elf", - "--manifest=" + rebase_path(sources[0], root_build_dir), - ] -} - -# TODO(TC-303): This is a temporary hack to get all of Zircon's debug files -# into the $root_build_dir/.build-id hierarchy. The Zircon build produces -# its own .build-id hierarchy under $zircon_build_dir, but using its ids.txt -# is the simpler way to populate the one in this build. When ids.txt is fully -# obsolete, hopefully Zircon will be in the unified build anyway. -foreach(target, - [ - { - name = "zircon-build-id" - sources = [ - "$zircon_build_dir/ids.txt", - ] - }, - { - name = "zircon-asan-build-id" - sources = [ - "$zircon_asan_build_dir/ids.txt", - ] - }, - ]) { - action(target.name) { - visibility = [ ":ids.txt" ] - script = "//scripts/build_id_conv.py" - sources = target.sources - outputs = [ - "$root_build_dir/${target_name}.stamp", - ] - args = - [ "--stamp=" + rebase_path(outputs[0], root_build_dir) ] + - rebase_path(sources + [ "$root_build_dir/.build-id" ], root_build_dir) - } -} - -images += [ - { - deps = [ - ":ids.txt", - ] - json = { - name = "build-id" - type = "txt" - } - }, -] - -write_images_manifest("images-manifest") { - outputs = [ - "$root_build_dir/images.json", - "$root_build_dir/image_paths.sh", - ] -} - -### -### SDK -### - -sdk_images = [] - -foreach(image, images) { - if (defined(image.sdk)) { - image_target_name = "${image.sdk}_sdk" - sdk_images += [ ":$image_target_name" ] - sdk_atom(image_target_name) { - id = "sdk://images/${image.sdk}" - category = "partner" - testonly = true - - file_content = "target/$target_cpu/${image.sdk}" - meta = { - dest = "images/${image.sdk}-meta.json" - schema = "image" - value = { - type = "image" - name = "${image.sdk}" - root = "images" - file = { - if (target_cpu == "x64") { - x64 = file_content - } else if (target_cpu == "arm64") { - arm64 = file_content - } else { - assert(false, "Unsupported target architecture: $target_cpu") - } - } - } - } - - image_sources = [] - if (defined(image.sources)) { - image_sources += image.sources - } else { - foreach(label, image.deps) { - image_sources += get_target_outputs(label) - } - } - - files = [ - { - source = image_sources[0] - dest = "target/$target_cpu/${image.sdk}" - }, - ] - - non_sdk_deps = image.deps - } - } -} - -sdk_molecule("images_sdk") { - testonly = true - - deps = sdk_images -}
diff --git a/images/blob_manifest.py b/images/blob_manifest.py deleted file mode 100755 index ebcf25b..0000000 --- a/images/blob_manifest.py +++ /dev/null
@@ -1,45 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import sys -import shlex - -def main(): - parser = argparse.ArgumentParser( - description='Product a blobfs manifest from a set of blobs.json', - fromfile_prefix_chars='@') - parser.convert_arg_line_to_args = shlex.split - parser.add_argument('--output', required=True, - help='Output manifest path') - parser.add_argument('--depfile', required=True, - help='Dependency file output path') - parser.add_argument('--input', action='append', default=[], - help='Input blobs.json, repeated') - - args = parser.parse_args() - - all_blobs = dict() - - with open(args.depfile, 'w') as depfile: - depfile.write(args.output) - depfile.write(':') - for path in args.input: - depfile.write(' ' + path) - with open(path) as input: - blobs = json.load(input) - for blob in blobs: - src = blob['source_path'] - all_blobs[blob['merkle']] = src - depfile.write(' ' + src) - - with open(args.output, 'w') as output: - for merkle, src in all_blobs.items(): - output.write('%s=%s\n' % (merkle, src)) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/images/boot.gni b/images/boot.gni deleted file mode 100644 index f66f0e8..0000000 --- a/images/boot.gni +++ /dev/null
@@ -1,193 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/config/clang/clang.gni") -import("//build/config/fuchsia/zircon.gni") - -# Build a "kernel partition" target for ChromeOS targets. -# -# Parameters -# -# deps (required) -# [list of one label] Must be a `zbi()` target defined earlier in the file. -# -# output_name (optional, default: `target_name`) -# output_extension (optional, default: `".vboot"`) -# [string] Determines the file name, in `root_out_dir`. -# -template("vboot") { - if (defined(invoker.output_name)) { - output_file = invoker.output_name - } else { - output_file = target_name - } - if (defined(invoker.output_extension)) { - if (invoker.output_extension != "") { - output_file += ".${invoker.output_extension}" - } - } else { - output_file += ".vboot" - } - output_file = "$root_out_dir/$output_file" - - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - tool = "//garnet/tools/vboot_reference:futility" - outputs = [ - output_file, - ] - - vboot_dir = "//third_party/vboot_reference" - kernel_keyblock = "$vboot_dir/tests/devkeys/kernel.keyblock" - private_keyblock = "$vboot_dir/tests/devkeys/kernel_data_key.vbprivk" - inputs = [ - kernel_keyblock, - private_keyblock, - ] - - assert(defined(deps), "vboot() requires deps") - zbi = [] - foreach(label, deps) { - zbi += get_target_outputs(label) - } - inputs += zbi - assert(zbi == [ zbi[0] ], "vboot() requires exactly one zbi() in deps") - - # The CrOS bootloader supports Multiboot (with `--flags 0x2` below). - # The Multiboot trampoline is the "kernel" (`--vmlinuz` switch) and the - # ZBI is the RAM disk (`--bootloader` switch). - assert(current_cpu == "x64") - kernel = "${zircon_build_dir}/multiboot.bin" - inputs += [ kernel ] - - args = [ - "vbutil_kernel", - "--pack", - rebase_path(output_file), - "--keyblock", - rebase_path(kernel_keyblock), - "--signprivate", - rebase_path(private_keyblock), - "--bootloader", - rebase_path(zbi[0]), - "--vmlinuz", - rebase_path(kernel), - "--version", - "1", - "--flags", - "0x2", - ] - } -} - -# Build an "EFI System Partition" target for EFI targets. -# -# Parameters -# -# deps (optional) -# [list of labels] Targets that generate the other inputs. -# -# output_name (optional, default: `target_name`) -# output_extension (optional, default: `".esp.blk"`) -# [string] Determines the file name, in `root_out_dir`. -# -# bootdata_bin (optional) -# [path] Must be a ramdisk that compliments zircon_bin. -# -# zircon_bin (optional) -# [path] A zircon kernel. -# -# zedboot (optional) -# [label] A Zedboot `zbi()` target. -# -# cmdline (optional) -# [path] A bootloader (Gigaboot) cmdline file to include in the EFI root. -# -template("esp") { - if (defined(invoker.output_name)) { - output_file = invoker.output_name - } else { - output_file = target_name - } - if (defined(invoker.output_extension)) { - if (invoker.output_extension != "") { - output_file += ".${invoker.output_extension}" - } - } else { - output_file += ".esp.blk" - } - output_file = "$root_out_dir/$output_file" - - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - "visibility", - ]) - - tool = "//garnet/go/src/make-efi" - mkfs_msdosfs_bin = "$zircon_tools_dir/mkfs-msdosfs" - - outputs = [ - output_file, - ] - inputs = [ - mkfs_msdosfs_bin, - ] - args = [ - "--output", - rebase_path(output_file), - "--mkfs", - rebase_path(mkfs_msdosfs_bin), - ] - - if (defined(invoker.zircon_bin)) { - args += [ - "--zircon", - rebase_path(invoker.zircon_bin), - ] - inputs += [ invoker.zircon_bin ] - } - - if (defined(invoker.bootdata_bin)) { - args += [ - "--bootdata", - rebase_path(invoker.bootdata_bin), - ] - inputs += [ invoker.bootdata_bin ] - } - - if (defined(invoker.zedboot)) { - args += [ - "--zedboot", - rebase_path(invoker.zedboot), - ] - inputs += [ invoker.zedboot ] - } - - if (defined(invoker.cmdline)) { - args += [ - "--cmdline", - rebase_path(invoker.cmdline), - ] - } - - if (target_cpu == "x64") { - gigaboot_bin = "${zircon_build_dir}/bootloader/bootx64.efi" - args += [ - "--efi-bootloader", - rebase_path(gigaboot_bin), - ] - inputs += [ gigaboot_bin ] - } - } -}
diff --git a/images/create-shell-commands.py b/images/create-shell-commands.py deleted file mode 100755 index 0b05d25..0000000 --- a/images/create-shell-commands.py +++ /dev/null
@@ -1,48 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import sys -import os -import shlex - - -def main(): - parser = argparse.ArgumentParser( - description='Create trampolines and a manifest for a set of shell commands', - fromfile_prefix_chars='@') - parser.convert_arg_line_to_args = shlex.split - parser.add_argument('--trampoline-dir', required=True, - help='Directory in which to create trampolines') - parser.add_argument('--output-manifest', required=True, - help='Output manifest path') - parser.add_argument('--uri', action='append', default=[], - help='A command URI to create an entry for') - - args = parser.parse_args() - - if not os.path.exists(args.trampoline_dir): - os.makedirs(args.trampoline_dir) - - commands = dict() - - for uri in args.uri: - name = uri.split('#')[-1] - name = os.path.split(name)[-1] - if name in commands: - sys.stderr.write('Duplicate shell command name: %s\n' % name) - return 1 - path = os.path.join(args.trampoline_dir, name) - with open(path, 'w') as f: - f.write('#!resolve %s\n' % uri) - commands[name] = path - - with open(args.output_manifest, 'w') as output: - for name, path in commands.items(): - output.write('bin/%s=%s\n' % (name, path)) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/images/custom_signing.gni b/images/custom_signing.gni deleted file mode 100644 index 6a895a4..0000000 --- a/images/custom_signing.gni +++ /dev/null
@@ -1,99 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zircon.gni") - -declare_args() { - # If non-empty, the given script will be invoked to produce a signed ZBI - # image. The given script must accept -z for the input zbi path, and -o for - # the output signed zbi path. The path must be in GN-label syntax (i.e. - # starts with //). - custom_signing_script = "" - - # If true, then the paving script will pave vbmeta images to the target device. - # It is assumed that the vbmeta image will be created by the custom_signing_script. - use_vbmeta = false -} - -# Template for producing signed ZBI images given a custom signing script. -# The signing script is required to accept two parameters: -# -z the path to the ZBI image to be signed -# -o the path to the image file to be output -# -v the path to the vbmeta file to be output (scripts not using AVB may ignore this) -# -B the path to the zircon build directory -# -# TODO(BLD-323): add flags for producing depfiles -# TODO(raggi): add support for custom flags (e.g. to switch keys) -# -# Paramters -# -# output_name (optional, default: target_name) -# output_extension (optional, default: signed) -# [string] These together determine the name of the output file. -# If `output_name` is omitted, then the name of the target is -# used. If `output_extension` is "" then `output_name` is the -# file name; otherwise, `${output_name}.${output_extension}`; -# the output file is always under `root_out_dir`. -# -# zbi (required) -# [list-of-strings] path to a ZBI image to be signed. Must only -# contain a single entry. -# -# deps (usually required) -# visibility (optional) -# testonly (optional) -# Same as for any GN `action` target. `deps` must list labels that -# produce all the `inputs`, `cmdline_inputs`, and `ramdisk_inputs` -# that are generated by the build (none are required for inputs that -# are part of the source tree). -template("custom_signed_zbi") { - if (defined(invoker.output_name)) { - output_file = invoker.output_name - } else { - output_file = target_name - } - - vbmeta_file = output_file + ".vbmeta" - - if (defined(invoker.output_extension)) { - if (invoker.output_extension != "") { - output_file += ".${invoker.output_extension}" - } - } else { - output_file += ".signed" - } - - forward_variables_from(invoker, - [ - "testonly", - "deps", - "zbi", - ]) - - assert([ zbi[0] ] == zbi, "zbi parameter must contain a single entry") - - output_file = "$root_out_dir/$output_file" - vbmeta_file = "$root_out_dir/$vbmeta_file" - action(target_name) { - script = custom_signing_script - - inputs = zbi - outputs = [ - output_file, - ] - if (use_vbmeta) { - outputs += [ vbmeta_file ] - } - args = [ - "-z", - rebase_path(inputs[0], root_build_dir), - "-o", - rebase_path(outputs[0], root_build_dir), - "-v", - rebase_path(vbmeta_file, root_build_dir), - "-B", - rebase_path(zircon_build_dir, root_build_dir), - ] - } -}
diff --git a/images/efi_local_cmdline.txt b/images/efi_local_cmdline.txt deleted file mode 100644 index 2482a4b..0000000 --- a/images/efi_local_cmdline.txt +++ /dev/null
@@ -1,2 +0,0 @@ -bootloader.default=local -bootloader.timeout=1
diff --git a/images/elfinfo.py b/images/elfinfo.py deleted file mode 100755 index 3aa4806..0000000 --- a/images/elfinfo.py +++ /dev/null
@@ -1,589 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from contextlib import contextmanager -from collections import namedtuple -import mmap -import os -import struct - - -# Standard ELF constants. -ELFMAG = '\x7fELF' -EI_CLASS = 4 -ELFCLASS32 = 1 -ELFCLASS64 = 2 -EI_DATA = 5 -ELFDATA2LSB = 1 -ELFDATA2MSB = 2 -EM_386 = 3 -EM_ARM = 40 -EM_X86_64 = 62 -EM_AARCH64 = 183 -PT_LOAD = 1 -PT_DYNAMIC = 2 -PT_INTERP = 3 -PT_NOTE = 4 -DT_NEEDED = 1 -DT_STRTAB = 5 -DT_SONAME = 14 -NT_GNU_BUILD_ID = 3 -SHT_SYMTAB = 2 - - -class elf_note( - namedtuple('elf_note', [ - 'name', - 'type', - 'desc', - ])): - - # An ELF note is identified by (name_string, type_integer). - def ident(self): - return (self.name, self.type) - - def is_build_id(self): - return self.ident() == ('GNU\0', NT_GNU_BUILD_ID) - - def build_id_hex(self): - if self.is_build_id(): - return ''.join(('%02x' % ord(byte)) for byte in self.desc) - return None - - def __repr__(self): - return ('elf_note(%r, %#x, <%d bytes>)' % - (self.name, self.type, len(self.desc))) - - -def gen_elf(): - # { 'Struct1': (ELFCLASS32 fields, ELFCLASS64 fields), - # 'Struct2': fields_same_for_both, ... } - elf_types = { - 'Ehdr': ([ - ('e_ident', '16s'), - ('e_type', 'H'), - ('e_machine', 'H'), - ('e_version', 'I'), - ('e_entry', 'I'), - ('e_phoff', 'I'), - ('e_shoff', 'I'), - ('e_flags', 'I'), - ('e_ehsize', 'H'), - ('e_phentsize', 'H'), - ('e_phnum', 'H'), - ('e_shentsize', 'H'), - ('e_shnum', 'H'), - ('e_shstrndx', 'H'), - ], [ - ('e_ident', '16s'), - ('e_type', 'H'), - ('e_machine', 'H'), - ('e_version', 'I'), - ('e_entry', 'Q'), - ('e_phoff', 'Q'), - ('e_shoff', 'Q'), - ('e_flags', 'I'), - ('e_ehsize', 'H'), - ('e_phentsize', 'H'), - ('e_phnum', 'H'), - ('e_shentsize', 'H'), - ('e_shnum', 'H'), - ('e_shstrndx', 'H'), - ]), - 'Phdr': ([ - ('p_type', 'I'), - ('p_offset', 'I'), - ('p_vaddr', 'I'), - ('p_paddr', 'I'), - ('p_filesz', 'I'), - ('p_memsz', 'I'), - ('p_flags', 'I'), - ('p_align', 'I'), - ], [ - ('p_type', 'I'), - ('p_flags', 'I'), - ('p_offset', 'Q'), - ('p_vaddr', 'Q'), - ('p_paddr', 'Q'), - ('p_filesz', 'Q'), - ('p_memsz', 'Q'), - ('p_align', 'Q'), - ]), - 'Shdr': ([ - ('sh_name', 'L'), - ('sh_type', 'L'), - ('sh_flags', 'L'), - ('sh_addr', 'L'), - ('sh_offset', 'L'), - ('sh_size', 'L'), - ('sh_link', 'L'), - ('sh_info', 'L'), - ('sh_addralign', 'L'), - ('sh_entsize', 'L'), - ], [ - ('sh_name', 'L'), - ('sh_type', 'L'), - ('sh_flags', 'Q'), - ('sh_addr', 'Q'), - ('sh_offset', 'Q'), - ('sh_size', 'Q'), - ('sh_link', 'L'), - ('sh_info', 'L'), - ('sh_addralign', 'Q'), - ('sh_entsize', 'Q'), - ]), - 'Dyn': ([ - ('d_tag', 'i'), - ('d_val', 'I'), - ], [ - ('d_tag', 'q'), - ('d_val', 'Q'), - ]), - 'Nhdr': [ - ('n_namesz', 'I'), - ('n_descsz', 'I'), - ('n_type', 'I'), - ], - 'dwarf2_line_header': [ - ('unit_length', 'L'), - ('version', 'H'), - ('header_length', 'L'), - ('minimum_instruction_length', 'B'), - ('default_is_stmt', 'B'), - ('line_base', 'b'), - ('line_range', 'B'), - ('opcode_base', 'B'), - ], - 'dwarf4_line_header': [ - ('unit_length', 'L'), - ('version', 'H'), - ('header_length', 'L'), - ('minimum_instruction_length', 'B'), - ('maximum_operations_per_instruction', 'B'), - ('default_is_stmt', 'B'), - ('line_base', 'b'), - ('line_range', 'b'), - ('opcode_base', 'B'), - ], - } - - # There is an accessor for each struct, e.g. Ehdr. - # Ehdr.read is a function like Struct.unpack_from. - # Ehdr.size is the size of the struct. - elf_accessor = namedtuple('elf_accessor', - ['size', 'read', 'write', 'pack']) - - # All the accessors for a format (class, byte-order) form one elf, - # e.g. use elf.Ehdr and elf.Phdr. - elf = namedtuple('elf', elf_types.keys()) - - def gen_accessors(is64, struct_byte_order): - def make_accessor(type, decoder): - return elf_accessor( - size=decoder.size, - read=lambda buffer, offset=0: type._make( - decoder.unpack_from(buffer, offset)), - write=lambda buffer, offset, x: decoder.pack_into( - buffer, offset, *x), - pack=lambda x: decoder.pack(*x)) - for name, fields in elf_types.iteritems(): - if isinstance(fields, tuple): - fields = fields[1 if is64 else 0] - type = namedtuple(name, [field_name for field_name, fmt in fields]) - decoder = struct.Struct(struct_byte_order + - ''.join(fmt for field_name, fmt in fields)) - yield make_accessor(type, decoder) - - for elfclass, is64 in [(ELFCLASS32, False), (ELFCLASS64, True)]: - for elf_bo, struct_bo in [(ELFDATA2LSB, '<'), (ELFDATA2MSB, '>')]: - yield ((chr(elfclass), chr(elf_bo)), - elf(*gen_accessors(is64, struct_bo))) - -# e.g. ELF[file[EI_CLASS], file[EI_DATA]].Ehdr.read(file).e_phnum -ELF = dict(gen_elf()) - -def get_elf_accessor(file): - # If it looks like an ELF file, whip out the decoder ring. - if file[:len(ELFMAG)] == ELFMAG: - return ELF[file[EI_CLASS], file[EI_DATA]] - return None - - -def gen_phdrs(file, elf, ehdr): - for pos in xrange(0, ehdr.e_phnum * elf.Phdr.size, elf.Phdr.size): - yield elf.Phdr.read(file, ehdr.e_phoff + pos) - - -def gen_shdrs(file, elf, ehdr): - for pos in xrange(0, ehdr.e_shnum * elf.Shdr.size, elf.Shdr.size): - yield elf.Shdr.read(file, ehdr.e_shoff + pos) - - -cpu = namedtuple('cpu', [ - 'e_machine', # ELF e_machine int - 'llvm', # LLVM triple CPU component - 'gn', # GN target_cpu -]) - -ELF_MACHINE_TO_CPU = {elf: cpu(elf, llvm, gn) for elf, llvm, gn in [ - (EM_386, 'i386', 'x86'), - (EM_ARM, 'arm', 'arm'), - (EM_X86_64, 'x86_64', 'x64'), - (EM_AARCH64, 'aarch64', 'arm64'), -]} - - -@contextmanager -def mmapper(filename): - """A context manager that yields (fd, file_contents) given a file name. -This ensures that the mmap and file objects are closed at the end of the -'with' statement.""" - fileobj = open(filename, 'rb') - fd = fileobj.fileno() - if os.fstat(fd).st_size == 0: - # mmap can't handle empty files. - try: - yield fd, '' - finally: - fileobj.close() - else: - mmapobj = mmap.mmap(fd, 0, access=mmap.ACCESS_READ) - try: - yield fd, mmapobj - finally: - mmapobj.close() - fileobj.close() - - -# elf_info objects are only created by `get_elf_info` or the `copy` or -# `rename` methods. -class elf_info( - namedtuple('elf_info', [ - 'filename', - 'cpu', # cpu tuple - 'notes', # list of (ident, desc): selected notes - 'build_id', # string: lowercase hex - 'stripped', # bool: Has no symbols or .debug_* sections - 'interp', # string or None: PT_INTERP (without \0) - 'soname', # string or None: DT_SONAME - 'needed', # list of strings: DT_NEEDED - ])): - - def rename(self, filename): - assert os.path.samefile(self.filename, filename) - # Copy the tuple. - clone = self.__class__(filename, *self[1:]) - # Copy the lazy state. - clone.elf = self.elf - if self.get_sources == clone.get_sources: - raise Exception("uninitialized elf_info object!") - clone.get_sources = self.get_sources - return clone - - def copy(self): - return self.rename(self.filename) - - # This is replaced with a closure by the creator in get_elf_info. - def get_sources(self): - raise Exception("uninitialized elf_info object!") - - def strip(self, stripped_filename): - """Write stripped output to the given file unless it already exists -with identical contents. Returns True iff the file was changed.""" - with mmapper(self.filename) as mapped: - fd, file = mapped - ehdr = self.elf.Ehdr.read(file) - - stripped_ehdr = ehdr._replace(e_shoff=0, e_shnum=0, e_shstrndx=0) - stripped_size = max(phdr.p_offset + phdr.p_filesz - for phdr in gen_phdrs(file, self.elf, ehdr) - if phdr.p_type == PT_LOAD) - assert ehdr.e_phoff + (ehdr.e_phnum * - ehdr.e_phentsize) <= stripped_size - - def gen_stripped_contents(): - yield self.elf.Ehdr.pack(stripped_ehdr) - yield file[self.elf.Ehdr.size:stripped_size] - - def old_file_matches(): - old_size = os.path.getsize(stripped_filename) - new_size = sum(len(x) for x in gen_stripped_contents()) - if old_size != new_size: - return False - with open(stripped_filename, 'rb') as f: - for chunk in gen_stripped_contents(): - if f.read(len(chunk)) != chunk: - return False - return True - - if os.path.exists(stripped_filename): - if old_file_matches(): - return False - else: - os.remove(stripped_filename) - - # Create the new file with the same mode as the original. - with os.fdopen(os.open(stripped_filename, - os.O_WRONLY | os.O_CREAT | os.O_EXCL, - os.fstat(fd).st_mode & 0777), - 'wb') as stripped_file: - stripped_file.write(self.elf.Ehdr.pack(stripped_ehdr)) - stripped_file.write(file[self.elf.Ehdr.size:stripped_size]) - return True - -def get_elf_info(filename, match_notes=False): - file = None - elf = None - ehdr = None - phdrs = None - - # Yields an elf_note for each note in any PT_NOTE segment. - def gen_notes(): - def round_up_to(size): - return ((size + 3) / 4) * 4 - for phdr in phdrs: - if phdr.p_type == PT_NOTE: - pos = phdr.p_offset - while pos < phdr.p_offset + phdr.p_filesz: - nhdr = elf.Nhdr.read(file, pos) - pos += elf.Nhdr.size - name = file[pos:pos + nhdr.n_namesz] - pos += round_up_to(nhdr.n_namesz) - desc = file[pos:pos + nhdr.n_descsz] - pos += round_up_to(nhdr.n_descsz) - yield elf_note(name, nhdr.n_type, desc) - - def gen_sections(): - shdrs = list(gen_shdrs(file, elf, ehdr)) - if not shdrs: - return - strtab_shdr = shdrs[ehdr.e_shstrndx] - for shdr, i in zip(shdrs, xrange(len(shdrs))): - if i == 0: - continue - assert shdr.sh_name < strtab_shdr.sh_size, ( - "%s: invalid sh_name" % filename) - yield (shdr, - extract_C_string(strtab_shdr.sh_offset + shdr.sh_name)) - - # Generates '\0'-terminated strings starting at the given offset, - # until an empty string. - def gen_strings(start): - while True: - end = file.find('\0', start) - assert end >= start, ( - "%s: Unterminated string at %#x" % (filename, start)) - if start == end: - break - yield file[start:end] - start = end + 1 - - def extract_C_string(start): - for string in gen_strings(start): - return string - return '' - - # Returns a string of hex digits (or None). - def get_build_id(): - build_id = None - for note in gen_notes(): - # Note that the last build_id note needs to be used due to TO-442. - possible_build_id = note.build_id_hex() - if possible_build_id: - build_id = possible_build_id - return build_id - - # Returns a list of elf_note objects. - def get_matching_notes(): - if isinstance(match_notes, bool): - if match_notes: - return list(gen_notes()) - else: - return [] - # If not a bool, it's an iterable of ident pairs. - return [note for note in gen_notes() if note.ident() in match_notes] - - # Returns a string (without trailing '\0'), or None. - def get_interp(): - # PT_INTERP points directly to a string in the file. - for interp in (phdr for phdr in phdrs if phdr.p_type == PT_INTERP): - interp = file[interp.p_offset:interp.p_offset + interp.p_filesz] - if interp[-1:] == '\0': - interp = interp[:-1] - return interp - return None - - # Returns a set of strings. - def get_soname_and_needed(): - # Each DT_NEEDED or DT_SONAME points to a string in the .dynstr table. - def GenDTStrings(tag): - return (extract_C_string(strtab_offset + dt.d_val) - for dt in dyn if dt.d_tag == tag) - - # PT_DYNAMIC points to the list of ElfNN_Dyn tags. - for dynamic in (phdr for phdr in phdrs if phdr.p_type == PT_DYNAMIC): - dyn = [elf.Dyn.read(file, dynamic.p_offset + dyn_offset) - for dyn_offset in xrange(0, dynamic.p_filesz, elf.Dyn.size)] - - # DT_STRTAB points to the string table's vaddr (.dynstr). - [strtab_vaddr] = [dt.d_val for dt in dyn if dt.d_tag == DT_STRTAB] - - # Find the PT_LOAD containing the vaddr to compute the file offset. - [strtab_offset] = [ - strtab_vaddr - phdr.p_vaddr + phdr.p_offset - for phdr in phdrs - if (phdr.p_type == PT_LOAD and - phdr.p_vaddr <= strtab_vaddr and - strtab_vaddr - phdr.p_vaddr < phdr.p_filesz) - ] - - soname = None - for soname in GenDTStrings(DT_SONAME): - break - - return soname, set(GenDTStrings(DT_NEEDED)) - return None, set() - - def get_stripped(): - return all( - shdr.sh_type != SHT_SYMTAB and not name.startswith('.debug_') - for shdr, name in gen_sections()) - - def get_cpu(): - return ELF_MACHINE_TO_CPU.get(ehdr.e_machine) - - def gen_source_files(): - # Given the file position of a CU header (starting with the - # beginning of the .debug_line section), return the position - # of the include_directories portion and the position of the - # next CU header. - def read_line_header(pos): - # Decode DWARF .debug_line per-CU header. - hdr_type = elf.dwarf2_line_header - hdr = hdr_type.read(file, pos) - assert hdr.unit_length < 0xfffffff0, ( - "%s: 64-bit DWARF" % filename) - assert hdr.version in [2,3,4], ( - "%s: DWARF .debug_line version %r" % - (filename, hdr.version)) - if hdr.version == 4: - hdr_type = elf.dwarf4_line_header - hdr = hdr_type.read(file, pos) - return (pos + hdr_type.size + hdr.opcode_base - 1, - pos + 4 + hdr.unit_length) - - # Decode include_directories portion of DWARF .debug_line format. - def read_include_dirs(pos): - include_dirs = list(gen_strings(pos)) - pos += sum(len(dir) + 1 for dir in include_dirs) + 1 - return pos, include_dirs - - # Decode file_paths portion of DWARF .debug_line format. - def gen_file_paths(start, limit): - while start < limit: - end = file.find('\0', start, limit) - assert end >= start, ( - "%s: Unterminated string at %#x" % (filename, start)) - if start == end: - break - name = file[start:end] - start = end + 1 - # Decode 3 ULEB128s to advance start, but only use the first. - for i in range(3): - value = 0 - bits = 0 - while start < limit: - byte = ord(file[start]) - start += 1 - value |= (byte & 0x7f) << bits - if (byte & 0x80) == 0: - break - bits += 7 - if i == 0: - include_idx = value - # Ignore the fake file names the compiler leaks into the DWARF. - if name not in ['<stdin>', '<command-line>']: - yield name, include_idx - - for shdr, name in gen_sections(): - if name == '.debug_line': - next = shdr.sh_offset - while next < shdr.sh_offset + shdr.sh_size: - pos, next = read_line_header(next) - - pos, include_dirs = read_include_dirs(pos) - assert pos <= next - - # 0 means relative to DW_AT_comp_dir, which should be ".". - # Indices into the actual table start at 1. - include_dirs.insert(0, '') - - # Decode file_paths and apply include directories. - for name, i in gen_file_paths(pos, next): - name = os.path.join(include_dirs[i], name) - yield os.path.normpath(name) - - # This closure becomes the elf_info object's `get_sources` method. - def lazy_get_sources(): - # Run the generator and cache its results as a set. - sources_cache = set(gen_source_files()) - # Replace the method to just return the cached set next time. - info.get_sources = lambda: sources_cache - return sources_cache - - # Map in the whole file's contents and use it as a string. - with mmapper(filename) as mapped: - fd, file = mapped - elf = get_elf_accessor(file) - if elf is not None: - # ELF header leads to program headers. - ehdr = elf.Ehdr.read(file) - assert ehdr.e_phentsize == elf.Phdr.size, ( - "%s: invalid e_phentsize" % filename) - phdrs = list(gen_phdrs(file, elf, ehdr)) - info = elf_info(filename, - get_cpu(), - get_matching_notes(), - get_build_id(), - get_stripped(), - get_interp(), - *get_soname_and_needed()) - info.elf = elf - info.get_sources = lazy_get_sources - return info - - return None - - -# Module public API. -__all__ = ['cpu', 'elf_info', 'elf_note', 'get_elf_accessor', 'get_elf_info'] - - -def test_main_strip(filenames): - for filename in filenames: - info = get_elf_info(filename) - print info - stripped_filename = info.filename + '.ei-strip' - info.strip(stripped_filename) - print '\t%s: %u -> %u' % (stripped_filename, - os.stat(filename).st_size, - os.stat(stripped_filename).st_size) - - -def test_main_get_info(filenames): - for filename in filenames: - info = get_elf_info(filename) - print info - for source in info.get_sources(): - print '\t' + source - - -# For manual testing. -if __name__ == "__main__": - import sys - if sys.argv[1] == '-strip': - test_main_strip(sys.argv[2:]) - else: - test_main_get_info(sys.argv[1:])
diff --git a/images/finalize_manifests.py b/images/finalize_manifests.py deleted file mode 100755 index cb05b79..0000000 --- a/images/finalize_manifests.py +++ /dev/null
@@ -1,440 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -This tool takes in multiple manifest files: - * system image and archive manifest files from each package - * Zircon's bootfs.manifest, optionally using a subset selected by the - "group" syntax (e.g. could specify just "core", or "core,misc" or - "core,misc,test"). - * "auxiliary" manifests - ** one from the toolchain for the target libraries (libc++ et al) - ** one from the build-zircon/*-ulib build, which has the Zircon ASan libraries - ** the unselected parts of the "main" manifests (i.e. Zircon) - -It emits final /boot and /system manifests used to make the actual images, -final archive manifests used to make each package, and the build ID map. - -The "auxiliary" manifests just supply a pool of files that might be used to -satisfy dependencies; their files are not included in the output a priori. - -The tool examines each file in its main input manifests. If it's not an -ELF file, it just goes into the appropriate output manifest. If it's an -ELF file, then the tool figures out what "variant" it is (if any), such as -"asan" and what other ELF files it requires via PT_INTERP and DT_NEEDED. -It then finds those dependencies and includes them in the output manifest, -and iterates on their dependencies. Each dependency is found either in the -*-shared/ toolchain $root_out_dir for the same variant toolchain that built -the root file, or among the files in auxiliary manifests (i.e. toolchain -and Zircon libraries). For things built in the asan variant, it finds the -asan versions of the toolchain/Zircon libraries. -""" - -from collections import namedtuple -import argparse -import fnmatch -import itertools -import manifest -import os -import sys -import variant - - -binary_info = variant.binary_info - -# An entry for a binary is (manifest.manifest_entry, elfinfo.elf_info). -binary_entry = namedtuple('binary_entry', ['entry', 'info']) - -# In recursions of CollectBinaries.AddBinary, this is the type of the -# context argument. -binary_context = namedtuple('binary_context', [ - 'variant', - 'soname_map', - 'root_dependent', -]) - -# Each --output argument yields an output_manifest tuple. -output_manifest = namedtuple('output_manifest', ['file', 'manifest']) - -# Each --binary argument yields a input_binary tuple. -input_binary = namedtuple('input_binary', ['target_pattern', 'output_group']) - - -# Collect all the binaries from auxiliary manifests into -# a dictionary mapping entry.target to binary_entry. -def collect_auxiliaries(manifest, examined): - aux_binaries = {} - for entry in manifest: - examined.add(entry.source) - info = binary_info(entry.source) - if info: - new_binary = binary_entry(entry, info) - binary = aux_binaries.setdefault(entry.target, new_binary) - if binary.entry.source != new_binary.entry.source: - raise Exception( - "'%s' in both %r and %r" % - (entry.target, binary.entry, entry)) - return aux_binaries - - -# Return an iterable of binary_entry for all the binaries in `manifest` and -# `input_binaries` and their dependencies from `aux_binaries`, and an -# iterable of manifest_entry for all the other files in `manifest`. -def collect_binaries(manifest, input_binaries, aux_binaries, examined): - # As we go, we'll collect the actual binaries for the output - # in this dictionary mapping entry.target to binary_entry. - binaries = {} - - # We'll collect entries in the manifest that aren't binaries here. - nonbinaries = [] - - # This maps GN toolchain (from variant.shared_toolchain) to a - # dictionary mapping DT_SONAME string to binary_entry. - soname_map_by_toolchain = {} - - def rewrite_binary_group(old_binary, group_override): - return binary_entry( - old_binary.entry._replace(group=group_override), - old_binary.info) - - def add_binary(binary, context=None, auxiliary=False): - # Add a binary by target name. - def add_auxiliary(target, required, group_override=None): - if group_override is None: - group_override = binary.entry.group - aux_context = context - else: - aux_context = None - # Look for the target in auxiliary manifests. - aux_binary = aux_binaries.get(target) - if required: - assert aux_binary, ( - "'%s' not in auxiliary manifests, needed by %r via %r" % - (target, binary.entry, context.root_dependent)) - if aux_binary: - add_binary(rewrite_binary_group(aux_binary, group_override), - aux_context, True) - return True - return False - - existing_binary = binaries.get(binary.entry.target) - if existing_binary is not None: - if existing_binary.entry.source != binary.entry.source: - raise Exception("%r in both %r and %r" % - (binary.entry.target, existing_binary, binary)) - # If the old record was in a later group, we still need to - # process all the dependencies again to promote them to - # the new group too. - if existing_binary.entry.group <= binary.entry.group: - return - - examined.add(binary.entry.source) - - # If we're not part of a recursion, discover the binary's context. - if context is None: - binary_variant, variant_file = variant.find_variant(binary.info) - if variant_file is not None: - # This is a variant that was actually built in a different - # place than its original name says. Rewrite everything to - # refer to the "real" name. - binary = binary_entry(binary.entry._replace(source=variant_file), - binary.info.rename(variant_file)) - examined.add(variant_file) - context = binary_context(binary_variant, - soname_map_by_toolchain.setdefault( - binary_variant.shared_toolchain, {}), - binary) - - binaries[binary.entry.target] = binary - assert binary.entry.group is not None, binary - - if binary.info.soname: - # This binary has a SONAME, so record it in the map. - soname_binary = context.soname_map.setdefault(binary.info.soname, - binary) - if soname_binary.entry.source != binary.entry.source: - raise Exception( - "SONAME '%s' in both %r and %r" % - (binary.info.soname, soname_binary, binary)) - if binary.entry.group < soname_binary.entry.group: - # Update the record to the earliest group. - context.soname_map[binary.info.soname] = binary - - # The PT_INTERP is implicitly required from an auxiliary manifest. - if binary.info.interp: - add_auxiliary('lib/' + binary.info.interp, True) - - # The variant might require other auxiliary binaries too. - for variant_aux, variant_aux_group in context.variant.aux: - add_auxiliary(variant_aux, True, variant_aux_group) - - # Handle the DT_NEEDED list. - for soname in binary.info.needed: - # The vDSO is not actually a file. - if soname == 'libzircon.so': - continue - - lib = context.soname_map.get(soname) - if lib and lib.entry.group <= binary.entry.group: - # Already handled this one in the same or earlier group. - continue - - # The DT_SONAME is libc.so, but the file is ld.so.1 on disk. - if soname == 'libc.so': - soname = 'ld.so.1' - - # Translate the SONAME to a target file name. - target = ('lib/' + - ('' if soname == context.variant.runtime - else context.variant.libprefix) + - soname) - if add_auxiliary(target, auxiliary): - # We found it in an existing manifest. - continue - - # An auxiliary's dependencies must all be auxiliaries too. - assert not auxiliary, ( - "missing '%s' needed by auxiliary %r via %r" % - (target, binary, context.root_dependent)) - - # It must be in the shared_toolchain output directory. - # Context like group is inherited from the dependent. - lib_entry = binary.entry._replace( - source=os.path.join(context.variant.shared_toolchain, soname), - target=target) - - assert os.path.exists(lib_entry.source), ( - "missing %r needed by %r via %r" % - (lib_entry, binary, context.root_dependent)) - - # Read its ELF info and sanity-check. - lib = binary_entry(lib_entry, binary_info(lib_entry.source)) - assert lib.info and lib.info.soname == soname, ( - "SONAME '%s' expected in %r, needed by %r via %r" % - (soname, lib, binary, context.root_dependent)) - - # Recurse. - add_binary(lib, context) - - for entry in manifest: - try: - info = None - # Don't inspect data resources in the manifest. Regardless of the - # bits in these files, we treat them as opaque data. - if not entry.target.startswith('data/'): - info = binary_info(entry.source) - except IOError as e: - raise Exception('%s from %s' % (e, entry)) - if info: - add_binary(binary_entry(entry, info)) - else: - nonbinaries.append(entry) - - matched_binaries = set() - for input_binary in input_binaries: - matches = fnmatch.filter(aux_binaries.iterkeys(), - input_binary.target_pattern) - assert matches, ( - "--input-binary='%s' did not match any binaries" % - input_binary.target_pattern) - for target in matches: - assert target not in matched_binaries, ( - "'%s' matched by multiple --input-binary patterns" % target) - matched_binaries.add(target) - add_binary(rewrite_binary_group(aux_binaries[target], - input_binary.output_group), - auxiliary=True) - - return binaries.itervalues(), nonbinaries - - -# Take an iterable of binary_entry, and return list of binary_entry (all -# stripped files), a list of binary_info (all debug files), and a boolean -# saying whether any new stripped output files were written in the process. -def strip_binary_manifest(manifest, stripped_dir, examined): - new_output = False - - def find_debug_file(filename): - # In the Zircon makefile build, the file to be installed is called - # foo.strip and the unstripped file is called foo. In the GN build, - # the file to be installed is called foo and the unstripped file has - # the same name in the exe.unstripped or lib.unstripped subdirectory. - if filename.endswith('.strip'): - debugfile = filename[:-6] - else: - dir, file = os.path.split(filename) - if file.endswith('.so') or '.so.' in file: - subdir = 'lib.unstripped' - else: - subdir = 'exe.unstripped' - debugfile = os.path.join(dir, subdir, file) - while not os.path.exists(debugfile): - # For dir/foo/bar, if dir/foo/exe.unstripped/bar - # didn't exist, try dir/exe.unstripped/foo/bar. - parent, dir = os.path.split(dir) - if not parent or not dir: - return None - dir, file = parent, os.path.join(dir, file) - debugfile = os.path.join(dir, subdir, file) - if not os.path.exists(debugfile): - debugfile = os.path.join(subdir, filename) - if not os.path.exists(debugfile): - return None - debug = binary_info(debugfile) - assert debug, ("Debug file '%s' for '%s' is invalid" % - (debugfile, filename)) - examined.add(debugfile) - return debug - - # The toolchain-supplied shared libraries, and Go binaries, are - # delivered unstripped. For these, strip the binary right here and - # update the manifest entry to point to the stripped file. - def make_debug_file(entry, info): - debug = info - stripped = os.path.join(stripped_dir, entry.target) - dir = os.path.dirname(stripped) - if not os.path.isdir(dir): - os.makedirs(dir) - if info.strip(stripped): - new_output = True - info = binary_info(stripped) - assert info, ("Stripped file '%s' for '%s' is invalid" % - (stripped, debug.filename)) - examined.add(debug.filename) - examined.add(stripped) - return entry._replace(source=stripped), info, debug - - stripped_manifest = [] - debug_list = [] - for entry, info in manifest: - assert entry.source == info.filename - if info.stripped: - debug = find_debug_file(info.filename) - else: - entry, info, debug = make_debug_file(entry, info) - stripped_manifest.append(binary_entry(entry, info)) - if debug is None: - print 'WARNING: no debug file found for %s' % info.filename - continue - assert debug.build_id, "'%s' has no build ID" % debug.filename - assert not debug.stripped, "'%s' is stripped" % debug.filename - assert info == debug._replace(filename=info.filename, stripped=True), ( - "Debug file mismatch: %r vs %r" % (info, debug)) - debug_list.append(debug) - - return stripped_manifest, debug_list, new_output - - -def emit_manifests(args, selected, unselected, input_binaries): - def update_file(file, contents, force=False): - if (not force and - os.path.exists(file) and - os.path.getsize(file) == len(contents)): - with open(file, 'r') as f: - if f.read() == contents: - return - with open(file, 'w') as f: - f.write(contents) - - # The name of every file we examine to make decisions goes into this set. - examined = set(args.manifest) - - # Collect all the inputs and reify. - aux_binaries = collect_auxiliaries(unselected, examined) - binaries, nonbinaries = collect_binaries(selected, input_binaries, - aux_binaries, examined) - - # Prepare to collate groups. - outputs = [output_manifest(file, []) for file in args.output] - - # Finalize the output binaries. If stripping wrote any new/changed files, - # then force an update of the manifest file even if it's identical. The - # manifest file's timestamp is what GN/Ninja sees as running this script - # having touched any of its outputs, and GN/Ninja doesn't know that the - # stripped files are implicit outputs (there's no such thing as a depfile - # for outputs, only for inputs). - binaries, debug_files, force_update = strip_binary_manifest( - binaries, args.stripped_dir, examined) - - # Collate groups. - for entry in itertools.chain((binary.entry for binary in binaries), - nonbinaries): - outputs[entry.group].manifest.append(entry._replace(group=None)) - - all_binaries = {binary.info.build_id: binary.entry for binary in binaries} - all_debug_files = {info.build_id: info for info in debug_files} - - # Emit each primary manifest. - for output in outputs: - depfile_output = output.file - # Sort so that functionally identical output is textually - # identical. - output.manifest.sort(key=lambda entry: entry.target) - update_file(output.file, - manifest.format_manifest_file(output.manifest), - force_update) - - # Emit the build ID list. - # Sort so that functionally identical output is textually identical. - debug_files = sorted(all_debug_files.itervalues(), - key=lambda info: info.build_id) - update_file(args.build_id_file, ''.join( - info.build_id + ' ' + os.path.abspath(info.filename) + '\n' - for info in debug_files)) - - # Emit the depfile. - if args.depfile: - with open(args.depfile, 'w') as f: - f.write(depfile_output + ':') - for file in sorted(examined): - f.write(' ' + file) - f.write('\n') - - -class input_binary_action(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - binaries = getattr(namespace, self.dest, None) - if binaries is None: - binaries = [] - setattr(namespace, self.dest, binaries) - outputs = getattr(namespace, 'output', None) - output_group = len(outputs) - 1 - binaries.append(input_binary(values, output_group)) - - -def parse_args(): - parser = argparse.ArgumentParser(description=''' -Massage manifest files from the build to produce images. -''', - epilog=''' -The --cwd and --group options apply to subsequent --manifest arguments. -Each input --manifest is assigned to the preceding --output argument file. -Any input --manifest that precedes all --output arguments -just supplies auxiliary files implicitly required by other (later) input -manifests, but does not add all its files to any --output manifest. This -is used for shared libraries and the like. -''') - parser.add_argument('--build-id-file', required=True, - metavar='FILE', - help='Output build ID list') - parser.add_argument('--depfile', - metavar='DEPFILE', - help='Ninja depfile to write') - parser.add_argument('--binary', action=input_binary_action, default=[], - metavar='PATH', - help='Take matching binaries from auxiliary manifests') - parser.add_argument('--stripped-dir', required=True, - metavar='STRIPPED_DIR', - help='Directory to hold stripped copies when needed') - return manifest.common_parse_args(parser) - - -def main(): - args = parse_args() - emit_manifests(args, args.selected, args.unselected, args.binary) - - -if __name__ == "__main__": - main()
diff --git a/images/fvm.gni b/images/fvm.gni deleted file mode 100644 index 675a6f9..0000000 --- a/images/fvm.gni +++ /dev/null
@@ -1,83 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zircon.gni") - -declare_args() { - # The size in bytes of the FVM partition image to create. Normally this is - # computed to be just large enough to fit the blob and data images. The - # default value is "", which means to size based on inputs. Specifying a size - # that is too small will result in build failure. - fvm_image_size = "" - - # The size of the FVM partition images "slice size". The FVM slice size is a - # minimum size of a particular chunk of a partition that is stored within - # FVM. A very small slice size may lead to decreased throughput. A very large - # slice size may lead to wasted space. The selected default size of 8mb is - # selected for conservation of space, rather than performance. - fvm_slice_size = "8388608" -} - -# Build an FVM partition -# -# Parameters -# -# args (optional) -# [list of strings] Additional arguments to pass to the FVM tool. -# -# output_name (required) -# [string] The filename to produce. -# -# partitions (required) -# [list of scopes] a list of partitions to be included -# dep (required) -# [label] The label must be defined earlier in the same file. -# type (required) -# [string] A partition type accepted by fvm (e.g. blob, data, data-unsafe) -# -# deps (optional) -# testonly (optional) -# visibility (optional) -# Same as for any GN `action()` target. -template("generate_fvm") { - zircon_tool_action(target_name) { - forward_variables_from(invoker, - [ - "testonly", - "deps", - "visibility", - ]) - tool = "fvm" - outputs = [ - invoker.output_name, - ] - args = rebase_path(outputs, root_build_dir) - if (defined(invoker.args)) { - args += invoker.args - } - sources = [] - if (!defined(deps)) { - deps = [] - } - foreach(part, invoker.partitions) { - args += [ "--${part.type}" ] - deps += [ part.dep ] - sources += get_target_outputs(part.dep) - args += rebase_path(get_target_outputs(part.dep), root_build_dir) - } - } -} - -fvm_slice_args = [ - "--slice", - fvm_slice_size, -] - -fvm_create_args = [ "create" ] + fvm_slice_args - -fvm_sparse_args = [ - "sparse", - "--compress", - "lz4", - ] + fvm_slice_args
diff --git a/images/guest/BUILD.gn b/images/guest/BUILD.gn deleted file mode 100644 index 6812232..0000000 --- a/images/guest/BUILD.gn +++ /dev/null
@@ -1,241 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zbi.gni") -import("//build/config/fuchsia/zircon.gni") -import("//build/images/manifest.gni") -import("//build/package.gni") -import("//garnet/build/pkgfs.gni") - -guest_packages = [ - get_label_info("//build/images:shell-commands", "label_no_toolchain"), - get_label_info("//garnet/bin/appmgr", "label_no_toolchain"), - get_label_info("//garnet/bin/guest/integration:guest_integration_tests_utils", - "label_no_toolchain"), - get_label_info("//garnet/bin/guest/pkg/zircon_guest:services_config", - "label_no_toolchain"), - get_label_info("//garnet/bin/run", "label_no_toolchain"), - get_label_info("//garnet/bin/sysmgr", "label_no_toolchain"), - get_label_info("//garnet/bin/trace", "label_no_toolchain"), - get_label_info("//garnet/bin/vsock_service:vsock_service", - "label_no_toolchain"), - get_label_info(pkgfs_package_label, "label_no_toolchain"), -] - -# The pkgsvr index is a manifest mapping `package_name/package_version` to -# the merkleroot of the package's meta.far file. -action("pkgsvr_index") { - visibility = [ ":*" ] - testonly = true - script = "//build/images/manifest.py" - args = [ "--contents" ] - outputs = [ - "$target_out_dir/$target_name", - ] - args += [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - sources = [] - deps = [] - foreach(pkg_label, guest_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.pkgsvr_index.rsp" - deps += [ "${pkg_label}.pkgsvr_index.rsp" ] - sources += [ pkg_rspfile ] - args += [ "@" + rebase_path(pkg_rspfile, root_build_dir) ] - } -} - -boot_manifest = "$target_out_dir/boot.manifest" -generate_manifest("guest.manifest") { - visibility = [ ":*" ] - testonly = true - - bootfs_manifest = boot_manifest - bootfs_zircon_groups = "misc,test" - - args = [] - deps = [] - sources = [] - foreach(pkg_label, guest_packages) { - # Find the response file written by package(). - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_system_rsp = "$pkg_target_out_dir/${pkg_target_name}.system.rsp" - deps += [ pkg_label ] - sources += [ pkg_system_rsp ] - args += [ "@" + rebase_path(pkg_system_rsp, root_build_dir) ] - } - - json = "guest_meta_package.json" - sources += [ json ] - args += [ "--entry=meta/package=" + rebase_path(json, root_build_dir) ] - - # Add the static packages (pkgsvr) index. - deps += [ ":pkgsvr_index" ] - pkgsvr_index = "$target_out_dir/pkgsvr_index" - sources += [ pkgsvr_index ] - args += [ "--entry=data/static_packages=" + - rebase_path(pkgsvr_index, root_build_dir) ] -} - -# Generate, sign, and seal the package file. -pm_build_package("guest.meta") { - visibility = [ ":*" ] - testonly = true - manifest = ":guest.manifest" -} - -guest_blob_manifest = "$root_build_dir/guest_blob.manifest" -action("guest_blob.manifest") { - visibility = [ ":*" ] - testonly = true - deps = [ - ":guest.manifest", - ":guest.meta", - ] - outputs = [ - guest_blob_manifest, - ] - depfile = guest_blob_manifest + ".d" - guest_manifest_outputs = get_target_outputs(":guest.manifest") - guest_manifest = guest_manifest_outputs[0] - inputs = [ - guest_manifest, - ] - script = "//build/images/blob_manifest.py" - args = [ "@{{response_file_name}}" ] - response_file_contents = [ - "--depfile=" + rebase_path(depfile, root_build_dir), - "--output=" + rebase_path(guest_blob_manifest, root_build_dir), - "--input=" + - rebase_path("$target_out_dir/guest.meta/blobs.json", root_build_dir), - ] - foreach(pkg_label, guest_packages) { - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_blobs_rsp = "$pkg_target_out_dir/${pkg_target_name}.blobs.rsp" - deps += [ "${pkg_label}.blobs.rsp" ] - inputs += [ pkg_blobs_rsp ] - response_file_contents += - [ "@" + rebase_path(pkg_blobs_rsp, root_build_dir) ] - } -} - -zircon_tool_action("guest_blob.blk") { - visibility = [ ":*" ] - testonly = true - deps = [ - ":guest_blob.manifest", - ] - blob_image_path = "$target_out_dir/$target_name" - outputs = [ - blob_image_path, - ] - depfile = blob_image_path + ".d" - inputs = [ - guest_blob_manifest, - ] - tool = "blobfs" - args = [ - "--depfile", - rebase_path(blob_image_path, root_build_dir), - "create", - "--manifest", - rebase_path(guest_blob_manifest, root_build_dir), - ] -} - -zircon_tool_action("guest_fvm") { - testonly = true - fvm = "$root_out_dir/guest_fvm.blk" - outputs = [ - fvm, - ] - tool = "fvm" - sources = [] - deps = [ - ":guest_blob.blk", - ] - foreach(label, deps) { - sources += get_target_outputs(label) - } - args = [ - rebase_path(fvm, root_build_dir), - "create", - "--blob", - ] + rebase_path(sources, root_build_dir) -} - -# Generate the /boot/config/devmgr file. -action("devmgr_config.txt") { - visibility = [ ":*" ] - testonly = true - script = "//build/images/manifest.py" - outputs = [ - "$target_out_dir/$target_name", - ] - pkgfs = "bin/" + pkgfs_binary_name - pkgfs_label = pkgfs_package_label + ".meta" - pkgfs_pkg_out_dir = get_label_info(pkgfs_label, "target_out_dir") + "/" + - get_label_info(pkgfs_label, "name") - pkgfs_blob_manifest = "$pkgfs_pkg_out_dir/meta/contents" - system_image_merkleroot = "$target_out_dir/guest.meta/meta.far.merkle" - - deps = [ - ":guest.manifest", - ":guest.meta", - pkgfs_label, - ] - sources = [ - boot_manifest, - pkgfs_blob_manifest, - system_image_merkleroot, - ] - - args = [ - "--output=" + rebase_path(outputs[0], root_build_dir), - - # Start with the fixed options. - "--entry=devmgr.require-system=true", - - # Add the pkgfs command line, embedding the merkleroot of the system image. - "--contents", - "--rewrite=*=zircon.system.pkgfs.cmd={target}+{source}", - "--entry=${pkgfs}=" + rebase_path(system_image_merkleroot, root_build_dir), - "--no-contents", - "--reset-rewrite", - - # Embed the pkgfs blob manifest with the "zircon.system.pkgfs.file." - # prefix on target file names. - "--rewrite=*=zircon.system.pkgfs.file.{target}={source}", - "--manifest=" + rebase_path(pkgfs_blob_manifest, root_build_dir), - "--reset-rewrite", - "--include=bin/devhost", - "--rewrite=bin/devhost=devhost.asan.strict=false", - "--manifest=" + rebase_path(boot_manifest, root_build_dir), - ] -} - -zbi("guest") { - testonly = true - deps = [ - ":devmgr_config.txt", - ":guest.manifest", - ] - inputs = [ - "${zircon_build_dir}/zircon.zbi", - boot_manifest, - ] - manifest = [ - { - outputs = [ - "config/devmgr", - ] - sources = get_target_outputs(":devmgr_config.txt") - }, - ] - cmdline = [] - cmdline_inputs = [] -}
diff --git a/images/guest/guest_meta_package.json b/images/guest/guest_meta_package.json deleted file mode 100644 index 90415a1..0000000 --- a/images/guest/guest_meta_package.json +++ /dev/null
@@ -1 +0,0 @@ -{"name": "guest_image", "version": "0"}
diff --git a/images/json.gni b/images/json.gni deleted file mode 100644 index 4b18920..0000000 --- a/images/json.gni +++ /dev/null
@@ -1,112 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Write an image manfiest at `gn gen` time. -# -# Parameters -# -# outputs (required) -# [list of two files] The first output is JSON, the second sh variables. -# -# images (required) -# [list of scopes] See below. -# -# Each scope in $images contains: -# -# default (optional) -# [bool] Include image in the default group (default: true). -# It is preferred that very large images that are rarely used are not -# in the default group. Absence of a value is equivalent to true. -# -# deps (required) -# [list of labels] Target that generates the image file. -# If `sources` is not specified, this must be an action in this file, -# and that action must produce a valid ZBI as the first declared output. -# -# installer (optional) -# [string] Put this image into the installer image under this name. -# -# public (optional) -# [list of strings] Each is "IMAGE_{NAME}_{TYPE}" where `TYPE` can be: -# `SPARSE` (sparse FVM), `RAW` (block image for any FS), `ZBI` -# (bootable zircon image), `RAM` (ramdisk without kernel--obsolete), -# `VBOOT` (ZBI in a vboot container). "IMAGE_{NAME}_{TYPE}={FILE}" -# will be written out (with `FILE` relative to `root_build_dir`), to be -# consumed by //scripts and various tools to find the relevant images. -# -# json (optional) -# [scope] Content for images.json; `path` is added automatically. -# Other fields should match TODO(mcgrathr): some JSON schema. -# Standard fields not properly documented in a schema yet: -# path (required) -# [file] Path relative to $root_build_dir where the image is found. -# Also serves as the Ninja command-line target argument to build it. -# name (required) -# [string] A simple identifier for the image. -# type (required) -# [string] Type of image: "zbi", "blk", "kernel", "vboot" -# bootserver_pave (optional) -# [string] The command-line switch to `bootserver` that should -# precede this file's name. The presence of this field implies -# that this image is needed for paving via Zedboot. The value "" -# means this image is the primary ZBI, which is not preceded by a -# switch on the `bootserver` command line. -# bootserver_netboot (optional) -# [string] The command-line switch to `bootserver` that should -# precede this file's name. The presence of this field implies -# that this image is needed for netbooting via Zedboot. The value "" -# means this image is the primary ZBI, which is not preceded by a -# switch on the `bootserver` command line. -# archive (optional; default: false) -# [boolean] This image should be included in a build archive. -# Implied by the presence of `bootserver`. -# -# sdk (optional) -# [string] Put this image into the SDK under this name. -# -# sources (optional) -# [list of files] The image file. -# -# updater (optional) -# [string] Put this image into the update manifest under this name. -# -template("write_images_manifest") { - not_needed([ "target_name" ]) # Seriously. - images_json = [] - image_paths = [] - foreach(image, invoker.images) { - image_sources = [] - if (defined(image.sources)) { - image_sources += image.sources - } else { - foreach(label, image.deps) { - image_sources += get_target_outputs(label) - } - } - image_file = rebase_path(image_sources[0], root_build_dir) - - if (defined(image.json)) { - images_json += [ - { - forward_variables_from(image.json, "*") - path = image_file - }, - ] - } - - if (defined(image.public)) { - foreach(name, image.public) { - image_paths += [ "${name}=${image_file}" ] - } - } - } - - outputs = invoker.outputs - assert(outputs == [ - outputs[0], - outputs[1], - ]) - write_file(outputs[0], images_json, "json") - write_file(outputs[1], image_paths) -}
diff --git a/images/manifest.gni b/images/manifest.gni deleted file mode 100644 index e13f2cf..0000000 --- a/images/manifest.gni +++ /dev/null
@@ -1,261 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/fuchsia/zircon.gni") - -declare_args() { - # Manifest files describing target libraries from toolchains. - # Can be either // source paths or absolute system paths. - toolchain_manifests = [ - # clang_prefix is relative to root_build_dir. - rebase_path("${clang_prefix}/../lib/${clang_target}.manifest", - "", - root_build_dir), - ] - - # Manifest files describing extra libraries from a Zircon build - # not included in `zircon_boot_manifests`, such as an ASan build. - # Can be either // source paths or absolute system paths. - # - # Since Zircon manifest files are relative to a Zircon source directory - # rather than to the directory containing the manifest, these are assumed - # to reside in a build directory that's a direct subdirectory of the - # Zircon source directory and thus their contents can be taken as - # relative to `get_path_info(entry, "dir") + "/.."`. - # TODO(mcgrathr): Make Zircon manifests self-relative too and then - # merge this and toolchain_manifests into generic aux_manifests. - if (zircon_use_asan) { - zircon_aux_manifests = [ "$zircon_build_abi_dir/bootfs.manifest" ] - } else { - zircon_aux_manifests = [ "$zircon_asan_build_dir/bootfs.manifest" ] - } - - # Manifest files describing files to go into the `/boot` filesystem. - # Can be either // source paths or absolute system paths. - # `zircon_boot_groups` controls which files are actually selected. - # - # Since Zircon manifest files are relative to a Zircon source directory - # rather than to the directory containing the manifest, these are assumed - # to reside in a build directory that's a direct subdirectory of the - # Zircon source directory and thus their contents can be taken as - # relative to `get_path_info(entry, "dir") + "/.."`. - zircon_boot_manifests = [ "$zircon_build_dir/bootfs.manifest" ] - - # Extra args to globally apply to the manifest generation script. - extra_manifest_args = [] -} - -# Action target that generates a response file in GN's "shlex" format. -# -# Parameters -# -# output_name (optional, default: target_name) -# [path] Response file to write (if relative, relative to target_out_dir). -# -# response_file_contents (required) -# data_deps (optional) -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Same as for any GN `action()` target. -# -template("generate_response_file") { - action(target_name) { - forward_variables_from(invoker, - [ - "data_deps", - "deps", - "public_deps", - "output_name", - "response_file_contents", - "testonly", - "visibility", - ]) - if (!defined(output_name)) { - output_name = target_name - } - outputs = [ - "$target_out_dir/$output_name", - ] - assert( - defined(response_file_contents), - "generate_response_file(\"${target_name}\") must define response_file_contents") - - if (response_file_contents == []) { - # GN doesn't allow an empty response file. - script = "/bin/cp" - args = [ - "-f", - "/dev/null", - ] - } else { - script = "/bin/ln" - args = [ - "-f", - "{{response_file_name}}", - ] - } - args += rebase_path(outputs, root_build_dir) - } -} - -# Action target that generates a manifest file in the `target=/abs/file` -# format used by `zbi`, `blobfs`, etc. ELF files in the manifest have -# their dynamic linking details examined and other necessary ELF files -# implicitly added to the manifest. All such files have their build IDs -# and unstripped files recorded in a build ID map (`ids.txt` file). -# Outputs: $target_out_dir/$target_name, $target_out_dir/$target_name.ids.txt -# -# Parameters -# -# args (required) -# [list of strings] Additional arguments to finalize_manifests.py; -# `sources` should list any files directly referenced. -# -# bootfs_manifest (optional) -# [string] Output a separate manifest file for the Zircon BOOTFS. This -# manifest will get the `bootfs_zircon_groups` selections, while the -# main manifest will get `zircon_groups` and the other entries -# indicated by `args`. The main output manifest will assume that -# libraries from the BOOTFS are available and not duplicate them. -# -# bootfs_zircon_groups (required with `bootfs_manifest`) -# [string] Comma-separated list of Zircon manifest groups to include -# in `bootfs_manifest`. -# -# zircon_groups (optional, default: "") -# [string] Comma-separated list of Zircon manifest groups to include. -# If this is "", then the Zircon manifest only provides binaries -# to satisfy dependencies. -# -# deps (optional) -# sources (optional) -# testonly (optional) -# visibility (optional) -# Same as for any GN `action()` target. -# -template("generate_manifest") { - assert(defined(invoker.args), - "generate_manifest(\"${target_name}\") requires args") - action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "sources", - "testonly", - "visibility", - "zircon_groups", - ]) - if (!defined(sources)) { - sources = [] - } - if (!defined(zircon_groups)) { - zircon_groups = "" - } - manifest_file = "$target_out_dir/$target_name" - depfile = "${manifest_file}.d" - build_id_file = "${manifest_file}.ids.txt" - stripped_dir = "${manifest_file}.stripped" - - script = "//build/images/finalize_manifests.py" - inputs = rebase_path([ - "elfinfo.py", - "manifest.py", - "variant.py", - ], - "", - "//build/images") - outputs = [ - manifest_file, - build_id_file, - ] - args = extra_manifest_args + [ - "--depfile=" + rebase_path(depfile, root_build_dir), - "--build-id-file=" + rebase_path(build_id_file, root_build_dir), - "--stripped-dir=" + rebase_path(stripped_dir, root_build_dir), - "@{{response_file_name}}", - ] - response_file_contents = [] - - # First the toolchain and Zircon manifests are pure auxiliaries: - # they just supply libraries that might satisfy dependencies. - sources += toolchain_manifests - foreach(manifest, toolchain_manifests) { - manifest_cwd = get_path_info(rebase_path(manifest), "dir") - response_file_contents += [ - "--cwd=$manifest_cwd", - "--manifest=" + rebase_path(manifest), - ] - } - sources += zircon_aux_manifests + zircon_boot_manifests - foreach(manifest, zircon_aux_manifests + zircon_boot_manifests) { - manifest_cwd = get_path_info(rebase_path(manifest), "dir") + "/.." - response_file_contents += [ - "--cwd=$manifest_cwd", - "--manifest=" + rebase_path(manifest), - ] - } - - manifests = [] - - if (defined(invoker.bootfs_manifest)) { - assert( - defined(invoker.bootfs_zircon_groups), - "generate_manifest with bootfs_manifest needs bootfs_zircon_groups") - outputs += [ invoker.bootfs_manifest ] - manifests += [ - { - output = invoker.bootfs_manifest - groups = invoker.bootfs_zircon_groups - }, - ] - - # Elide both devhost variants from the Zircon input manifest. - # Each variant will be included if there is a driver that needs it. - # That way we can tell whether both variants are actually in use. - response_file_contents += [ - "--exclude=bin/devhost", - "--exclude=bin/devhost.asan", - ] - } - - manifests += [ - { - output = manifest_file - groups = zircon_groups - }, - ] - - foreach(manifest, manifests) { - response_file_contents += - [ "--output=" + rebase_path(manifest.output, root_build_dir) ] - if (manifest.groups != "") { - # The boot manifests were already listed as auxiliaries, but now - # list them again with selected groups to go in the output. This - # means the script processes these manifests twice, but we can't - # just omit them as auxiliaries because dependencies from the - # binaries selected here have to be found by target name in a - # previously-processed manifest. - response_file_contents += [ "--groups=${manifest.groups}" ] - sources += zircon_boot_manifests - foreach(manifest, zircon_boot_manifests) { - manifest_cwd = get_path_info(rebase_path(manifest), "dir") + "/.." - response_file_contents += [ - "--cwd=$manifest_cwd", - "--manifest=" + rebase_path(manifest), - ] - } - } - } - - response_file_contents += [ "--groups=all" ] - - # Now further `--manifest` or `--entry` arguments in invoker.args will - # contribute to the output manifest. - response_file_contents += [ "--cwd=." ] + invoker.args - } -}
diff --git a/images/manifest.py b/images/manifest.py deleted file mode 100755 index 23a132e..0000000 --- a/images/manifest.py +++ /dev/null
@@ -1,336 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from collections import namedtuple -import argparse -import os -import errno -import fnmatch -import shlex -import shutil -import sys - - -manifest_entry = namedtuple('manifest_entry', [ - 'group', - 'target', - 'source', - 'manifest', -]) - - -def format_manifest_entry(entry): - return (('' if entry.group is None else '{' + entry.group + '}') + - entry.target + '=' + entry.source) - - -def format_manifest_file(manifest): - return ''.join(format_manifest_entry(entry) + '\n' for entry in manifest) - - -def read_manifest_lines(sep, lines, title, manifest_cwd, result_cwd): - for line in lines: - # Remove the trailing newline. - assert line.endswith('\n'), 'Unterminated manifest line: %r' % line - line = line[:-1] - - # Grok {group}... syntax. - group = None - if line.startswith('{'): - end = line.find('}') - assert end > 0, 'Unterminated { in manifest line: %r' % line - group = line[1:end] - line = line[end + 1:] - - # Grok target=source syntax. - [target_file, build_file] = line.split(sep, 1) - - if manifest_cwd != result_cwd: - # Expand the path based on the cwd presumed in the manifest. - build_file = os.path.normpath(os.path.join(manifest_cwd, - build_file)) - # Make it relative to the cwd we want to work from. - build_file = os.path.relpath(build_file, result_cwd) - - # TODO(mcgrathr): Dismal kludge to avoid pulling in asan runtime - # libraries from the zircon ulib bootfs.manifest because their source - # file names don't match the ones in the toolchain manifest. - if 'prebuilt/downloads/clang/lib/' in build_file: - continue - - yield manifest_entry(group, target_file, build_file, title) - - -def partition_manifest(manifest, select, selected_group, unselected_group): - selected = [] - unselected = [] - for entry in manifest: - if select(entry.group): - selected.append(entry._replace(group=selected_group)) - else: - unselected.append(entry._replace(group=unselected_group)) - return selected, unselected - - -def ingest_manifest_lines(sep, lines, title, in_cwd, groups, out_cwd, output_group): - groups_seen = set() - def select(group): - groups_seen.add(group) - if isinstance(groups, bool): - return groups - return group in groups - selected, unselected = partition_manifest( - read_manifest_lines(sep, lines, title, in_cwd, out_cwd), - select, output_group, None) - return selected, unselected, groups_seen - - -def apply_source_rewrites(rewrites, entry): - for rewrite in rewrites: - if entry.source == rewrite.source: - return entry._replace(source=rewrite.target) - return entry - - -def apply_rewrites(sep, rewrites, entry): - for pattern, line in rewrites: - if fnmatch.fnmatchcase(entry.target, pattern): - [new_entry] = read_manifest_lines( - sep, - [line.format(**entry._asdict()) + '\n'], entry.manifest, - os.path.dirname(entry.manifest), - os.path.dirname(entry.manifest)) - entry = new_entry._replace(group=entry.group) - return entry - - -def contents_entry(entry): - with open(entry.source) as file: - [line] = file.read().splitlines() - return entry._replace(source=line) - - -class input_action_base(argparse.Action): - def __init__(self, *args, **kwargs): - super(input_action_base, self).__init__(*args, **kwargs) - - def __call__(self, parser, namespace, values, option_string=None): - outputs = getattr(namespace, 'output', None) - - all_selected = getattr(namespace, 'selected', None) - if all_selected is None: - all_selected = [] - setattr(namespace, 'selected', all_selected) - all_unselected = getattr(namespace, 'unselected', None) - if all_unselected is None: - all_unselected = [] - setattr(namespace, 'unselected', all_unselected) - - if namespace.groups is None or outputs is None: - groups = False - elif namespace.groups == 'all': - groups = True - else: - groups = set(group if group else None - for group in namespace.groups.split(',')) - - cwd = getattr(namespace, 'cwd', '') - - if outputs is not None: - output_group = len(outputs) - 1 - else: - output_group = None - - selected, unselected, groups_seen = self.get_manifest_lines( - namespace, values, cwd, groups, namespace.output_cwd, output_group) - - include = getattr(namespace, 'include', []) - include_source = getattr(namespace, 'include_source', []) - exclude = getattr(namespace, 'exclude', []) - if include or exclude or include_source: - def included(entry): - def matches(file, patterns): - return any(fnmatch.fnmatch(file, pattern) - for pattern in patterns) - if matches(entry.target, exclude): - return False - if include and not matches(entry.target, include): - return False - return (not include_source or - matches(entry.source, include_source)) - unselected += filter(lambda entry: not included(entry), selected) - selected = filter(included, selected) - - if getattr(namespace, 'contents', False): - selected = map(contents_entry, selected); - unselected = map(contents_entry, unselected); - - sep = getattr(namespace, 'separator', '=') - rewrites = [entry.split('=', 1) - for entry in getattr(namespace, 'rewrite', [])] - selected = [apply_rewrites(sep, rewrites, entry) for entry in selected] - unselected = [apply_rewrites(sep, rewrites, entry) for entry in unselected] - - if not isinstance(groups, bool): - unused_groups = groups - groups_seen - set([None]) - if unused_groups: - raise Exception( - '%s not found in %r; try one of: %s' % - (', '.join(map(repr, unused_groups)), values, - ', '.join(map(repr, groups_seen - groups)))) - - all_selected += selected - all_unselected += unselected - - -class input_manifest_action(input_action_base): - def __init__(self, *args, **kwargs): - super(input_manifest_action, self).__init__(*args, **kwargs) - - def get_manifest_lines(self, namespace, filename, *args): - all_inputs = getattr(namespace, 'manifest', None) - if all_inputs is None: - all_inputs = [] - setattr(namespace, 'manifest', all_inputs) - all_inputs.append(filename) - with open(filename, 'r') as file: - return ingest_manifest_lines(getattr(namespace, 'separator', '='), - file, file.name, *args) - - -class input_entry_action(input_action_base): - def __init__(self, *args, **kwargs): - super(input_entry_action, self).__init__(*args, **kwargs) - - def get_manifest_lines(self, namespace, entry, *args): - return ingest_manifest_lines( - getattr(namespace, 'separator', '='), - [entry + '\n'], namespace.entry_manifest, *args) - - -def common_parse_args(parser): - parser.fromfile_prefix_chars='@' - parser.convert_arg_line_to_args = shlex.split - parser.add_argument('--output', action='append', required=True, - metavar='FILE', - help='Output file') - parser.add_argument('--output-cwd', default='', - metavar='DIRECTORY', - help='Emit source paths relative to DIRECTORY') - parser.add_argument('--absolute', action='store_true', default=False, - help='Output source file names as absolute paths') - parser.add_argument('--cwd', default='', - metavar='DIRECTORY', - help='Input entries are relative to this directory') - parser.add_argument('--groups', default='all', - metavar='GROUP_LIST', - help='"all" or comma-separated groups to include') - parser.add_argument('--manifest', action=input_manifest_action, - metavar='FILE', default=[], - help='Input manifest file (must exist)') - parser.add_argument('--entry', action=input_entry_action, - metavar='PATH=FILE', - help='Add a single entry as if from an input manifest') - parser.add_argument('--entry-manifest', default='<command-line --entry>', - metavar='TITLE', - help=('Title in lieu of manifest file name for' + - ' subsequent --entry arguments')) - parser.add_argument('--include', action='append', default=[], - metavar='TARGET', - help='Include only input entries matching TARGET'), - parser.add_argument('--include-source', action='append', default=[], - metavar='SOURCE', - help='Include only input entries matching SOURCE'), - parser.add_argument('--reset-include', - action='store_const', const=[], dest='include', - help='Reset previous --include') - parser.add_argument('--exclude', action='append', default=[], - metavar='TARGET', - help='Ignore input entries matching TARGET'), - parser.add_argument('--reset-exclude', - action='store_const', const=[], dest='exclude', - help='Reset previous --exclude') - parser.add_argument('--separator', default='=', - metavar='SEP', - help='Use SEP between TARGET and SOURCE in entries') - return parser.parse_args() - - -def parse_args(): - parser = argparse.ArgumentParser(description='Read manifest files.') - parser.add_argument('--copy-contentaddr', action='store_true', default=False, - help='Copy to content-addressed targets, not manifest') - parser.add_argument('--sources', action='store_true', default=False, - help='Write source file per line, not manifest entry') - parser.add_argument('--contents', - action='store_true', default=False, - help='Replace each source file name with its contents') - parser.add_argument('--no-contents', - action='store_false', dest='contents', - help='Reset previous --contents') - parser.add_argument( - '--rewrite', action='append', default=[], - metavar='PATTERN=ENTRY', - help='Replace entries whose target matches PATTERN with ENTRY,' - ' which can use {source} and {target} substitutions'), - parser.add_argument('--reset-rewrite', dest='rewrite', - action='store_const', const=[], - help='Reset previous --rewrite') - parser.add_argument('--unique', - action='store_true', default=False, - help='Elide duplicates even with different sources') - parser.add_argument('--stamp', - metavar='FILE', - help='Touch FILE at the end.') - args = common_parse_args(parser) - if args.copy_contentaddr: - if args.contents: - parser.error('--copy-contentaddr is incompatible with --contents') - args.unique = True - args.sources = True - return args - - -def main(): - args = parse_args() - output_sets = [(dict() if args.unique else set()) for file in args.output] - for entry in getattr(args, 'selected', []): - assert entry.group is not None, entry - if args.absolute: - line = os.path.abspath(entry.source) - else: - line = entry.source - if not args.sources: - line = entry.target + args.separator + line - if args.unique: - output_sets[entry.group][entry.target] = line - else: - output_sets[entry.group].add(line) - for output_filename, output_set in zip(args.output, output_sets): - if args.copy_contentaddr: - created_dirs = set() - for target, source in output_set.iteritems(): - target_path = os.path.join(output_filename, target) - if os.path.exists(target_path): - continue - target_dir = os.path.dirname(target_path) - if target_dir not in created_dirs: - if not os.path.exists(target_dir): - os.makedirs(target_dir) - created_dirs.add(target_dir) - shutil.copyfile(source, target_path) - else: - with open(output_filename, 'w') as file: - file.write(''.join(sorted( - line + '\n' for line in - (output_set.itervalues() if args.unique else output_set)))) - if args.stamp: - with open(args.stamp, 'w') as file: - os.utime(file.name, None) - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/images/max_fvm_size.gni b/images/max_fvm_size.gni deleted file mode 100644 index b6a10c5..0000000 --- a/images/max_fvm_size.gni +++ /dev/null
@@ -1,9 +0,0 @@ -# Copyright 2019 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Maximum allowable size for the FVM in a release mode build - # Zero means no limit - max_fvm_size = "0" -}
diff --git a/images/pack-images.py b/images/pack-images.py deleted file mode 100755 index 343d49c..0000000 --- a/images/pack-images.py +++ /dev/null
@@ -1,252 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import StringIO -import argparse -import functools -import json -import operator -import os -import sys -import tarfile -import time -import zipfile - - -def generate_script(images, type): - # The bootserver must be in there or we lose. - # TODO(mcgrathr): Multiple bootservers for different platforms - # and switch in the script. - [bootserver] = [image['path'] for image in images - if image['name'] == 'bootserver'] - script = '''\ -#!/bin/sh -dir="$(dirname "$0")" -set -x -''' - switches = dict((switch, '"$dir/%s"' % image['path']) - for image in images if type in image - for switch in image[type]) - cmd = ['exec', '"$dir/%s"' % bootserver] - for switch, path in sorted(switches.iteritems()): - cmd += [switch, path] - cmd.append('"$@"') - script += ' '.join(cmd) + '\n' - return script - - -class TGZArchiver(object): - """Public interface needs to match ZipArchiver.""" - - def __init__(self, outfile): - self._archive = tarfile.open(outfile, 'w:gz', dereference=True) - - def __enter__(self): - return self - - def __exit__(self, unused_type, unused_value, unused_traceback): - self._archive.close() - - @staticmethod - def _sanitize_tarinfo(executable, info): - assert info.isfile() - info.mode = 0o555 if executable else 0o444 - info.uid = 0 - info.gid = 0 - info.uname = '' - info.gname = '' - return info - - def add_path(self, path, name, executable): - self._archive.add( - path, - name, - filter=functools.partial(self._sanitize_tarinfo, executable)) - - def add_contents(self, contents, name, executable): - info = self._sanitize_tarinfo(executable, tarfile.TarInfo(name)) - info.size = len(contents) - info.mtime = time.time() - self._archive.addfile(info, StringIO.StringIO(contents)) - - -class ZipArchiver(object): - """Public interface needs to match TGZArchiver.""" - - def __init__(self, outfile): - self._archive = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED) - self._archive.comment = 'Fuchsia build archive' - - def __enter__(self): - return self - - def __exit__(self, unused_type, unused_value, unused_traceback): - self._archive.close() - - def add_path(self, path, name, unused_executable): - self._archive.write(path, name) - - def add_contents(self, contents, name, unused_executable): - self._archive.writestr(name, contents) - - -def format_archiver(outfile, format): - return {'tgz': TGZArchiver, 'zip': ZipArchiver}[format](outfile) - - -def write_archive(outfile, format, images): - # Synthesize a sanitized form of the input. - path_images = [] - for image in images: - path = image['path'] - if 'archive' in image: - del image['archive'] - image['path'] = image['name'] + '.' + image['type'] - path_images.append((path, image)) - - # Generate scripts that use the sanitized file names. - content_images = [ - (generate_script([image for path, image in path_images], - 'bootserver_pave'), { - 'name': 'pave', - 'type': 'sh', - 'path': 'pave.sh' - }), - (generate_script([image for path, image in path_images], - 'bootserver_netboot'), { - 'name': 'netboot', - 'type': 'sh', - 'path': 'netboot.sh' - }) - ] - - # Self-reference. - content_images.append( - (json.dumps([image for _, image in (path_images + content_images)], - indent=2, sort_keys=True), - { - 'name': 'images', - 'type': 'json', - 'path': 'images.json', - })) - - # Canonicalize the order of the files in the archive. - path_images = sorted(path_images, key=lambda pair: pair[1]['path']) - content_images = sorted(content_images, key=lambda pair: pair[1]['path']) - - def is_executable(image): - return image['type'] == 'sh' or image['type'].startswith('exe') - - with format_archiver(outfile, format) as archiver: - for path, image in path_images: - archiver.add_path(path, image['path'], is_executable(image)) - for contents, image in content_images: - archiver.add_contents(contents, image['path'], is_executable(image)) - - - -def write_symbol_archive(outfile, format, ids_file, files_read): - files_read.add(ids_file) - with open(ids_file, 'r') as f: - ids = [line.split() for line in f] - out_ids = '' - with format_archiver(outfile, format) as archiver: - for id, file in ids: - file = os.path.relpath(file) - files_read.add(file) - name = os.path.relpath(file, '../..') - archiver.add_path(file, name, False) - out_ids += '%s %s\n' % (id, name) - archiver.add_contents(out_ids, 'ids.txt', False) - - -def archive_format(args, outfile): - if args.format: - return args.format - if outfile.endswith('.zip'): - return 'zip' - if outfile.endswith('.tgz') or outfile.endswith('.tar.gz'): - return 'tgz' - sys.stderr.write('''\ -Cannot guess archive format from file name %r; use --format. -''' % outfile) - sys.exit(1) - - -def main(): - parser = argparse.ArgumentParser(description='Pack Fuchsia build images.') - parser.add_argument('--depfile', - metavar='FILE', - help='Write Ninja dependencies file') - parser.add_argument('json', nargs='+', - metavar='FILE', - help='Read JSON image list from FILE') - parser.add_argument('--pave', - metavar='FILE', - help='Write paving bootserver script to FILE') - parser.add_argument('--netboot', - metavar='FILE', - help='Write netboot bootserver script to FILE') - parser.add_argument('--archive', - metavar='FILE', - help='Write archive to FILE') - parser.add_argument('--symbol-archive', - metavar='FILE', - help='Write symbol archive to FILE') - parser.add_argument('--format', choices=['tgz', 'zip'], - help='Archive format (default: from FILE suffix)') - args = parser.parse_args() - - # Keep track of every input file for the depfile. - files_read = set() - def read_json_file(filename): - files_read.add(filename) - with open(filename, 'r') as f: - return json.load(f) - - images = reduce(operator.add, - (read_json_file(file) for file in args.json), - []) - - outfile = None - - # Write an executable script into outfile for the given bootserver mode. - def write_script_for(outfile, mode): - with os.fdopen(os.open(outfile, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, - 0o777), - 'w') as script_file: - script_file.write(generate_script(images, mode)) - - # First write the local scripts that work relative to the build directory. - if args.pave: - outfile = args.pave - write_script_for(args.pave, 'bootserver_pave') - if args.netboot: - outfile = args.netboot - write_script_for(args.netboot, 'bootserver_netboot') - - if args.archive: - outfile = args.archive - archive_images = [image for image in images - if (image.get('archive', False) or - 'bootserver_pave' in image or - 'bootserver_netboot' in image)] - files_read |= set(image['path'] for image in archive_images) - write_archive(outfile, archive_format(args, outfile), archive_images) - - if args.symbol_archive: - outfile = args.symbol_archive - [ids_file] = [image['path'] for image in images - if image['name'] == 'build-id' and image['type'] == 'txt'] - write_symbol_archive(outfile, archive_format(args, outfile), - ids_file, files_read) - - if outfile and args.depfile: - with open(args.depfile, 'w') as depfile: - depfile.write('%s: %s\n' % (outfile, ' '.join(sorted(files_read)))) - - -if __name__ == "__main__": - main()
diff --git a/images/system_meta_package.json b/images/system_meta_package.json deleted file mode 100644 index 9917831..0000000 --- a/images/system_meta_package.json +++ /dev/null
@@ -1 +0,0 @@ -{"name": "system_image", "version": "0"}
diff --git a/images/system_package_key_check.py b/images/system_package_key_check.py deleted file mode 100755 index a29706c..0000000 --- a/images/system_package_key_check.py +++ /dev/null
@@ -1,18 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. 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 subprocess -import sys - -def main(pm_binary, stamp_file, key_file): - if not os.path.exists(key_file): - subprocess.check_call([pm_binary, '-k', key_file, 'genkey']) - with open(stamp_file, 'w') as f: - f.write('OK\n') - return 0 - -if __name__ == '__main__': - sys.exit(main(*sys.argv[1:]))
diff --git a/images/update_package.json b/images/update_package.json deleted file mode 100644 index de37794..0000000 --- a/images/update_package.json +++ /dev/null
@@ -1 +0,0 @@ -{"name": "update", "version": "0"}
diff --git a/images/variant.py b/images/variant.py deleted file mode 100755 index be92199..0000000 --- a/images/variant.py +++ /dev/null
@@ -1,132 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from collections import namedtuple -import elfinfo -import glob -import os - - -# Copied from //zircon/system/public/zircon/driver/binding.h, which see. -ZIRCON_NOTE_DRIVER = 0x31565244 # DRV1 -ZIRCON_DRIVER_IDENT = ('Zircon\0', ZIRCON_NOTE_DRIVER) - - -def binary_info(filename): - return elfinfo.get_elf_info(filename, [ZIRCON_DRIVER_IDENT]) - -def is_driver(info): - return bool(info.notes) - - -class variant( - namedtuple('variant', [ - 'shared_toolchain', # GN toolchain (and thus build dir subdirectory). - 'libprefix', # Prefix on DT_SONAME string. - 'runtime', # SONAME of runtime, does not use libprefix. - 'aux', # List of (file, group) required if this is used. - ])): - - def matches(self, info, assume=False): - if self.libprefix and info.interp: - return info.interp.startswith(self.libprefix) - if self.runtime: - return self.runtime in info.needed - return assume - - -def make_variant(name, info): - libprefix = '' - runtime = None - # All drivers need devhost; it must be in /boot (group 0). - aux = [('bin/devhost', 0)] if is_driver(info) else [] - if name is None: - tc = '%s-shared' % info.cpu.gn - else: - tc = '%s-%s-shared' % (info.cpu.gn, name) - if name in ('asan', 'asan-sancov'): - libprefix = 'asan/' - runtime = 'libclang_rt.asan.so' - # ASan drivers need devhost.asan. - aux = [(file + '.asan', group) for file, group in aux] - return variant(tc, libprefix, runtime, aux) - - -def find_variant(info, build_dir=os.path.curdir): - variant = None - variant_file = None - abs_build_dir = os.path.abspath(build_dir) - abs_filename = os.path.abspath(info.filename) - if abs_filename.startswith(os.path.join(abs_build_dir, '')): - # It's in the build directory. If it's a variant, it's a hard link - # into the variant toolchain root_out_dir. - file_stat = os.stat(info.filename) - if file_stat.st_nlink > 1: - # Figure out which variant it's linked to. Non-variant drivers - # are linked to the -shared toolchain. We match those as well - # as actual variants so we'll replace the unadorned filename - # with its -shared/ version, which is where the lib.unstripped/ - # subdirectory is found. Below, we'll change the name but not - # call it a variant. - rel_filename = os.path.relpath(abs_filename, abs_build_dir) - variant_prefix = info.cpu.gn + '-' - subdirs = [subdir - for subdir in os.listdir(build_dir) - if (subdir.startswith(variant_prefix) and - os.path.exists(os.path.join(subdir, rel_filename)))] - files = [os.path.join(subdir, rel_filename) for subdir in subdirs] - assert all(os.path.samestat(os.stat(file), file_stat) - for file in files), ( - "Not all %r matches are hard links: %r" % (info, files)) - # Rust binaries have multiple links but are not variants. - # So just ignore a multiply-linked file with no matches. - if files: - # A variant loadable_module (or driver_module) is actually - # built in the variant's -shared toolchain but is also - # linked to other variant toolchains. - if (len(subdirs) > 1 and - sum(subdir.endswith('-shared') for subdir in subdirs) == 1): - [subdir] = [subdir for subdir in subdirs - if subdir.endswith('-shared')] - else: - assert len(files) == 1, ( - "Multiple hard links to %r: %r" % (info, files)) - [subdir] = subdirs - name = subdir[len(variant_prefix):] - variant_file = os.path.relpath( - os.path.join(subdir, rel_filename), build_dir) - if name != 'shared': - # loadable_module and driver_module targets are linked - # to the variant-shared toolchain. - if name[-7:] == '-shared': - name = name[:-7] - variant = make_variant(name, info) - else: - # It's from an auxiliary. - asan = make_variant('asan', info) - if asan.matches(info): - variant = asan - if variant: - assert variant.matches(info, True), "%r vs %r" % (variant, info) - return variant, variant_file - return make_variant(None, info), variant_file - - -# Module public API. -__all__ = ['binary_info', 'find_variant', 'variant'] - - -def test_main(build_dir, filenames): - for filename in filenames: - info = binary_info(filename) - print info - print ' Driver: %r' % is_driver(info) - print ' %r' % (find_variant(info, build_dir),) - - -# For manual testing. -if __name__ == "__main__": - import sys - test_main(sys.argv[1], sys.argv[2:])
diff --git a/images/zedboot/BUILD.gn b/images/zedboot/BUILD.gn deleted file mode 100644 index 1bb2a68..0000000 --- a/images/zedboot/BUILD.gn +++ /dev/null
@@ -1,238 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zbi.gni") -import("//build/images/boot.gni") -import("//build/images/custom_signing.gni") -import("//build/images/json.gni") -import("//build/images/manifest.gni") - -declare_args() { - # List of kernel command line arguments to bake into the Zedboot image. - # See //zircon/docs/kernel_cmdline.md and - # [`zedboot_devmgr_config`](#zedboot_devmgr_config). - zedboot_cmdline_args = [] - - # Files containing additional kernel command line arguments to bake into - # the Zedboot image. The contents of these files (in order) come after any - # arguments directly in [`zedboot_cmdline_args`](#zedboot_cmdline_args). - # These can be GN `//` source pathnames or absolute system pathnames. - zedboot_cmdline_files = [] - - # List of arguments to populate /boot/config/devmgr in the Zedboot image. - zedboot_devmgr_config = [ "netsvc.netboot=true" ] -} - -# This parallels the `images` list in //build/images/BUILD.gn, which see. -zedboot_images = [] - -# Construct a minimal manifest containing only the few user binaries -# that constitute zedboot, and the libraries they depend on. -# TODO(mcgrathr): This could be made smaller by constraining the drivers -# included, but we don't currently have a good way to determine the -# subset that is useful to Zedboot. -zedboot_binary_patterns = [ - # These are the core things needed for booting (local and netboot). - "bin/bootsvc", - "bin/devmgr", - "bin/dlog", - "bin/fshost", - "bin/netsvc", - "bin/pwrbtn-monitor", - "bin/svchost", - "bin/virtual-console", - "driver/*", # Drivers automagically cause devhost to be brought in. - - # These are needed for installer runs. - "bin/blobfs", - "bin/install-disk-image", - "bin/minfs", - "bin/mount", - - # These are useful for debugging. - "bin/dd", - "bin/driverctl", - "bin/fsck*", - "bin/gpt", - "bin/killall", - "bin/lsblk", - "bin/lsdev", - "bin/lsusb", - "bin/mkfs*", - "bin/nand-util", - "bin/netdump", - "bin/ping", - "bin/ps", - "bin/sh", - "bin/umount", - "bin/unbind", -] - -generate_manifest("zedboot.manifest") { - visibility = [ ":*" ] - args = [] - foreach(pattern, zedboot_binary_patterns) { - args += [ "--binary=" + pattern ] - } -} -manifest_outputs = get_target_outputs(":zedboot.manifest") -manifest_file = manifest_outputs[0] - -action("devmgr_config.txt") { - visibility = [ ":zbi" ] - - script = "../manifest.py" - outputs = [ - "$target_out_dir/$target_name", - ] - - args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ] - foreach(entry, zedboot_devmgr_config) { - args += [ "--entry=$entry" ] - } -} - -zbi("zbi") { - output_name = "zedboot" - deps = [ - ":devmgr_config.txt", - ":zedboot.manifest", - ] - inputs = [ - "${zircon_build_dir}/kernel.zbi", - manifest_file, - ] - manifest = [ - { - outputs = [ - "config/devmgr", - ] - sources = get_target_outputs(":devmgr_config.txt") - }, - ] - cmdline = zedboot_cmdline_args - cmdline_inputs = zedboot_cmdline_files -} - -zedboot_images += [ - { - deps = [ - ":zbi", - ] - public = [ - "IMAGE_ZEDBOOT_ZBI", - "IMAGE_ZIRCONR_ZBI", - ] - json = { - name = "zircon-r" - type = "zbi" - if (custom_signing_script == "") { - bootserver_pave = [ "--zirconr" ] - } - } - }, -] - -if (custom_signing_script != "") { - custom_signed_zbi("signed") { - output_name = "zedboot.zbi" - deps = [ - ":zbi", - ] - zbi = get_target_outputs(":zbi") - } - - zedboot_images += [ - { - deps = [ - ":signed", - ] - public = [ - "IMAGE_ZIRCONR_SIGNEDZBI", - ] - json = { - name = "zircon-r.signed" - type = "zbi.signed" - bootserver_pave = [ - "--zirconr", - - # TODO(ZX-2625): `dm reboot-recovery` boots from - # zircon-b instead of zircon-r, so put it there too. - "--zirconb", - ] - } - }, - ] -} - -if (target_cpu != "arm64") { - vboot("vboot") { - output_name = "zedboot" - deps = [ - ":zbi", - ] - } - - zedboot_images += [ - { - deps = [ - ":vboot", - ] - public = [ - "IMAGE_ZEDBOOT_VBOOT", - ] - json = { - name = "zedboot" - type = "vboot" - } - }, - ] - - esp("esp") { - output_name = "zedboot" - cmdline = "efi_cmdline.txt" - deps = [ - ":zbi", - ] - zedboot_zbi_outputs = get_target_outputs(":zbi") - zedboot = zedboot_zbi_outputs[0] - } - zedboot_images += [ - { - deps = [ - ":esp", - ] - public = [ - "IMAGE_ZEDBOOT_ESP", - ] - json = { - name = "zedboot-efi" - type = "blk" - } - }, - ] -} - -group("zedboot") { - deps = [ - ":zbi", - ] - if (target_cpu != "arm64") { - deps += [ - ":esp", - ":vboot", - ] - } - if (custom_signing_script != "") { - deps += [ ":signed" ] - } -} - -write_images_manifest("zedboot-manifest") { - images = zedboot_images - outputs = [ - "$root_build_dir/zedboot_images.json", - "$root_build_dir/zedboot_image_paths.sh", - ] -}
diff --git a/images/zedboot/efi_cmdline.txt b/images/zedboot/efi_cmdline.txt deleted file mode 100644 index 5b5efe9..0000000 --- a/images/zedboot/efi_cmdline.txt +++ /dev/null
@@ -1,2 +0,0 @@ -bootloader.default=zedboot -bootloader.timeout=1
diff --git a/json/validate_json.gni b/json/validate_json.gni deleted file mode 100644 index 9bcb919..0000000 --- a/json/validate_json.gni +++ /dev/null
@@ -1,64 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") - -# Validate a JSON file against a JSON schema. -# -# data (required) -# [file] JSON file to validate. -# If this file is not valid JSON, or does not meet the schema, then this -# target will fail to build. -# -# schema (required) -# [file] Schema to use for validation. -# -# sources (optional) -# [list of files] Additional schema files referenced by schema. -# Additional schema files used by the original schema file must be listed -# here for validation to be re-run when they change. -# -# deps (optional) -# public_deps (optional) -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# validate_json("validate_my_json") { -# data = "my_file.json" -# schema = "my_schema.json" -# } -template("validate_json") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "sources", - "public_deps", - "testonly", - "visibility", - ]) - - tool = "//build/tools/json_validator" - - stamp_file = "$target_gen_dir/$target_name.verified" - - inputs = [ - invoker.data, - invoker.schema, - ] - - outputs = [ - stamp_file, - ] - - args = [ - rebase_path(invoker.schema), - rebase_path(invoker.data), - rebase_path(stamp_file), - ] - } -}
diff --git a/mac/find_sdk.py b/mac/find_sdk.py deleted file mode 100755 index 0ce1e64..0000000 --- a/mac/find_sdk.py +++ /dev/null
@@ -1,54 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Prints the lowest locally available SDK version greater than or equal to a -given minimum sdk version to standard output. If --developer-dir is passed, then -the script will use the Xcode toolchain located at DEVELOPER_DIR. - -Usage: - python find_sdk.py [--developer-dir DEVELOPER_DIR] 10.12 -""" - -import argparse -import os -import re -import subprocess -import sys - - -def parse_version(version_str): - """'10.6' => [10, 6]""" - return map(int, re.findall(r'(\d+)', version_str)) - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--print-sdk-path", - action="store_true", dest="print_sdk_path", default=False, - help="Print the path to the SDK") - parser.add_argument("--developer-dir", help='Path to Xcode') - parser.add_argument("min_sdk_version", help="Minimum SDK version") - args = parser.parse_args() - - if args.developer_dir: - os.environ['DEVELOPER_DIR'] = args.developer_dir - - # 'xcrun' always returns the latest available SDK - version = subprocess.check_output(['xcrun', '--sdk', 'macosx', - '--show-sdk-version']).strip() - if parse_version(version) < parse_version(args.min_sdk_version): - raise Exception('SDK version %s is before minimum version %s' - % (version, args.min_sdk_version)) - if args.print_sdk_path: - print subprocess.check_output(['xcrun', '--sdk', 'macosx', - '--show-sdk-path']).strip() - print version - - return 0 - - -if __name__ == '__main__': - if sys.platform != 'darwin': - raise Exception("This script only runs on Mac") - sys.exit(main())
diff --git a/make_map.py b/make_map.py deleted file mode 100755 index 6f0ba96..0000000 --- a/make_map.py +++ /dev/null
@@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Make a mapping of dependencies for fidl files. - -The map contains one line per mapping, each of which is from a fidl file location -to a sequence of GN build targets. If the mapping is public (ie directly from the -source or through a public_deps dependency) then it is prepended with "pub ". - -The sequence of targets has length greater than 1 if the file can be referenced -from this module through a sequence of dependencies. - -An example entry is: - -pub //garnet/public/lib/ui/views/fidl/views.fidl: //garnet/public/lib/media/fidl:services //apps/mozart/services/views:views -""" - -import ast -import optparse -import os -import sys -import zipfile - -# for some reason, gn seems to tack on an extra element in the directory -def fix_label(label): - split_tag = label.split(':') - split_label = split_tag[0].split('/') - split_label.pop() - split_tag[0] = '/'.join(split_label) - return ':'.join(split_tag) - -def rel_label(label, relpath): - split_label = label.split(':')[0].split('/') - for el in relpath.split('/'): - if el == '..': - split_label.pop() - else: - split_label.append(el) - return '/'.join(split_label) - -def handle_map_deps(o, depsmap, covered, target, is_public): - #o.write('#pass-through from %s (public %s)\n' % (depsmap, is_public)) - for dep in file(depsmap): - parts = dep.split() - if parts[0] != 'pub': continue - fileref = parts[1].rstrip(':') - if fileref in covered: continue - pubstr = 'pub ' if is_public else '' - o.write('%s%s: %s %s\n' % (pubstr, fileref, target, ' '.join(parts[2:]))) - - -def make_map(output, sources, map_deps, map_public_deps, target): - target = fix_label(target) - o = file(output, 'w') - covered = set() - for i in sources: - covered.add(i) - new_path = rel_label(target, i) - o.write('pub %s: %s\n' % (new_path, target)) - for m in map_deps: - handle_map_deps(o, m, covered, target, False) - for m in map_public_deps: - handle_map_deps(o, m, covered, target, True) - -def main(): - parser = optparse.OptionParser() - - parser.add_option('--sources', help='List of source files.') - parser.add_option('--target', help='Name of current target.') - parser.add_option('--map-deps', help='List of map files of deps to aggregate.') - parser.add_option('--map-public-deps', help='List of map files of public deps to aggregate.') - parser.add_option('--output', help='Path to output archive.') - - options, _ = parser.parse_args() - - sources = [] - if (options.sources): - sources = ast.literal_eval(options.sources) - map_deps = [] - if options.map_deps: - map_deps = ast.literal_eval(options.map_deps) - map_public_deps = [] - if options.map_public_deps: - map_public_deps = ast.literal_eval(options.map_public_deps) - output = options.output - target = options.target - - make_map(output, sources, map_deps, map_public_deps, target) - -if __name__ == '__main__': - sys.exit(main())
diff --git a/manifest/build b/manifest/build deleted file mode 100644 index 188d676..0000000 --- a/manifest/build +++ /dev/null
@@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<manifest> - <imports> - <localimport file="minimal"/> - <localimport file="third_party"/> - </imports> -</manifest>
diff --git a/manifest/minimal b/manifest/minimal deleted file mode 100644 index 84d4f22..0000000 --- a/manifest/minimal +++ /dev/null
@@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<manifest> - <projects> - <project name="build" - path="build" - remote="https://fuchsia.googlesource.com/build" - gerrithost="https://fuchsia-review.googlesource.com"/> - </projects> - <hooks> - <hook name="symlink-.gn" - project="build" - action="dot_gn_symlink.sh"/> - </hooks> -</manifest>
diff --git a/manifest/third_party b/manifest/third_party deleted file mode 100644 index c930953..0000000 --- a/manifest/third_party +++ /dev/null
@@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<manifest> - <imports> - <localimport file="minimal"/> - </imports> - <projects> - <project name="third_party/mako" - path="third_party/mako" - remote="https://fuchsia.googlesource.com/third_party/mako" - gerrithost="https://fuchsia-review.googlesource.com" - revision="e6b41d232315660de544a7a692e58acddd2e612c"/> - <project name="third_party/python/mock" - path="third_party/python/mock" - remote="https://fuchsia.googlesource.com/third_party/python/testing-cabal/mock" - gerrithost="https://fuchsia-review.googlesource.com" - revision="8c19ef6c95004524cb9f0b170a1aff6f47ade764"/> - <project name="third_party/pytoml" - path="third_party/pytoml" - remote="https://fuchsia.googlesource.com/third_party/pytoml" - gerrithost="https://fuchsia-review.googlesource.com" - revision="8641351699f44401232786cd9f320ac373c3a02e"/> - <project name="third_party/pyyaml" - path="third_party/pyyaml" - remote="https://fuchsia.googlesource.com/third_party/pyyaml" - gerrithost="https://fuchsia-review.googlesource.com" - revision="7f118278ff09fc2deea32b429cffc38856bf6992"/> - <project name="third_party/rapidjson" - path="third_party/rapidjson" - remote="https://fuchsia.googlesource.com/third_party/rapidjson" - revision="32d07c55db1bb6c2ae17cba4033491a667647753" - gerrithost="https://fuchsia-review.googlesource.com"/> - </projects> -</manifest>
diff --git a/module_args/dart.gni b/module_args/dart.gni deleted file mode 100644 index d174721..0000000 --- a/module_args/dart.gni +++ /dev/null
@@ -1,6 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This variable should point to the Dart SDK. -dart_sdk_root = "///third_party/dart/sdk"
diff --git a/package.gni b/package.gni deleted file mode 100644 index 837b37e..0000000 --- a/package.gni +++ /dev/null
@@ -1,844 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/assert_cmx.gni") -import("//build/cmx/cmx.gni") -import("//build/compiled_action.gni") -import("//build/gn/packages.gni") -import("//build/images/manifest.gni") -import("//build/json/validate_json.gni") -import("//build/package/component.gni") -import("//build/packages/package_internal.gni") -import("//build/testing/test_spec.gni") - -declare_args() { - # The package key to use for signing Fuchsia packages made by the - # `package()` template (and the `system_image` packge). If this - # doesn't exist yet when it's needed, it will be generated. New - # keys can be generated with the `pm -k FILE genkey` host command. - system_package_key = "//build/development.key" -} - -# Generate a signed, sealed package file from a manifest. -# -# Parameters -# -# manifest (required) -# [label] A generate_manifest() target defined earlier in the same file. -# This provides the contents for the package. -# -# deps (optional) -# test (optional) -# visibility (optional) -# Same as for any GN `action()` target. - -template("pm_build_package") { - compiled_action(target_name) { - tool = "//garnet/go/src/pm:pm_bin" - tool_output_name = "pm" - - deps = [] - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "testonly", - "visibility", - ]) - pkg_manifest_outputs = get_target_outputs(invoker.manifest) - pkg_manifest_file = pkg_manifest_outputs[0] - pkg_out_dir = "$target_out_dir/$target_name" - - deps += [ - "//build/images:system_package_key_check", - invoker.manifest, - ] - - inputs = [ - pkg_manifest_file, - system_package_key, - ] - - depfile = "$pkg_out_dir/meta.far.d" - - outputs = [ - # produced by seal, must be listed first because of depfile rules. - "$pkg_out_dir/meta.far", - - # update - "$pkg_out_dir/meta/contents", - - # sign - "$pkg_out_dir/meta/pubkey", - "$pkg_out_dir/meta/signature", - - # seal - "$pkg_out_dir/meta.far.merkle", - - # package blob manifest - "$pkg_out_dir/blobs.json", - ] - - args = [ - "-k", - rebase_path(system_package_key, root_build_dir), - "-o", - rebase_path(pkg_out_dir, root_build_dir), - "-m", - rebase_path(pkg_manifest_file, root_build_dir), - "build", - "-depfile", - "-blobsfile", - ] - } -} - -# Defines a package -# -# The package template is used to define a unit of related code and data. -# A package always has a name (defaulting to the target name) and lists of -# scopes describing the components of the package. -# -# Parameters -# -# deprecated_system_image (optional, default `false`) -# [bool] If true, the package is stored in the /system filesystem image -# rather than in a Fuchsia package. -# -# TODO(PKG-46): Will be removed entirely eventually. -# -# If this package uses the `drivers` parameter, -# `deprecated_system_image` must be set to `true` because we are not -# yet sophisticated enough to load drivers out of packages. -# -# meta (optional) -# [list of scopes] Defines the metadata entries in the package. A metadata -# entry is typically a source file and is placed in the `meta/` directory of -# the assembled package. -# -# Requires `deprecated_system_image` to be `false`. -# -# Entries in a scope in the meta list: -# -# path (required) -# [path] Location of entry in source or build directory. If the -# resource is checked in, this will typically be specified as a -# path relative to the BUILD.gn file containing the `package()` -# target. If the resource is generated, this will typically be -# specified relative to `$target_gen_dir`. -# -# dest (required) -# [path] Location the resource will be placed within `meta/`. -# -# binary (optional, *DEPRECATED*) -# [string] The path to the the primary binary for the package, relative to -# `$root_out_dir`. The binary will be placed in the assembled package at -# `bin/app` and will be executed by default when running the package. -# -# Requires `deprecated_system_image` to be `false`. -# -# binaries (optional) -# [list of scopes] Defines the binaries in the package. A binary is -# typically produced by the build system and is placed in the `bin/` -# directory of the assembled package. -# -# Entries in a scope in the binaries list: -# -# name (required) -# [string] Name of the binary. -# -# source (optional) -# [path] Location of the binary in the build directory if it is not -# at `$root_out_dir/$name`. -# -# dest (optional) -# [path] Location the binary will be placed within `bin/`. -# -# shell (optional) -# [boolean] (default: false) When true, the binary is runnable from the shell. -# Shell binaries are run in the shell namespace and are not run as components. -# -# components (optional) -# [list of fuchsia_component targets] Defines all the components this -# package should include in assembled package. -# -# Requires `deprecated_system_image` to be `false`. -# -# tests (optional) -# [list of scopes] Defines the test binaries in the package. A test is -# typically produced by the build system and is placed in the `test/` -# directory of the assembled package. -# -# Entries in a scope in the tests list: -# -# name (required) -# [string] Name of the test. -# -# dest (optional) -# [path] Location the binary will be placed within `test/`. -# -# disabled (optional) -# [bool] Whether to disable the test on continuous integration -# jobs. This can be used when a test is temporarily broken, or if -# it is too flaky or slow for CI. The test will also be skipped by -# the `runtests` command. -# -# environments (optional, default: [ { dimensions = { device_type = "QEMU" } } ]) -# [list of scopes] Device environments in which the test should run. -# -# Each scope in $environments contains: -# -# dimensions (required) -# [scope] Dimensions of bots to target. Valid dimensions are -# element-wise subsets of the test platform entries defined in -# //build/testing/platforms.gni. -# -# label (optional) -# [string] A key on which tests may be grouped. Tests with a given -# label will be run (1) together, and (2) only with support from -# the Infrastructure team. Labels are used as an escape hatch from -# the default testing pipeline for special tests or environments. -# -# drivers (optional) -# [list of scopes] Defines the drivers in the package. A driver is -# typically produced by the build system and is placed in the `driver/` -# directory of the assembled package. -# -# Requires `deprecated_system_image` to be `true`. -# -# Entries in a scope in the drivers list: -# -# name (required) -# [string] Name of the driver. -# -# loadable_modules (optional) -# [list of scopes] Defines the loadable modules in the package. These -# are produced by `loadable_module()` GN targets, and are typically -# placed in the `lib/` directory of the assembled packaged. -# -# Entries in a scope in the loadable_modules list: -# -# name (required) -# [string] Name of the loadable_module. -# -# dest (optional, default: "lib") -# [string] Location the binary will be placed in the package. -# -# libraries (optional, *DEPRECATED*) -# [list of scopes] Defines the (shared) libraries in the package. A library -# is placed in the `lib/` directory of the assembled package. -# -# This is deprecated but is necessary in some `system_image` packages -# that install libraries used by things that don't properly isolate -# their dependencies. Do not use it unless you are sure you have to. -# -# Entries in a scope in the libraries list: -# -# name (required) -# [string] Name of the library -# -# source (optional) -# [path] Location of the binary in the build directory if it is not at -# `$root_out_dir/$name` -# -# dest (optional) -# [path] Location the binary will be placed within `lib/` -# -# resources (optional) -# [list of scopes] Defines the resources in the package. A resource is a -# data file that may be produced by the build system, checked in to a -# source repository, or produced by another system that runs before the -# build. Resources are placed in the `data/` directory of the assembled -# package. -# -# Entries in a scope in the resources list: -# -# path (required) -# [path] Location of resource in source or build directory. If the -# resource is checked in, this will typically be specified as a -# path relative to the BUILD.gn file containing the `package()` -# target. If the resource is generated, this will typically be -# specified relative to `$target_gen_dir`. -# -# dest (required) -# [path] Location the resource will be placed within `data/`. -# -# extra (optional) -# [list of paths] Manifest files containing extra entries, which -# might be generated by the build. -# -# deps (optional) -# public_deps (optional) -# data_deps (optional) -# testonly (optional) -# Usual GN meanings. -# -template("package") { - if (current_toolchain == target_toolchain) { - forward_variables_from(invoker, [ "testonly" ]) - pkg_target_name = target_name - pkg = { - package_version = "0" # placeholder - forward_variables_from(invoker, - [ - "binaries", - "binary", - "components", - "data_deps", - "deprecated_system_image", - "deprecated_bare_package_url", - "deps", - "public_deps", - "drivers", - "extra", - "libraries", - "loadable_modules", - "meta", - "package_name", - "resources", - "visibility", - "tests", - ]) - if (!defined(binaries)) { - binaries = [] - } - if (!defined(deprecated_system_image)) { - deprecated_system_image = false - } - if (!defined(deps)) { - deps = [] - } - if (!defined(components)) { - components = [] - } - if (!defined(data_deps)) { - data_deps = [] - } - if (!defined(public_deps)) { - public_deps = [] - } - if (!defined(extra)) { - extra = [] - } - if (!defined(drivers)) { - drivers = [] - } - if (!defined(loadable_modules)) { - loadable_modules = [] - } - if (!defined(libraries)) { - libraries = [] - } - if (!defined(meta)) { - meta = [] - } - if (!defined(package_name)) { - package_name = pkg_target_name - } - if (defined(deprecated_bare_package_url)) { - deps += [ "${deprecated_bare_package_url}:bare_package_url_whitelist" ] - } - if (components == []) { - assert_cmx(package_name) { - forward_variables_from(invoker, "*") - } - } - foreach(component, components) { - deps += [ component ] - } - if (!defined(resources)) { - resources = [] - } - if (!defined(tests)) { - tests = [] - } - package_set = "" - } - - pkg_label = get_label_info(":$pkg_target_name", "label_no_toolchain") - pkg_desc = "Package ${pkg_label} (${pkg.package_name}):" - if (pkg.deprecated_system_image) { - assert(pkg.meta == [], - "$pkg_desc deprecated_system_image incompatible with meta") - assert(pkg.components == [], - "$pkg_desc deprecated_system_image incompatible with components") - assert(!defined(pkg.binary), - "$pkg_desc deprecated_system_image incompatible with binary") - } else { - assert(pkg.drivers == [], - "$pkg_desc drivers requires deprecated_system_image") - assert(pkg.libraries == [], - "$pkg_desc libraries requires deprecated_system_image") - if (defined(pkg.binary)) { - pkg.binaries += [ - { - name = "app" - source = pkg.binary - }, - ] - } - } - - # Validate .cmx files - foreach(meta, pkg.meta) { - if (get_path_info(meta.dest, "extension") == "cmx") { - validate = "validate_" + pkg_target_name + "_" + - get_path_info(meta.dest, "file") - cmx_validate(validate) { - data = meta.path - - # the cmx file may be generated by one of this package's dependencies, - # but we don't know which one, so depend on all package deps here. - deps = pkg.deps - } - pkg.deps += [ ":$validate" ] - } - } - - # cmx_format will minify cmx files in non-debug builds, and pretty-print cmx - # files in debug builds - meta_with_formatted_cmx = [] - foreach(meta, pkg.meta) { - if (get_path_info(meta.dest, "extension") == "cmx") { - format = - "format_" + pkg_target_name + "_" + get_path_info(meta.dest, "file") - - # TODO(CF-156): Remove this logic once all URLs are fuchsia-pkg. - if (defined(pkg.deprecated_bare_package_url)) { - merged_deprecated_bare_package_url = - "merged_deprecated_bare_package_url_" + pkg_target_name + "_" + - get_path_info(meta.dest, "file") - cmx_merge(merged_deprecated_bare_package_url) { - sources = [ - meta.path, - rebase_path("//build/deprecated_bare_package_url"), - ] - deps = pkg.deps - } - merged_deprecated_bare_package_url_outputs = [] - merged_deprecated_bare_package_url_outputs = - get_target_outputs(":$merged_deprecated_bare_package_url") - merged_deprecated_bare_package_url_path = - merged_deprecated_bare_package_url_outputs[0] - pkg.deps += [ ":$merged_deprecated_bare_package_url" ] - cmx_format(format) { - data = rebase_path(merged_deprecated_bare_package_url_path) - deps = pkg.deps - } - } else { - cmx_format(format) { - data = rebase_path(meta.path) - deps = pkg.deps - } - } - formatted_outputs = [] - formatted_outputs = get_target_outputs(":$format") - meta.path = formatted_outputs[0] - pkg.deps += [ ":$format" ] - } - meta_with_formatted_cmx += [ meta ] - } - - shell_binaries = [] - - # Collect the package's primary manifest. For a system_image package, - # this is its contributions to the /system manifest. For an isolated - # package, this is the manifest for the package's `pkg/` filesystem. - pkg_manifest = [] - foreach(meta, meta_with_formatted_cmx) { - pkg_manifest += [ - { - dest = "meta/${meta.dest}" - source = rebase_path(meta.path) - }, - ] - } - foreach(binary, pkg.binaries) { - if (defined(binary.dest)) { - dest = binary.dest - } else { - dest = binary.name - } - dest = "bin/${dest}" - if (defined(binary.shell) && binary.shell) { - shell_binaries += [ dest ] - } - - pkg_manifest += [ - { - dest = dest - - if (defined(binary.source)) { - source = binary.source - } else { - source = binary.name - } - source = rebase_path(source, "", root_out_dir) - }, - ] - } - foreach(test, pkg.tests) { - is_disabled = defined(test.disabled) && test.disabled - pkg_manifest += [ - { - if (defined(test.dest)) { - dest = test.dest - } else { - dest = test.name - } - if (is_disabled) { - dest = "disabled/${dest}" - } - dest = "test/${dest}" - source = rebase_path(test.name, "", root_out_dir) - - if (!is_disabled) { - test_spec("${test.name}.spec") { - name = test.name - if (pkg.deprecated_system_image) { - location = "/system/$dest" - } else { - location = "/pkgfs/packages/${pkg.package_name}/${pkg.package_version}/$dest" - } - - # Encode the package name in the output directory to disambiguate - # during post-processing - cross-referencing with packages.json - - # whether a given test spec came from a package that was actually - # included in the build. - output_dir = "$target_out_dir/$pkg_target_name" - - forward_variables_from(test, [ "environments" ]) - } - } - }, - ] - } - foreach(module, pkg.loadable_modules) { - pkg_manifest += [ - { - if (defined(module.dest)) { - dest = module.dest - } else { - dest = "lib" - } - dest += "/${module.name}" - source = rebase_path(module.name, "", root_out_dir) - }, - ] - } - foreach(driver, pkg.drivers) { - pkg_manifest += [ - { - dest = "driver/${driver.name}" - source = rebase_path(driver.name, "", root_out_dir) - }, - ] - } - foreach(resource, pkg.resources) { - pkg_manifest += [ - { - dest = "data/${resource.dest}" - source = rebase_path(resource.path) - }, - ] - } - - # TODO(mcgrathr): Remove this when we can! Packages installing - # libraries in the system image is all kinds of wrong. - foreach(library, pkg.libraries) { - pkg_manifest += [ - { - if (defined(library.dest)) { - dest = library.dest - } else { - dest = library.name - } - dest = "lib/${dest}" - if (defined(library.source)) { - source = library.source - } else { - # TODO(mcgrathr): This breaks when everything is a variant so - # that only this here is using the non-variant shlib build. - source = get_label_info(shlib_toolchain, "name") - source += "/${library.name}" - } - source = rebase_path(source, "", root_out_dir) - }, - ] - } - - # Collect all the arguments describing input manifest files - # and all the entries we've just synthesized in `pkg_manifest`. - manifest_sources = pkg.extra - manifest_args = [] - foreach(manifest_file, pkg.extra) { - manifest_file = rebase_path(manifest_file, root_build_dir) - manifest_args += [ "--manifest=${manifest_file}" ] - } - manifest_args += [ "--entry-manifest=${pkg_label}" ] - foreach(entry, pkg_manifest) { - manifest_sources += [ entry.source ] - manifest_args += [ "--entry=${entry.dest}=${entry.source}" ] - } - - # An empty package() target doesn't actually generate a package at all. - # Conveniently, an empty system_image package has exactly that effect. - if (manifest_sources == [] && pkg.components == []) { - pkg.deprecated_system_image = true - } - - if (pkg.deprecated_system_image) { - # Dummy target to deposit an empty ids.txt file for - # //build/images:ids.txt to collect. - action("${pkg_target_name}.final.manifest.ids.txt") { - script = "/bin/cp" - - # Add sources and deps so that the package gets rebuilt whenever they - # change. - sources = manifest_sources - data_deps = pkg.data_deps - deps = pkg.deps - public_deps = pkg.public_deps - outputs = [ - "$target_out_dir/${target_name}", - ] - args = [ - "-f", - "/dev/null", - ] + rebase_path(outputs, root_build_dir) - } - } else { - # Synthesize the meta/package file. - pkg_meta_package = "${pkg_target_name}_meta_package.json" - action(pkg_meta_package) { - visibility = [ ":${pkg_target_name}.manifest" ] - script = "//build/gn/write_package_json.py" - outputs = [ - "$target_out_dir/$pkg_meta_package", - ] - args = [ - "--name", - pkg.package_name, - "--version", - pkg.package_version, - rebase_path(pkg_meta_package, root_build_dir, target_out_dir), - ] - } - - generate_manifest("${pkg_target_name}.manifest") { - sources = manifest_sources + get_target_outputs(":$pkg_meta_package") - args = manifest_args + - [ "--entry=meta/package=" + - rebase_path(pkg_meta_package, "", target_out_dir) ] - deps = pkg.deps + [ ":$pkg_meta_package" ] - public_deps = pkg.public_deps - } - - final_manifest = "${pkg_target_name}.final.manifest" - final_manifest_ids = "${final_manifest}.ids.txt" - - # TODO(CF-224): clean this up when gn has metadata support for templates - # merge all package ids and component ids in a single file. - action(final_manifest_ids) { - script = "/usr/bin/sort" - output_name = "${target_out_dir}/${final_manifest_ids}" - outputs = [ - output_name, - ] - manifest_id = "$target_out_dir/${pkg_target_name}.manifest.ids.txt" - args = [ - "-u", - "-o", - rebase_path(output_name), - rebase_path(manifest_id), - ] - inputs = [ - manifest_id, - ] - deps = [ - ":${pkg_target_name}.manifest", - ] - - foreach(component, pkg.components) { - deps += [ component ] - component_name = get_label_info(component, "name") - dir = get_label_info(component, "target_out_dir") - manifest_file = "${dir}/${component_name}.manifest.ids.txt" - inputs += [ manifest_file ] - args += [ rebase_path(manifest_file) ] - } - } - - # Merge all component and package manifests in single file - action(final_manifest) { - script = "//build/cat.py" - output_name = "${target_out_dir}/${final_manifest}" - outputs = [ - output_name, - ] - visibility = [ "*" ] - - pmx = "$target_out_dir/${pkg_target_name}.manifest" - args = [ - "-o", - rebase_path(output_name), - "-i", - rebase_path("$target_out_dir/${pkg_target_name}.manifest"), - ] - inputs = [ - pmx, - ] - deps = [ - ":${final_manifest_ids}", - ":${pkg_target_name}.manifest", - ] - - foreach(component, pkg.components) { - deps += [ component ] - component_name = get_label_info(component, "name") - dir = get_label_info(component, "target_out_dir") - manifest_file = "${dir}/${component_name}.manifest" - inputs += [ manifest_file ] - args += [ - "-i", - rebase_path(manifest_file), - ] - } - } - - # Next generate a signed, sealed package file. - pm_build_package("${pkg_target_name}.meta") { - manifest = ":$final_manifest" - } - - # Clear it so we don't put anything into the system image. - manifest_args = [] - } - - generate_response_file(pkg_target_name) { - if (defined(pkg.visibility)) { - visibility = pkg.visibility + [ - "//build/gn:packages", - "//build/images:system_image.manifest", - ] - } - if (pkg.deprecated_system_image) { - deps = pkg.deps + [ ":${pkg_target_name}.final.manifest.ids.txt" ] - } else { - deps = pkg.deps + [ ":${pkg_target_name}.final.manifest" ] - } - data_deps = pkg.data_deps - public_deps = pkg.public_deps - output_name = "${pkg_target_name}.system.rsp" - response_file_contents = manifest_args - } - - # TODO(raggi): once /system is removed, the blobs rsp's can be removed, as - # all packages would produce a blobs.json. - generate_response_file("${pkg_target_name}.blobs.rsp") { - if (pkg.deprecated_system_image) { - # A system_image package has no blobs of its own. - response_file_contents = [] - } else { - # A real package needs blobs for all its contents and for its - # synthesized meta.far file. - deps = [ - ":${pkg_target_name}.meta", - ] - response_file_contents = [ - "--input", - rebase_path("${pkg_target_name}.meta/blobs.json", - root_build_dir, - target_out_dir), - ] - } - } - - generate_response_file("${pkg_target_name}.shell_commands.rsp") { - response_file_contents = [] - - foreach(binary, shell_binaries) { - response_file_contents += [ - # TODO(CF-105): fuchsia-pkg URIs should always have a variant (add /${pkg.package_version}). - "--uri", - "fuchsia-pkg://fuchsia.com/${pkg.package_name}#${binary}", - ] - } - } - - # Determine why this package is being built. - if (!pkg.deprecated_system_image) { - foreach(name, available_packages) { - if (name == pkg_label) { - pkg.package_set = "available" - } - } - foreach(name, preinstall_packages) { - if (name == pkg_label) { - pkg.package_set = "preinstall" - } - } - foreach(name, monolith_packages) { - if (name == pkg_label) { - pkg.package_set = "monolith" - } - } - } - - generate_system_index("${pkg_target_name}.system_index.rsp") { - deprecated_system_image = pkg.deprecated_system_image - meta_target = ":${pkg_target_name}.meta" - package_set = pkg.package_set - package_name = pkg.package_name - package_version = pkg.package_version - blobs_json = "${pkg_target_name}.meta/blobs.json" - } - - # A real package needs has a pkgsvr index entry mapping its package - # name and version to its meta.far file's merkleroot. - # The amber index is the same, but needs the meta.far filename - # in the build, rather than its merkleroot. - # TODO(mcgrathr): Make amber publish use pkgsvr index directly. - foreach(index, - [ - { - name = "pkgsvr_index" - file = "meta.far.merkle" - }, - { - name = "amber_index" - file = "meta.far" - }, - ]) { - generate_index("${pkg_target_name}.${index.name}.rsp") { - deprecated_system_image = pkg.deprecated_system_image - if (!deprecated_system_image) { - deps = [ - ":${pkg_target_name}.manifest", - ":${pkg_target_name}.meta", - ] - } - index_file = "${pkg_target_name}.meta/${index.file}" - package_name = pkg.package_name - package_version = pkg.package_version - pkg_label = pkg_label - if (defined(testonly)) { - testonly = testonly - } - } - } - } else { - group(target_name) { - forward_variables_from(invoker, - [ - "public_deps", - "deps", - "testonly", - ]) - } - - # Suppress unused variable warnings. - not_needed(invoker, "*") - } -}
diff --git a/package/component.gni b/package/component.gni deleted file mode 100644 index aa1c7d2..0000000 --- a/package/component.gni +++ /dev/null
@@ -1,307 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/cmx/cmx.gni") -import("//build/images/manifest.gni") - -# Defines a fuchsia component. -# -# This template is used to define a unit of component. -# A component always has a manifest defining that component. -# -# Parameters -# -# manifest (required) -# [path] Defines the manifest source path for this component. -# -# manifest_dest (optional) -# [path] Defines the destination of the component manifest within the assembled package. -# -# If not provided, defaults to "meta/<manifest>.cmx" if manifest was .cmx, and "meta/<manifest>.cm" if manfiest was .cml. -# -# binary (required) -# [path] The path to the the primary binary for the component. -# -# loadable_modules (optional) -# [list of scopes] Defines the loadable modules in the package. These -# are produced by `loadable_module()` GN targets, and are typically -# placed in the `lib/` directory of the assembled packaged. -# -# Entries in a scope in the loadable_modules list: -# -# name (required) -# [string] Name of the loadable_module. -# -# dest (optional, default: "lib") -# [string] Location the lib will be placed in the package. -# -# resources (optional) -# [list of scopes] Defines the resources for this component. A resource is a -# data file that may be produced by the build system, checked in to a -# source repository, or produced by another system that runs before the -# build. Resources are placed in the `data/` directory of the assembled -# package. -# -# Entries in a scope in the resources list: -# -# path (required) -# [path] Location of resource in source or build directory. If the -# resource is checked in, this will typically be specified as a -# path relative to the BUILD.gn file containing the `package()` -# target. If the resource is generated, this will typically be -# specified relative to `$target_gen_dir`. -# -# dest (required) -# [path] Location the resource will be placed within `data/`. -# -# test (optional) -# [bool] Should be true if this component is test. -# -# deps (optional) -# public_deps (optional) -# data_deps (optional) -# visibility (optional) -# testonly (optional) -# Usual GN meanings. -# -template("fuchsia_component") { - if (current_toolchain == target_toolchain) { - component_label = get_label_info(":$target_name", "label_with_toolchain") - forward_variables_from(invoker, [ "testonly" ]) - component = { - forward_variables_from(invoker, - [ - "binary", - "data_deps", - "deps", - "public_deps", - "loadable_modules", - "resources", - "visibility", - "manifest", - "manifest_dest", - "test", - ]) - assert(defined(manifest), - "Component $component_label should define manifest") - manifest_extension = get_path_info(manifest, "extension") - assert( - manifest_extension == "cmx" || manifest_extension == "cml", - "Component $component_label's manifest $manifest should have extension .cmx or .cml") - if (!defined(manifest_dest)) { - if (manifest_extension == "cmx") { - manifest_dest = "meta/" + get_path_info(manifest, "file") - } else { - manifest_dest = "meta/" + get_path_info(manifest, "name") + ".cm" - } - } else { - manifest_dest_extension = get_path_info(manifest_dest, "extension") - if (manifest_extension == "cmx") { - assert( - manifest_dest_extension == "cmx", - "Component $component_label's manifest_dest $manifest_dest should have extension .cmx") - } else { - assert( - manifest_dest_extension == "cm", - "Component $component_label's manifest_dest $manifest_dest should have extension .cm") - } - } - - # remove this check once we support dart and flutter - assert(defined(binary), "Component $component_label should define binary") - if (!defined(deps)) { - deps = [] - } - if (!defined(data_deps)) { - data_deps = [] - } - if (!defined(public_deps)) { - public_deps = [] - } - if (!defined(test)) { - test = false - } - if (!defined(loadable_modules)) { - loadable_modules = [] - } - if (!defined(manifest)) { - manifest = rebase_path("meta/${name}.cmx") - } - if (!defined(resources)) { - resources = [] - } - } - - component_manifest = [] - if (get_path_info(component.manifest, "extension") == "cmx") { - validate = "validate_" + target_name + "_" + - get_path_info(component.manifest_dest, "file") - - cmx_validate(validate) { - data = component.manifest - - # the cmx file may be generated by one of this component's dependencies, - # but we don't know which one, so depend on all package deps here. - deps = component.deps - public_deps = component.public_deps - } - component.deps += [ ":$validate" ] - - # Collect the component's primary manifest. - component_manifest += [ - { - dest = component.manifest_dest - source = rebase_path(component.manifest) - }, - ] - } else if (get_path_info(component.manifest, "extension") == "cml") { - compiled = "compiled_" + target_name + "_" + - get_path_info(component.manifest_dest, "file") - - cm_compile(compiled) { - data = component.manifest - - # the cm file may be generated by one of this component's dependencies, - # but we don't know which one, so depend on all package deps here. - deps = component.deps - public_deps = component.public_deps - } - component.deps += [ ":$compiled" ] - compiled_outputs = get_target_outputs(":$compiled") - - # Collect the component's primary manifest. - component_manifest += [ - { - dest = component.manifest_dest - source = rebase_path(compiled_outputs[0]) - }, - ] - } - - bin_dir = "bin/" - if (component.test) { - bin_dir = "test/" - } - component_manifest += [ - { - dest = bin_dir + get_path_info(component.binary, "file") - source = rebase_path(component.binary, "", root_out_dir) - }, - ] - foreach(module, component.loadable_modules) { - component_manifest += [ - { - if (defined(module.dest)) { - dest = module.dest - } else { - dest = "lib" - } - dest += "/${module.name}" - source = rebase_path(module.name, "", root_out_dir) - }, - ] - } - foreach(resource, component.resources) { - component_manifest += [ - { - dest = "data/${resource.dest}" - source = rebase_path(resource.path) - }, - ] - } - - # Collect all the arguments describing input manifest files - # and all the entries we've just synthesized in `component_manifest`. - manifest_sources = [] - manifest_args = [] - foreach(entry, component_manifest) { - manifest_sources += [ entry.source ] - manifest_args += [ "--entry=${entry.dest}=${entry.source}" ] - } - - # Generate component build manifest with all its dynamically linked libraries - # resolved. - generate_manifest("${target_name}.manifest") { - sources = manifest_sources - args = manifest_args - deps = component.deps - public_deps = component.public_deps - } - - group(target_name) { - public_deps = [ - ":${target_name}.manifest", - ] - } - } else { - group(target_name) { - forward_variables_from(invoker, - [ - "public_deps", - "deps", - "testonly", - ]) - } - - # Suppress unused variable warnings. - not_needed(invoker, "*") - } -} - -# Defines fuchsia test component. -# -# This template is used to define a unit of test component. -# A component always has a manifest defining that component. -# -# Parameters -# -# binary (required) -# [path] The path to the the primary binary for the component. -# This is also be used to infer your manifest source and -# destination path. -# -# manifest (optional) -# see fuchsia_component() -# Would be infered from binary name if not specified. -# -# -# loadable_modules (optional) -# see fuchsia_component() -# -# resources (optional) -# see fuchsia_component() -# -# deps (optional) -# public_deps (optional) -# data_deps (optional) -# visibility (optional) -# Usual GN meanings. -# -template("fuchsia_test_component") { - forward_variables_from(invoker, - [ - "binary", - "manifest", - ]) - - # remove this check once we support dart and flutter - assert(defined(binary), "Component $target_name should define binary") - fuchsia_component(target_name) { - testonly = true - test = true - name = get_path_info(binary, "file") - if (!defined(manifest)) { - manifest = rebase_path("meta/${name}.cmx") - } - forward_variables_from(invoker, - [ - "data_deps", - "deps", - "public_deps", - "loadable_modules", - "resources", - "visibility", - ]) - } -}
diff --git a/package_group.gni b/package_group.gni deleted file mode 100644 index 576c0cf..0000000 --- a/package_group.gni +++ /dev/null
@@ -1,98 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Generate a group of packages -# -# Parameters -# deps (required) -# List of packages or package_groups to depend on. -# -# testonly (optional) -# visibilty (optional) - -template("package_group") { - pkg_target_name = target_name - - response_files = [ - "system", - "blob", - "pkgsvr_index", - "amber_index", - ] - - intermediate_targets = [] - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - foreach(rsp, response_files) { - rsp_name = "${pkg_target_name}.${rsp}.rsp" - action(rsp_name) { - visibility = [ - ":$pkg_target_name", - "//build/images:$rsp", - "//build/images:$rsp.manifest", - "//build/images:update_packages.manifest", - ] - script = "//build/cat.sh" - output_name = "${target_out_dir}/${rsp_name}" - outputs = [ - output_name, - ] - args = [ rebase_path(output_name) ] - inputs = [] - deps = [] - - foreach(pkg_label, invoker.deps) { - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_rspfile = "$pkg_target_out_dir/${pkg_target_name}.${rsp}.rsp" - args += [ rebase_path(pkg_rspfile) ] - inputs += [ pkg_rspfile ] - if (rsp == "system") { - deps += [ pkg_label ] - } else { - deps += [ get_label_info(pkg_label, "dir") + - ":${pkg_target_name}.${rsp}.rsp" ] - } - } - } - - intermediate_targets += [ ":${rsp_name}" ] - } - - manifest_target_name = pkg_target_name + ".manifest" - - action(manifest_target_name) { - visibility = [ - ":$pkg_target_name", - "//build/images:ids.txt", - ] - script = "//build/cat.sh" - output_name = "${target_out_dir}/${manifest_target_name}.ids.txt" - args = [ rebase_path(output_name) ] - inputs = [] - deps = [] - - foreach(pkg_label, invoker.deps) { - pkg_target_name = get_label_info(pkg_label, "name") - pkg_target_out_dir = get_label_info(pkg_label, "target_out_dir") - pkg_ids = "$pkg_target_out_dir/${pkg_target_name}.manifest.ids.txt" - args += [ rebase_path(pkg_ids) ] - inputs += [ pkg_ids ] - deps += - [ get_label_info(pkg_label, "dir") + ":${pkg_target_name}.manifest" ] - } - outputs = [ - output_name, - ] - } - intermediate_targets += [ ":${manifest_target_name}" ] - - group(pkg_target_name) { - public_deps = intermediate_targets - } -}
diff --git a/packages/install b/packages/install deleted file mode 100644 index ece8a6f..0000000 --- a/packages/install +++ /dev/null
@@ -1,5 +0,0 @@ -{ - "labels": [ - "//build/gn:install" - ] -}
diff --git a/packages/json_merge b/packages/json_merge deleted file mode 100644 index 11243e3..0000000 --- a/packages/json_merge +++ /dev/null
@@ -1,8 +0,0 @@ -{ - "labels": [ - "//build/tools/json_merge:install" - ], - "host_tests": [ - "//build/tools/json_merge:json_merge_test" - ] -}
diff --git a/packages/json_validator b/packages/json_validator deleted file mode 100644 index eada0b0..0000000 --- a/packages/json_validator +++ /dev/null
@@ -1,5 +0,0 @@ -{ - "labels": [ - "//build/tools/json_validator:install" - ] -}
diff --git a/packages/netboot b/packages/netboot deleted file mode 100644 index 6f19a7e..0000000 --- a/packages/netboot +++ /dev/null
@@ -1,6 +0,0 @@ -{ - "labels": [ - "//build/images:netboot", - "//build/images:netboot-script" - ] -}
diff --git a/packages/package_internal.gni b/packages/package_internal.gni deleted file mode 100644 index 008a0c6..0000000 --- a/packages/package_internal.gni +++ /dev/null
@@ -1,68 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/images/manifest.gni") - -# This contains templates and implementation details for package rules. - -template("generate_system_index") { - generate_response_file(target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - if (invoker.deprecated_system_image) { - # A system_image package will be included directly in the system package. - response_file_contents = [] - not_needed(invoker, "*") - } else { - forward_variables_from(invoker, - [ - "blobs_json", - "meta_target", - "package_name", - "package_set", - "package_version", - ]) - - deps = [ - "${meta_target}", - ] - if (package_set == "") { - package_tags = "" - } else { - package_tags = "#${package_set}" - } - response_file_contents = - [ "--entry=${package_name}/${package_version}${package_tags}=" + - rebase_path(blobs_json, root_build_dir, target_out_dir) ] - } - } -} - -template("generate_index") { - generate_response_file(target_name) { - forward_variables_from(invoker, - [ - "deps", - "testonly", - ]) - if (invoker.deprecated_system_image) { - # A system_image package has no index entry. - response_file_contents = [] - not_needed(invoker, "*") - } else { - forward_variables_from(invoker, - [ - "index_file", - "package_name", - "package_version", - "pkg_label", - ]) - response_file_contents = [ - "--entry-manifest=${pkg_label}", - "--entry=${package_name}/${package_version}=" + - rebase_path(index_file, root_build_dir, target_out_dir), - ] - } - } -}
diff --git a/packages/prebuilt_package.gni b/packages/prebuilt_package.gni deleted file mode 100644 index 477edeb..0000000 --- a/packages/prebuilt_package.gni +++ /dev/null
@@ -1,156 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/fuchsia/zircon.gni") -import("//build/gn/packages.gni") -import("//build/images/manifest.gni") -import("//build/packages/package_internal.gni") - -# Generate a signed, sealed package file from a prebuilt archive. -# -# Parameters -# -# archive (required) -# Path to archive containing a package. -# -# package_name (optional) -# Name of the package. -# Defaults to the target's name. -# -# testonly (optional) -# visibility (optional) -# Usual GN meanings. -# -template("prebuilt_package") { - pkg_target_name = target_name - pkg_label = get_label_info(":$pkg_target_name", "label_no_toolchain") - pkg_name = target_name - if (defined(invoker.package_name)) { - pkg_name = invoker.package_name - } - - meta_dir = target_out_dir + "/" + pkg_name + ".meta" - blobs_json = "$meta_dir/blobs.json" - - action(target_name) { - forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) - - archive = invoker.archive - - script = "//build/packages/prebuilt_package.py" - - manifest = "$target_out_dir/$pkg_name.manifest" - system_rsp = "$target_out_dir/$pkg_name.system.rsp" - ids_txt = "$target_out_dir/$pkg_name.final.manifest.ids.txt" - meta_merkle = "$meta_dir/meta.far.merkle" - - args = [ - "--pm-tool", - rebase_path("$root_out_dir/host_$host_cpu/pm"), - "--name", - pkg_name, - "--archive", - rebase_path(archive), - "--workdir", - rebase_path(meta_dir, root_build_dir), - "--manifest", - rebase_path(manifest, root_build_dir), - "--system-rsp", - rebase_path(system_rsp, root_build_dir), - "--ids-txt", - rebase_path(ids_txt, root_build_dir), - ] - inputs = [ - archive, - ] - outputs = [ - manifest, - ids_txt, - system_rsp, - blobs_json, - meta_merkle, - ] - - deps = [ - "//garnet/go/src/pm:pm_bin($host_toolchain)", - ] - } - - group(target_name + ".manifest") { - public_deps = [ - ":$pkg_target_name", - ] - } - - group(target_name + ".final.manifest.ids.txt") { - public_deps = [ - ":$pkg_target_name", - ] - } - - generate_response_file("${pkg_target_name}.blobs.rsp") { - response_file_contents = ["--input=" + rebase_path(blobs_json, root_build_dir)] - } - - pkg = { - package_name = target_name - package_version = 0 - } - - generate_system_index(target_name + ".system_index.rsp") { - deprecated_system_image = false - meta_target = ":$pkg_target_name" - - foreach(name, available_packages) { - if (name == pkg_label) { - package_set = "available" - } - } - foreach(name, preinstall_packages) { - if (name == pkg_label) { - package_set = "preinstall" - } - } - foreach(name, monolith_packages) { - if (name == pkg_label) { - package_set = "monolith" - } - } - - package_name = pkg.package_name - package_version = pkg.package_version - blobs_json = blobs_json - } - - generate_response_file("${pkg_target_name}.shell_commands.rsp") { - response_file_contents = [] - } - - foreach(index, - [ - { - name = "pkgsvr_index" - file = "meta.far.merkle" - }, - { - name = "amber_index" - file = "meta.far" - }, - ]) { - generate_index("${pkg_target_name}.${index.name}.rsp") { - deprecated_system_image = false - index_file = "${meta_dir}/${index.file}" - package_name = pkg.package_name - package_version = pkg.package_version - pkg_label = pkg_label - deps = [ - ":$pkg_target_name", - ] - } - } -}
diff --git a/packages/prebuilt_package.py b/packages/prebuilt_package.py deleted file mode 100755 index 377c931..0000000 --- a/packages/prebuilt_package.py +++ /dev/null
@@ -1,62 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import shutil -import subprocess -import sys - -def extract(pm, far_path, workdir): - if not os.path.exists(workdir): - os.makedirs(workdir) - args = [pm, 'expand', far_path] - subprocess.check_output(args, stderr=subprocess.STDOUT, cwd=workdir) - - -def findblobs(workdir): - bloblist = [] - srcdir = os.path.join(workdir, 'blobs') - for blob in os.listdir(srcdir): - path = os.path.join(srcdir, blob) - bloblist.append({'name': blob, - 'path': path, - 'size': os.stat(path).st_size}) - return bloblist - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--pm-tool', help='Path to pm tool') - parser.add_argument('--name', help='Name of prebuilt package') - parser.add_argument('--archive', help='Path to archive containing prebuilt package') - parser.add_argument('--workdir', help='Path to working directory') - parser.add_argument('--manifest', help='Manifest file to generate') - parser.add_argument('--system-rsp', help='System response file to generate') - parser.add_argument('--ids-txt', help='ids.txt file to generate') - - args = parser.parse_args() - - extract(args.pm_tool, args.archive, args.workdir) - - bloblist = findblobs(args.workdir) - - with open(args.manifest, 'w') as f: - for blob in bloblist: - f.write('%s=%s/blobs/%s\n' % (blob['name'], args.workdir, - blob['name'])) - - with open(args.system_rsp, 'w') as f: - f.truncate(0) - - with open(args.ids_txt, 'w') as f: - f.truncate(0) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/packages/shell-commands b/packages/shell-commands deleted file mode 100644 index 4bf8dd9..0000000 --- a/packages/shell-commands +++ /dev/null
@@ -1,5 +0,0 @@ -{ - "packages": [ - "//build/images:shell-commands" - ] -}
diff --git a/persist_logs.gni b/persist_logs.gni deleted file mode 100644 index be8b8e1..0000000 --- a/persist_logs.gni +++ /dev/null
@@ -1,105 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -declare_args() { - persist_logs = is_debug -} - -# Adds a config to persist logs to disk -# -# The persist_logs template is used to generate a config for sysmgr that runs an -# instance of log_listener. This instance will be configured to listen for (and -# ignore) specific tags, and to write logs it finds into a target file. -# -# The file the logs are written to is located at /data/logs.${target_name} -# -# Once this section is added, the name provided will need to be pointed at by -# something in the gn packages descriptions (e.g. //garnet/packages) -# -# Parameters -# -# log_tags (optional): -# [list of strings] Logs with these tags will be written to the log file. -# -# ignore_log_tags (optional): -# [list of strings] Logs with these tags will NOT be written to the log -# file, even if the log has tags included in the "log_tags" section. -# -# max_disk_usage (optional): -# [string] This persist_logs usage will be guaranteed to not use more than -# this amount of bytes on disk space. The default is 64,000. -# -# Example: -# -# persist_logs("amber_logs") { -# log_tags = [ "amber" ] -# ignore_log_tags = [ "klog" ] -# max_disk_usage = "10000" -# } - -template("persist_logs") { - forward_variables_from(invoker, - [ - "log_tags", - "ignore_log_tags", - "max_disk_usage", - ]) - - pkg_resources = [] - pkg_deps = [] - - if (!defined(log_tags)) { - log_tags = [] - } - if (!defined(ignore_log_tags)) { - ignore_log_tags = [] - } - - name = target_name - logs_action_name = "logs/${target_name}" - output_file = "$target_out_dir/${target_name}_log_listener.config" - - action(logs_action_name) { - script = "//build/gn/gen_persistent_log_config.py" - outputs = [ - output_file, - ] - args = [ name ] + rebase_path(outputs, root_build_dir) - if (log_tags != []) { - args += [ "--tags" ] - foreach(tag, invoker.log_tags) { - args += [ tag ] - } - } - if (ignore_log_tags != []) { - args += [ "--ignore-tags" ] - foreach(ignore_tag, ignore_log_tags) { - args += [ ignore_tag ] - } - } - if (defined(max_disk_usage)) { - args += [ - "--file-capacity", - max_disk_usage, - ] - } - } - - if (persist_logs) { - pkg_resources = [ - { - dest = "sysmgr/${target_name}_log_listener.config" - path = output_file - }, - ] - pkg_deps = [ ":$logs_action_name" ] - } - package(target_name) { - deprecated_system_image = true - resources = pkg_resources - deps = pkg_deps - } -}
diff --git a/rust/BUILD.gn b/rust/BUILD.gn deleted file mode 100644 index 02778db..0000000 --- a/rust/BUILD.gn +++ /dev/null
@@ -1,19 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -# A toolchain dedicated to processing Rust code. -# The only targets in this toolchain are action() targets, so it -# has no real tools. But every toolchain needs stamp and copy. -toolchain("rustlang") { - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } -}
diff --git a/rust/build_rustc_target.py b/rust/build_rustc_target.py deleted file mode 100755 index 38925bf..0000000 --- a/rust/build_rustc_target.py +++ /dev/null
@@ -1,287 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import subprocess -import sys - -TERM_COLOR_RED = '\033[91m' -TERM_COLOR_END = '\033[0m' - -# Updates the path of the main target in the depfile to the relative path -# from base_path build_output_path -def fix_depfile(depfile_path, base_path, build_output_path): - with open(depfile_path, "r") as depfile: - content = depfile.read() - content_split = content.split(': ', 1) - target_path = os.path.relpath(build_output_path, start=base_path) - new_content = "%s: %s" % (target_path, content_split[1]) - with open(depfile_path, "w") as depfile: - depfile.write(new_content) - -# Creates the directory containing the given file. -def create_base_directory(file): - path = os.path.dirname(file) - try: - os.makedirs(path) - except os.error: - # Already existed. - pass - -# Starts the given command and returns the newly created job. -def start_command(args, env): - return subprocess.Popen(args, env=env, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - -def main(): - parser = argparse.ArgumentParser("Compiles a Rust crate") - parser.add_argument("--rustc", - help="Path to rustc", - required=True) - parser.add_argument("--cipd-version", - help="CIPD version of Rust toolchain", - required=False) - parser.add_argument("--crate-root", - help="Path to source directory", - required=True) - parser.add_argument("--cargo-toml-dir", - help="Path to directory in which a Cargo.toml for this target may be generated", - required=True) - parser.add_argument("--crate-type", - help="Type of crate to build", - required=True, - choices=["bin", "rlib", "staticlib", "proc-macro"]) - parser.add_argument("--package-name", - help="Name of package to build", - required=True) - parser.add_argument("--crate-name", - help="Name of crate to build", - required=True) - parser.add_argument("--version", - help="Semver version of the crate being built", - required=True) - parser.add_argument("--edition", - help="Edition of rust to use when compiling the crate", - required=True, - choices=["2015", "2018"]) - parser.add_argument("--opt-level", - help="Optimization level", - required=True, - choices=["0", "1", "2", "3", "s", "z"]) - parser.add_argument("--lto", - help="Use LTO", - required=False, - choices=["thin", "fat"]) - parser.add_argument("--output-file", - help="Path at which the output file should be stored", - required=True) - parser.add_argument("--depfile", - help="Path at which the output depfile should be stored", - required=True) - parser.add_argument("--root-out-dir", - help="Root output dir on which depfile paths should be rebased", - required=True) - parser.add_argument("--test-output-file", - help="Path at which the unit test output file should be stored if --with-unit-tests is supplied", - required=False) - parser.add_argument("--with-unit-tests", - help="Whether or not to build unit tests", - action="store_true", - required=False) - parser.add_argument("--target", - help="Target for which this crate is being compiled", - required=True) - parser.add_argument("--cmake-dir", - help="Path to the directory containing cmake", - required=True) - parser.add_argument("--clang_prefix", - help="Path to the clang prefix", - required=True) - parser.add_argument("--clang-resource-dir", - help="Path to the clang resource dir", - required=True) - parser.add_argument("--sysroot", - help="Path to the sysroot", - required=True) - parser.add_argument("--shared-libs-root", - help="Path to the location of shared libraries", - required=True) - parser.add_argument("--first-party-crate-root", - help="Path to directory containing the libs for first-party dependencies", - required=True) - parser.add_argument("--third-party-deps-data", - help="Path to output of third_party_crates.py", - required=True) - parser.add_argument("--out-info", - help="Path metadata output", - required=True) - parser.add_argument("--dep-data", - action="append", - help="Path to metadata from a crate dependency", - required=False) - parser.add_argument("--mmacosx-version-min", - help="Select macosx framework version", - required=False) - parser.add_argument("--symbol-level", - help="Symbols to include (0=none, 1=minimal, 2=full)", - choices=["0", "1", "2"], - required=True) - parser.add_argument("--warnings", - help="Whether or not to error on warnings (deny=error, allow=ignore)", - choices=["deny", "allow"], - required=True) - - parser.add_argument - args = parser.parse_args() - - env = os.environ.copy() - env["CC"] = os.path.join(args.clang_prefix, "clang") - env["CXX"] = os.path.join(args.clang_prefix, "clang++") - env["AR"] = os.path.join(args.clang_prefix, "llvm-ar") - env["RANLIB"] = os.path.join(args.clang_prefix, "llvm-ranlib") - if args.cmake_dir: - env["PATH"] = "%s:%s" % (env["PATH"], args.cmake_dir) - env["RUST_BACKTRACE"] = "1" - - create_base_directory(args.output_file) - - if args.warnings == "allow": - warnings_flag = "-Awarnings" - else: - warnings_flag = "-Dwarnings" - - call_args = [ - args.rustc, - args.crate_root, - warnings_flag, - "--edition=%s" % args.edition, - "--crate-type=%s" % args.crate_type, - "--crate-name=%s" % args.crate_name, - "--target=%s" % args.target, - "-Copt-level=%s" % args.opt_level, - "-Cdebuginfo=%s" % args.symbol_level, - "-Lnative=%s" % args.shared_libs_root, - "--color=always", - ] - - if args.target.endswith("fuchsia"): - call_args += [ - "-L", os.path.join(args.sysroot, "lib"), - "-Clink-arg=--pack-dyn-relocs=relr", - "-Clink-arg=--sysroot=%s" % args.sysroot, - "-Clink-arg=-L%s" % os.path.join(args.sysroot, "lib"), - "-Clink-arg=-L%s" % os.path.join(args.clang_resource_dir, args.target, "lib"), - "-Clink-arg=--threads", - "-Clink-arg=-dynamic-linker=ld.so.1", - ] - if args.target.startswith("aarch64"): - call_args += ["-Clink-arg=--fix-cortex-a53-843419"] - else: - call_args += [ - "-Clinker=%s" % os.path.join(args.clang_prefix, "clang"), - ] - if args.target.startswith("aarch64"): - call_args += ["-Clink-arg=-Wl,--fix-cortex-a53-843419"] - if args.target.endswith("linux-gnu"): - call_args += ["-Clink-arg=-Wl,--build-id"] - if not args.target.endswith("darwin"): - call_args += ["-Clink-arg=-Wl,--threads"] - - if args.mmacosx_version_min: - call_args += [ - "-Clink-arg=-mmacosx-version-min=%s" % args.mmacosx_version_min, - ] - - if args.lto: - call_args += ["-Clto=%s" % args.lto] - - third_party_json = json.load(open(args.third_party_deps_data)) - search_paths = third_party_json["deps_folders"] + [ args.first_party_crate_root ] - for path in search_paths: - call_args += ["-L", "dependency=%s" % path] - - externs = [] - - # Collect externs - if args.dep_data: - for data_path in args.dep_data: - if not os.path.isfile(data_path): - print TERM_COLOR_RED - print "Missing Rust target data for dependency " + data_path - print "Did you accidentally depend on a non-Rust target?" - print TERM_COLOR_END - return -1 - dep_data = json.load(open(data_path)) - if dep_data["third_party"]: - package_name = dep_data["package_name"] - crate_data = third_party_json["crates"][package_name] - crate = crate_data["crate_name"] - lib_path = crate_data["lib_path"] - else: - crate = dep_data["crate_name"] - lib_path = dep_data["lib_path"] - crate_underscore = crate.replace("-", "_") - externs.append("%s=%s" % (crate_underscore, lib_path)) - - # add externs to arguments - for extern in externs: - call_args += ["--extern", extern] - - # Build the depfile - depfile_args = call_args + [ - "-o%s" % args.depfile, - "--emit=dep-info", - ] - if args.with_unit_tests: - depfile_args += ["--test"] - depfile_job = start_command(depfile_args, env) - - # Build the desired output - build_args = call_args + ["-o%s" % args.output_file] - build_job = start_command(build_args, env) - - # Build the test harness - if args.with_unit_tests: - build_test_args = call_args + [ - "-o%s" % args.test_output_file, - "--test", - ] - test_job = start_command(build_test_args, env) - - # Write output dependency info - create_base_directory(args.out_info) - with open(args.out_info, "w") as file: - file.write(json.dumps({ - "crate_name": args.crate_name, - "package_name": args.package_name, - "third_party": False, - "cargo_toml_dir": args.cargo_toml_dir, - "lib_path": args.output_file, - "version": args.version, - }, sort_keys=True, indent=4, separators=(",", ": "))) - - # Wait for build jobs to complete - - stdout, stderr = depfile_job.communicate() - if depfile_job.returncode != 0: - print(stdout + stderr) - return depfile_job.returncode - fix_depfile(args.depfile, os.getcwd(), args.output_file) - - stdout, stderr = build_job.communicate() - if build_job.returncode != 0: - print(stdout + stderr) - return build_job.returncode - - if args.with_unit_tests: - stdout, stderr = test_job.communicate() - if test_job.returncode != 0: - print(stdout + stderr) - return test_job.returncode - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rust/compile_3p_crates.py b/rust/compile_3p_crates.py deleted file mode 100755 index ad9a03e..0000000 --- a/rust/compile_3p_crates.py +++ /dev/null
@@ -1,254 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import subprocess -import sys - -ROOT_PATH = os.path.abspath(__file__ + "/../../..") -sys.path += [os.path.join(ROOT_PATH, "third_party", "pytoml")] -import pytoml - -# "foo" from "foo 0.1.0 (//path/to/crate)" -def package_name_from_crate_id(crate_id): - return crate_id.split(" ")[0] - -# Removes the (//path/to/crate) from the crate id "foo 0.1.0 (//path/to/crate)" -# This is necessary in order to support locally-patched (mirrored) crates -def pathless_crate_id(crate_id): - split_id = crate_id.split(" ") - return split_id[0] + " " + split_id[1] - -# Creates the directory containing the given file. -def create_base_directory(file): - path = os.path.dirname(file) - try: - os.makedirs(path) - except os.error: - # Already existed. - pass - -# Runs the given command and returns its return code and output. -def run_command(args, env, cwd): - job = subprocess.Popen(args, env=env, cwd=cwd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = job.communicate() - return (job.returncode, stdout, stderr) - -def main(): - parser = argparse.ArgumentParser("Compiles all third-party Rust crates") - parser.add_argument("--rustc", - help="Path to rustc", - required=True) - parser.add_argument("--cargo", - help="Path to the cargo tool", - required=True) - parser.add_argument("--crate-root", - help="Path to the crate root", - required=True) - parser.add_argument("--opt-level", - help="Optimization level", - required=True, - choices=["0", "1", "2", "3", "s", "z"]) - parser.add_argument("--symbol-level", - help="Symbols to include (0=none, 1=minimal, 2=full)", - choices=["0", "1", "2"], - required=True) - parser.add_argument("--out-dir", - help="Path at which the output libraries should be stored", - required=True) - parser.add_argument("--out-deps-data", - help="File in which data about the dependencies should be stored", - required=True) - parser.add_argument("--target", - help="Target for which this crate is being compiled", - required=True) - parser.add_argument("--cmake-dir", - help="Path to the directory containing cmake", - required=True) - parser.add_argument("--clang_prefix", - help="Path to the clang prefix", - required=True) - parser.add_argument("--clang-resource-dir", - help="Path to the clang resource dir", - required=True) - parser.add_argument("--mmacosx-version-min", - help="Select macosx framework version", - required=False) - # TODO(cramertj) make these args required when the third_party/rust-crates change lands - parser.add_argument("--sysroot", - help="Path to the sysroot", - required=False) - parser.add_argument("--shared-libs-root", - help="Path to the location of shared libraries", - required=False) - parser.add_argument("--cipd-version", - help="CIPD version of Rust toolchain", - required=False) - parser.add_argument - args = parser.parse_args() - - env = os.environ.copy() - create_base_directory(args.out_dir) - - clang_c_compiler = os.path.join(args.clang_prefix, "clang") - - rustflags = [ - "-Copt-level=" + args.opt_level, - "-Cdebuginfo=" + args.symbol_level, - ] - - if args.target.endswith("fuchsia"): - if args.target.startswith("aarch64"): - rustflags += ["-Clink-arg=--fix-cortex-a53-843419"] - rustflags += [ - "-L", os.path.join(args.sysroot, "lib"), - "-Clink-arg=--pack-dyn-relocs=relr", - "-Clink-arg=--threads", - "-Clink-arg=-L%s" % os.path.join(args.sysroot, "lib"), - "-Clink-arg=-L%s" % os.path.join(args.clang_resource_dir, args.target, "lib"), - ] - if args.sysroot and args.shared_libs_root: - rustflags += [ - "-Clink-arg=--sysroot=" + args.sysroot, - "-Lnative=" + args.shared_libs_root, - ] - else: - if args.target.startswith("aarch64"): - rustflags += ["-Clink-arg=-Wl,--fix-cortex-a53-843419"] - if args.target.endswith("linux-gnu"): - rustflags += ["-Clink-arg=-Wl,--build-id"] - if not args.target.endswith("darwin"): - rustflags += ["-Clink-arg=-Wl,--threads"] - env["CARGO_TARGET_LINKER"] = clang_c_compiler - env["CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER"] = clang_c_compiler - env["CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER"] = clang_c_compiler - env["CARGO_TARGET_%s_LINKER" % args.target.replace("-", "_").upper()] = clang_c_compiler - rustflags += ["-Clink-arg=--target=" + args.target] - - if args.mmacosx_version_min: - rustflags += ["-Clink-arg=-mmacosx-version-min=%s" % args.mmacosx_version_min] - env["CARGO_TARGET_%s_RUSTFLAGS" % args.target.replace("-", "_").upper()] = ( - ' '.join(rustflags) - ) - env["CARGO_TARGET_DIR"] = args.out_dir - env["CARGO_BUILD_DEP_INFO_BASEDIR"] = args.out_dir - env["RUSTC"] = args.rustc - env["RUST_BACKTRACE"] = "1" - env["CC"] = clang_c_compiler - if args.sysroot and args.shared_libs_root: - env["CFLAGS"] = "--sysroot=%s -L %s" % (args.sysroot, args.shared_libs_root) - env["CXX"] = os.path.join(args.clang_prefix, "clang++") - env["AR"] = os.path.join(args.clang_prefix, "llvm-ar") - env["RANLIB"] = os.path.join(args.clang_prefix, "llvm-ranlib") - env["PATH"] = "%s:%s" % (env["PATH"], args.cmake_dir) - - call_args = [ - args.cargo, - "build", - "--color=always", - "--target=%s" % args.target, - "--frozen", - ] - - call_args.append("--message-format=json") - - retcode, stdout, stderr = run_command(call_args, env, args.crate_root) - if retcode != 0: - # The output is not particularly useful as it is formatted in JSON. - # Re-run the command with a user-friendly format instead. - del call_args[-1] - _, stdout, stderr = run_command(call_args, env, args.crate_root) - print(stdout + stderr) - return retcode - - cargo_toml_path = os.path.join(args.crate_root, "Cargo.toml") - with open(cargo_toml_path, "r") as file: - cargo_toml = pytoml.load(file) - - crate_id_to_info = {} - deps_folders = set() - for line in stdout.splitlines(): - data = json.loads(line) - if "filenames" not in data: - continue - crate_id = pathless_crate_id(data["package_id"]) - assert len(data["filenames"]) == 1 - lib_path = data["filenames"][0] - - # For libraries built for both the host and the target, pick - # the one being built for the target. - # If we've already seen a lib with the given ID and the new one doesn't - # contain our target, discard it and keep the current entry. - if (crate_id in crate_id_to_info) and (args.target not in lib_path): - continue - crate_name = data["target"]["name"] - if crate_name != "fuchsia-third-party": - # go from e.g. target/debug/deps/libfoo.rlib to target/debug/deps - deps_folders.add(os.path.dirname(lib_path)) - - crate_id_to_info[crate_id] = { - "crate_name": crate_name, - "lib_path": lib_path, - } - - cargo_lock_path = os.path.join(args.crate_root, "Cargo.lock") - with open(cargo_lock_path, "r") as file: - cargo_lock_toml = pytoml.load(file) - - # output the info for fuchsia-third-party's direct dependencies - crates = {} - cargo_dependencies = cargo_toml["dependencies"] - fuchsia_target_spec = 'cfg(target_os = "fuchsia")' - non_fuchsia_target_spec = 'cfg(not(target_os = "fuchsia"))' - if "fuchsia" in args.target: - target_spec = fuchsia_target_spec - non_target_spec = non_fuchsia_target_spec - else: - target_spec = non_fuchsia_target_spec - non_target_spec = fuchsia_target_spec - target_only_deps = cargo_toml \ - .get("target", {}) \ - .get(target_spec, {}) \ - .get("dependencies", []) - cargo_dependencies.update(target_only_deps) - other_target_deps = cargo_toml \ - .get("target", {}) \ - .get(non_target_spec, {}) \ - .get("dependencies", []) - for package in cargo_lock_toml["package"]: - if package["name"] == "fuchsia-third-party": - for crate_id in package["dependencies"]: - crate_id = pathless_crate_id(crate_id) - if crate_id in crate_id_to_info: - crate_info = crate_id_to_info[crate_id] - crate_name = crate_info["crate_name"] - package_name = package_name_from_crate_id(crate_id) - if package_name in cargo_dependencies: - crate_info["cargo_dependency_toml"] = cargo_dependencies[package_name] - crates[package_name] = crate_info - elif package_name not in other_target_deps: - print (package_name + " not found in Cargo.toml dependencies section") - return 1 - - # normalize paths for patches - patches = cargo_toml["patch"]["crates-io"] - for patch in patches: - path = patches[patch]["path"] - path = os.path.join(args.crate_root, path) - patches[patch] = { "path": path } - - create_base_directory(args.out_deps_data) - with open(args.out_deps_data, "w") as file: - file.write(json.dumps({ - "crates": crates, - "deps_folders": list(deps_folders), - "patches": patches, - }, sort_keys=True, indent=4, separators=(",", ": "))) # for humans - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rust/config.gni b/rust/config.gni deleted file mode 100644 index 4d86928..0000000 --- a/rust/config.gni +++ /dev/null
@@ -1,120 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/config/compiler.gni") -import("//build/config/sysroot.gni") -import("//build/fidl/toolchain.gni") -if (is_mac) { - # For mac_sdk_min: - import("//build/config/mac/config.gni") -} - -declare_args() { - # Sets a custom base directory for `rustc` and `cargo`. - # This can be used to test custom Rust toolchains. - rustc_prefix = "//buildtools/${host_platform}/rust/bin" - - # Sets the default LTO type for rustc bulids. - rust_lto = "unset" - - # Sets the fuchsia toolchain target triple suffix (after arch) - rust_toolchain_triple_suffix = "fuchsia" - - # Sets whether Rust compiler warnings cause errors or not. - # "deny" will make all warnings into errors, while "allow" will ignore warnings - rust_warnings = "deny" -} - -_sysroot = sysroot -_sysroot_deps = [] - -# TODO(BLD-230): sysroot.gni should provide the correct label and path to the Fuchsia sysroot. -if (is_fuchsia) { - _sysroot_deps = [ "//garnet/public/sdk:zircon_sysroot_export" ] - _sysroot = rebase_path( - "$root_out_dir/sdk/exported/zircon_sysroot/arch/$target_cpu/sysroot") -} - -_std_deps = [] -if (is_fuchsia) { - _std_deps += [ - # These libraries are required by libstd. - "//zircon/public/lib/backtrace", - "//zircon/public/lib/fdio", - ] -} - -_platform_args = [] -if (is_mac) { - _platform_args += [ - "--mmacosx-version-min", - mac_sdk_min, - ] -} - -assert(current_os == "mac" || current_os == "linux" || current_os == "fuchsia", - "current_os was neither mac, linux, nor fuchsia") -if (current_os == "mac") { - _target = "x86_64-apple-darwin" - assert(current_cpu == "x64") -} else if (current_os == "linux") { - assert(current_cpu == "x64") - _target = "x86_64-unknown-linux-gnu" -} else if (current_os == "fuchsia") { - assert(current_cpu == "x64" || current_cpu == "arm64") - if (current_cpu == "x64") { - _target = "x86_64-$rust_toolchain_triple_suffix" - } else if (current_cpu == "arm64") { - _target = "aarch64-$rust_toolchain_triple_suffix" - } -} - -if (is_debug) { - _rust_opt_level = "0" -} else { - _rust_opt_level = "z" -} - -clang_prefix_rebased = rebase_path(clang_prefix, "", root_build_dir) - -clang_resource_dir = exec_script(rebase_path("$clang_prefix_rebased/clang"), - [ - "--target=$_target", - "-print-resource-dir", - ], - "trim string", - []) - -# rust_config collects common arguments and dependencies for rustc builds -rust_build_args = [ - "--rustc", - rebase_path("$rustc_prefix/rustc"), - "--cmake-dir", - rebase_path("//buildtools/cmake/bin"), - "--shared-libs-root", - rebase_path(get_label_info("//default($shlib_toolchain)", - "root_out_dir")), - "--target", - _target, - "--sysroot", - _sysroot, - "--clang_prefix", - rebase_path(clang_prefix_rebased, "", root_build_dir), - "--clang-resource-dir", - clang_resource_dir, - "--opt-level", - _rust_opt_level, - "--symbol-level", - "$symbol_level", - ] + _platform_args - -rust_build_deps = _sysroot_deps + _std_deps - -# We want to force a recompile of the Rust world whenever Rust toolchain -# changes since artifacts from an older version of the toolchain may or -# may not be compatible with newer ones. -# To achieve this, we insert a build dependency on the rust version. -rust_build_inputs = - [ "//buildtools/${host_platform}/rust/.versions/rust.cipd_version" ]
diff --git a/rust/fidl_rust.gni b/rust/fidl_rust.gni deleted file mode 100644 index 298e1b0..0000000 --- a/rust/fidl_rust.gni +++ /dev/null
@@ -1,83 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") -import("//build/rust/toolchain.gni") - -# Generates some Rust bindings for a FIDL library. -# -# The parameters for this template are defined in //build/fidl/fidl.gni. The -# relevant parameters in this template are: -# - name. - -template("fidl_rust") { - assert(current_toolchain == rust_toolchain, - "This template can only be used in $rust_toolchain.") - - not_needed(invoker, [ "sources" ]) - - main_target_name = target_name - generation_target_name = "${target_name}_rust_generate" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - underscore_name = "fidl_" + string_replace(library_name, ".", "_") - - fidl_target_gen_dir = - get_label_info(":bogus($fidl_toolchain)", "target_gen_dir") - file_stem = "$fidl_target_gen_dir/$underscore_name" - json_representation = "$fidl_target_gen_dir/$target_name.fidl.json" - - compiled_action(generation_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - visibility = [ ":*" ] - - tool = "//garnet/go/src/fidl:fidlgen" - - inputs = [ - json_representation, - ] - - outputs = [ - "$file_stem.rs", - ] - - args = [ - "--json", - rebase_path(json_representation, root_build_dir), - "--output-base", - rebase_path(file_stem, root_build_dir), - "--include-base", - rebase_path(root_gen_dir, root_build_dir), - "--generators", - "rust", - ] - - deps = [ - ":$main_target_name($fidl_toolchain)", - ] - } - - group(main_target_name) { - forward_variables_from(invoker, - [ - "public_deps", - "testonly", - "visibility", - ]) - - deps = [ - ":$generation_target_name", - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - } -}
diff --git a/rust/fidl_rust_library.gni b/rust/fidl_rust_library.gni deleted file mode 100644 index fa4a56c..0000000 --- a/rust/fidl_rust_library.gni +++ /dev/null
@@ -1,58 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/fidl/toolchain.gni") -import("//build/rust/rustc_library.gni") -import("//build/rust/toolchain.gni") - -# Declares the rustc_library invocation for the generated FIDL bindings. - -template("fidl_rust_library") { - not_needed(invoker, [ "sources" ]) - - generation_target_name = "${target_name}_rust_generate" - rustc_target_name = "${target_name}-rustc" - - library_name = target_name - if (defined(invoker.name)) { - library_name = invoker.name - } - - underscore_name = "fidl_" + string_replace(library_name, ".", "_") - - fidl_target_gen_dir = - get_label_info(":bogus($fidl_toolchain)", "target_gen_dir") - file_stem = "$fidl_target_gen_dir/${underscore_name}" - - rustc_library(rustc_target_name) { - name = underscore_name - version = "0.1.0" - edition = "2018" - forward_variables_from(invoker, [ "testonly" ]) - deps = [ - "//garnet/public/lib/fidl/rust/fidl", - "//garnet/public/rust/fuchsia-async", - "//garnet/public/rust/fuchsia-zircon", - "//third_party/rust-crates/rustc_deps:futures-preview", - ] - - if (defined(invoker.public_deps)) { - foreach(dep, invoker.public_deps) { - label = get_label_info(dep, "label_no_toolchain") - deps += [ "${label}-rustc" ] - } - } - - if (defined(invoker.deps)) { - foreach(dep, invoker.deps) { - label = get_label_info(dep, "label_no_toolchain") - deps += [ "${label}-rustc" ] - } - } - - non_rust_deps = [ ":$generation_target_name($rust_toolchain)" ] - source_root = rebase_path("$file_stem.rs") - } -}
diff --git a/rust/list_3p_crates.py b/rust/list_3p_crates.py deleted file mode 100755 index 62bb008..0000000 --- a/rust/list_3p_crates.py +++ /dev/null
@@ -1,32 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import sys - -ROOT_PATH = os.path.abspath(__file__ + "/../../..") -sys.path += [os.path.join(ROOT_PATH, "third_party", "pytoml")] -import pytoml - -def main(): - parser = argparse.ArgumentParser( - "Lists all of the names of crates included in a Cargo.toml file") - parser.add_argument("--cargo-toml", - help="Path to Cargo.toml", - required=True) - args = parser.parse_args() - - with open(args.cargo_toml, "r") as file: - cargo_toml = pytoml.load(file) - for key in cargo_toml["dependencies"].keys(): - print key - target_specs = ['cfg(target_os = "fuchsia")', 'cfg(not(target_os = "fuchsia"))'] - for target_spec in target_specs: - for key in cargo_toml.get("target", {}).get(target_spec, {}).get("dependencies", []): - print key - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rust/list_files_in_dir.py b/rust/list_files_in_dir.py deleted file mode 100755 index 8e1f4ba..0000000 --- a/rust/list_files_in_dir.py +++ /dev/null
@@ -1,23 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import sys - -def main(): - parser = argparse.ArgumentParser( - "Lists all of the filepaths in the provided directory") - parser.add_argument("--dir", - help="Path to directory", - required=True) - args = parser.parse_args() - - # Print out one line for each file in the directory - for f in os.listdir(args.dir): - print os.path.abspath(os.path.join(args.dir, f)) - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rust/rustc_artifact.gni b/rust/rustc_artifact.gni deleted file mode 100644 index 7bd936e..0000000 --- a/rust/rustc_artifact.gni +++ /dev/null
@@ -1,369 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/fidl/toolchain.gni") -import("//build/rust/config.gni") # for rust_config -import("//build/sdk/sdk_atom.gni") -import("//build/testing/test_spec.gni") - -template("rustc_third_party_artifact") { - # Dummy build target to match the one in rustc_artifact - build_target_name = "${target_name}_build" - action(build_target_name) { - script = "//build/rust/write_3p_crate_dep_info.py" - forward_variables_from(invoker, [ "crate_name" ]) - - out_info_path = "${target_out_dir}/${target_name}_info.json" - - args = [ - # This is a slight lie to the end user-- the crate name that - # users provide and that appears in Cargo.toml is the package name, - # which may be different than the crate name (the thing given to - # --extern). One example of this is the rust-crypto crate, - # whose real crate name is crypto, but which is published under - # the package name rust-crypto. - "--package-name", - crate_name, - "--output", - rebase_path(out_info_path), - ] - outputs = [ - out_info_path, - ] - } - - group(target_name) { - public_deps = [ - ":${build_target_name}", - ] - } -} - -# Defines a Rust artifact to be built directly with rustc (rather than using cargo) -# -# Only for internal use, supporting rustc_library and rustc_binary. -# -# The arguments are the same as for rustc_library and rustc_binary, with the exception -# of `type`, which must be one of bin/lib/staticlib/proc-macro. This is used to determine -# the kind of artifact that is produced by rustc. -template("rustc_artifact") { - assert(defined(invoker.type), - "Must specify an artifact type (bin/lib/staticlib/proc-macro)") - type = invoker.type - - # bin: executable binary application - # lib: intermediate artifact to be used in other Rust programs - # staticlib: a statically-linked system library, generally used for linking Rust into C - # proc-macro: a procedural macro (such as a custom-derive) - assert( - type == "bin" || type == "lib" || type == "staticlib" || - type == "proc-macro", - "Artifact type must be one of: \"bin\", \"lib\", \"staticlib\", or \"proc-macro\"") - if (type == "lib") { - # For now, lib == rlib, but this could change in future versions of rustc. - # If/when this changes, we will likely want to transition manually rather - # than being automatically changed as a result of a toolchain upgrade. - type = "rlib" - } - - if (defined(invoker.name)) { - package_name = invoker.name - } else { - package_name = target_name - } - - crate_name = string_replace(package_name, "-", "_") - - if (defined(invoker.version)) { - version = invoker.version - } else { - version = "0.1.0" - } - - assert(defined(invoker.edition), "Must specify an edition. Preferably 2018") - edition = invoker.edition - - group_deps = [] - - if (type == "bin") { - if (defined(invoker.with_lto)) { - with_lto = invoker.with_lto - } else if (rust_lto != "unset") { - with_lto = rust_lto - } else if (is_debug) { - with_lto = "none" - } else { - # Release builds default to "thin" lto - with_lto = "thin" - } - } else { - with_lto = "none" - } - assert(with_lto == "none" || with_lto == "thin" || with_lto == "fat", - "with_lto was neither none, thin, or fat") - - # Determine the prefix and extension for the output file based on the crate type - if (type == "bin") { - prefix = "" - extension = "" - root_file = "src/main.rs" - } else if (type == "rlib") { - prefix = "lib" - extension = ".rlib" - root_file = "src/lib.rs" - } else if (type == "staticlib") { - prefix = "staticlib" - extension = ".a" - root_file = "src/lib.rs" - } else if (type == "proc-macro") { - prefix = "lib" - root_file = "src/lib.rs" - } - - third_party_build = "//third_party/rust-crates/rustc_deps:build-third-party" - third_party_deps_data = "${root_out_dir}/rust_third_party/deps_data.json" - first_party_crate_root = "${root_out_dir}/rust_crates" - if (defined(invoker.output_file_override)) { - output_filename = invoker.output_file_override - } else { - output_filename = "${prefix}${crate_name}${extension}" - } - output_file = "${first_party_crate_root}/$output_filename" - output_depfile = "${first_party_crate_root}/${prefix}${crate_name}.d" - test_output_file = "${root_out_dir}/${crate_name}_${invoker.type}_test" - - build_target_name = "${target_name}_build" - group_deps += [ ":${build_target_name}" ] - - with_unit_tests = defined(invoker.with_unit_tests) && invoker.with_unit_tests - - # If host-side tests are present, record metadata for testing instruction. - if (with_unit_tests && (is_linux || is_mac)) { - test_spec("${target_name}_spec") { - name = invoker.target_name - location = test_output_file - } - } - - # Iterate through the deps collecting a list of the outputs - # of their build targets, which will be passed to rustc as - # `--extern` crates. - dep_info_paths = [] - if (defined(invoker.deps)) { - foreach(dep, invoker.deps) { - dep_target_name = get_label_info(dep, "name") - dep_dir = get_label_info(dep, "dir") - dep_build_target = "${dep_dir}:${dep_target_name}_build" - dep_out_dir = get_label_info(dep_build_target, "target_out_dir") - dep_info_path = "${dep_out_dir}/${dep_target_name}_build_info.json" - dep_info_paths += [ - "--dep-data", - rebase_path(dep_info_path), - ] - } - } - - if (defined(invoker.source_root)) { - root_file = invoker.source_root - } - root_file = rebase_path(root_file) - - cargo_toml_dir = "$target_gen_dir/$target_name" - - # Declare the action target that performs the build itself - action(build_target_name) { - script = "//build/rust/build_rustc_target.py" - - forward_variables_from(invoker, - [ - "deps", - "testonly", - ]) - if (!defined(deps)) { - deps = [] - } - deps += [ third_party_build ] - inputs = [ - root_file, - ] - depfile = output_depfile - - if (defined(invoker.non_rust_deps)) { - public_deps = invoker.non_rust_deps - } - - out_info_path = "${target_out_dir}/${target_name}_info.json" - - args = [ - "--crate-root", - rebase_path(root_file), - "--cargo-toml-dir", - rebase_path(cargo_toml_dir), - "--crate-type", - type, - "--crate-name", - crate_name, - "--package-name", - package_name, - "--depfile", - rebase_path(output_depfile), - "--root-out-dir", - rebase_path(root_out_dir), - "--output-file", - rebase_path(output_file), - "--test-output-file", - rebase_path(test_output_file), - "--first-party-crate-root", - rebase_path(first_party_crate_root), - "--third-party-deps-data", - rebase_path(third_party_deps_data), - "--out-info", - rebase_path(out_info_path), - "--version", - version, - "--edition", - edition, - "--warnings", - rust_warnings, - ] - - args += rust_build_args - deps += rust_build_deps - inputs += rust_build_inputs - - if (with_lto != "none") { - args += [ - "--lto", - with_lto, - ] - } - if (with_unit_tests) { - args += [ "--with-unit-tests" ] - } - - args += dep_info_paths - outputs = [ - output_file, - out_info_path, - ] - if (with_unit_tests) { - outputs += [ test_output_file ] - } - } - - # Copy binaries and staticlibs out of rust_crates/* into the root dir - # TODO(cramertj) remove and replace with writing directly to the root - # dir once all existing build rules have moved off of using rust_crates/* - if (type == "bin" || type == "staticlib") { - copy_target_name = "${target_name}_copy" - group_deps += [ ":${copy_target_name}" ] - output_path = "${root_out_dir}/${prefix}${crate_name}${extension}" - copy(copy_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - deps = [ - ":${build_target_name}", - ] - sources = [ - output_file, - ] - outputs = [ - output_path, - ] - } - - # if appropriate, create an SDK atom for the binary/staticlib that we just - # copied - if (type == "bin" && defined(invoker.sdk_category) && - invoker.sdk_category != "excluded" && !is_fuchsia && - !(defined(invoker.test) && invoker.test)) { - output_name = target_name - file_base = "tools/$output_name" - - sdk_atom("${target_name}_sdk") { - id = "sdk://tools/${output_name}" - - category = invoker.sdk_category - - meta = { - dest = "${file_base}-meta.json" - schema = "host_tool" - value = { - type = "host_tool" - name = output_name - root = "tools" - files = [ file_base ] - } - } - - files = [ - { - source = output_path - dest = file_base - }, - ] - - if (defined(invoker.sdk_deps)) { - deps = invoker.sdk_deps - } - - non_sdk_deps = [ ":$copy_target_name" ] - } - } - } - - cargo_toml_target_name = "${target_name}_cargo" - group_deps += [ ":${cargo_toml_target_name}" ] - action(cargo_toml_target_name) { - script = "//build/rust/write_cargo_toml.py" - forward_variables_from(invoker, - [ - "deps", - "testonly", - ]) - if (!defined(deps)) { - deps = [] - } - deps += [ third_party_build ] - if (defined(invoker.non_rust_deps)) { - public_deps = invoker.non_rust_deps - } - args = [ - "--out-dir", - rebase_path(cargo_toml_dir), - "--source-root", - root_file, - "--package-name", - package_name, - "--crate-name", - crate_name, - "--crate-type", - type, - "--version", - version, - "--edition", - edition, - "--third-party-deps-data", - rebase_path(third_party_deps_data), - ] - - if (with_lto != "none") { - args += [ - "--lto", - with_lto, - ] - } - - # list of paths to info about crate dependencies - args += dep_info_paths - outputs = [ - "${cargo_toml_dir}/Cargo.toml", - ] - } - - group(target_name) { - forward_variables_from(invoker, [ "testonly" ]) - public_deps = group_deps - } -}
diff --git a/rust/rustc_binary.gni b/rust/rustc_binary.gni deleted file mode 100644 index ebc421d..0000000 --- a/rust/rustc_binary.gni +++ /dev/null
@@ -1,78 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/rust/rustc_artifact.gni") - -# Defines a Rust binary -# -# Parameters -# -# name -# Name of the crate as defined in its manifest file. If not specified, it is -# assumed to be the same as the target name. -# -# version (optional) -# Semver version of the crate as seen on crates.io. -# -# edition -# Edition of the Rust language to be used. -# Options are "2015" and "2018". If unsure, choose "2018". -# -# deps (optional) -# List of rust_library GN targets on which this crate depends. -# Third party crates can be included through paths like -# "//third_party/rust-crates/rustc_deps:<cratename>", -# -# non_rust_deps (optional) -# List of non-rust_library GN targets on which this crate depends. -# -# with_unit_tests (optional) -# Builds unit tests associated with the binary. This will create a -# `<name>_bin_test` test file in the output directory. -# -# sdk_category (optional) -# If this field is set, this rust binary will be included in SDK builds for -# the provided category. See //build/sdk/sdk_atom.gni for available -# categories. -# -# source_root (optional) -# Location of the crate root (e.g. `src/main.rs` or `src/lib.rs`). -# This defaults to `./src/main.rs` for binaries and `./src/lib.rs` for libraries, -# and should only be changed when absolutely necessary -# (such as in the case of generated code). -# -# with_lto (optional) -# Force LTO to be enabled/disabled for the binary. Values are "none", "thin" and -# "fat". This value takes precedence over GN args or the default value for the -# type of build (debug or release). -# -# Example of usage: -# -# rustc_binary("foo") { -# deps = [ -# "//garnet/public/rust/bar", -# "//third_party/rust-crates/rustc_deps:clap", -# "//third_party/rust-crates/rustc_deps:serde", -# "//third_party/rust-crates/rustc_deps:slab", -# ] -# with_unit_tests = true -# } -template("rustc_binary") { - rustc_artifact(target_name) { - forward_variables_from(invoker, - [ - "name", - "version", - "edition", - "deps", - "non_rust_deps", - "with_unit_tests", - "source_root", - "testonly", - "with_lto", - "sdk_category", - ]) - type = "bin" - } -}
diff --git a/rust/rustc_library.gni b/rust/rustc_library.gni deleted file mode 100644 index b10311a..0000000 --- a/rust/rustc_library.gni +++ /dev/null
@@ -1,66 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/rust/rustc_artifact.gni") - -# Defines a Rust library -# -# Parameters -# -# name -# Name of the crate as defined in its manifest file. If not specified, it is -# assumed to be the same as the target name. -# -# version -# Semver version of the crate as seen on crates.io. -# -# edition -# Edition of the Rust language to be used. -# Options are "2015" and "2018". If unsure, choose "2018". -# -# deps (optional) -# List of rust_library GN targets on which this crate depends. -# Third party crates can be included through paths like -# "//third_party/rust-crates/rustc_deps:<cratename>", -# -# non_rust_deps (optional) -# List of non-rust_library GN targets on which this crate depends. -# -# with_unit_tests (optional) -# Builds unit tests associated with the binary. This will create a -# `<name>_lib_test` test file in the output directory. -# -# source_root (optional) -# Location of the crate root (e.g. `src/main.rs` or `src/lib.rs`). -# This defaults to `./src/main.rs` for binaries and `./src/lib.rs` for libraries, -# and should only be changed when absolutely necessary -# (such as in the case of generated code). -# -# Example of usage: -# -# rustc_library("foo") { -# deps = [ -# "//garnet/public/rust/bar", -# "//third_party/rust-crates/rustc_deps:clap", -# "//third_party/rust-crates/rustc_deps:serde", -# "//third_party/rust-crates/rustc_deps:slab", -# ] -# with_unit_tests = true -# } -template("rustc_library") { - rustc_artifact(target_name) { - forward_variables_from(invoker, - [ - "name", - "version", - "edition", - "deps", - "non_rust_deps", - "with_unit_tests", - "source_root", - "testonly", - ]) - type = "lib" - } -}
diff --git a/rust/rustc_macro.gni b/rust/rustc_macro.gni deleted file mode 100644 index bee0b16..0000000 --- a/rust/rustc_macro.gni +++ /dev/null
@@ -1,160 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/rust/rustc_artifact.gni") - -# Defines a Rust procedural macro -# -# Parameters -# -# name -# Name of the crate as defined in its manifest file. If not specified, it is -# assumed to be the same as the target name. -# -# version (optional) -# Semver version of the crate as seen on crates.io. -# -# edition -# Edition of the Rust language to be used. -# Options are "2015" and "2018". If unsure, choose "2018". -# -# deps (optional) -# List of rust_library GN targets on which this crate depends. -# Third party crates can be included through paths like -# "//third_party/rust-crates/rustc_deps:<cratename>". -# -# source_root (optional) -# Location of the crate root (e.g. `src/main.rs` or `src/lib.rs`). -# This defaults to `./src/main.rs` for binaries and `./src/lib.rs` for libraries, -# and should only be changed when absolutely necessary -# (such as in the case of generated code). -# -# with_lto (optional) -# Force LTO to be enabled/disabled for the binary. Values are "none", "thin" and -# "fat". This value takes precedence over GN args or the default value for the -# type of build (debug or release). -# -# Example of usage: -# -# rustc_macro("foo") { -# deps = [ -# "//garnet/public/rust/bar", -# "//third_party/rust-crates/rustc_deps:serde", -# "//third_party/rust-crates/rustc_deps:slab", -# ] -# } -template("rustc_macro") { - # Compiling procedural macros is... a bit awkward. - # - # Even though they're provided to crates that use them as if they were normal - # external crates, they're actually '.so's that are compiled for the host machine, - # and then linked into the compiler, so they and all their dependencies should - # be built for the host target. - # - # Once this is done, the resulting artifacts are copied into the Fuchsia target - # directories to act as if they had been built for Fuchsia. In order to avoid - # conflicts, the outputs of the original (host) artifact are built with a - # `_proc_macro` suffix added onto the end, which is removed when they're copied - # into the final target directory. - proc_macro_target = "${target_name}_proc_macro" - proc_macro_host_target = ":${proc_macro_target}($host_toolchain)" - - if (defined(invoker.name)) { - rustc_artifact_name = invoker.name - } else { - rustc_artifact_name = target_name - } - - crate_name = string_replace(rustc_artifact_name, "-", "_") - - if (host_os == "mac") { - macro_extension = ".dylib" - } else { - macro_extension = ".so" - } - - # The actual host-target build of the proc macro crate. - rustc_artifact(proc_macro_target) { - forward_variables_from(invoker, - [ - "deps", - "version", - "edition", - "source_root", - "testonly", - "with_lto", - ]) - name = rustc_artifact_name - type = "proc-macro" - output_file_override = "lib${crate_name}_proc_macro${macro_extension}" - } - - # Copy the generated Cargo.toml - copy_cargo_toml_target = "${target_name}_copy_cargo_toml" - proc_macro_target_gen_dir = - get_label_info(proc_macro_host_target, "target_gen_dir") - copy(copy_cargo_toml_target) { - visibility = [ ":${target_name}" ] - forward_variables_from(invoker, [ "testonly" ]) - deps = [ - proc_macro_host_target, - ] - sources = [ - "$proc_macro_target_gen_dir/$proc_macro_target/Cargo.toml", - ] - outputs = [ - "$target_gen_dir/$target_name/Cargo.toml", - ] - } - - # Copy the generated _build_info.json which provides data about the target that - # was built. - copy_out_info_target = "${target_name}_copy_info" - out_info_path = "$target_out_dir/${rustc_artifact_name}_build_info.json" - proc_macro_target_out_dir = - get_label_info(proc_macro_host_target, "target_out_dir") - copy(copy_out_info_target) { - visibility = [ ":${target_name}" ] - forward_variables_from(invoker, [ "testonly" ]) - deps = [ - proc_macro_host_target, - ] - sources = [ - "$proc_macro_target_out_dir/${proc_macro_target}_build_info.json", - ] - outputs = [ - out_info_path, - ] - } - - # Copy the generated `.so`. - copy_binary_target = "${target_name}_copy_binary" - proc_macro_target_root_out_dir = - get_label_info(proc_macro_host_target, "root_out_dir") - proc_macro_target_out_bin_path = "$proc_macro_target_root_out_dir/rust_crates/lib${crate_name}_proc_macro${macro_extension}" - out_bin_path = - "${root_out_dir}/rust_crates/lib${crate_name}${macro_extension}" - copy(copy_binary_target) { - visibility = [ ":${target_name}" ] - forward_variables_from(invoker, [ "testonly " ]) - deps = [ - proc_macro_host_target, - ] - sources = [ - proc_macro_target_out_bin_path, - ] - outputs = [ - out_bin_path, - ] - } - - # Group all of the `copy` targets into one group which is publicly exposed. - group(target_name) { - deps = [ - ":$copy_binary_target", - ":$copy_cargo_toml_target", - ":$copy_out_info_target", - ] - } -}
diff --git a/rust/rustc_staticlib.gni b/rust/rustc_staticlib.gni deleted file mode 100644 index e5b564b..0000000 --- a/rust/rustc_staticlib.gni +++ /dev/null
@@ -1,105 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/rust/rustc_artifact.gni") - -# Defines a Rust static library -# -# Parameters -# -# name -# Name of the crate as defined in its manifest file. If not specified, it is -# assumed to be the same as the target name. -# -# version -# Semver version of the crate as seen on crates.io. -# -# deps (optional) -# List of rust_library GN targets on which this crate depends. -# Third party crates can be included through paths like -# "//third_party/rust-crates/rustc_deps:<cratename>", -# -# non_rust_deps (optional) -# List of non-rust_library GN targets on which this crate depends. -# -# with_unit_tests (optional) -# Builds unit tests associated with the binary. This will create a -# `<name>-bin-unit-test` test file in the output directory. -# -# source_root (optional) -# Location of the crate root (e.g. `src/main.rs` or `src/lib.rs`). -# This defaults to `./src/main.rs` for binaries and `./src/lib.rs` for libraries, -# and should only be changed when absolutely necessary -# (such as in the case of generated code). -# -# output_name (optional) -# Name of the output file. -# -# Example of usage: -# -# rustc_staticlib("foo") { -# deps = [ -# "//garnet/public/rust/bar", -# "//third_party/rust-crates/rustc_deps:clap", -# "//third_party/rust-crates/rustc_deps:serde", -# "//third_party/rust-crates/rustc_deps:slab", -# ] -# with_unit_tests = true -# } -template("rustc_staticlib") { - rustc_target = "_${target_name}_rustc_artifact" - group_target = "${target_name}" - - if (defined(invoker.name)) { - rustc_artifact_name = invoker.name - } else { - rustc_artifact_name = target_name - } - - rustc_artifact(rustc_target) { - forward_variables_from(invoker, - [ - "version", - "deps", - "edition", - "non_rust_deps", - "with_unit_tests", - "output_name", - "source_root", - "testonly", - ]) - name = rustc_artifact_name - type = "staticlib" - } - - public_hdrs = [] - if (defined(invoker.public)) { - public_hdrs += invoker.public - } - - header_target = "_${target_name}_staticlib_headers" - config_target = "_${target_name}_staticlib_config" - - source_set(header_target) { - public = public_hdrs - visibility = [ ":$group_target" ] - } - - first_party_crate_root = "${root_out_dir}/rust_crates" - crate_name = string_replace(rustc_artifact_name, "-", "_") - build_output = "${first_party_crate_root}/staticlib${crate_name}.a" - - config(config_target) { - libs = [ build_output ] - visibility = [ ":$group_target" ] - } - - group(target_name) { - public_configs = [ ":$config_target" ] - public_deps = [ - ":$header_target", - ":$rustc_target", - ] - } -}
diff --git a/rust/toolchain.gni b/rust/toolchain.gni deleted file mode 100644 index 0d1c29c..0000000 --- a/rust/toolchain.gni +++ /dev/null
@@ -1,5 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -rust_toolchain = "//build/rust:rustlang"
diff --git a/rust/write_3p_crate_dep_info.py b/rust/write_3p_crate_dep_info.py deleted file mode 100755 index fe50996..0000000 --- a/rust/write_3p_crate_dep_info.py +++ /dev/null
@@ -1,39 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -# Creates the directory containing the given file. -def create_base_directory(file): - path = os.path.dirname(file) - try: - os.makedirs(path) - except os.error: - # Already existed. - pass - -def main(): - parser = argparse.ArgumentParser( - "Writes an info.json file for a third-party target") - parser.add_argument("--package-name", - help="Package name of the crate being depended upon", - required=True) - parser.add_argument("--output", - help="Path to output json file", - required=True) - args = parser.parse_args() - - create_base_directory(args.output) - with open(args.output, "w") as file: - file.write(json.dumps({ - "package_name": args.package_name, - "third_party": True, - }, sort_keys=True, indent=4, separators=(",", ": "))) - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rust/write_cargo_toml.py b/rust/write_cargo_toml.py deleted file mode 100755 index dad1a60..0000000 --- a/rust/write_cargo_toml.py +++ /dev/null
@@ -1,148 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import datetime -import json -import os -import subprocess -import sys - -TERM_COLOR_RED = '\033[91m' -TERM_COLOR_END = '\033[0m' - -ROOT_PATH = os.path.abspath(__file__ + "/../../..") -sys.path += [os.path.join(ROOT_PATH, "third_party", "pytoml")] -import pytoml - -# List of packages that are part of the third-party build -# that live in-tree. In order to unify the two packages in builds -# that use the output cargo.tomls, we use `= "*"` as the version -# for these libraries, causing them to resolve via the patch section. -IN_TREE_THIRD_PARTY_PACKAGES = [ - "fuchsia-zircon", - "fuchsia-zircon-sys", -] - -CARGO_TOML_CONTENTS = '''\ -# Copyright %(year)s The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -[package] -name = "%(package_name)s" -version = "%(version)s" -edition = "%(edition)s" -license-file = "LICENSE" -authors = ["rust-fuchsia@fuchsia.com"] -description = "Rust crate for Fuchsia OS" -repository = "https://fuchsia.googlesource.com" - -%(bin_or_lib)s -%(is_proc_macro)s -name = "%(crate_name)s"%(lib_crate_type)s -path = "%(source_root)s" -''' - -def cur_year(): - return datetime.datetime.now().year - -def main(): - parser = argparse.ArgumentParser("Writes a Cargo.toml for a Rust crate") - parser.add_argument("--package-name", - help="Name of the package", - required=True) - parser.add_argument("--crate-name", - help="Name of the crate", - required=True) - parser.add_argument("--source-root", - help="Root lib.rs or main.rs for the crate", - required=True) - parser.add_argument("--version", - help="Version of crate", - required=True) - parser.add_argument("--edition", - help="Edition of rust to use when compiling the crate", - required=True) - parser.add_argument("--out-dir", - help="Path to directory where Cargo.toml should be written", - required=True) - parser.add_argument("--crate-type", - help="Type of crate to build", - required=True, - choices=["bin", "rlib", "staticlib", "proc-macro"]) - parser.add_argument("--lto", - help="Add lto options to crate", - required=False, - choices=["none", "thin", "fat"]) - parser.add_argument("--third-party-deps-data", - help="Path to output of third_party_crates.py", - required=True) - parser.add_argument("--dep-data", - action="append", - help="Path to metadata from a previous invocation of this script", - required=False) - - parser.add_argument - args = parser.parse_args() - cargo_toml_path = os.path.join(args.out_dir, "Cargo.toml") - - third_party_json = json.load(open(args.third_party_deps_data)) - - deps = {} - if args.dep_data: - for data_path in args.dep_data: - if not os.path.isfile(data_path): - print TERM_COLOR_RED - print "Missing Rust target data for dependency " + data_path - print "Did you accidentally depend on a non-Rust target?" - print TERM_COLOR_END - return -1 - dep_data = json.load(open(data_path)) - if dep_data["third_party"]: - crate = dep_data["package_name"] - crate_data = third_party_json["crates"][crate] - deps[crate] = crate_data["cargo_dependency_toml"] - else: - package_name = dep_data["package_name"] - if package_name in IN_TREE_THIRD_PARTY_PACKAGES: - deps[package_name] = { - "version": "*", - } - else: - deps[package_name] = { - "path": dep_data["cargo_toml_dir"], - "version": dep_data["version"], - } - - with open(cargo_toml_path, "w") as file: - file.write(CARGO_TOML_CONTENTS % { - "package_name": args.package_name, - "crate_name": args.crate_name, - "version": args.version, - "edition": args.edition, - "deps": deps, - "year": cur_year(), - "bin_or_lib": "[[bin]]" if args.crate_type == "bin" else "[lib]", - "is_proc_macro": "proc-macro = true" if args.crate_type == "proc-macro" else "", - "lib_crate_type": "" if args.crate_type == "bin" else ( - '\ncrate_type = ["%s"]' % args.crate_type - ), - "source_root": args.source_root, - }) - dependencies = { "dependencies": deps } - file.write(pytoml.dumps({ - "dependencies": deps, - "patch": { "crates-io": third_party_json["patches"] }, - })) - - profile = { "profile": { "release": { "panic" : "abort", "opt-level": "z" } } } - if args.lto and args.lto != "none": - profile["profile"]["release"]["lto"] = args.lto - - file.write(pytoml.dumps(profile)) - -if __name__ == '__main__': - sys.exit(main())
diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index e2a078a..0000000 --- a/rustfmt.toml +++ /dev/null
@@ -1,61 +0,0 @@ -# This file was originally created by running the command -# rustfmt --print-config default rustfmt.toml && sort -u rustfmt.toml -o rustfmt.toml. -# Changes from the defaults are marked with comments. -binop_separator = "Front" -blank_lines_lower_bound = 0 -blank_lines_upper_bound = 1 -brace_style = "SameLineWhere" -color = "Auto" -combine_control_expr = true -comment_width = 100 # Fuchsia uses 100 -condense_wildcard_suffixes = false -control_brace_style = "AlwaysSameLine" -disable_all_formatting = false -edition = "2018" -emit_mode = "Files" -empty_item_single_line = true -error_on_line_overflow = false -error_on_unformatted = false -fn_args_density = "Compressed" # Fuchsia prefers compressed -fn_single_line = false -force_explicit_abi = true -force_multiline_blocks = false -format_strings = false -hard_tabs = false -hide_parse_errors = false -imports_indent = "Block" -imports_layout = "Mixed" -ignore = [ - "bin/netcfg/src/device_id.rs", -] -indent_style = "Block" -match_arm_blocks = true -match_block_trailing_comma = false -max_width = 100 -merge_derives = true -merge_imports = false -newline_style = "Unix" -normalize_comments = false -remove_nested_parens = true -reorder_impl_items = false -reorder_imports = true -reorder_modules = true -report_fixme = "Never" -report_todo = "Never" -skip_children = false -space_after_colon = true -space_before_colon = false -spaces_around_ranges = false -struct_field_align_threshold = 0 -struct_lit_single_line = true -tab_spaces = 4 -trailing_comma = "Vertical" -trailing_semicolon = true -type_punctuation_density = "Wide" -unstable_features = false -use_field_init_shorthand = false -use_small_heuristics = "Default" -use_try_shorthand = true # Fuchsia prefers the shortcut -where_single_line = false -wrap_comments = false # TODO make true when rustfmt#3153 is fixed, -# otherwise comments will violate max_width
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn deleted file mode 100644 index e1d7c7d..0000000 --- a/sdk/BUILD.gn +++ /dev/null
@@ -1,33 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/sdk/sdk_documentation.gni") - -sdk_documentation("schemas") { - name = "metadata_schemas" - category = "partner" - - schemas = [ - "cc_prebuilt_library", - "cc_source_library", - "common", - "dart_library", - "documentation", - "fidl_library", - "host_tool", - "image", - "loadable_module", - "manifest", - "sysroot", - ] - files = [] - foreach(schema, schemas) { - files += [ - { - source = "//build/sdk/meta/$schema.json" - dest = "meta/schemas/$schema.json" - }, - ] - } -}
diff --git a/sdk/MAINTAINERS b/sdk/MAINTAINERS deleted file mode 100644 index 0b7024a..0000000 --- a/sdk/MAINTAINERS +++ /dev/null
@@ -1,2 +0,0 @@ -alainv@google.com -pylaligand@google.com
diff --git a/sdk/README.md b/sdk/README.md deleted file mode 100644 index 26c3ff8..0000000 --- a/sdk/README.md +++ /dev/null
@@ -1,100 +0,0 @@ -# SDK build tools - -This directory contains templates and scripts used to build and consume SDKs in -the Fuchsia GN build. - - -## Overview - -The build output of "an SDK build" is a tarball containing files collected from -the source tree and the output directory, augmented with metadata files. - -Metadata includes the nature of an element (e.g. programming language(s), -runtime type), its relationship with other elements (e.g. dependencies, -supporting tools), the context in which the element was constructed (e.g. -target architecture, high-level compilation options), etc... -Schemas for the various types of SDK elements are available under [meta/](meta). - - -## Implementation - -Individual elements are declared using the [`sdk_atom`](sdk_atom.gni) template. -It should be rare for a developer to directly use that template though: in most -instances its use should be wrapped by another higher-level template, such as -language-based templates. - -Groups of atoms are declared with the [`sdk_molecule`](sdk_molecule.gni) -template. A molecule can also depend on other molecules. Molecules are a great -way to provide hierarchy to SDK atoms. - - -## Declaring SDK elements - -There are a few GN templates developers should use to enable the inclusion of -their code in an SDK: -- [`sdk_shared_library`](/cpp/sdk_shared_library.gni) -- [`sdk_source_set`](/cpp/sdk_source_set.gni) -- [`sdk_executable`](/cpp/sdk_executable.gni) - -Some language-specific targets are also SDK-ready: -- [`dart_library`](/dart/dart_library.gni) -- [`fidl_library`](/fidl/fidl_library.gni) -- [`go_binary`](/go/go_binary.gni) - -In order to add documentation to an SDK, use the -[`sdk_documentation`](/sdk/sdk_documentation.gni) template. - -A target `//foo/bar` declared with one of these templates will yield an -additional target `//foo/bar:bar_sdk` which is an atom ready to be included in -an SDK. - -Additionally, the [`sdk`](sdk.gni) template should be used to declare an -SDK. - -### Visibility - -The `sdk_atom` template declares a `category` parameter which allows developers -to control who may be able to use their atom. See the parameter's documentation -for more information on this. - - -## Creating a custom SDK - -Once elements have been set up for inclusion in an SDK, declaring such an SDK -only takes a few steps: - -1. Identify the atoms needed in the SDK; -2. Create a new SDK `//some/place:my_sdk` with the `sdk` template, regrouping - the atoms and molecules that should be included; -3. Add a new - [package](https://fuchsia.googlesource.com/docs/+/master/build_packages.md) - file for the molecule: -``` -{ - "labels": [ - "//some/place:my_sdk" - ] -} -``` - -The package file can now be used in a standard Fuchsia build and will produce -the archive at `//out/<build-type>/sdk/archive/my_sdk.tar.gz`. - -Note that in order for the archive to be generated, an extra GN argument has to -be passed to GN: -``` -build_sdk_archives=true -``` - - -#### Using a custom SDK in the build - -By setting the `export` property to true on an SDK target, that SDK's contents -become available in the build output directory and may be used for other GN -targets to depend on. This is useful for example when building third-party code -which would otherwise rely on an official SDK. - -For an SDK declared at `//some/place:my_sdk` and marked as "exported", an -additional GN target exists: `//some/place:my_sdk_export`. -This target will generate a usable SDK under -`//out/<build-type>/sdk/exported/my_sdk`.
diff --git a/sdk/create_atom_manifest.py b/sdk/create_atom_manifest.py deleted file mode 100755 index 0ae82a3..0000000 --- a/sdk/create_atom_manifest.py +++ /dev/null
@@ -1,94 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import itertools -import json -import os -import sys - -from sdk_common import Atom, detect_category_violations, detect_collisions, gather_dependencies - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--id', - help='The atom\'s identifier', - required=True) - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--depfile', - help='Path to the depfile', - required=True) - parser.add_argument('--deps', - help='List of manifest paths for dependencies', - nargs='*') - parser.add_argument('--file', - help='A (destination <-- source) mapping', - action='append', - nargs=2) - parser.add_argument('--file-list', - help='A file containing destination=source mappings') - parser.add_argument('--gn-label', - help='GN label of the atom', - required=True) - parser.add_argument('--category', - help='Publication level', - required=True) - parser.add_argument('--meta', - help="Path to the atom's metadata file in the SDK", - default='', - required=False) - args = parser.parse_args() - - # Gather the definitions of other atoms this atom depends on. - (deps, atoms) = gather_dependencies(args.deps) - - # Build the list of files making up this atom. - extra_files = [] - if args.file_list: - with open(args.file_list, 'r') as file_list_file: - for line in file_list_file.readlines(): - extra_files.append(line.strip().split('=', 1)) - files = [] - for destination, source in itertools.chain(args.file, extra_files): - files.append({ - 'source': source, - 'destination': destination, - }) - - atoms.update([Atom({ - 'id': args.id, - 'meta': args.meta, - 'gn-label': args.gn_label, - 'category': args.category, - 'deps': sorted(list(deps)), - 'files': files, - })]) - - if detect_collisions(atoms): - print('Name collisions detected!') - return 1 - if detect_category_violations(args.category, atoms): - print('Publication level violations detected!') - return 1 - - manifest = { - 'ids': [args.id], - 'atoms': map(lambda a: a.json, sorted(list(atoms))), - } - - with open(os.path.abspath(args.out), 'w') as out: - json.dump(manifest, out, indent=2, sort_keys=True) - - with open(args.depfile, 'w') as dep_file: - dep_file.write(args.out + ': ') - for destination, source in extra_files: - dep_file.write(source + ' ') - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/sdk/create_molecule_manifest.py b/sdk/create_molecule_manifest.py deleted file mode 100755 index ecd0274..0000000 --- a/sdk/create_molecule_manifest.py +++ /dev/null
@@ -1,44 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -from sdk_common import detect_category_violations, detect_collisions, gather_dependencies - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--deps', - help='List of manifest paths for the included elements', - nargs='*') - parser.add_argument('--category', - help='Minimum publication level', - required=False) - args = parser.parse_args() - - (direct_deps, atoms) = gather_dependencies(args.deps) - if detect_collisions(atoms): - print('Name collisions detected!') - return 1 - if args.category: - if detect_category_violations(args.category, atoms): - print('Publication level violations detected!') - return 1 - manifest = { - 'ids': [], - 'atoms': map(lambda a: a.json, sorted(list(atoms))), - } - with open(os.path.abspath(args.out), 'w') as out: - json.dump(manifest, out, indent=2, sort_keys=True) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/sdk/export_sdk.py b/sdk/export_sdk.py deleted file mode 100755 index a8c6f3c..0000000 --- a/sdk/export_sdk.py +++ /dev/null
@@ -1,56 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import errno -import json -import os -import shutil -import sys - - -def make_dir(path, is_dir=False): - """Creates the directory at `path`.""" - target = path if is_dir else os.path.dirname(path) - try: - os.makedirs(target) - except OSError as exception: - if exception.errno == errno.EEXIST and os.path.isdir(target): - pass - else: - raise - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--out-dir', - help='Path to the directory where to install the SDK', - required=True) - parser.add_argument('--stamp-file', - help='Path to the victory file', - required=True) - parser.add_argument('--manifest', - help='Path to the SDK\'s manifest file', - required=True) - args = parser.parse_args() - - # Remove any existing output. - shutil.rmtree(args.out_dir, True) - - with open(args.manifest, 'r') as manifest_file: - mappings = map(lambda l: l.strip().split('=', 1), - manifest_file.readlines()) - - for dest, source in mappings: - destination = os.path.join(args.out_dir, dest) - make_dir(destination) - shutil.copy2(source, destination) - - with open(args.stamp_file, 'w') as stamp_file: - stamp_file.write('Now go use it\n') - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/sdk/generate_archive_manifest.py b/sdk/generate_archive_manifest.py deleted file mode 100755 index 6c490c9..0000000 --- a/sdk/generate_archive_manifest.py +++ /dev/null
@@ -1,70 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys -from urlparse import urlparse - -from sdk_common import Atom - - -class MappingAction(argparse.Action): - '''Parses file mappings flags.''' - - def __init__(self, option_strings, dest, nargs=None, **kwargs): - if nargs is not None: - raise ValueError("nargs is not allowed") - super(MappingAction, self).__init__(option_strings, dest, nargs=2, - **kwargs) - - def __call__(self, parser, namespace, values, option_string=None): - mappings = getattr(namespace, 'mappings', None) - if mappings is None: - mappings = {} - setattr(namespace, 'mappings', mappings) - mappings[values[0]] = values[1] - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--manifest', - help='Path to the SDK\'s manifest file', - required=True) - parser.add_argument('--mapping', - help='Extra files to add to the archive', - action=MappingAction) - parser.add_argument('--output', - help='Path to the output file manifest', - required=True) - args = parser.parse_args() - - with open(args.manifest, 'r') as manifest_file: - manifest = json.load(manifest_file) - - all_files = {} - def add(dest, src): - if dest in all_files: - print('Error: multiple entries for %s' % dest) - print(' - %s' % all_files[dest]) - print(' - %s' % src) - return 1 - all_files[dest] = src - - for atom in [Atom(a) for a in manifest['atoms']]: - for file in atom.files: - add(file.destination, file.source) - - for dest, source in args.mappings.iteritems(): - add(dest, source) - - with open(args.output, 'w') as output_file: - for mapping in sorted(all_files.iteritems()): - output_file.write('%s=%s\n' % mapping) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/sdk/generate_meta.py b/sdk/generate_meta.py deleted file mode 100755 index f6600c8..0000000 --- a/sdk/generate_meta.py +++ /dev/null
@@ -1,48 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import sys - -from sdk_common import Atom - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--manifest', - help='Path to the SDK\'s manifest file', - required=True) - parser.add_argument('--meta', - help='Path to output metadata file', - required=True) - parser.add_argument('--target-arch', - help='Architecture of precompiled target atoms', - required=True) - parser.add_argument('--host-arch', - help='Architecture of host tools', - required=True) - args = parser.parse_args() - - with open(args.manifest, 'r') as manifest_file: - manifest = json.load(manifest_file) - - atoms = [Atom(a) for a in manifest['atoms']] - meta = { - 'arch': { - 'host': args.host_arch, - 'target': [ - args.target_arch, - ], - }, - 'parts': sorted(filter(lambda m: m, [a.metadata for a in atoms])), - } - - with open(args.meta, 'w') as meta_file: - json.dump(meta, meta_file, indent=2, sort_keys=True) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/sdk/manifest_schema.json b/sdk/manifest_schema.json deleted file mode 100644 index 2b6e13e..0000000 --- a/sdk/manifest_schema.json +++ /dev/null
@@ -1,102 +0,0 @@ -{ - "description": "Schema for a build-generated SDK manifest", - "type": "object", - "properties": { - "atoms": { - "description": "The set of all atoms in the current manifest, forming a complete dependency graph", - "type": "array", - "items": { - "$ref": "#/definitions/atom" - } - }, - "ids": { - "description": "IDs of the main atoms in this manifest (as opposed to dependencies)", - "type": "array", - "items": { - "$ref": "#/definitions/atomId" - } - } - }, - "required": [ - "atoms", - "ids" - ], - "additionalProperties": false, - "definitions": { - "atomId": { - "description": "Unique identifier for an atom", - "type": "string", - "pattern": "^sdk://([a-z][a-z0-9-_\\.]+)(/([a-z][a-z0-9-_\\.]+))*$" - }, - "atom": { - "description": "An SDK artifact", - "type": "object", - "properties": { - "id": { - "description": "The atom's unique identifier", - "$ref": "#/definitions/atomId" - }, - "gn-label": { - "description": "Label of the GN target which generated the atom", - "type": "string" - }, - "meta": { - "description": "Path to the atom's metadata file in the SDK", - "type": "string" - }, - "category": { - "description": "Publication level of this atom", - "type": "string", - "enum": [ - "excluded", - "experimental", - "internal", - "partner", - "public" - ] - }, - "files": { - "description": "Paths to files making up the atom, relative to the SDK root", - "type": "array", - "items": { - "$ref": "#/definitions/atomFile" - } - }, - "deps": { - "description": "The ids of the atoms this atom directly depends on", - "type": "array", - "items": { - "$ref": "#/definitions/atomId" - } - } - }, - "required": [ - "category", - "deps", - "files", - "id", - "gn-label" - ], - "additionalProperties": false - }, - "atomFile": { - "description": "Description of a file pertaining to an atom", - "type": "object", - "properties": { - "source": { - "description": "Path to the source file", - "type": "string" - }, - "destination": { - "description": "Destination path of the file relative to the SDK root", - "type": "string" - } - }, - "required": [ - "source", - "destination" - ], - "additionalProperties": false - } - } -}
diff --git a/sdk/meta/banjo_library.json b/sdk/meta/banjo_library.json deleted file mode 100644 index 0a47835..0000000 --- a/sdk/meta/banjo_library.json +++ /dev/null
@@ -1,36 +0,0 @@ -{ - "description": "A BANJO library", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "banjo_library" - ] - }, - "name": { - "description": "Name of the library", - "$ref": "common.json#/definitions/banjo_library_name" - }, - "sources": { - "description": "List of library sources", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "required": [ - "name", - "sources", - "type" - ] - } - ] -}
diff --git a/sdk/meta/cc_prebuilt_library.json b/sdk/meta/cc_prebuilt_library.json deleted file mode 100644 index 0a9c83b..0000000 --- a/sdk/meta/cc_prebuilt_library.json +++ /dev/null
@@ -1,98 +0,0 @@ -{ - "description": "A prebuilt C/C++ library", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "cc_prebuilt_library" - ] - }, - "name": { - "description": "Name of the library", - "$ref": "common.json#/definitions/cc_library_name" - }, - "format": { - "description": "The distribution format of the binaries", - "type": "string", - "enum": [ - "shared", - "static" - ] - }, - "headers": { - "description": "List of public headers", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "include_dir": { - "description": "Path to the base directory for includes", - "$ref": "common.json#/definitions/file" - }, - "deps": { - "description": "List of C/C++ libraries this library depends on", - "type": "array", - "items": { - "$ref": "#/definitions/package_name" - } - }, - "binaries": { - "description": "The binary files for the library, per architecture", - "type": "object", - "properties": { - "x64": { - "description": "Binaries for the x64 architecture", - "$ref": "#/definitions/binaryGroup" - }, - "arm64": { - "description": "Binaries for the arm64 architecture", - "$ref": "#/definitions/binaryGroup" - } - }, - "additionalProperties": false, - "minProperties": 1, - "maxProperties": 2 - } - }, - "required": [ - "binaries", - "deps", - "format", - "headers", - "name", - "type" - ] - } - ], - "definitions": { - "binaryGroup": { - "description": "A set of binary files compiled for a given architecture", - "type": "object", - "properties": { - "link": { - "description": "The link-time version of the library", - "$ref": "common.json#/definitions/file" - }, - "dist": { - "description": "The version of the library to add to Fuchsia packages", - "$ref": "common.json#/definitions/file" - }, - "debug": { - "description": "The unstripped version of the library", - "$ref": "common.json#/definitions/file" - } - }, - "required": [ - "link" - ] - } - } -}
diff --git a/sdk/meta/cc_source_library.json b/sdk/meta/cc_source_library.json deleted file mode 100644 index 34733d3..0000000 --- a/sdk/meta/cc_source_library.json +++ /dev/null
@@ -1,65 +0,0 @@ -{ - "description": "A set of C/C++ sources", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "cc_source_library" - ] - }, - "name": { - "description": "Name of the library", - "$ref": "common.json#/definitions/cc_library_name" - }, - "sources": { - "description": "List of library sources", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "headers": { - "description": "List of public headers", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "include_dir": { - "description": "Path to the base directory for includes", - "$ref": "common.json#/definitions/file" - }, - "deps": { - "description": "List of C/C++ libraries this library depends on", - "type": "array", - "items": { - "$ref": "#/definitions/package_name" - } - }, - "fidl_deps": { - "description": "List of FIDL libraries this library depends on", - "type": "array", - "items": { - "$ref": "common.json#/definitions/fidl_library_name" - } - } - }, - "required": [ - "deps", - "fidl_deps", - "headers", - "include_dir", - "name", - "sources", - "type" - ] - } - ] -}
diff --git a/sdk/meta/common.json b/sdk/meta/common.json deleted file mode 100644 index a17c6a5..0000000 --- a/sdk/meta/common.json +++ /dev/null
@@ -1,58 +0,0 @@ -{ - "definitions": { - "file": { - "description": "Path to a file from the root of the SDK", - "type": "string" - }, - "sdk_element": { - "description": "Base type for SDK elements", - "type": "object", - "properties": { - "type": { - "description": "The type of the element", - "type": "string" - }, - "name": { - "description": "The name of the element", - "type": "string" - }, - "root": { - "description": "The root of the element in the SDK", - "type": "string" - }, - "files": { - "description": "The list of files pertaining to the element", - "type": "array", - "items": { - "$ref": "#/definitions/file" - } - } - }, - "required": [ - "name", - "root", - "type" - ] - }, - "banjo_library_name": { - "description": "Name of a BANJO library", - "type": "string" - }, - "fidl_library_name": { - "description": "Name of a FIDL library", - "type": "string" - }, - "cc_library_name": { - "description": "Name of a C/C++ library", - "type": "string" - }, - "target_arch": { - "description": "Target architecture", - "type": "string", - "enum": [ - "arm64", - "x64" - ] - } - } -}
diff --git a/sdk/meta/dart_library.json b/sdk/meta/dart_library.json deleted file mode 100644 index 3d90f91..0000000 --- a/sdk/meta/dart_library.json +++ /dev/null
@@ -1,84 +0,0 @@ -{ - "description": "A Dart library", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "dart_library" - ] - }, - "name": { - "description": "Name of the library", - "$ref": "#/definitions/package_name" - }, - "sources": { - "description": "List of library sources", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "deps": { - "description": "List of Dart libraries this library depends on", - "type": "array", - "items": { - "$ref": "#/definitions/package_name" - } - }, - "third_party_deps": { - "description": "List of third-party dependencies", - "type": "array", - "items": { - "$ref": "#/definitions/third_party_library" - } - }, - "fidl_deps": { - "description": "List of FIDL libraries this library depends on", - "type": "array", - "items": { - "$ref": "common.json#/definitions/fidl_library_name" - } - } - }, - "required": [ - "deps", - "fidl_deps", - "name", - "sources", - "third_party_deps", - "type" - ] - } - ], - "definitions": { - "package_name": { - "description": "A Dart package name", - "type": "string" - }, - "third_party_library": { - "description": "A third-party Dart package", - "type": "object", - "properties": { - "name": { - "description": "Name of the package", - "$ref": "#/definitions/package_name" - }, - "version": { - "description": "Version number of the package", - "type": "string" - } - }, - "required": [ - "name", - "version" - ] - } - } -}
diff --git a/sdk/meta/documentation.json b/sdk/meta/documentation.json deleted file mode 100644 index 3362acf..0000000 --- a/sdk/meta/documentation.json +++ /dev/null
@@ -1,31 +0,0 @@ -{ - "description": "A set of documents", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "documentation" - ] - }, - "docs": { - "description": "The list of documents pertaining to the set", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "required": [ - "type", - "docs" - ] - } - ] -}
diff --git a/sdk/meta/fidl_library.json b/sdk/meta/fidl_library.json deleted file mode 100644 index abc8291..0000000 --- a/sdk/meta/fidl_library.json +++ /dev/null
@@ -1,36 +0,0 @@ -{ - "description": "A FIDL library", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "fidl_library" - ] - }, - "name": { - "description": "Name of the library", - "$ref": "common.json#/definitions/fidl_library_name" - }, - "sources": { - "description": "List of library sources", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "required": [ - "name", - "sources", - "type" - ] - } - ] -}
diff --git a/sdk/meta/host_tool.json b/sdk/meta/host_tool.json deleted file mode 100644 index a6d11fe..0000000 --- a/sdk/meta/host_tool.json +++ /dev/null
@@ -1,31 +0,0 @@ -{ - "description": "A host tool", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "host_tool" - ] - }, - "files": { - "description": "The list of files pertaining to the element", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "required": [ - "type", - "files" - ] - } - ] -}
diff --git a/sdk/meta/image.json b/sdk/meta/image.json deleted file mode 100644 index f9fd1b0..0000000 --- a/sdk/meta/image.json +++ /dev/null
@@ -1,41 +0,0 @@ -{ - "description": "A target image", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "image" - ] - }, - "file": { - "description": "The image, per architecture", - "type": "object", - "properties": { - "x64": { - "description": "File for the x64 architecture", - "$ref": "common.json#/definitions/file" - }, - "arm64": { - "description": "File for the arm64 architecture", - "$ref": "common.json#/definitions/file" - } - }, - "additionalProperties": false, - "minProperties": 1, - "maxProperties": 2 - } - }, - "required": [ - "type", - "file" - ] - } - ] -}
diff --git a/sdk/meta/loadable_module.json b/sdk/meta/loadable_module.json deleted file mode 100644 index ae7361d..0000000 --- a/sdk/meta/loadable_module.json +++ /dev/null
@@ -1,63 +0,0 @@ -{ - "description": "A collection of object files that can be loaded at runtime", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "loadable_module" - ] - }, - "name": { - "description": "Name of the module", - "type": "string" - }, - "resources": { - "description": "Resource files associated with the module", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "binaries": { - "description": "The binary files for the module, per architecture", - "type": "object", - "properties": { - "x64": { - "description": "Binaries for the x64 architecture", - "$ref": "#/definitions/binaryGroup" - }, - "arm64": { - "description": "Binaries for the arm64 architecture", - "$ref": "#/definitions/binaryGroup" - } - }, - "additionalProperties": false, - "minProperties": 1, - "maxProperties": 2 - } - }, - "required": [ - "binaries", - "name", - "resources", - "type" - ] - } - ], - "definitions": { - "binaryGroup": { - "description": "A set of binary files compiled for a given architecture", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - } -}
diff --git a/sdk/meta/manifest.json b/sdk/meta/manifest.json deleted file mode 100644 index bac0c4a..0000000 --- a/sdk/meta/manifest.json +++ /dev/null
@@ -1,40 +0,0 @@ -{ - "description": "A target image", - "type": "object", - "properties": { - "arch": { - "description": "The various architectures encountered in the SDK", - "type": "object", - "properties": { - "host": { - "description": "The host architecture", - "type": "string" - }, - "target": { - "description": "The target architectures", - "type": "array", - "items": { - "$ref": "common.json#/definitions/target_arch" - } - } - }, - "additionalProperties": false, - "required": [ - "host", - "target" - ] - }, - "parts": { - "description": "The metadata files for elements in the SDK", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "additionalProperties": false, - "required": [ - "arch", - "parts" - ] -}
diff --git a/sdk/meta/sysroot.json b/sdk/meta/sysroot.json deleted file mode 100644 index e7e2bc6..0000000 --- a/sdk/meta/sysroot.json +++ /dev/null
@@ -1,101 +0,0 @@ -{ - "description": "The sysroot", - "type": "object", - "allOf": [ - { - "$ref": "common.json#/definitions/sdk_element" - }, - { - "properties": { - "type": { - "description": "Marker for this type of element", - "type": "string", - "enum": [ - "sysroot" - ] - }, - "name": { - "description": "Always 'sysroot'", - "type": "string", - "enum": [ - "sysroot" - ] - }, - "versions": { - "description": "The various versions of the sysroot, per architecture", - "type": "object", - "properties": { - "x64": { - "description": "x64 version", - "$ref": "#/definitions/version" - }, - "arm64": { - "description": "arm64 version", - "$ref": "#/definitions/version" - } - }, - "additionalProperties": false, - "minProperties": 1, - "maxProperties": 2 - } - }, - "required": [ - "name", - "type", - "versions" - ] - } - ], - "definitions": { - "version": { - "description": "Sysroot files for a given architecture", - "type": "object", - "properties": { - "root": { - "description": "Path to the root of the sysroot", - "$ref": "common.json#/definitions/file" - }, - "headers": { - "description": "List of public headers", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "include_dir": { - "description": "Path to the base directory for includes", - "$ref": "common.json#/definitions/file" - }, - "link_libs": { - "description": "List of link-time libraries", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "dist_libs": { - "description": "List of libraries for inclusion in packages", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - }, - "debug_libs": { - "description": "List of libraries for debugging", - "type": "array", - "items": { - "$ref": "common.json#/definitions/file" - } - } - }, - "required": [ - "root", - "headers", - "include_dir", - "link_libs", - "dist_libs", - "debug_libs" - ] - } - } -}
diff --git a/sdk/sdk.gni b/sdk/sdk.gni deleted file mode 100644 index e02f1ea..0000000 --- a/sdk/sdk.gni +++ /dev/null
@@ -1,284 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/json/validate_json.gni") -import("sdk_molecule.gni") - -declare_args() { - # Whether to build SDK tarballs. - build_sdk_archives = false -} - -# A collection of elements to be published in an SDK. -# -# Parameters -# -# name (optional) -# Name of the SDK. -# Defaults to the target's name. -# -# category (required) -# Describes the minimum category that atoms in this SDK must have. -# See //build/sdk/sdk_atom.gni for possible values. -# -# export (optional) -# Whether to export the contents of this SDK to the output directory. -# This is useful when an SDK-like file structure is needed as part of the -# build, for example to port a language runtime which would otherwise rely -# on an official SDK. -# Defaults to false. - -template("sdk") { - assert(defined(invoker.category), "Must define an SDK category") - - main_target_name = target_name - generation_target_name = "${target_name}_molecule" - copy_target_name = "${target_name}_copy" - verification_target_name = "${target_name}_manifest_verify" - meta_target_name = "${target_name}_meta" - verify_meta_target_name = "${target_name}_meta_verify" - archive_manifest_target_name = "${target_name}_archive_manifest" - archive_target_name = "${target_name}_archive" - - if (!is_fuchsia) { - assert(false, "SDKs can only target Fuchsia") - } - target_triple = target_cpu - if (host_cpu == "x64") { - host_triple_cpu = "x86_64" - } else if (host_cpu == "arm64") { - host_triple_cpu = "aarch64" - } else { - assert(false, "Unrecognized host CPU: $host_cpu") - } - if (host_os == "linux") { - host_triple_os = "linux-gnu" - } else if (host_os == "mac") { - host_triple_os = "apple-darwin" - } else if (host_os == "fuchsia") { - host_triple_os = "fuchsia" - } else { - assert(false, "Unrecognized host OS: $host_os") - } - host_triple = "$host_triple_cpu-$host_triple_os" - - # Generates the manifest. - sdk_molecule(generation_target_name) { - forward_variables_from(invoker, "*", [ "export" ]) - - if (!defined(deps)) { - deps = [] - } - deps += [ "//build/sdk:schemas" ] - - category = invoker.category - } - - sdk_name = target_name - if (defined(invoker.name)) { - sdk_name = invoker.name - } - final_manifest_file = "$root_out_dir/sdk/manifest/$sdk_name" - - # Copies the manifest to a central location. - copy(copy_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - sources = [ - "$target_gen_dir/$generation_target_name.sdk", - ] - - outputs = [ - final_manifest_file, - ] - - deps = [ - ":$generation_target_name", - ] - } - - # Verifies that the manifest is valid. - validate_json(verification_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - data = final_manifest_file - - schema = "//build/sdk/manifest_schema.json" - - deps = [ - ":$copy_target_name", - ] - } - - sdk_meta_file = "$target_gen_dir/$sdk_name.sdk_meta.json" - - # Generates a metadata file describing the various parts of the SDK. - action(meta_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - script = "//build/sdk/generate_meta.py" - - inputs = [ - final_manifest_file, - ] - - outputs = [ - sdk_meta_file, - ] - - args = [ - "--manifest", - rebase_path(final_manifest_file), - "--meta", - rebase_path(sdk_meta_file), - "--target-arch", - target_triple, - "--host-arch", - host_triple, - ] - - public_deps = [ - ":$copy_target_name", - ":$verification_target_name", - ] - } - - # Verifies that the manifest metadata is valid. - validate_json(verify_meta_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - data = sdk_meta_file - - schema = "//build/sdk/meta/manifest.json" - - public_deps = [ - ":$meta_target_name", - ] - } - - archive_manifest_file = "$target_gen_dir/$sdk_name.archive_manifest" - - additional_archive_files = [ - { - source = sdk_meta_file - dest = "meta/manifest.json" - }, - ] - - # From the manifest file representing the SDK, generates a list of the files - # going into the final archive. - action(archive_manifest_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - script = "//build/sdk/generate_archive_manifest.py" - - sources = [ - "//build/sdk/sdk_common.py", - ] - - inputs = [ - final_manifest_file, - ] - - outputs = [ - archive_manifest_file, - ] - - args = [ - "--manifest", - rebase_path(final_manifest_file), - "--output", - rebase_path(archive_manifest_file), - ] - - foreach(file, additional_archive_files) { - inputs += [ file.source ] - args += [ - "--mapping", - file.dest, - rebase_path(file.source), - ] - } - - public_deps = [ - ":$verify_meta_target_name", - ] - } - - if (build_sdk_archives) { - # Generates the final archive. - final_archive = "$root_out_dir/sdk/archive/$sdk_name.tar.gz" - - compiled_action(archive_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - tool = "//build/tools/tar_maker" - - inputs = [ - archive_manifest_file, - ] - - outputs = [ - final_archive, - ] - - args = [ - "-manifest", - rebase_path(archive_manifest_file), - "-output", - rebase_path(final_archive), - ] - - deps = [ - ":$archive_manifest_target_name", - ] - } - } else { - group(archive_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - deps = [ - ":$archive_manifest_target_name", - ] - } - } - - group(main_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - deps = [ - ":$archive_target_name", - ] - } - - if (defined(invoker.export) && invoker.export) { - stamp_file = "$target_gen_dir/$target_name.exported" - - action("${target_name}_export") { - script = "//build/sdk/export_sdk.py" - - inputs = [ - archive_manifest_file, - ] - - outputs = [ - stamp_file, - ] - - args = [ - "--out-dir", - rebase_path("$root_out_dir/sdk/exported/$sdk_name"), - "--stamp-file", - rebase_path(stamp_file), - "--manifest", - rebase_path(archive_manifest_file), - ] - - deps = [ - ":$archive_manifest_target_name", - ] - } - } -}
diff --git a/sdk/sdk_atom.gni b/sdk/sdk_atom.gni deleted file mode 100644 index c3cf2f9..0000000 --- a/sdk/sdk_atom.gni +++ /dev/null
@@ -1,225 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/compiled_action.gni") -import("//build/json/validate_json.gni") - -# Defines an SDK element. -# -# Outputs -# -# $target_gen_dir/$target_name.sdk -# A manifest describing what files pertain to the atom and which other atoms -# are required by this atom. -# -# $target_gen_dir/$target_name.meta.json -# A metadata file describing the atom. -# This file is included in the final SDK and used to e.g. drive the -# inclusion of the atom in a different build system. -# -# Parameters -# -# id -# Identifier of this element within SDKs. -# The identifier should represent the canonical base path of the element -# within SDKs according to the standard layout (https://fuchsia.googlesource.com/docs/+/master/development/sdk/layout.md). -# For an element at $ROOT/pkg/foo, the id should be "sdk://pkg/foo". -# -# category -# Describes the availability of the element. -# Possible values, from most restrictive to least restrictive: -# - excluded : the atom may not be included in SDKs; -# - experimental : the atom is available with no quality guarantee; -# - internal : the atom is exposed within the Fuchsia tree; -# - partner : the atom may be used by select partners; -# - public : the atom may be included in published SDKs. -# -# meta -# Scope describing the element's metadata file. -# See the "Metadata scope" section for how to populate this attribute. -# -# files -# List of scopes describing the contents of this element. -# See the "File scopes" section for how to describe files. -# -# file_list -# Path to a file containing file mappings. -# Each line in the file should contain a "dest=source" mapping, similarly to -# file scopes. -# -# deps (optional) -# List of GN labels for other SDK elements this element depends on at build -# time. -# These labels must point to "sdk_atom" targets. -# -# non_sdk_deps (optional) -# List of GN labels which this target needs built. -# -# Metadata scope -# -# This scope describes a metadata file to be added to the SDK element. Its -# supported attributes are: -# -# source (optional) -# Path to the metadata file. -# -# value (optional) -# Scope representing the metadata contents. -# -# NOTE: Exactly one of `source` or `value` must be set. -# -# dest (required) -# Path to the metadata file in the SDK, relatively to the SDK root -# -# schema (required) -# Name of the schema for this file, ignoring the extension. -# Metadata files are hosted under //build/sdk/meta. -# If the metadata file conforms to //build/sdk/meta/foo.json, the -# present attribute should have a value of "foo". -# -# File scopes -# -# Each scope describes a file to be added to the SDK element. The supported -# attributes are: -# -# source (required) -# Path to the original file. -# This path may be absolute or relative to the target's directory. -# -# dest (required) -# Destination path of the file relative to the SDK root. - -template("sdk_atom") { - assert(defined(invoker.category), "Must define an SDK category") - category = invoker.category - - assert(defined(invoker.id), "Must define an SDK ID") - - assert(defined(invoker.meta), "Must specify some metadata") - meta = invoker.meta - - gn_deps = [] - if (defined(invoker.non_sdk_deps)) { - gn_deps = invoker.non_sdk_deps - } - - dep_manifests = [] - if (defined(invoker.deps)) { - gn_deps += invoker.deps - foreach(dep, invoker.deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - dep_manifests += [ rebase_path("$gen_dir/$name.sdk") ] - } - } - - assert(defined(invoker.files), "An atom must specify some files") - file_args = [] - file_inputs = [] - foreach(file, invoker.files) { - assert(defined(file.source), "File $file does not specify a source.") - assert(defined(file.dest), "File $file does not specify a destination.") - file_inputs += [ file.source ] - source = rebase_path(file.source) - file_args += [ - "--file", - file.dest, - source, - ] - } - - meta_target_name = "${target_name}_meta" - meta_content = invoker.meta - meta_file = "$target_gen_dir/$target_name.meta.json" - - if (defined(meta_content.value)) { - # Directly write the value into a file in the output directory. - write_file(meta_file, meta_content.value, "json") - meta_deps = gn_deps - } else { - meta_copy_target_name = "${target_name}_meta_copy" - assert(defined(meta_content.source), "Meta scope needs a source or value") - - # Copy the file to a canonical location for access by other rules. - # TODO(DX-497): instead, make sure that all atoms generate their metadata - # file in the right location. - copy(meta_copy_target_name) { - sources = [ - meta_content.source, - ] - - outputs = [ - meta_file, - ] - - deps = gn_deps - } - - meta_deps = [ ":$meta_copy_target_name" ] - } - - # Verify that the metadata complies with the specified schema. - validate_json(meta_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - data = meta_file - schema = "//build/sdk/meta/${meta_content.schema}.json" - sources = [ - # This file is imported by all schemas. - "//build/sdk/meta/common.json", - ] - public_deps = meta_deps - } - - # Add the metadata file to the set of files to include in SDKs. - meta_source = rebase_path(meta_file) - file_args += [ - "--file", - meta.dest, - meta_source, - ] - - # Builds a manifest representing this element. - action(target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - manifest = "$target_gen_dir/$target_name.sdk" - depfile = "$manifest.d" - - script = "//build/sdk/create_atom_manifest.py" - - public_deps = gn_deps + [ ":$meta_target_name" ] - - inputs = dep_manifests + file_inputs + [ - # Imported by the action's script. - "//build/sdk/sdk_common.py", - ] - - outputs = [ - manifest, - ] - - args = [ - "--id", - invoker.id, - "--out", - rebase_path(manifest, root_build_dir), - "--depfile", - rebase_path(depfile), - "--gn-label", - get_label_info(":$target_name", "label_with_toolchain"), - "--category", - category, - "--meta", - meta.dest, - "--deps", - ] + dep_manifests + file_args - - if (defined(invoker.file_list)) { - args += [ - "--file-list", - rebase_path(invoker.file_list), - ] - } - } -}
diff --git a/sdk/sdk_atom_alias.gni b/sdk/sdk_atom_alias.gni deleted file mode 100644 index 2329aaa..0000000 --- a/sdk/sdk_atom_alias.gni +++ /dev/null
@@ -1,71 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Defines an alias for an SDK element. -# -# Parameters -# -# atom -# The label of the aliased atom. -# -# non_sdk_deps (optional) -# List of GN labels which this target needs built. - -template("sdk_atom_alias") { - assert(defined(invoker.atom), "Must define an atom to alias") - - # This template simply copies the output files of the sdk_atom template to - # the correct location. - - atom_gen_dir = get_label_info(invoker.atom, "target_gen_dir") - atom_name = get_label_info(invoker.atom, "name") - - group_deps = [] - - copy_meta_target_name = "${target_name}_copy_meta" - group_deps += [ ":$copy_meta_target_name" ] - copy(copy_meta_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - sources = [ - "$atom_gen_dir/$atom_name.meta.json", - ] - - outputs = [ - "$target_gen_dir/$target_name.meta.json", - ] - - deps = [ - invoker.atom, - ] - } - - copy_manifest_target_name = "${target_name}_copy_manifest" - group_deps += [ ":$copy_manifest_target_name" ] - copy(copy_manifest_target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - sources = [ - "$atom_gen_dir/$atom_name.sdk", - ] - - outputs = [ - "$target_gen_dir/$target_name.sdk", - ] - - deps = [ - invoker.atom, - ] - } - - group(target_name) { - forward_variables_from(invoker, [ "testonly" ]) - - public_deps = group_deps - - if (defined(invoker.non_sdk_deps)) { - public_deps += invoker.non_sdk_deps - } - } -}
diff --git a/sdk/sdk_common.py b/sdk/sdk_common.py deleted file mode 100644 index ed30aaf..0000000 --- a/sdk/sdk_common.py +++ /dev/null
@@ -1,103 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import collections -import json - - -class File(object): - '''Wrapper class for file definitions.''' - - def __init__(self, json): - self.source = json['source'] - self.destination = json['destination'] - - def __str__(self): - return '{%s <-- %s}' % (self.destination, self.source) - - -class Atom(object): - '''Wrapper class for atom data, adding convenience methods.''' - - def __init__(self, json): - self.json = json - self.id = json['id'] - self.metadata = json['meta'] - self.label = json['gn-label'] - self.category = json['category'] - self.deps = json['deps'] - self.files = [File(f) for f in json['files']] - - def __str__(self): - return str(self.id) - - def __hash__(self): - return hash(self.label) - - def __eq__(self, other): - return self.label == other.label - - def __ne__(self, other): - return not __eq__(self, other) - - def __cmp__(self, other): - return cmp(self.id, other.id) - - -def gather_dependencies(manifests): - '''Extracts the set of all required atoms from the given manifests, as well - as the set of names of all the direct dependencies. - ''' - direct_deps = set() - atoms = set() - for dep in manifests: - with open(dep, 'r') as dep_file: - dep_manifest = json.load(dep_file) - direct_deps.update(dep_manifest['ids']) - atoms.update(map(lambda a: Atom(a), dep_manifest['atoms'])) - return (direct_deps, atoms) - - -def detect_collisions(atoms): - '''Detects name collisions in a given atom list.''' - mappings = collections.defaultdict(lambda: []) - for atom in atoms: - mappings[atom.id].append(atom) - has_collisions = False - for id, group in mappings.iteritems(): - if len(group) == 1: - continue - has_collisions = True - labels = [a.label for a in group] - print('Targets sharing the SDK id %s:' % id) - for label in labels: - print(' - %s' % label) - return has_collisions - - -CATEGORIES = [ - 'excluded', - 'experimental', - 'internal', - 'partner', - 'public', -] - - -def index_for_category(category): - if not category in CATEGORIES: - raise Exception('Unknown SDK category "%s"' % category) - return CATEGORIES.index(category) - - -def detect_category_violations(category, atoms): - '''Detects mismatches in publication categories.''' - has_violations = False - category_index = index_for_category(category) - for atom in atoms: - if index_for_category(atom.category) < category_index: - has_violations = True - print('%s has publication level %s, incompatible with %s' % ( - atom, atom.category, category)) - return has_violations
diff --git a/sdk/sdk_common_unittest.py b/sdk/sdk_common_unittest.py deleted file mode 100755 index 33e700b..0000000 --- a/sdk/sdk_common_unittest.py +++ /dev/null
@@ -1,48 +0,0 @@ -#!/usr/bin/python3.5 -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# TODO(INTK-247): switch to the standard shebang line when the mocking library -# is available. - -import os -import sys -import unittest -from unittest.mock import patch, MagicMock - -from sdk_common import Atom, AtomId, detect_category_violations - - -def _atom(name, category): - return Atom({ - 'id': { - 'domain': 'foo', - 'name': name, - }, - 'category': category, - 'gn-label': '//hello', - 'deps': [], - 'package-deps': [], - 'files': [], - 'tags': [], - }) - - -class SdkCommonTests(unittest.TestCase): - - def test_categories(self): - atoms = [_atom('hello', 'internal'), _atom('world', 'public')] - self.assertFalse(detect_category_violations('internal', atoms)) - - def test_categories_failure(self): - atoms = [_atom('hello', 'internal'), _atom('world', 'public')] - self.assertTrue(detect_category_violations('partner', atoms)) - - def test_category_name_bogus(self): - atoms = [_atom('hello', 'foobarnotgood'), _atom('world', 'public')] - self.assertRaises(Exception, detect_category_violations, 'partner', atoms) - - -if __name__ == '__main__': - unittest.main()
diff --git a/sdk/sdk_documentation.gni b/sdk/sdk_documentation.gni deleted file mode 100644 index 00d321f..0000000 --- a/sdk/sdk_documentation.gni +++ /dev/null
@@ -1,53 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/sdk/sdk_atom.gni") - -# Declares a set of documents to be added to an SDK. -# -# Parameters -# -# category (required) -# Publication level of the document set in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# name (required) -# Name of the document set in the SDK. -# -# files (required) -# List of scopes describing the documents to add to SDKs. -# See "File scopes" in //build/sdk/sdk_atom.gni for a description of the -# scope format. - -template("sdk_documentation") { - assert(defined(invoker.category), "Must define an SDK category") - assert(defined(invoker.name), "Must define an SDK name") - assert(defined(invoker.files), "Must add documentation files") - - sdk_files = [] - foreach(file, invoker.files) { - sdk_files += [ file.dest ] - } - - sdk_atom(target_name) { - forward_variables_from(invoker, - [ - "category", - "files", - ]) - - id = "sdk://docs/${invoker.name}" - - meta = { - schema = "documentation" - dest = "docs/${invoker.name}.json" - value = { - type = "documentation" - name = invoker.name - docs = sdk_files - root = "docs" - } - } - } -}
diff --git a/sdk/sdk_molecule.gni b/sdk/sdk_molecule.gni deleted file mode 100644 index dfdeaae..0000000 --- a/sdk/sdk_molecule.gni +++ /dev/null
@@ -1,72 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Defines a group of SDK elements. -# -# Parameters -# -# category (optional) -# Describes the minimum category that atoms in this molecule must have. -# See //build/sdk/sdk_atom.gni for possible values. -# -# deps (optional) -# List of GN labels referencing the elements of this group. -# These labels must point to "sdk_atom" or "sdk_molecule" targets. -# -# non_sdk_deps (optional) -# List of GN labels which this target needs built. - -template("sdk_molecule") { - gn_deps = [] - if (defined(invoker.non_sdk_deps)) { - gn_deps = invoker.non_sdk_deps - } - - dep_manifests = [] - if (defined(invoker.deps)) { - gn_deps += invoker.deps - foreach(dep, invoker.deps) { - gen_dir = get_label_info(dep, "target_gen_dir") - name = get_label_info(dep, "name") - dep_manifests += [ rebase_path("$gen_dir/$name.sdk") ] - } - } - - # Builds a manifest representing members of the group. - action(target_name) { - forward_variables_from(invoker, - [ - "assert_no_deps", - "testonly", - ]) - - manifest = "$target_gen_dir/$target_name.sdk" - - script = "//build/sdk/create_molecule_manifest.py" - - deps = gn_deps - - inputs = dep_manifests + [ - # Imported by the action's script. - "//build/sdk/sdk_common.py", - ] - - outputs = [ - manifest, - ] - - args = [ - "--out", - rebase_path(manifest), - "--deps", - ] + dep_manifests - - if (defined(invoker.category)) { - args += [ - "--category", - invoker.category, - ] - } - } -}
diff --git a/sdk/sdk_prebuilt_executable.gni b/sdk/sdk_prebuilt_executable.gni deleted file mode 100644 index 5cd8933..0000000 --- a/sdk/sdk_prebuilt_executable.gni +++ /dev/null
@@ -1,66 +0,0 @@ -# Copyright 2019 The Fuchsia Authors. 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/sdk/sdk_atom.gni") - -# A prebuilt host executable which can be bundled in an SDK. -# -# prebuilt (required) -# Label of the prebuilt executable. -# -# category (required) -# Publication level of the executable in SDKs. -# See //build/sdk/sdk_atom.gni. -# -# sdk_deps (optional) -# List of labels representing elements that should be added to SDKs -# alongside the present binary. -# Labels in the list must represent SDK-ready targets. - -template("sdk_prebuilt_executable") { - assert(defined(invoker.category), "Must define an SDK category") - assert(defined(invoker.prebuilt), "Must set the path") - if (is_fuchsia) { - assert(false, "Only valid for host tools") - } - - main_target_name = target_name - - group(main_target_name) { - # No-op target, only used to abide by naming conventions. - } - - tool_name = get_path_info(invoker.prebuilt, "file") - file_base = "tools/$tool_name" - - sdk_atom("${target_name}_sdk") { - id = "sdk://tools/$tool_name" - - category = invoker.category - - meta = { - dest = "$file_base-meta.json" - schema = "host_tool" - value = { - type = "host_tool" - name = tool_name - root = "tools" - files = [ file_base ] - } - } - - files = [ - { - source = invoker.prebuilt - dest = file_base - }, - ] - - if (defined(invoker.sdk_deps)) { - deps = invoker.sdk_deps - } - - non_sdk_deps = [ ":$main_target_name" ] - } -}
diff --git a/secondary/third_party/dart/pkg/analyzer/BUILD.gn b/secondary/third_party/dart/pkg/analyzer/BUILD.gn deleted file mode 100644 index a864313..0000000 --- a/secondary/third_party/dart/pkg/analyzer/BUILD.gn +++ /dev/null
@@ -1,33 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("analyzer") { - package_name = "analyzer" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/args", - "//third_party/dart-pkg/pub/charcode", - "//third_party/dart-pkg/pub/collection", - "//third_party/dart-pkg/pub/convert", - "//third_party/dart-pkg/pub/crypto", - "//third_party/dart-pkg/pub/glob", - "//third_party/dart-pkg/pub/html", - "//third_party/dart-pkg/pub/meta", - "//third_party/dart-pkg/pub/package_config", - "//third_party/dart-pkg/pub/path", - "//third_party/dart-pkg/pub/plugin", - "//third_party/dart-pkg/pub/pub_semver", - "//third_party/dart-pkg/pub/source_span", - "//third_party/dart-pkg/pub/watcher", - "//third_party/dart-pkg/pub/yaml", - "//third_party/dart/pkg/front_end", - "//third_party/dart/pkg/kernel", - ] -}
diff --git a/secondary/third_party/dart/pkg/analyzer_cli/BUILD.gn b/secondary/third_party/dart/pkg/analyzer_cli/BUILD.gn deleted file mode 100644 index 176597c..0000000 --- a/secondary/third_party/dart/pkg/analyzer_cli/BUILD.gn +++ /dev/null
@@ -1,26 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("analyzer_cli") { - package_name = "analyzer_cli" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/args", - "//third_party/dart-pkg/pub/bazel_worker", - "//third_party/dart-pkg/pub/cli_util", - "//third_party/dart-pkg/pub/package_config", - "//third_party/dart-pkg/pub/plugin", - "//third_party/dart-pkg/pub/protobuf", - "//third_party/dart-pkg/pub/yaml", - "//third_party/dart/pkg/analyzer", - "//third_party/dart/pkg/telemetry", - "//third_party/dart/third_party/pkg/linter", - ] -}
diff --git a/secondary/third_party/dart/pkg/build_integration/BUILD.gn b/secondary/third_party/dart/pkg/build_integration/BUILD.gn deleted file mode 100644 index 852cdae..0000000 --- a/secondary/third_party/dart/pkg/build_integration/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("build_integration") { - package_name = "build_integration" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart/pkg/front_end", - ] -}
diff --git a/secondary/third_party/dart/pkg/front_end/BUILD.gn b/secondary/third_party/dart/pkg/front_end/BUILD.gn deleted file mode 100644 index 56c95ef..0000000 --- a/secondary/third_party/dart/pkg/front_end/BUILD.gn +++ /dev/null
@@ -1,22 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("front_end") { - package_name = "front_end" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/convert", - "//third_party/dart-pkg/pub/crypto", - "//third_party/dart-pkg/pub/meta", - "//third_party/dart-pkg/pub/path", - "//third_party/dart-pkg/pub/source_span", - "//third_party/dart/pkg/kernel", - ] -}
diff --git a/secondary/third_party/dart/pkg/kernel/BUILD.gn b/secondary/third_party/dart/pkg/kernel/BUILD.gn deleted file mode 100644 index 424812a..0000000 --- a/secondary/third_party/dart/pkg/kernel/BUILD.gn +++ /dev/null
@@ -1,20 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("kernel") { - package_name = "kernel" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/args", - "//third_party/dart-pkg/pub/logging", - "//third_party/dart-pkg/pub/package_config", - "//third_party/dart-pkg/pub/path", - ] -}
diff --git a/secondary/third_party/dart/pkg/telemetry/BUILD.gn b/secondary/third_party/dart/pkg/telemetry/BUILD.gn deleted file mode 100644 index 1f2819f..0000000 --- a/secondary/third_party/dart/pkg/telemetry/BUILD.gn +++ /dev/null
@@ -1,20 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("telemetry") { - package_name = "telemetry" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/http", - "//third_party/dart-pkg/pub/path", - "//third_party/dart-pkg/pub/stack_trace", - "//third_party/dart-pkg/pub/usage", - ] -}
diff --git a/secondary/third_party/dart/pkg/typed_mock/BUILD.gn b/secondary/third_party/dart/pkg/typed_mock/BUILD.gn deleted file mode 100644 index afaa351..0000000 --- a/secondary/third_party/dart/pkg/typed_mock/BUILD.gn +++ /dev/null
@@ -1,13 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("typed_mock") { - package_name = "typed_mock" - - sources = [] - - disable_analysis = true -}
diff --git a/secondary/third_party/dart/pkg/vm/BUILD.gn b/secondary/third_party/dart/pkg/vm/BUILD.gn deleted file mode 100644 index 0ea19c4..0000000 --- a/secondary/third_party/dart/pkg/vm/BUILD.gn +++ /dev/null
@@ -1,19 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("vm") { - package_name = "vm" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/args", - "//third_party/dart/pkg/front_end", - "//third_party/dart/pkg/kernel", - ] -}
diff --git a/secondary/third_party/dart/third_party/pkg/func/BUILD.gn b/secondary/third_party/dart/third_party/pkg/func/BUILD.gn deleted file mode 100644 index 7d3ca4c..0000000 --- a/secondary/third_party/dart/third_party/pkg/func/BUILD.gn +++ /dev/null
@@ -1,13 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("func") { - package_name = "func" - - sources = [] - - disable_analysis = true -}
diff --git a/secondary/third_party/dart/third_party/pkg/intl/BUILD.gn b/secondary/third_party/dart/third_party/pkg/intl/BUILD.gn deleted file mode 100644 index 2c9b491..0000000 --- a/secondary/third_party/dart/third_party/pkg/intl/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("intl") { - package_name = "intl" - - sources = [] - - deps = [ - "//third_party/dart-pkg/pub/path", - ] - - disable_analysis = true -}
diff --git a/secondary/third_party/dart/third_party/pkg/linter/BUILD.gn b/secondary/third_party/dart/third_party/pkg/linter/BUILD.gn deleted file mode 100644 index 7e00fe1..0000000 --- a/secondary/third_party/dart/third_party/pkg/linter/BUILD.gn +++ /dev/null
@@ -1,23 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. 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/dart/dart_library.gni") - -dart_library("linter") { - package_name = "linter" - - sources = [] - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/pub/args", - "//third_party/dart-pkg/pub/cli_util", - "//third_party/dart-pkg/pub/glob", - "//third_party/dart-pkg/pub/plugin", - "//third_party/dart-pkg/pub/source_span", - "//third_party/dart-pkg/pub/yaml", - "//third_party/dart/pkg/analyzer", - ] -}
diff --git a/secondary/third_party/glfw/BUILD.gn b/secondary/third_party/glfw/BUILD.gn deleted file mode 100644 index 6531a27..0000000 --- a/secondary/third_party/glfw/BUILD.gn +++ /dev/null
@@ -1,74 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("glfw_config") { - include_dirs = [ - "include", - "deps", - ] - cflags = [ - "-Wall", - "-Wno-deprecated", - ] - - # add flags to avoid compiler warnings - cflags += [ - "-Wno-int-conversion", - "-Wno-implicit-function-declaration", - "-Wno-sign-compare", - ] -} -static_library("glfw") { - defines = [ - "_GLFW_BUILD_DLL", - "__GLFW_USE_HYBRID_HPG", - ] - sources = [ - "deps/getopt.c", - "deps/glad.c", - "src/context.c", - "src/init.c", - "src/input.c", - "src/monitor.c", - "src/vulkan.c", - "src/window.c", - ] - if (is_mac) { - defines += [ - "_GLFW_COCOA", - "_GLFW_USE_RETINA", - ] - libs = [ - "Cocoa.framework", - "CoreFoundation.framework", - "CoreGraphics.framework", - "CoreVideo.framework", - "IOKit.framework", - "OpenGL.framework", - ] - sources += [ - "src/cocoa_init.m", - "src/cocoa_joystick.m", - "src/cocoa_monitor.m", - "src/cocoa_time.c", - "src/cocoa_window.m", - "src/nsgl_context.m", - "src/posix_tls.c", - ] - } else if (is_linux) { - defines += [ "_GLFW_X11" ] - sources += [ - "src/egl_context.c", - "src/glx_context.c", - "src/linux_joystick.c", - "src/posix_time.c", - "src/posix_tls.c", - "src/x11_init.c", - "src/x11_monitor.c", - "src/x11_window.c", - "src/xkb_unicode.c", - ] - } - configs += [ ":glfw_config" ] -}
diff --git a/secondary/third_party/llvm/BUILD.gn b/secondary/third_party/llvm/BUILD.gn deleted file mode 100644 index e8e4d19..0000000 --- a/secondary/third_party/llvm/BUILD.gn +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_toolchain == host_toolchain, - "LLVM should only be referenced from host tools.") - -config("include") { - include_dirs = [ - "include", - - # For our build configuration includes. - "//build/secondary/third_party/llvm/include", - ] -}
diff --git a/secondary/third_party/llvm/README.md b/secondary/third_party/llvm/README.md deleted file mode 100644 index 3f75e71..0000000 --- a/secondary/third_party/llvm/README.md +++ /dev/null
@@ -1,7 +0,0 @@ -# LLVM build configuration. - -This is not complete, it has only the portions of the build files that are -required. - -Some headers are generated by CMake at configuration time. Our versions of -these are checked into include/.
diff --git a/secondary/third_party/llvm/include/llvm/Config/AsmParsers.def b/secondary/third_party/llvm/include/llvm/Config/AsmParsers.def deleted file mode 100644 index a8d663b..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/AsmParsers.def +++ /dev/null
@@ -1,31 +0,0 @@ -/*===- llvm/Config/AsmParsers.def - LLVM Assembly Parsers -------*- C++ -*-===*\ -|* *| -|* The LLVM Compiler Infrastructure *| -|* *| -|* This file is distributed under the University of Illinois Open Source *| -|* License. See LICENSE.TXT for details. *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This file enumerates all of the assembly-language parsers *| -|* supported by this build of LLVM. Clients of this file should define *| -|* the LLVM_ASM_PARSER macro to be a function-like macro with a *| -|* single parameter (the name of the target whose assembly can be *| -|* generated); including this file will then enumerate all of the *| -|* targets with assembly parsers. *| -|* *| -|* The set of targets supported by LLVM is generated at configuration *| -|* time, at which point this header is generated. Do not modify this *| -|* header directly. *| -|* *| -\*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_ASM_PARSER -# error Please define the macro LLVM_ASM_PARSER(TargetName) -#endif - -LLVM_ASM_PARSER(AArch64) -LLVM_ASM_PARSER(X86) - - -#undef LLVM_ASM_PARSER
diff --git a/secondary/third_party/llvm/include/llvm/Config/AsmPrinters.def b/secondary/third_party/llvm/include/llvm/Config/AsmPrinters.def deleted file mode 100644 index f1fa0ab..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/AsmPrinters.def +++ /dev/null
@@ -1,31 +0,0 @@ -/*===- llvm/Config/AsmPrinters.def - LLVM Assembly Printers -----*- C++ -*-===*\ -|* *| -|* The LLVM Compiler Infrastructure *| -|* *| -|* This file is distributed under the University of Illinois Open Source *| -|* License. See LICENSE.TXT for details. *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This file enumerates all of the assembly-language printers *| -|* supported by this build of LLVM. Clients of this file should define *| -|* the LLVM_ASM_PRINTER macro to be a function-like macro with a *| -|* single parameter (the name of the target whose assembly can be *| -|* generated); including this file will then enumerate all of the *| -|* targets with assembly printers. *| -|* *| -|* The set of targets supported by LLVM is generated at configuration *| -|* time, at which point this header is generated. Do not modify this *| -|* header directly. *| -|* *| -\*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_ASM_PRINTER -# error Please define the macro LLVM_ASM_PRINTER(TargetName) -#endif - -LLVM_ASM_PRINTER(AArch64) -LLVM_ASM_PRINTER(X86) - - -#undef LLVM_ASM_PRINTER
diff --git a/secondary/third_party/llvm/include/llvm/Config/Disassemblers.def b/secondary/third_party/llvm/include/llvm/Config/Disassemblers.def deleted file mode 100644 index 576c284..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/Disassemblers.def +++ /dev/null
@@ -1,31 +0,0 @@ -/*===- llvm/Config/Disassemblers.def - LLVM Assembly Parsers ----*- C++ -*-===*\ -|* *| -|* The LLVM Compiler Infrastructure *| -|* *| -|* This file is distributed under the University of Illinois Open Source *| -|* License. See LICENSE.TXT for details. *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This file enumerates all of the assembly-language parsers *| -|* supported by this build of LLVM. Clients of this file should define *| -|* the LLVM_DISASSEMBLER macro to be a function-like macro with a *| -|* single parameter (the name of the target whose assembly can be *| -|* generated); including this file will then enumerate all of the *| -|* targets with assembly parsers. *| -|* *| -|* The set of targets supported by LLVM is generated at configuration *| -|* time, at which point this header is generated. Do not modify this *| -|* header directly. *| -|* *| -\*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_DISASSEMBLER -# error Please define the macro LLVM_DISASSEMBLER(TargetName) -#endif - -LLVM_DISASSEMBLER(AArch64) -LLVM_DISASSEMBLER(X86) - - -#undef LLVM_DISASSEMBLER
diff --git a/secondary/third_party/llvm/include/llvm/Config/Targets.def b/secondary/third_party/llvm/include/llvm/Config/Targets.def deleted file mode 100644 index 16983ee..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/Targets.def +++ /dev/null
@@ -1,30 +0,0 @@ -/*===- llvm/Config/Targets.def - LLVM Target Architectures ------*- C++ -*-===*\ -|* *| -|* The LLVM Compiler Infrastructure *| -|* *| -|* This file is distributed under the University of Illinois Open Source *| -|* License. See LICENSE.TXT for details. *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This file enumerates all of the target architectures supported by *| -|* this build of LLVM. Clients of this file should define the *| -|* LLVM_TARGET macro to be a function-like macro with a single *| -|* parameter (the name of the target); including this file will then *| -|* enumerate all of the targets. *| -|* *| -|* The set of targets supported by LLVM is generated at configuration *| -|* time, at which point this header is generated. Do not modify this *| -|* header directly. *| -|* *| -\*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_TARGET -# error Please define the macro LLVM_TARGET(TargetName) -#endif - -LLVM_TARGET(AArch64) -LLVM_TARGET(X86) - - -#undef LLVM_TARGET
diff --git a/secondary/third_party/llvm/include/llvm/Config/abi-breaking.h b/secondary/third_party/llvm/include/llvm/Config/abi-breaking.h deleted file mode 100644 index 730d9f0..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/abi-breaking.h +++ /dev/null
@@ -1,50 +0,0 @@ -/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/ -/* */ -/* The LLVM Compiler Infrastructure */ -/* */ -/* This file is distributed under the University of Illinois Open Source */ -/* License. See LICENSE.TXT for details. */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This file controls the C++ ABI break introduced in LLVM public header. */ - -#ifndef LLVM_ABI_BREAKING_CHECKS_H -#define LLVM_ABI_BREAKING_CHECKS_H - -/* Define to enable checks that alter the LLVM C++ ABI */ -#define LLVM_ENABLE_ABI_BREAKING_CHECKS 1 - -/* Define to enable reverse iteration of unordered llvm containers */ -#define LLVM_ENABLE_REVERSE_ITERATION 0 - -/* Allow selectively disabling link-time mismatch checking so that header-only - ADT content from LLVM can be used without linking libSupport. */ -#if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING - -// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build -// mismatch with LLVM -#if defined(_MSC_VER) -// Use pragma with MSVC -#define LLVM_XSTR(s) LLVM_STR(s) -#define LLVM_STR(s) #s -#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS)) -#undef LLVM_XSTR -#undef LLVM_STR -#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch -// FIXME: Implement checks without weak. -#elif defined(__cplusplus) -namespace llvm { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS -extern int EnableABIBreakingChecks; -__attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks; -#else -extern int DisableABIBreakingChecks; -__attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks; -#endif -} -#endif // _MSC_VER - -#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING - -#endif
diff --git a/secondary/third_party/llvm/include/llvm/Config/config.h b/secondary/third_party/llvm/include/llvm/Config/config.h deleted file mode 100644 index f439bc0..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/config.h +++ /dev/null
@@ -1,408 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* Exported configuration */ -#include "llvm/Config/llvm-config.h" - -/* Bug report URL. */ -#define BUG_REPORT_URL "https://bugs.llvm.org/" - -/* Define to 1 to enable backtraces, and to 0 otherwise. */ -#define ENABLE_BACKTRACES 1 - -/* Define to 1 to enable crash overrides, and to 0 otherwise. */ -#define ENABLE_CRASH_OVERRIDES 1 - -/* Define to 1 if you have the `backtrace' function. */ -#if !defined(__Fuchsia__) -#define HAVE_BACKTRACE TRUE -#endif - -#define BACKTRACE_HEADER <execinfo.h> - -/* Define to 1 if you have the <CrashReporterClient.h> header file. */ -/* #undef HAVE_CRASHREPORTERCLIENT_H */ - -/* can use __crashreporter_info__ */ -#define HAVE_CRASHREPORTER_INFO 0 - -/* Define to 1 if you have the declaration of `arc4random', and to 0 if you - don't. */ -#define HAVE_DECL_ARC4RANDOM 0 - -/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you - don't. */ -#define HAVE_DECL_FE_ALL_EXCEPT 1 - -/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you - don't. */ -#define HAVE_DECL_FE_INEXACT 1 - -/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you - don't. */ -#define HAVE_DECL_STRERROR_S 0 - -/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ -#define LLVM_ENABLE_DIA_SDK 0 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if dlopen() is available on this platform. */ -#define HAVE_DLOPEN 1 - -/* Define if dladdr() is available on this platform. */ -/* #undef HAVE_DLADDR */ - -/* Define to 1 if you have the <errno.h> header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the <fenv.h> header file. */ -#define HAVE_FENV_H 1 - -/* Define if libffi is available on this platform. */ -/* #undef HAVE_FFI_CALL */ - -/* Define to 1 if you have the <ffi/ffi.h> header file. */ -/* #undef HAVE_FFI_FFI_H */ - -/* Define to 1 if you have the <ffi.h> header file. */ -/* #undef HAVE_FFI_H */ - -/* Define to 1 if you have the `futimens' function. */ -#define HAVE_FUTIMENS 1 - -/* Define to 1 if you have the `futimes' function. */ -#define HAVE_FUTIMES 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the `getrlimit' function. */ -#if !defined(__Fuchsia__) -#define HAVE_GETRLIMIT 1 -#endif - -/* Define to 1 if you have the `getrusage' function. */ -#if !defined(__Fuchsia__) -#define HAVE_GETRUSAGE 1 -#endif - -/* Define to 1 if you have the `isatty' function. */ -#define HAVE_ISATTY 1 - -/* Define to 1 if you have the `edit' library (-ledit). */ -/* #undef HAVE_LIBEDIT */ - -/* Define to 1 if you have the `pfm' library (-lpfm). */ -/* #undef HAVE_LIBPFM */ - -/* Define to 1 if you have the `psapi' library (-lpsapi). */ -/* #undef HAVE_LIBPSAPI */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the `pthread_getname_np' function. */ -#define HAVE_PTHREAD_GETNAME_NP 1 - -/* Define to 1 if you have the `pthread_setname_np' function. */ -#define HAVE_PTHREAD_SETNAME_NP 1 - -/* Define to 1 if you have the `z' library (-lz). */ -#define HAVE_LIBZ 1 - -/* Define to 1 if you have the <link.h> header file. */ -#if defined(__linux__) -#define HAVE_LINK_H 1 -#endif - -/* Define to 1 if you have the `lseek64' function. */ -#if defined(__linux__) -#define HAVE_LSEEK64 1 -#endif - -/* Define to 1 if you have the <mach/mach.h> header file. */ -#if defined(__APPLE__) -#define HAVE_MACH_MACH_H 1 -#endif - -/* Define to 1 if you have the `mallctl' function. */ -/* #undef HAVE_MALLCTL */ - -/* Define to 1 if you have the `mallinfo' function. */ -#if defined(__linux__) -#define HAVE_MALLINFO 1 -#endif - -/* Define to 1 if you have the <malloc.h> header file. */ -#if defined(__linux__) -#define HAVE_MALLOC_H 1 -#endif - -/* Define to 1 if you have the <malloc/malloc.h> header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ - -/* Define to 1 if you have the `malloc_zone_statistics' function. */ -/* #undef HAVE_MALLOC_ZONE_STATISTICS */ - -/* Define to 1 if you have the `posix_fallocate' function. */ -#if defined(__linux__) -#define HAVE_POSIX_FALLOCATE 1 -#endif - -/* Define to 1 if you have the `posix_spawn' function. */ -#define HAVE_POSIX_SPAWN 1 - -/* Define to 1 if you have the `pread' function. */ -#define HAVE_PREAD 1 - -/* Have pthread_getspecific */ -#define HAVE_PTHREAD_GETSPECIFIC 1 - -/* Define to 1 if you have the <pthread.h> header file. */ -#define HAVE_PTHREAD_H 1 - -/* Have pthread_mutex_lock */ -#define HAVE_PTHREAD_MUTEX_LOCK 1 - -/* Have pthread_rwlock_init */ -#define HAVE_PTHREAD_RWLOCK_INIT 1 - -/* Define to 1 if you have the `realpath' function. */ -#define HAVE_REALPATH 1 - -/* Define to 1 if you have the `sbrk' function. */ -#if !defined(__Fuchsia__) -#define HAVE_SBRK 1 -#endif - -/* Define to 1 if you have the `setenv' function. */ -#define HAVE_SETENV 1 - -/* Define to 1 if you have the `sched_getaffinity' function. */ -#if defined(__linux__) -#define HAVE_SCHED_GETAFFINITY 1 -#endif - -/* Define to 1 if you have the `CPU_COUNT' macro. */ -#define HAVE_CPU_COUNT 1 - -/* Define to 1 if you have the `setrlimit' function. */ -#if !defined(__Fuchsia__) -#define HAVE_SETRLIMIT 1 -#endif - -/* Define to 1 if you have the `sigaltstack' function. */ -#define HAVE_SIGALTSTACK 1 - -/* Define to 1 if you have the <signal.h> header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the `strerror_r' function. */ -#define HAVE_STRERROR_R 1 - -/* Define to 1 if you have the `sysconf' function. */ -#define HAVE_SYSCONF 1 - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the <sys/mman.h> header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#if !defined(__Fuchsia__) -#define HAVE_SYS_RESOURCE_H 1 -#endif - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if the setupterm() function is supported this platform. */ -/*#if !defined(__Fuchsia__) -#define HAVE_TERMINFO 1 -#endif*/ - -/* Define if the xar_open() function is supported this platform. */ -/* #undef HAVE_LIBXAR */ - -/* Define to 1 if you have the <termios.h> header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the <valgrind/valgrind.h> header file. */ -/* #undef HAVE_VALGRIND_VALGRIND_H */ - -/* Define to 1 if you have the <zlib.h> header file. */ -#define HAVE_ZLIB_H 1 - -/* Have host's _alloca */ -/* #undef HAVE__ALLOCA */ - -/* Define to 1 if you have the `_chsize_s' function. */ -/* #undef HAVE__CHSIZE_S */ - -/* Define to 1 if you have the `_Unwind_Backtrace' function. */ -#define HAVE__UNWIND_BACKTRACE 1 - -/* Have host's __alloca */ -/* #undef HAVE___ALLOCA */ - -/* Have host's __ashldi3 */ -/* #undef HAVE___ASHLDI3 */ - -/* Have host's __ashrdi3 */ -/* #undef HAVE___ASHRDI3 */ - -/* Have host's __chkstk */ -/* #undef HAVE___CHKSTK */ - -/* Have host's __chkstk_ms */ -/* #undef HAVE___CHKSTK_MS */ - -/* Have host's __cmpdi2 */ -/* #undef HAVE___CMPDI2 */ - -/* Have host's __divdi3 */ -/* #undef HAVE___DIVDI3 */ - -/* Have host's __fixdfdi */ -/* #undef HAVE___FIXDFDI */ - -/* Have host's __fixsfdi */ -/* #undef HAVE___FIXSFDI */ - -/* Have host's __floatdidf */ -/* #undef HAVE___FLOATDIDF */ - -/* Have host's __lshrdi3 */ -/* #undef HAVE___LSHRDI3 */ - -/* Have host's __main */ -/* #undef HAVE___MAIN */ - -/* Have host's __moddi3 */ -/* #undef HAVE___MODDI3 */ - -/* Have host's __udivdi3 */ -/* #undef HAVE___UDIVDI3 */ - -/* Have host's __umoddi3 */ -/* #undef HAVE___UMODDI3 */ - -/* Have host's ___chkstk */ -/* #undef HAVE____CHKSTK */ - -/* Have host's ___chkstk_ms */ -/* #undef HAVE____CHKSTK_MS */ - -/* Linker version detected at compile time. */ -/* #undef HOST_LINK_VERSION */ - -/* Define if we link Polly to the tools */ -/* #undef LINK_POLLY_INTO_TOOLS */ - -/* Target triple LLVM will generate code for by default */ -/* Doesn't use `cmakedefine` because it is allowed to be empty. */ -#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64-unknown-linux-gnu" - -/* Define if threads enabled */ -#define LLVM_ENABLE_THREADS 1 - -/* Define if zlib compression is available */ -#define LLVM_ENABLE_ZLIB 1 - -/* Has gcc/MSVC atomic intrinsics */ -#define LLVM_HAS_ATOMICS 1 - -/* Host triple LLVM will be executed on */ -#define LLVM_HOST_TRIPLE "x86_64-unknown-linux-gnu" - -/* Define if this is Unixish platform */ -#define LLVM_ON_UNIX 1 - -/* Define if this is Win32ish platform */ -/* #undef LLVM_ON_WIN32 */ - -/* Define if overriding target triple is enabled */ -/* #undef LLVM_TARGET_TRIPLE_ENV */ - -/* Define if we have the Intel JIT API runtime support library */ -#define LLVM_USE_INTEL_JITEVENTS 0 - -/* Define if we have the oprofile JIT-support library */ -#define LLVM_USE_OPROFILE 0 - -/* LLVM version information */ -/* #undef LLVM_VERSION_INFO */ - -/* Whether tools show host and target info when invoked with --version */ -#define LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO 1 - -/* Major version of the LLVM API */ -#define LLVM_VERSION_MAJOR 7 - -/* Minor version of the LLVM API */ -#define LLVM_VERSION_MINOR 0 - -/* Patch version of the LLVM API */ -#define LLVM_VERSION_PATCH 0 - -/* LLVM version string */ -#define LLVM_VERSION_STRING "7.0.0svn" - -/* Define if libxml2 is supported on this platform. */ -#define LLVM_LIBXML2_ENABLED 1 - -/* Define to the extension used for shared libraries, say, ".so". */ -#define LTDL_SHLIB_EXT ".so" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "https://bugs.llvm.org/" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "LLVM" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 7.0.0svn" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "7.0.0svn" - -/* Define to the vendor of this package. */ -/* #undef PACKAGE_VENDOR */ - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define to a function implementing stricmp */ -/* #undef stricmp */ - -/* Define to a function implementing strdup */ -/* #undef strdup */ - -/* Whether GlobalISel rule coverage is being collected */ -#define LLVM_GISEL_COV_ENABLED 0 - -/* Define to the default GlobalISel coverage file prefix */ -/* #undef LLVM_GISEL_COV_PREFIX */ - -#endif
diff --git a/secondary/third_party/llvm/include/llvm/Config/llvm-config.h b/secondary/third_party/llvm/include/llvm/Config/llvm-config.h deleted file mode 100644 index 53ad892..0000000 --- a/secondary/third_party/llvm/include/llvm/Config/llvm-config.h +++ /dev/null
@@ -1,85 +0,0 @@ -/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/ -/* */ -/* The LLVM Compiler Infrastructure */ -/* */ -/* This file is distributed under the University of Illinois Open Source */ -/* License. See LICENSE.TXT for details. */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This file enumerates variables from the LLVM configuration so that they - can be in exported headers and won't override package specific directives. - This is a C header that can be included in the llvm-c headers. */ - -#ifndef LLVM_CONFIG_H -#define LLVM_CONFIG_H - -/* Define if LLVM_ENABLE_DUMP is enabled */ -/* #undef LLVM_ENABLE_DUMP */ - -/* Define if we link Polly to the tools */ -/* #undef LINK_POLLY_INTO_TOOLS */ - -/* Target triple LLVM will generate code for by default */ -#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64-unknown-linux-gnu" - -/* Define if threads enabled */ -#define LLVM_ENABLE_THREADS 1 - -/* Has gcc/MSVC atomic intrinsics */ -#define LLVM_HAS_ATOMICS 1 - -/* Host triple LLVM will be executed on */ -#define LLVM_HOST_TRIPLE "x86_64-unknown-linux-gnu" - -/* LLVM architecture name for the native architecture, if available */ -#define LLVM_NATIVE_ARCH X86 - -/* LLVM name for the native AsmParser init function, if available */ -#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser - -/* LLVM name for the native AsmPrinter init function, if available */ -#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter - -/* LLVM name for the native Disassembler init function, if available */ -#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler - -/* LLVM name for the native Target init function, if available */ -#define LLVM_NATIVE_TARGET LLVMInitializeX86Target - -/* LLVM name for the native TargetInfo init function, if available */ -#define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo - -/* LLVM name for the native target MC init function, if available */ -#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC - -/* Define if this is Unixish platform */ -#define LLVM_ON_UNIX 1 - -/* Define if this is Win32ish platform */ -/* #undef LLVM_ON_WIN32 */ - -/* Define if we have the Intel JIT API runtime support library */ -#define LLVM_USE_INTEL_JITEVENTS 0 - -/* Define if we have the oprofile JIT-support library */ -#define LLVM_USE_OPROFILE 0 - -/* Major version of the LLVM API */ -#define LLVM_VERSION_MAJOR 7 - -/* Minor version of the LLVM API */ -#define LLVM_VERSION_MINOR 0 - -/* Patch version of the LLVM API */ -#define LLVM_VERSION_PATCH 0 - -/* LLVM version string */ -#define LLVM_VERSION_STRING "7.0.0svn" - -/* Whether LLVM records statistics for use with GetStatistics(), - * PrintStatistics() or PrintStatisticsJSON() - */ -#define LLVM_FORCE_ENABLE_STATS 0 - -#endif
diff --git a/secondary/third_party/llvm/include/llvm/Support/VCSRevision.h b/secondary/third_party/llvm/include/llvm/Support/VCSRevision.h deleted file mode 100644 index 04cf109..0000000 --- a/secondary/third_party/llvm/include/llvm/Support/VCSRevision.h +++ /dev/null
@@ -1,5 +0,0 @@ -/* When compiling in-LLVM tree, this file is populated by a revisioin from SVN - * that is defined as LLVM_REVISION. To support non-SVN cases, the code is - * designed to work if this value is not defined, as long as this file exists. - */ -#undef LLVM_REVISION
diff --git a/secondary/third_party/llvm/lib/BinaryFormat/BUILD.gn b/secondary/third_party/llvm/lib/BinaryFormat/BUILD.gn deleted file mode 100644 index 814f8e5..0000000 --- a/secondary/third_party/llvm/lib/BinaryFormat/BUILD.gn +++ /dev/null
@@ -1,14 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("BinaryFormat") { - sources = [ - "Dwarf.cpp", - "Magic.cpp", - ] - - public_deps = [ - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Bitcode/BUILD.gn b/secondary/third_party/llvm/lib/Bitcode/BUILD.gn deleted file mode 100644 index 50df892..0000000 --- a/secondary/third_party/llvm/lib/Bitcode/BUILD.gn +++ /dev/null
@@ -1,10 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -group("Bitcode") { - public_deps = [ - "Reader", - "Writer", - ] -}
diff --git a/secondary/third_party/llvm/lib/Bitcode/Reader/BUILD.gn b/secondary/third_party/llvm/lib/Bitcode/Reader/BUILD.gn deleted file mode 100644 index f3f781c..0000000 --- a/secondary/third_party/llvm/lib/Bitcode/Reader/BUILD.gn +++ /dev/null
@@ -1,18 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Reader") { - sources = [ - "BitReader.cpp", - "BitcodeReader.cpp", - "BitstreamReader.cpp", - "MetadataLoader.cpp", - "ValueList.cpp", - ] - - deps = [ - "../../IR", - "../../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Bitcode/Writer/BUILD.gn b/secondary/third_party/llvm/lib/Bitcode/Writer/BUILD.gn deleted file mode 100644 index 758d165..0000000 --- a/secondary/third_party/llvm/lib/Bitcode/Writer/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Writer") { - sources = [ - "BitWriter.cpp", - "BitcodeWriter.cpp", - "BitcodeWriterPass.cpp", - "ValueEnumerator.cpp", - ] - - deps = [ - "../../IR", - "../../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/DebugInfo/BUILD.gn b/secondary/third_party/llvm/lib/DebugInfo/BUILD.gn deleted file mode 100644 index 31e7321..0000000 --- a/secondary/third_party/llvm/lib/DebugInfo/BUILD.gn +++ /dev/null
@@ -1,173 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("DebugInfo") { - sources = [ - "CodeView/AppendingTypeTableBuilder.cpp", - "CodeView/CVSymbolVisitor.cpp", - "CodeView/CVTypeVisitor.cpp", - "CodeView/CodeViewError.cpp", - "CodeView/CodeViewRecordIO.cpp", - "CodeView/ContinuationRecordBuilder.cpp", - "CodeView/DebugChecksumsSubsection.cpp", - "CodeView/DebugCrossExSubsection.cpp", - "CodeView/DebugCrossImpSubsection.cpp", - "CodeView/DebugFrameDataSubsection.cpp", - "CodeView/DebugInlineeLinesSubsection.cpp", - "CodeView/DebugLinesSubsection.cpp", - "CodeView/DebugStringTableSubsection.cpp", - "CodeView/DebugSubsection.cpp", - "CodeView/DebugSubsectionRecord.cpp", - "CodeView/DebugSubsectionVisitor.cpp", - "CodeView/DebugSymbolRVASubsection.cpp", - "CodeView/DebugSymbolsSubsection.cpp", - "CodeView/EnumTables.cpp", - "CodeView/Formatters.cpp", - "CodeView/GlobalTypeTableBuilder.cpp", - "CodeView/LazyRandomTypeCollection.cpp", - "CodeView/Line.cpp", - "CodeView/MergingTypeTableBuilder.cpp", - "CodeView/RecordName.cpp", - "CodeView/RecordSerialization.cpp", - "CodeView/SimpleTypeSerializer.cpp", - "CodeView/StringsAndChecksums.cpp", - "CodeView/SymbolDumper.cpp", - "CodeView/SymbolRecordMapping.cpp", - "CodeView/SymbolSerializer.cpp", - "CodeView/TypeDumpVisitor.cpp", - "CodeView/TypeHashing.cpp", - "CodeView/TypeIndex.cpp", - "CodeView/TypeIndexDiscovery.cpp", - "CodeView/TypeRecordMapping.cpp", - "CodeView/TypeStreamMerger.cpp", - "CodeView/TypeTableCollection.cpp", - "DWARF/DWARFAbbreviationDeclaration.cpp", - "DWARF/DWARFAcceleratorTable.cpp", - "DWARF/DWARFAddressRange.cpp", - "DWARF/DWARFCompileUnit.cpp", - "DWARF/DWARFContext.cpp", - "DWARF/DWARFDataExtractor.cpp", - "DWARF/DWARFDebugAbbrev.cpp", - "DWARF/DWARFDebugArangeSet.cpp", - "DWARF/DWARFDebugAranges.cpp", - "DWARF/DWARFDebugFrame.cpp", - "DWARF/DWARFDebugInfoEntry.cpp", - "DWARF/DWARFDebugLine.cpp", - "DWARF/DWARFDebugLoc.cpp", - "DWARF/DWARFDebugMacro.cpp", - "DWARF/DWARFDebugPubTable.cpp", - "DWARF/DWARFDebugRangeList.cpp", - "DWARF/DWARFDebugRnglists.cpp", - "DWARF/DWARFDie.cpp", - "DWARF/DWARFExpression.cpp", - "DWARF/DWARFFormValue.cpp", - "DWARF/DWARFGdbIndex.cpp", - "DWARF/DWARFTypeUnit.cpp", - "DWARF/DWARFUnit.cpp", - "DWARF/DWARFUnitIndex.cpp", - "DWARF/DWARFVerifier.cpp", - "MSF/MSFBuilder.cpp", - "MSF/MSFCommon.cpp", - "MSF/MSFError.cpp", - "MSF/MappedBlockStream.cpp", - "PDB/GenericError.cpp", - "PDB/IPDBSourceFile.cpp", - "PDB/Native/DbiModuleDescriptor.cpp", - "PDB/Native/DbiModuleDescriptorBuilder.cpp", - "PDB/Native/DbiModuleList.cpp", - "PDB/Native/DbiStream.cpp", - "PDB/Native/DbiStreamBuilder.cpp", - "PDB/Native/EnumTables.cpp", - "PDB/Native/GSIStreamBuilder.cpp", - "PDB/Native/GlobalsStream.cpp", - "PDB/Native/Hash.cpp", - "PDB/Native/HashTable.cpp", - "PDB/Native/InfoStream.cpp", - "PDB/Native/InfoStreamBuilder.cpp", - "PDB/Native/ModuleDebugStream.cpp", - "PDB/Native/NamedStreamMap.cpp", - "PDB/Native/NativeBuiltinSymbol.cpp", - "PDB/Native/NativeCompilandSymbol.cpp", - "PDB/Native/NativeEnumModules.cpp", - "PDB/Native/NativeEnumSymbol.cpp", - "PDB/Native/NativeEnumTypes.cpp", - "PDB/Native/NativeExeSymbol.cpp", - "PDB/Native/NativeRawSymbol.cpp", - "PDB/Native/NativeSession.cpp", - "PDB/Native/PDBFile.cpp", - "PDB/Native/PDBFileBuilder.cpp", - "PDB/Native/PDBStringTable.cpp", - "PDB/Native/PDBStringTableBuilder.cpp", - "PDB/Native/PublicsStream.cpp", - "PDB/Native/RawError.cpp", - "PDB/Native/SymbolStream.cpp", - "PDB/Native/TpiHashing.cpp", - "PDB/Native/TpiStream.cpp", - "PDB/Native/TpiStreamBuilder.cpp", - "PDB/PDB.cpp", - "PDB/PDBContext.cpp", - "PDB/PDBExtras.cpp", - "PDB/PDBInterfaceAnchors.cpp", - "PDB/PDBSymDumper.cpp", - "PDB/PDBSymbol.cpp", - "PDB/PDBSymbolAnnotation.cpp", - "PDB/PDBSymbolBlock.cpp", - "PDB/PDBSymbolCompiland.cpp", - "PDB/PDBSymbolCompilandDetails.cpp", - "PDB/PDBSymbolCompilandEnv.cpp", - "PDB/PDBSymbolCustom.cpp", - "PDB/PDBSymbolData.cpp", - "PDB/PDBSymbolExe.cpp", - "PDB/PDBSymbolFunc.cpp", - "PDB/PDBSymbolFuncDebugEnd.cpp", - "PDB/PDBSymbolFuncDebugStart.cpp", - "PDB/PDBSymbolLabel.cpp", - "PDB/PDBSymbolPublicSymbol.cpp", - "PDB/PDBSymbolThunk.cpp", - "PDB/PDBSymbolTypeArray.cpp", - "PDB/PDBSymbolTypeBaseClass.cpp", - "PDB/PDBSymbolTypeBuiltin.cpp", - "PDB/PDBSymbolTypeCustom.cpp", - "PDB/PDBSymbolTypeDimension.cpp", - "PDB/PDBSymbolTypeEnum.cpp", - "PDB/PDBSymbolTypeFriend.cpp", - - #"PDB/DIA/DIAEnumLineNumbers.cpp", - #"PDB/DIA/DIASectionContrib.cpp", - #"PDB/DIA/DIAEnumDebugStreams.cpp", - #"PDB/DIA/DIARawSymbol.cpp", - #"PDB/DIA/DIAEnumTables.cpp", - #"PDB/DIA/DIAEnumSourceFiles.cpp", - #"PDB/DIA/DIAEnumSectionContribs.cpp", - #"PDB/DIA/DIASourceFile.cpp", - #"PDB/DIA/DIASession.cpp", - #"PDB/DIA/DIATable.cpp", - #"PDB/DIA/DIAEnumSymbols.cpp", - #"PDB/DIA/DIAInjectedSource.cpp", - #"PDB/DIA/DIALineNumber.cpp", - #"PDB/DIA/DIAError.cpp", - #"PDB/DIA/DIADataStream.cpp", - #"PDB/DIA/DIAEnumInjectedSources.cpp", - "PDB/PDBSymbolTypeFunctionArg.cpp", - "PDB/PDBSymbolTypeFunctionSig.cpp", - "PDB/PDBSymbolTypeManaged.cpp", - "PDB/PDBSymbolTypePointer.cpp", - "PDB/PDBSymbolTypeTypedef.cpp", - "PDB/PDBSymbolTypeUDT.cpp", - "PDB/PDBSymbolTypeVTable.cpp", - "PDB/PDBSymbolTypeVTableShape.cpp", - "PDB/PDBSymbolUnknown.cpp", - "PDB/PDBSymbolUsingNamespace.cpp", - "PDB/UDTLayout.cpp", - "Symbolize/DIPrinter.cpp", - "Symbolize/SymbolizableObjectFile.cpp", - "Symbolize/Symbolize.cpp", - ] - - public_deps = [ - "../Demangle", - "../Object", - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Demangle/BUILD.gn b/secondary/third_party/llvm/lib/Demangle/BUILD.gn deleted file mode 100644 index 636d361..0000000 --- a/secondary/third_party/llvm/lib/Demangle/BUILD.gn +++ /dev/null
@@ -1,13 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Demangle") { - sources = [ - "ItaniumDemangle.cpp", - ] - - deps = [ - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/IR/BUILD.gn b/secondary/third_party/llvm/lib/IR/BUILD.gn deleted file mode 100644 index 88ee64b..0000000 --- a/secondary/third_party/llvm/lib/IR/BUILD.gn +++ /dev/null
@@ -1,91 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("../../utils/TableGen/tablegen.gni") - -tablegen("attributes") { - source = "../../include/llvm/IR/Attributes.td" - output = "$target_gen_dir/llvm/IR/Attributes.gen" - args = [ "-gen-attrs" ] -} - -tablegen("attributes_compat_func") { - source = "AttributesCompatFunc.td" - output = "$target_gen_dir/AttributesCompatFunc.inc" - args = [ "-gen-attrs" ] -} - -tablegen("intrinsics") { - source = "../../include/llvm/IR/Intrinsics.td" - output = "$target_gen_dir/llvm/IR/Intrinsics.gen" - args = [ "-gen-intrinsic" ] -} - -config("includes") { - include_dirs = [ target_gen_dir ] -} - -static_library("IR") { - sources = [ - "AsmWriter.cpp", - "Attributes.cpp", - "AutoUpgrade.cpp", - "BasicBlock.cpp", - "Comdat.cpp", - "ConstantFold.cpp", - "ConstantRange.cpp", - "Constants.cpp", - "Core.cpp", - "DIBuilder.cpp", - "DataLayout.cpp", - "DebugInfo.cpp", - "DebugInfoMetadata.cpp", - "DebugLoc.cpp", - "DiagnosticHandler.cpp", - "DiagnosticInfo.cpp", - "DiagnosticPrinter.cpp", - "Dominators.cpp", - "Function.cpp", - "GVMaterializer.cpp", - "Globals.cpp", - "IRBuilder.cpp", - "IRPrintingPasses.cpp", - "InlineAsm.cpp", - "Instruction.cpp", - "Instructions.cpp", - "IntrinsicInst.cpp", - "LLVMContext.cpp", - "LLVMContextImpl.cpp", - "LegacyPassManager.cpp", - "MDBuilder.cpp", - "Mangler.cpp", - "Metadata.cpp", - "Module.cpp", - "ModuleSummaryIndex.cpp", - "Operator.cpp", - "OptBisect.cpp", - "Pass.cpp", - "PassManager.cpp", - "PassRegistry.cpp", - "ProfileSummary.cpp", - "SafepointIRVerifier.cpp", - "Statepoint.cpp", - "Type.cpp", - "TypeFinder.cpp", - "Use.cpp", - "User.cpp", - "Value.cpp", - "ValueSymbolTable.cpp", - "Verifier.cpp", - ] - - public_configs = [ ":includes" ] - - public_deps = [ - ":attributes", - ":attributes_compat_func", - ":intrinsics", - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/MC/BUILD.gn b/secondary/third_party/llvm/lib/MC/BUILD.gn deleted file mode 100644 index 121406f..0000000 --- a/secondary/third_party/llvm/lib/MC/BUILD.gn +++ /dev/null
@@ -1,71 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# LLVM Machine Code library. -static_library("MC") { - sources = [ - "ConstantPools.cpp", - "ELFObjectWriter.cpp", - "LLVMBuild.txt", - "MCAsmBackend.cpp", - "MCAsmInfo.cpp", - "MCAsmInfoCOFF.cpp", - "MCAsmInfoDarwin.cpp", - "MCAsmInfoELF.cpp", - "MCAsmInfoWasm.cpp", - "MCAsmMacro.cpp", - "MCAsmStreamer.cpp", - "MCAssembler.cpp", - "MCCodeEmitter.cpp", - "MCCodePadder.cpp", - "MCCodeView.cpp", - "MCContext.cpp", - "MCDwarf.cpp", - "MCELFObjectTargetWriter.cpp", - "MCELFStreamer.cpp", - "MCExpr.cpp", - "MCFragment.cpp", - "MCInst.cpp", - "MCInstPrinter.cpp", - "MCInstrAnalysis.cpp", - "MCInstrDesc.cpp", - "MCLabel.cpp", - "MCLinkerOptimizationHint.cpp", - "MCMachOStreamer.cpp", - "MCMachObjectTargetWriter.cpp", - "MCNullStreamer.cpp", - "MCObjectFileInfo.cpp", - "MCObjectStreamer.cpp", - "MCObjectWriter.cpp", - "MCRegisterInfo.cpp", - "MCSchedule.cpp", - "MCSection.cpp", - "MCSectionCOFF.cpp", - "MCSectionELF.cpp", - "MCSectionMachO.cpp", - "MCSectionWasm.cpp", - "MCStreamer.cpp", - "MCSubtargetInfo.cpp", - "MCSymbol.cpp", - "MCSymbolELF.cpp", - "MCTargetOptions.cpp", - "MCValue.cpp", - "MCWasmObjectTargetWriter.cpp", - "MCWasmStreamer.cpp", - "MCWin64EH.cpp", - "MCWinCOFFStreamer.cpp", - "MCWinEH.cpp", - "MachObjectWriter.cpp", - "StringTableBuilder.cpp", - "SubtargetFeature.cpp", - "WasmObjectWriter.cpp", - "WinCOFFObjectWriter.cpp", - ] - - public_deps = [ - "../BinaryFormat", - "../DebugInfo", - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/MC/MCDisassembler/BUILD.gn b/secondary/third_party/llvm/lib/MC/MCDisassembler/BUILD.gn deleted file mode 100644 index cc07bc0..0000000 --- a/secondary/third_party/llvm/lib/MC/MCDisassembler/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("MCDisassembler") { - sources = [ - "Disassembler.cpp", - "MCDisassembler.cpp", - "MCExternalSymbolizer.cpp", - "MCRelocationInfo.cpp", - "MCSymbolizer.cpp", - ] - - public_deps = [ - "..", - ] -}
diff --git a/secondary/third_party/llvm/lib/MC/MCParser/BUILD.gn b/secondary/third_party/llvm/lib/MC/MCParser/BUILD.gn deleted file mode 100644 index 1ce8cad..0000000 --- a/secondary/third_party/llvm/lib/MC/MCParser/BUILD.gn +++ /dev/null
@@ -1,22 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("MCParser") { - sources = [ - "AsmLexer.cpp", - "AsmParser.cpp", - "COFFAsmParser.cpp", - "DarwinAsmParser.cpp", - "ELFAsmParser.cpp", - "MCAsmLexer.cpp", - "MCAsmParser.cpp", - "MCAsmParserExtension.cpp", - "MCTargetAsmParser.cpp", - ] - - deps = [ - "../../BinaryFormat", - "../../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Object/BUILD.gn b/secondary/third_party/llvm/lib/Object/BUILD.gn deleted file mode 100644 index 406d4e7..0000000 --- a/secondary/third_party/llvm/lib/Object/BUILD.gn +++ /dev/null
@@ -1,37 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Object") { - sources = [ - "Archive.cpp", - "ArchiveWriter.cpp", - "Binary.cpp", - "COFFImportFile.cpp", - "COFFModuleDefinition.cpp", - "COFFObjectFile.cpp", - "Decompressor.cpp", - "ELF.cpp", - "ELFObjectFile.cpp", - "Error.cpp", - "IRObjectFile.cpp", - "IRSymtab.cpp", - "MachOObjectFile.cpp", - "MachOUniversal.cpp", - "ModuleSymbolTable.cpp", - "Object.cpp", - "ObjectFile.cpp", - "RecordStreamer.cpp", - "SymbolSize.cpp", - "SymbolicFile.cpp", - "WasmObjectFile.cpp", - "WindowsResource.cpp", - ] - - public_deps = [ - "../Bitcode", - "../IR", - "../MC/MCParser", - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Support/BUILD.gn b/secondary/third_party/llvm/lib/Support/BUILD.gn deleted file mode 100644 index e63d6ec..0000000 --- a/secondary/third_party/llvm/lib/Support/BUILD.gn +++ /dev/null
@@ -1,130 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("Support") { - sources = [ - "AMDGPUMetadata.cpp", - "APFloat.cpp", - "APInt.cpp", - "APSInt.cpp", - "ARMAttributeParser.cpp", - "ARMBuildAttrs.cpp", - "ARMWinEH.cpp", - "Allocator.cpp", - "BinaryStreamError.cpp", - "BinaryStreamReader.cpp", - "BinaryStreamRef.cpp", - "BinaryStreamWriter.cpp", - "BlockFrequency.cpp", - "BranchProbability.cpp", - "COM.cpp", - "CachePruning.cpp", - "Chrono.cpp", - "CodeGenCoverage.cpp", - "CommandLine.cpp", - "Compression.cpp", - "ConvertUTF.cpp", - "ConvertUTFWrapper.cpp", - "CrashRecoveryContext.cpp", - "DAGDeltaAlgorithm.cpp", - "DJB.cpp", - "DataExtractor.cpp", - "Debug.cpp", - "DebugCounter.cpp", - "DeltaAlgorithm.cpp", - "Error.cpp", - "ErrorHandling.cpp", - "FileOutputBuffer.cpp", - "FileUtilities.cpp", - "FoldingSet.cpp", - "FormatVariadic.cpp", - "FormattedStream.cpp", - "GlobPattern.cpp", - "GraphWriter.cpp", - "Hashing.cpp", - "InitLLVM.cpp", - "IntEqClasses.cpp", - "IntervalMap.cpp", - "JamCRC.cpp", - "KnownBits.cpp", - "LEB128.cpp", - "LineIterator.cpp", - "Locale.cpp", - "LockFileManager.cpp", - "LowLevelType.cpp", - "MD5.cpp", - "ManagedStatic.cpp", - "MathExtras.cpp", - "MemoryBuffer.cpp", - "NativeFormatting.cpp", - "Options.cpp", - "Parallel.cpp", - "PluginLoader.cpp", - "PrettyStackTrace.cpp", - "RandomNumberGenerator.cpp", - "Regex.cpp", - "SHA1.cpp", - "ScaledNumber.cpp", - "ScopedPrinter.cpp", - "SmallPtrSet.cpp", - "SmallVector.cpp", - "SourceMgr.cpp", - "SpecialCaseList.cpp", - "Statistic.cpp", - "StringExtras.cpp", - "StringMap.cpp", - "StringPool.cpp", - "StringRef.cpp", - "StringSaver.cpp", - "SystemUtils.cpp", - "TarWriter.cpp", - "TargetParser.cpp", - "ThreadPool.cpp", - "Timer.cpp", - "ToolOutputFile.cpp", - "TrigramIndex.cpp", - "Triple.cpp", - "Twine.cpp", - "Unicode.cpp", - "UnicodeCaseFold.cpp", - "WithColor.cpp", - "YAMLParser.cpp", - "YAMLTraits.cpp", - "circular_raw_ostream.cpp", - "raw_os_ostream.cpp", - "raw_ostream.cpp", - "regcomp.c", - "regerror.c", - "regexec.c", - "regfree.c", - "regstrlcpy.c", - "xxhash.cpp", - - # System - "Atomic.cpp", - "DynamicLibrary.cpp", - "Errno.cpp", - "Host.cpp", - "Memory.cpp", - "Mutex.cpp", - "Path.cpp", - "Process.cpp", - "Program.cpp", - "RWMutex.cpp", - "Signals.cpp", - "TargetRegistry.cpp", - "ThreadLocal.cpp", - "Threading.cpp", - "Valgrind.cpp", - "Watchdog.cpp", - ] - - public_configs = [ "../..:include" ] - - libs = [ "dl" ] - - deps = [ - "//third_party/zlib", - ] -}
diff --git a/secondary/third_party/llvm/lib/TableGen/BUILD.gn b/secondary/third_party/llvm/lib/TableGen/BUILD.gn deleted file mode 100644 index 3d33f87..0000000 --- a/secondary/third_party/llvm/lib/TableGen/BUILD.gn +++ /dev/null
@@ -1,23 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_toolchain == host_toolchain, - "LLVM TableGen should only be referenced from the host toolchain.") - -static_library("TableGen") { - sources = [ - "Error.cpp", - "Main.cpp", - "Record.cpp", - "SetTheory.cpp", - "StringMatcher.cpp", - "TGLexer.cpp", - "TGParser.cpp", - "TableGenBackend.cpp", - ] - - public_deps = [ - "../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Target/AArch64/BUILD.gn b/secondary/third_party/llvm/lib/Target/AArch64/BUILD.gn deleted file mode 100644 index 6b89f95..0000000 --- a/secondary/third_party/llvm/lib/Target/AArch64/BUILD.gn +++ /dev/null
@@ -1,178 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("../../../utils/TableGen/tablegen.gni") - -template("aarch64_tablegen") { - tablegen(target_name) { - source = "AArch64.td" - args = [ "-I=" + rebase_path(".", root_build_dir) ] + invoker.args - output = invoker.output - } -} - -aarch64_tablegen("asm_matcher") { - output = "$target_gen_dir/AArch64GenAsmMatcher.inc" - args = [ "-gen-asm-matcher" ] -} - -aarch64_tablegen("asm_writer") { - output = "$target_gen_dir/AArch64GenAsmWriter.inc" - args = [ "-gen-asm-writer" ] -} - -aarch64_tablegen("asm_writer1") { - output = "$target_gen_dir/AArch64GenAsmWriter1.inc" - args = [ - "-gen-asm-writer", - "-asmwriternum=1", - ] -} - -aarch64_tablegen("calling_conv") { - output = "$target_gen_dir/AArch64GenCallingConv.inc" - args = [ "-gen-callingconv" ] -} - -aarch64_tablegen("dag_isel") { - output = "$target_gen_dir/AArch64GenDAGISel.inc" - args = [ "-gen-dag-isel" ] -} - -aarch64_tablegen("disassembler_tables") { - output = "$target_gen_dir/AArch64GenDisassemblerTables.inc" - args = [ "-gen-disassembler" ] -} - -aarch64_tablegen("fast_isel") { - output = "$target_gen_dir/AArch64GenFastISel.inc" - args = [ "-gen-fast-isel" ] -} - -aarch64_tablegen("global_isel") { - output = "$target_gen_dir/AArch64GenGlobalISel.inc" - args = [ "-gen-global-isel" ] -} - -aarch64_tablegen("instr_info") { - output = "$target_gen_dir/AArch64GenInstrInfo.inc" - args = [ "-gen-instr-info" ] -} - -aarch64_tablegen("mc_code_emitter") { - output = "$target_gen_dir/AArch64GenMCCodeEmitter.inc" - args = [ "-gen-emitter" ] -} - -aarch64_tablegen("mc_pseudo_lowering") { - output = "$target_gen_dir/AArch64GenMCPseudoLowering.inc" - args = [ "-gen-pseudo-lowering" ] -} - -aarch64_tablegen("register_bank") { - output = "$target_gen_dir/AArch64GenRegisterBank.inc" - args = [ "-gen-register-bank" ] -} - -aarch64_tablegen("register_info") { - output = "$target_gen_dir/AArch64GenRegisterInfo.inc" - args = [ "-gen-register-info" ] -} - -aarch64_tablegen("subtarget") { - output = "$target_gen_dir/AArch64GenSubtargetInfo.inc" - args = [ "-gen-subtarget" ] -} - -aarch64_tablegen("system_operands") { - output = "$target_gen_dir/AArch64GenSystemOperands.inc" - args = [ "-gen-searchable-tables" ] -} - -config("includes") { - include_dirs = [ target_gen_dir ] -} - -static_library("AArch64") { - sources = [ - "AArch64A53Fix835769.cpp", - "AArch64A57FPLoadBalancing.cpp", - "AArch64AdvSIMDScalarPass.cpp", - "AArch64AsmPrinter.cpp", - "AArch64CallLowering.cpp", - "AArch64CleanupLocalDynamicTLSPass.cpp", - "AArch64CollectLOH.cpp", - "AArch64CondBrTuning.cpp", - "AArch64ConditionOptimizer.cpp", - "AArch64ConditionalCompares.cpp", - "AArch64DeadRegisterDefinitionsPass.cpp", - "AArch64ExpandPseudoInsts.cpp", - "AArch64FalkorHWPFFix.cpp", - "AArch64FastISel.cpp", - "AArch64FrameLowering.cpp", - "AArch64ISelDAGToDAG.cpp", - "AArch64ISelLowering.cpp", - "AArch64InstrInfo.cpp", - "AArch64InstructionSelector.cpp", - "AArch64LegalizerInfo.cpp", - "AArch64LoadStoreOptimizer.cpp", - "AArch64MCInstLower.cpp", - "AArch64MacroFusion.cpp", - "AArch64PBQPRegAlloc.cpp", - "AArch64PromoteConstant.cpp", - "AArch64RedundantCopyElimination.cpp", - "AArch64RegisterBankInfo.cpp", - "AArch64RegisterInfo.cpp", - "AArch64SIMDInstrOpt.cpp", - "AArch64SelectionDAGInfo.cpp", - "AArch64StorePairSuppress.cpp", - "AArch64Subtarget.cpp", - "AArch64TargetMachine.cpp", - "AArch64TargetObjectFile.cpp", - "AArch64TargetTransformInfo.cpp", - "AsmParser/AArch64AsmParser.cpp", - "InstPrinter/AArch64InstPrinter.cpp", - "MCTargetDesc/AArch64AsmBackend.cpp", - "MCTargetDesc/AArch64ELFObjectWriter.cpp", - "MCTargetDesc/AArch64ELFStreamer.cpp", - "MCTargetDesc/AArch64MCAsmInfo.cpp", - "MCTargetDesc/AArch64MCCodeEmitter.cpp", - "MCTargetDesc/AArch64MCExpr.cpp", - "MCTargetDesc/AArch64MCTargetDesc.cpp", - "MCTargetDesc/AArch64MachObjectWriter.cpp", - "MCTargetDesc/AArch64TargetStreamer.cpp", - "MCTargetDesc/AArch64WinCOFFObjectWriter.cpp", - "MCTargetDesc/AArch64WinCOFFStreamer.cpp", - "TargetInfo/AArch64TargetInfo.cpp", - "Utils/AArch64BaseInfo.cpp", - ] - - include_dirs = [ "." ] - - public_configs = [ ":includes" ] - - deps = [ - ":asm_matcher", - ":asm_writer", - ":asm_writer1", - ":calling_conv", - ":dag_isel", - ":disassembler_tables", - ":fast_isel", - ":global_isel", - ":instr_info", - ":mc_code_emitter", - ":mc_pseudo_lowering", - ":register_bank", - ":register_info", - ":subtarget", - ":system_operands", - ] - - public_deps = [ - "../../IR", - "../../MC", - "../../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Target/AArch64/Disassembler/BUILD.gn b/secondary/third_party/llvm/lib/Target/AArch64/Disassembler/BUILD.gn deleted file mode 100644 index 7fd3be3..0000000 --- a/secondary/third_party/llvm/lib/Target/AArch64/Disassembler/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Disassembler") { - sources = [ - "AArch64Disassembler.cpp", - "AArch64ExternalSymbolizer.cpp", - ] - - include_dirs = [ ".." ] - - public_deps = [ - "..", - "../../../MC/MCDisassembler", - ] -}
diff --git a/secondary/third_party/llvm/lib/Target/X86/BUILD.gn b/secondary/third_party/llvm/lib/Target/X86/BUILD.gn deleted file mode 100644 index 3b70682..0000000 --- a/secondary/third_party/llvm/lib/Target/X86/BUILD.gn +++ /dev/null
@@ -1,172 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("../../../utils/TableGen/tablegen.gni") - -template("x86_tablegen") { - tablegen(target_name) { - source = "X86.td" - args = [ "-I=" + rebase_path(".", root_build_dir) ] + invoker.args - output = invoker.output - } -} - -x86_tablegen("asm_matcher") { - output = "$target_gen_dir/X86GenAsmMatcher.inc" - args = [ "-gen-asm-matcher" ] -} - -x86_tablegen("asm_writer") { - output = "$target_gen_dir/X86GenAsmWriter.inc" - args = [ "-gen-asm-writer" ] -} - -x86_tablegen("asm_writer1") { - output = "$target_gen_dir/X86GenAsmWriter1.inc" - args = [ - "-gen-asm-writer", - "-asmwriternum=1", - ] -} - -x86_tablegen("calling_conv") { - output = "$target_gen_dir/X86GenCallingConv.inc" - args = [ "-gen-callingconv" ] -} - -x86_tablegen("dag_isel") { - output = "$target_gen_dir/X86GenDAGISel.inc" - args = [ "-gen-dag-isel" ] -} - -x86_tablegen("disassembler_tables") { - output = "$target_gen_dir/X86GenDisassemblerTables.inc" - args = [ "-gen-disassembler" ] -} - -x86_tablegen("evex2vex_tables") { - output = "$target_gen_dir/X86GenEVEX2VEXTables.inc" - args = [ "-gen-x86-EVEX2VEX-tables" ] -} - -x86_tablegen("fast_isel") { - output = "$target_gen_dir/X86GenFastISel.inc" - args = [ "-gen-fast-isel" ] -} - -x86_tablegen("global_isel") { - output = "$target_gen_dir/X86GenGlobalISel.inc" - args = [ "-gen-global-isel" ] -} - -x86_tablegen("instr_info") { - output = "$target_gen_dir/X86GenInstrInfo.inc" - args = [ "-gen-instr-info" ] -} - -x86_tablegen("register_bank") { - output = "$target_gen_dir/X86GenRegisterBank.inc" - args = [ "-gen-register-bank" ] -} - -x86_tablegen("register_info") { - output = "$target_gen_dir/X86GenRegisterInfo.inc" - args = [ "-gen-register-info" ] -} - -x86_tablegen("subtarget") { - output = "$target_gen_dir/X86GenSubtargetInfo.inc" - args = [ "-gen-subtarget" ] -} - -config("includes") { - include_dirs = [ target_gen_dir ] -} - -static_library("X86") { - sources = [ - "InstPrinter/X86ATTInstPrinter.cpp", - "InstPrinter/X86InstComments.cpp", - "InstPrinter/X86IntelInstPrinter.cpp", - "MCTargetDesc/X86AsmBackend.cpp", - "MCTargetDesc/X86ELFObjectWriter.cpp", - "MCTargetDesc/X86MCAsmInfo.cpp", - "MCTargetDesc/X86MCCodeEmitter.cpp", - "MCTargetDesc/X86MCTargetDesc.cpp", - "MCTargetDesc/X86MachObjectWriter.cpp", - "MCTargetDesc/X86WinCOFFObjectWriter.cpp", - "MCTargetDesc/X86WinCOFFStreamer.cpp", - "MCTargetDesc/X86WinCOFFTargetStreamer.cpp", - "ShadowCallStack.cpp", - "TargetInfo/X86TargetInfo.cpp", - "Utils/X86ShuffleDecode.cpp", - "X86AsmPrinter.cpp", - "X86AvoidStoreForwardingBlocks.cpp", - "X86CallFrameOptimization.cpp", - "X86CallLowering.cpp", - "X86CallingConv.cpp", - "X86CmovConversion.cpp", - "X86DomainReassignment.cpp", - "X86EvexToVex.cpp", - "X86ExpandPseudo.cpp", - "X86FastISel.cpp", - "X86FixupBWInsts.cpp", - "X86FixupLEAs.cpp", - "X86FixupSetCC.cpp", - "X86FlagsCopyLowering.cpp", - "X86FloatingPoint.cpp", - "X86FrameLowering.cpp", - "X86ISelDAGToDAG.cpp", - "X86ISelLowering.cpp", - "X86IndirectBranchTracking.cpp", - "X86InstrFMA3Info.cpp", - "X86InstrInfo.cpp", - "X86InstructionSelector.cpp", - "X86InterleavedAccess.cpp", - "X86LegalizerInfo.cpp", - "X86MCInstLower.cpp", - "X86MachineFunctionInfo.cpp", - "X86MacroFusion.cpp", - "X86OptimizeLEAs.cpp", - "X86PadShortFunction.cpp", - "X86RegisterBankInfo.cpp", - "X86RegisterInfo.cpp", - "X86RetpolineThunks.cpp", - "X86SelectionDAGInfo.cpp", - "X86ShuffleDecodeConstantPool.cpp", - "X86Subtarget.cpp", - "X86TargetMachine.cpp", - "X86TargetObjectFile.cpp", - "X86TargetTransformInfo.cpp", - "X86VZeroUpper.cpp", - "X86WinAllocaExpander.cpp", - "X86WinEHState.cpp", - ] - - include_dirs = [ "." ] - - public_configs = [ ":includes" ] - - deps = [ - ":asm_matcher", - ":asm_writer", - ":asm_writer1", - ":calling_conv", - ":dag_isel", - ":disassembler_tables", - ":evex2vex_tables", - ":fast_isel", - ":global_isel", - ":instr_info", - ":register_bank", - ":register_info", - ":subtarget", - ] - - public_deps = [ - "../../IR", - "../../MC", - "../../Support", - ] -}
diff --git a/secondary/third_party/llvm/lib/Target/X86/Disassembler/BUILD.gn b/secondary/third_party/llvm/lib/Target/X86/Disassembler/BUILD.gn deleted file mode 100644 index d4cbad9..0000000 --- a/secondary/third_party/llvm/lib/Target/X86/Disassembler/BUILD.gn +++ /dev/null
@@ -1,17 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("Disassembler") { - sources = [ - "X86Disassembler.cpp", - "X86DisassemblerDecoder.cpp", - ] - - include_dirs = [ ".." ] - - public_deps = [ - "..", - "../../../MC/MCDisassembler", - ] -}
diff --git a/secondary/third_party/llvm/utils/TableGen/BUILD.gn b/secondary/third_party/llvm/utils/TableGen/BUILD.gn deleted file mode 100644 index b65a62d..0000000 --- a/secondary/third_party/llvm/utils/TableGen/BUILD.gn +++ /dev/null
@@ -1,61 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(current_toolchain == host_toolchain, - "LLVM TableGen should only be referenced from the host toolchain.") - -executable("tablegen") { - sources = [ - "AsmMatcherEmitter.cpp", - "AsmWriterEmitter.cpp", - "AsmWriterInst.cpp", - "Attributes.cpp", - "CTagsEmitter.cpp", - "CallingConvEmitter.cpp", - "CodeEmitterGen.cpp", - "CodeGenDAGPatterns.cpp", - "CodeGenHwModes.cpp", - "CodeGenInstruction.cpp", - "CodeGenMapTable.cpp", - "CodeGenRegisters.cpp", - "CodeGenSchedule.cpp", - "CodeGenTarget.cpp", - "DAGISelEmitter.cpp", - "DAGISelMatcher.cpp", - "DAGISelMatcherEmitter.cpp", - "DAGISelMatcherGen.cpp", - "DAGISelMatcherOpt.cpp", - "DFAPacketizerEmitter.cpp", - "DisassemblerEmitter.cpp", - "FastISelEmitter.cpp", - "FixedLenDecoderEmitter.cpp", - "GlobalISelEmitter.cpp", - "InfoByHwMode.cpp", - "InstrDocsEmitter.cpp", - "InstrInfoEmitter.cpp", - "IntrinsicEmitter.cpp", - "OptParserEmitter.cpp", - "PseudoLoweringEmitter.cpp", - "RISCVCompressInstEmitter.cpp", - "RegisterBankEmitter.cpp", - "RegisterInfoEmitter.cpp", - "SDNodeProperties.cpp", - "SearchableTableEmitter.cpp", - "SubtargetEmitter.cpp", - "SubtargetFeatureInfo.cpp", - "TableGen.cpp", - "Types.cpp", - "X86DisassemblerTables.cpp", - "X86EVEX2VEXTablesEmitter.cpp", - "X86FoldTablesEmitter.cpp", - "X86ModRMFilters.cpp", - "X86RecognizableInstr.cpp", - ] - - deps = [ - "../../lib/TableGen", - ] - - libs = [ "dl" ] -}
diff --git a/secondary/third_party/llvm/utils/TableGen/tablegen.gni b/secondary/third_party/llvm/utils/TableGen/tablegen.gni deleted file mode 100644 index c234982..0000000 --- a/secondary/third_party/llvm/utils/TableGen/tablegen.gni +++ /dev/null
@@ -1,48 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") - -# Runs the LLVM tablegen tool. -# -# Inputs -# -# source (required) -# [string] Source file -# -# output (required) -# [string] Output file. LLVM normally expects to #include these files. Put -# them in $target_gen_dir/<path_to_original>/<name>.gen. The target_gen_dir -# will be automatically added to the include path. -# -# args (required) -# [string list] What do to. Usually this include something like "-gen-..." -# -# Note: CMake function definition for tablegen is in -# cmake/modules/TableGen.cmake -template("tablegen") { - compiled_action("${target_name}_action") { - tool = "//third_party/llvm/utils/TableGen:tablegen" - - inputs = [ - invoker.source, - ] - outputs = [ - invoker.output, - ] - args = invoker.args + [ - "-I=" + rebase_path("//third_party/llvm/include", root_build_dir), - rebase_path(invoker.source, root_build_dir), - "-o", - rebase_path(invoker.output, root_build_dir), - ] - } - - source_set(target_name) { - deps = [ - ":${target_name}_action", - ] - #public_configs = [ ":target_gen_dir_include" ] - } -}
diff --git a/secondary/third_party/shaderc/fake_sys/BUILD.gn b/secondary/third_party/shaderc/fake_sys/BUILD.gn deleted file mode 100644 index fb35424..0000000 --- a/secondary/third_party/shaderc/fake_sys/BUILD.gn +++ /dev/null
@@ -1,9 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("config") { - if (is_fuchsia) { - include_dirs = [ "//build/secondary/third_party/shaderc/fake_sys" ] - } -}
diff --git a/secondary/third_party/shaderc/fake_sys/sys/resource.h b/secondary/third_party/shaderc/fake_sys/sys/resource.h deleted file mode 100644 index dbcdd46..0000000 --- a/secondary/third_party/shaderc/fake_sys/sys/resource.h +++ /dev/null
@@ -1,5 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Fake version of <sys/resource.h> to allow shaderc and friends to compile.
diff --git a/secondary/third_party/shaderc/libshaderc/BUILD.gn b/secondary/third_party/shaderc/libshaderc/BUILD.gn deleted file mode 100644 index 68eb43e..0000000 --- a/secondary/third_party/shaderc/libshaderc/BUILD.gn +++ /dev/null
@@ -1,26 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -source_set("libshaderc") { - deps = [ - "//third_party/shaderc/libshaderc_util", - "//third_party/shaderc/third_party/glslang:SPIRV", - "//third_party/shaderc/third_party/glslang:glslang-default-resource-limits", - "//third_party/shaderc/third_party/spirv-tools:spirv-tools-opt", - ] - include_dirs = [ - "//third_party/shaderc/libshaderc/include", - "//third_party/shaderc/libshaderc_util/include", - "//third_party/shaderc/third_party/glslang", - "//third_party/shaderc/third_party/spirv-tools/include", - ] - sources = [ - "include/shaderc/shaderc.h", - "include/shaderc/shaderc.hpp", - "src/shaderc.cc", - "src/shaderc_private.h", - ] -}
diff --git a/secondary/third_party/shaderc/libshaderc_util/BUILD.gn b/secondary/third_party/shaderc/libshaderc_util/BUILD.gn deleted file mode 100644 index be55090..0000000 --- a/secondary/third_party/shaderc/libshaderc_util/BUILD.gn +++ /dev/null
@@ -1,43 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -source_set("libshaderc_util") { - deps = [ - "//third_party/shaderc/third_party/glslang", - "//third_party/shaderc/third_party/glslang:SPIRV", - "//third_party/shaderc/third_party/glslang:glslang-default-resource-limits", - "//third_party/shaderc/third_party/spirv-tools:spirv-tools-opt", - ] - include_dirs = [ - "//third_party/shaderc/libshaderc_util/include", - "//third_party/shaderc/third_party/glslang", - "//third_party/shaderc/third_party/spirv-tools/include", - ] - sources = [ - "include/libshaderc_util/compiler.h", - "include/libshaderc_util/counting_includer.h", - "include/libshaderc_util/file_finder.h", - "include/libshaderc_util/format.h", - "include/libshaderc_util/io.h", - "include/libshaderc_util/message.h", - "include/libshaderc_util/mutex.h", - "include/libshaderc_util/resources.h", - "include/libshaderc_util/resources.inc", - "include/libshaderc_util/shader_stage.h", - "include/libshaderc_util/spirv_tools_wrapper.h", - "include/libshaderc_util/string_piece.h", - "include/libshaderc_util/universal_unistd.h", - "include/libshaderc_util/version_profile.h", - "src/compiler.cc", - "src/file_finder.cc", - "src/io.cc", - "src/message.cc", - "src/resources.cc", - "src/shader_stage.cc", - "src/spirv_tools_wrapper.cc", - "src/version_profile.cc", - ] -}
diff --git a/secondary/third_party/shaderc/third_party/glslang/BUILD.gn b/secondary/third_party/shaderc/third_party/glslang/BUILD.gn deleted file mode 100644 index 6750b84..0000000 --- a/secondary/third_party/shaderc/third_party/glslang/BUILD.gn +++ /dev/null
@@ -1,163 +0,0 @@ -# Copyright 2017 The Fuchsia Authors -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -config("glslang_config") { - include_dirs = [ - ".", - "glslang/Public", - ] -} - -config("glslang_internal_config") { - cflags_cc = [ - "-Wno-ignored-qualifiers", - "-Wno-missing-field-initializers", - "-Wno-reorder", - "-Wno-unused-function", - "-Wno-unused-variable", - ] -} - -static_library("glslang") { - sources = [ - "glslang/GenericCodeGen/CodeGen.cpp", - "glslang/GenericCodeGen/Link.cpp", - "glslang/MachineIndependent/Constant.cpp", - "glslang/MachineIndependent/InfoSink.cpp", - "glslang/MachineIndependent/Initialize.cpp", - "glslang/MachineIndependent/IntermTraverse.cpp", - "glslang/MachineIndependent/Intermediate.cpp", - "glslang/MachineIndependent/ParseContextBase.cpp", - "glslang/MachineIndependent/ParseHelper.cpp", - "glslang/MachineIndependent/PoolAlloc.cpp", - "glslang/MachineIndependent/RemoveTree.cpp", - "glslang/MachineIndependent/Scan.cpp", - "glslang/MachineIndependent/ShaderLang.cpp", - "glslang/MachineIndependent/SymbolTable.cpp", - "glslang/MachineIndependent/Versions.cpp", - "glslang/MachineIndependent/attribute.cpp", - "glslang/MachineIndependent/glslang_tab.cpp", - "glslang/MachineIndependent/intermOut.cpp", - "glslang/MachineIndependent/iomapper.cpp", - "glslang/MachineIndependent/limits.cpp", - "glslang/MachineIndependent/linkValidate.cpp", - "glslang/MachineIndependent/parseConst.cpp", - "glslang/MachineIndependent/preprocessor/Pp.cpp", - "glslang/MachineIndependent/preprocessor/PpAtom.cpp", - "glslang/MachineIndependent/preprocessor/PpContext.cpp", - "glslang/MachineIndependent/preprocessor/PpScanner.cpp", - "glslang/MachineIndependent/preprocessor/PpTokens.cpp", - "glslang/MachineIndependent/propagateNoContraction.cpp", - "glslang/MachineIndependent/reflection.cpp", - ] - deps = [ - ":HLSL", - ":OGLCompiler", - ":OSDependent", - ":SPIRV", - ":glslang-default-resource-limits", - ] - public_configs = [ ":glslang_config" ] - configs += [ ":glslang_internal_config" ] -} -static_library("OSDependent") { - cflags_cc = [ - "-Wno-unused-function", - "-Wno-unused-variable", - ] - sources = [ - "glslang/OSDependent/Unix/ossource.cpp", - ] - public_configs = [ "//third_party/shaderc/fake_sys:config" ] -} -static_library("OGLCompiler") { - sources = [ - "OGLCompilersDLL/InitializeDll.cpp", - ] -} -config("HLSL_config") { - defines = [ "ENABLE_HLSL" ] -} -static_library("HLSL") { - cflags_cc = [ - "-Wno-reorder", - "-Wno-inconsistent-missing-override", - "-Wno-missing-field-initializers", - ] - public_configs = [ ":HLSL_config" ] - sources = [ - "hlsl/hlslAttributes.cpp", - "hlsl/hlslGrammar.cpp", - "hlsl/hlslOpMap.cpp", - "hlsl/hlslParseHelper.cpp", - "hlsl/hlslParseables.cpp", - "hlsl/hlslScanContext.cpp", - "hlsl/hlslTokenStream.cpp", - ] -} -static_library("SPIRV") { - cflags_cc = [ - "-Wno-reorder", - "-Wno-missing-field-initializers", - "-Wno-unused-variable", - ] - sources = [ - "SPIRV/GlslangToSpv.cpp", - "SPIRV/InReadableOrder.cpp", - "SPIRV/Logger.cpp", - "SPIRV/SpvBuilder.cpp", - "SPIRV/disassemble.cpp", - "SPIRV/doc.cpp", - ] -} -static_library("SPVRemapper") { - sources = [ - "SPIRV/SPVRemapper.cpp", - ] -} -executable("spirv-remap") { - sources = [ - "StandAlone/spirv-remap.cpp", - ] - deps = [ - ":SPIRV", - ":SPVRemapper", - ":glslang", - ] -} -static_library("glslang-default-resource-limits") { - include_dirs = [ "." ] - sources = [ - "StandAlone/ResourceLimits.cpp", - ] -} -executable("glslangValidator") { - include_dirs = [ "." ] - sources = [ - "StandAlone/StandAlone.cpp", - ] - deps = [ - ":SPIRV", - ":SPVRemapper", - ":glslang", - ":glslang-default-resource-limits", - ] -}
diff --git a/secondary/third_party/shaderc/third_party/spirv-tools/BUILD.gn b/secondary/third_party/shaderc/third_party/spirv-tools/BUILD.gn deleted file mode 100644 index 544ec9e..0000000 --- a/secondary/third_party/shaderc/third_party/spirv-tools/BUILD.gn +++ /dev/null
@@ -1,556 +0,0 @@ -# Copyright 2017 The Fuchsia Authors -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -config("spirv_warnings") { - visibility = [ ":*" ] - cflags_cc = [ - "-Wno-delete-non-virtual-dtor", - "-Wno-return-std-move", - ] -} -group("generate_include_files") { - deps = [ - ":build_version_include_file", - ":core_and_operands_1_0_include_files", - ":core_and_operands_1_1_include_files", - ":core_and_operands_1_2_include_files", - ":core_and_operands_unified1_include_files", - ":debug_info_include_file", - ":extension_enum_include_file", - ":generators_include_file", - ":glsl_1_0_include_file", - ":vendor_tables_amd_gcn_shader", - ":vendor_tables_amd_shader_ballot", - ":vendor_tables_amd_shader_explicit_vertex_parameter", - ":vendor_tables_amd_shader_trinary_minmax", - ":vendor_tables_debug_info", - ] -} - -# The actions below were created by roughly transcribing the actions in -# //third_party/shaderc/third_party/spirv-tools/Android.mk - -# TODO(SCN-649): use GN wizardry to reduce boilerplate in the actions below. - -action("build_version_include_file") { - script = "utils/update_build_version.py" - args = [ - rebase_path(".", root_build_dir), - rebase_path("$target_gen_dir/build-version.inc", root_build_dir), - ] - sources = [ - "CHANGES", - ] - outputs = [ - "$target_gen_dir/build-version.inc", - ] -} -action("glsl_1_0_include_file") { - script = "utils/generate_grammar_tables.py" - spirv_core_grammar = - "external/spirv-headers/include/spirv/1.0/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - glsl_grammar = "external/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json" - output_file = "$target_gen_dir/glsl.std.450.insts-1.0.inc" - args = [ - "--spirv-core-grammar=" + rebase_path(spirv_core_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--extinst-glsl-grammar=" + rebase_path(glsl_grammar, root_build_dir), - "--glsl-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - glsl_grammar, - spirv_core_grammar, - ] - outputs = [ - output_file, - ] -} -action("core_and_operands_1_0_include_files") { - script = "utils/generate_grammar_tables.py" - spirv_core_grammar = - "external/spirv-headers/include/spirv/1.0/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - glsl_grammar = "external/spirv-headers/include/spirv/1.2/extinst.glsl.std.450.grammar.json" - opencl_grammar = "external/spirv-headers/include/spirv/1.2/extinst.opencl.std.100.grammar.json" - core_insts_output_file = "$target_gen_dir/core.insts-1.0.inc" - operand_kinds_output_file = "$target_gen_dir/operand.kinds-1.0.inc" - glsl_insts_output_file = "$target_gen_dir/glsl.std.450.insts.inc" - opencl_insts_output_file = "$target_gen_dir/opencl.std.insts.inc" - args = [ - "--spirv-core-grammar=" + rebase_path(spirv_core_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--extinst-glsl-grammar=" + rebase_path(glsl_grammar, root_build_dir), - "--extinst-opencl-grammar=" + rebase_path(opencl_grammar, root_build_dir), - "--core-insts-output=" + - rebase_path(core_insts_output_file, root_build_dir), - "--glsl-insts-output=" + - rebase_path(glsl_insts_output_file, root_build_dir), - "--opencl-insts-output=" + - rebase_path(opencl_insts_output_file, root_build_dir), - "--operand-kinds-output=" + - rebase_path(operand_kinds_output_file, root_build_dir), - ] - sources = [ - spirv_core_grammar, - ] - outputs = [ - core_insts_output_file, - operand_kinds_output_file, - ] -} -action("core_and_operands_1_1_include_files") { - script = "utils/generate_grammar_tables.py" - spirv_core_grammar = - "external/spirv-headers/include/spirv/1.1/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - core_insts_output_file = "$target_gen_dir/core.insts-1.1.inc" - operand_kinds_output_file = "$target_gen_dir/operand.kinds-1.1.inc" - args = [ - "--spirv-core-grammar=" + rebase_path(spirv_core_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--core-insts-output=" + - rebase_path(core_insts_output_file, root_build_dir), - "--operand-kinds-output=" + - rebase_path(operand_kinds_output_file, root_build_dir), - ] - sources = [ - spirv_core_grammar, - ] - outputs = [ - core_insts_output_file, - operand_kinds_output_file, - ] -} -action("core_and_operands_1_2_include_files") { - script = "utils/generate_grammar_tables.py" - spirv_core_grammar = - "external/spirv-headers/include/spirv/1.2/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - core_insts_output_file = "$target_gen_dir/core.insts-1.2.inc" - operand_kinds_output_file = "$target_gen_dir/operand.kinds-1.2.inc" - args = [ - "--spirv-core-grammar=" + rebase_path(spirv_core_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--core-insts-output=" + - rebase_path(core_insts_output_file, root_build_dir), - "--operand-kinds-output=" + - rebase_path(operand_kinds_output_file, root_build_dir), - ] - sources = [ - spirv_core_grammar, - ] - outputs = [ - core_insts_output_file, - operand_kinds_output_file, - ] -} -action("core_and_operands_unified1_include_files") { - script = "utils/generate_grammar_tables.py" - spirv_core_grammar = - "external/spirv-headers/include/spirv/unified1/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - core_insts_output_file = "$target_gen_dir/core.insts-unified1.inc" - operand_kinds_output_file = "$target_gen_dir/operand.kinds-unified1.inc" - args = [ - "--spirv-core-grammar=" + rebase_path(spirv_core_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--core-insts-output=" + - rebase_path(core_insts_output_file, root_build_dir), - "--operand-kinds-output=" + - rebase_path(operand_kinds_output_file, root_build_dir), - ] - sources = [ - spirv_core_grammar, - ] - outputs = [ - core_insts_output_file, - operand_kinds_output_file, - ] -} -action("extension_enum_include_file") { - script = "utils/generate_grammar_tables.py" - - # TODO: this must be kept up-to-date - spirv_core_latest_grammar = - "external/spirv-headers/include/spirv/unified1/spirv.core.grammar.json" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - extension_enum_output_file = "$target_gen_dir/extension_enum.inc" - enum_string_mapping_output_file = "$target_gen_dir/enum_string_mapping.inc" - args = [ - "--spirv-core-grammar=" + - rebase_path(spirv_core_latest_grammar, root_build_dir), - "--extinst-debuginfo-grammar=" + - rebase_path(debug_info_grammar, root_build_dir), - "--extension-enum-output=" + - rebase_path(extension_enum_output_file, root_build_dir), - "--enum-string-mapping-output=" + - rebase_path(enum_string_mapping_output_file, root_build_dir), - ] - sources = [ - debug_info_grammar, - spirv_core_latest_grammar, - ] - outputs = [ - extension_enum_output_file, - enum_string_mapping_output_file, - ] -} -action("generators_include_file") { - script = "utils/generate_registry_tables.py" - input_file = "external/spirv-headers/include/spirv/spir-v.xml" - output_file = "$target_gen_dir/generators.inc" - args = [ - "--xml=" + rebase_path(input_file, root_build_dir), - "--generator-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_file, - ] - outputs = [ - output_file, - ] -} -action("debug_info_include_file") { - script = "utils/generate_language_headers.py" - debug_info_grammar = "source/extinst.debuginfo.grammar.json" - base_filename = "DebugInfo" - output_path = "$target_gen_dir/DebugInfo" - output_path_with_h = "$target_gen_dir/DebugInfo.h" - args = [ - "--extinst-name=" + base_filename, - "--extinst-grammar=" + rebase_path(debug_info_grammar, root_build_dir), - "--extinst-output-base=" + rebase_path(output_path, root_build_dir), - ] - sources = [ - debug_info_grammar, - ] - outputs = [ - output_path_with_h, - ] -} -action("vendor_tables_debug_info") { - script = "utils/generate_grammar_tables.py" - input_grammar_file = "source/extinst.debuginfo.grammar.json" - output_file = "$target_gen_dir/debuginfo.insts.inc" - args = [ - "--extinst-vendor-grammar=" + - rebase_path(input_grammar_file, root_build_dir), - "--vendor-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_grammar_file, - ] - outputs = [ - output_file, - ] -} -action("vendor_tables_amd_gcn_shader") { - script = "utils/generate_grammar_tables.py" - input_grammar_file = "source/extinst.spv-amd-gcn-shader.grammar.json" - output_file = "$target_gen_dir/spv-amd-gcn-shader.insts.inc" - args = [ - "--extinst-vendor-grammar=" + - rebase_path(input_grammar_file, root_build_dir), - "--vendor-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_grammar_file, - ] - outputs = [ - output_file, - ] -} -action("vendor_tables_amd_shader_ballot") { - script = "utils/generate_grammar_tables.py" - input_grammar_file = "source/extinst.spv-amd-shader-ballot.grammar.json" - output_file = "$target_gen_dir/spv-amd-shader-ballot.insts.inc" - args = [ - "--extinst-vendor-grammar=" + - rebase_path(input_grammar_file, root_build_dir), - "--vendor-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_grammar_file, - ] - outputs = [ - output_file, - ] -} -action("vendor_tables_amd_shader_explicit_vertex_parameter") { - script = "utils/generate_grammar_tables.py" - input_grammar_file = - "source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json" - output_file = - "$target_gen_dir/spv-amd-shader-explicit-vertex-parameter.insts.inc" - args = [ - "--extinst-vendor-grammar=" + - rebase_path(input_grammar_file, root_build_dir), - "--vendor-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_grammar_file, - ] - outputs = [ - output_file, - ] -} -action("vendor_tables_amd_shader_trinary_minmax") { - script = "utils/generate_grammar_tables.py" - input_grammar_file = - "source/extinst.spv-amd-shader-trinary-minmax.grammar.json" - output_file = "$target_gen_dir/spv-amd-shader-trinary-minmax.insts.inc" - args = [ - "--extinst-vendor-grammar=" + - rebase_path(input_grammar_file, root_build_dir), - "--vendor-insts-output=" + rebase_path(output_file, root_build_dir), - ] - sources = [ - input_grammar_file, - ] - outputs = [ - output_file, - ] -} -config("include_config") { - include_dirs = [ - "external/spirv-headers/include", - "include", - "source", - ".", - target_gen_dir, - ] -} -group("spirv-deps") { - public_configs = [ ":include_config" ] - deps = [ - ":generate_include_files", - ] -} -static_library("spirv-tools") { - configs += [ ":spirv_warnings" ] - public_configs = [ "//third_party/shaderc/fake_sys:config" ] - deps = [ - ":spirv-deps", - ] - sources = [ - "source/assembly_grammar.cpp", - "source/binary.cpp", - "source/diagnostic.cpp", - "source/disassemble.cpp", - "source/enum_string_mapping.cpp", - "source/ext_inst.cpp", - "source/extensions.cpp", - "source/id_descriptor.cpp", - "source/libspirv.cpp", - "source/message.cpp", - "source/name_mapper.cpp", - "source/opcode.cpp", - "source/operand.cpp", - "source/parsed_operand.cpp", - "source/print.cpp", - "source/software_version.cpp", - "source/spirv_endian.cpp", - "source/spirv_stats.cpp", - "source/spirv_target_env.cpp", - "source/spirv_validator_options.cpp", - "source/table.cpp", - "source/text.cpp", - "source/text_handler.cpp", - "source/util/bit_stream.cpp", - "source/util/parse_number.cpp", - "source/util/string_utils.cpp", - "source/util/timer.cpp", - "source/val/basic_block.cpp", - "source/val/construct.cpp", - "source/val/function.cpp", - "source/val/instruction.cpp", - "source/val/validation_state.cpp", - "source/validate.cpp", - "source/validate_adjacency.cpp", - "source/validate_arithmetics.cpp", - "source/validate_atomics.cpp", - "source/validate_barriers.cpp", - "source/validate_bitwise.cpp", - "source/validate_builtins.cpp", - "source/validate_capability.cpp", - "source/validate_cfg.cpp", - "source/validate_composites.cpp", - "source/validate_conversion.cpp", - "source/validate_datarules.cpp", - "source/validate_decorations.cpp", - "source/validate_derivatives.cpp", - "source/validate_ext_inst.cpp", - "source/validate_id.cpp", - "source/validate_image.cpp", - "source/validate_instruction.cpp", - "source/validate_layout.cpp", - "source/validate_literals.cpp", - "source/validate_logicals.cpp", - "source/validate_primitives.cpp", - "source/validate_type_unique.cpp", - ] -} -static_library("spirv-tools-opt") { - configs += [ ":spirv_warnings" ] - deps = [ - ":spirv-deps", - ":spirv-tools", - ] - sources = [ - "source/opt/aggressive_dead_code_elim_pass.cpp", - "source/opt/basic_block.cpp", - "source/opt/block_merge_pass.cpp", - "source/opt/build_module.cpp", - "source/opt/ccp_pass.cpp", - "source/opt/cfg.cpp", - "source/opt/cfg_cleanup_pass.cpp", - "source/opt/common_uniform_elim_pass.cpp", - "source/opt/compact_ids_pass.cpp", - "source/opt/composite.cpp", - "source/opt/const_folding_rules.cpp", - "source/opt/constants.cpp", - "source/opt/copy_prop_arrays.cpp", - "source/opt/dead_branch_elim_pass.cpp", - "source/opt/dead_insert_elim_pass.cpp", - "source/opt/dead_variable_elimination.cpp", - "source/opt/decoration_manager.cpp", - "source/opt/def_use_manager.cpp", - "source/opt/dominator_analysis.cpp", - "source/opt/dominator_tree.cpp", - "source/opt/eliminate_dead_constant_pass.cpp", - "source/opt/eliminate_dead_functions_pass.cpp", - "source/opt/feature_manager.cpp", - "source/opt/flatten_decoration_pass.cpp", - "source/opt/fold.cpp", - "source/opt/fold_spec_constant_op_and_composite_pass.cpp", - "source/opt/folding_rules.cpp", - "source/opt/freeze_spec_constant_value_pass.cpp", - "source/opt/function.cpp", - "source/opt/if_conversion.cpp", - "source/opt/inline_exhaustive_pass.cpp", - "source/opt/inline_opaque_pass.cpp", - "source/opt/inline_pass.cpp", - "source/opt/insert_extract_elim.cpp", - "source/opt/instruction.cpp", - "source/opt/instruction_list.cpp", - "source/opt/ir_context.cpp", - "source/opt/ir_loader.cpp", - "source/opt/licm_pass.cpp", - "source/opt/local_access_chain_convert_pass.cpp", - "source/opt/local_redundancy_elimination.cpp", - "source/opt/local_single_block_elim_pass.cpp", - "source/opt/local_single_store_elim_pass.cpp", - "source/opt/local_ssa_elim_pass.cpp", - "source/opt/loop_descriptor.cpp", - "source/opt/loop_peeling.cpp", - "source/opt/loop_unroller.cpp", - "source/opt/loop_unswitch_pass.cpp", - "source/opt/loop_utils.cpp", - "source/opt/mem_pass.cpp", - "source/opt/merge_return_pass.cpp", - "source/opt/module.cpp", - "source/opt/optimizer.cpp", - "source/opt/pass.cpp", - "source/opt/pass_manager.cpp", - "source/opt/private_to_local_pass.cpp", - "source/opt/propagator.cpp", - "source/opt/redundancy_elimination.cpp", - "source/opt/remove_duplicates_pass.cpp", - "source/opt/replace_invalid_opc.cpp", - "source/opt/scalar_analysis.cpp", - "source/opt/scalar_analysis_simplification.cpp", - "source/opt/scalar_replacement_pass.cpp", - "source/opt/set_spec_constant_default_value_pass.cpp", - "source/opt/simplification_pass.cpp", - "source/opt/ssa_rewrite_pass.cpp", - "source/opt/strength_reduction_pass.cpp", - "source/opt/strip_debug_info_pass.cpp", - "source/opt/strip_reflect_info_pass.cpp", - "source/opt/type_manager.cpp", - "source/opt/types.cpp", - "source/opt/unify_const_pass.cpp", - "source/opt/value_number_table.cpp", - "source/opt/workaround1209.cpp", - ] -} -executable("spirv-opt") { - deps = [ - ":spirv-deps", - ":spirv-tools", - ":spirv-tools-opt", - ] - sources = [ - "tools/opt/opt.cpp", - ] -} -executable("spirv-dis") { - deps = [ - ":spirv-deps", - ":spirv-tools", - ] - sources = [ - "tools/dis/dis.cpp", - ] -} -executable("spirv-cfg") { - deps = [ - ":spirv-deps", - ":spirv-tools", - ] - sources = [ - "tools/cfg/bin_to_dot.cpp", - "tools/cfg/cfg.cpp", - ] -} -executable("spirv-val") { - deps = [ - ":spirv-deps", - ":spirv-tools", - ] - sources = [ - "tools/val/val.cpp", - ] -} -executable("spirv-as") { - deps = [ - ":spirv-deps", - ":spirv-tools", - ] - sources = [ - "tools/as/as.cpp", - ] -} -executable("spirv-tools-cpp-example") { - deps = [ - ":spirv-tools", - ":spirv-tools-opt", - ] - include_dirs = [ "include" ] - sources = [ - "examples/cpp-interface/main.cpp", - ] -}
diff --git a/secondary/third_party/spirv-cross/BUILD.gn b/secondary/third_party/spirv-cross/BUILD.gn deleted file mode 100644 index 5ad8a47..0000000 --- a/secondary/third_party/spirv-cross/BUILD.gn +++ /dev/null
@@ -1,44 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -config("public_preprocessor_definitions") { - defines = [ "SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" ] -} - -source_set("spirv-cross") { - public_configs = [ ":public_preprocessor_definitions" ] - - sources = [ - # spirv-cross-core - "GLSL.std.450.h", - "spirv.hpp", - "spirv_cfg.cpp", - "spirv_cfg.hpp", - "spirv_common.hpp", - "spirv_cpp.cpp", - - # spirv-cross-cpp - "spirv_cpp.hpp", - "spirv_cross.cpp", - "spirv_cross.hpp", - "spirv_cross_util.cpp", - - # spirv-cross-util - "spirv_cross_util.hpp", - - # spirv-cross-glsl - "spirv_glsl.cpp", - "spirv_glsl.hpp", - "spirv_hlsl.cpp", - - # spirv-cross-hlsl - "spirv_hlsl.hpp", - "spirv_msl.cpp", - - # spirv-cross-msl - "spirv_msl.hpp", - ] -}
diff --git a/test.gni b/test.gni deleted file mode 100644 index ca9c385..0000000 --- a/test.gni +++ /dev/null
@@ -1,36 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/testing/test_spec.gni") - -# This declares a test executable. -# -# The parameters are precisely those of an `executable`. -# -template("test") { - if (is_linux || is_mac) { - test_spec("${target_name}_spec") { - name = invoker.target_name - location = "$root_out_dir/${invoker.target_name}" - } - } - - executable(target_name) { - forward_variables_from(invoker, "*") - testonly = true - if (is_linux || is_mac) { - # Write runtime dependencies to the root out dir of the base host - # toolchain so that the file may be found by cross-referencing with - # $root_build_dir/host_tests.json. - test_name = get_path_info(target_name, "name") - host_out_dir = get_label_info(":$target_name(${toolchain_variant.base})", - "target_out_dir") - write_runtime_deps = "$host_out_dir/$test_name.$test_data_ext" - } - } -} - -set_defaults("test") { - configs = default_executable_configs -}
diff --git a/test/test_package.gni b/test/test_package.gni deleted file mode 100644 index 8a908c9..0000000 --- a/test/test_package.gni +++ /dev/null
@@ -1,136 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/package.gni") - -# Helper template to create test component which runtests can execute. -# -# This template assumes that for all the test binaries in |tests| there would -# be a corresponding component manifest file in meta/ folder with same name. -# If there is none this template will fail with an error. -# -# Parameters -# -# meta (optional) -# [list of scopes] Defines the metadata entries in the package. A metadata -# entry is typically a source file and is placed in the `meta/` directory of -# the assembled package. -# -# Entries in a scope in the meta list: -# -# path (required) -# [path] Location of entry in source or build directory. If the -# resource is checked in, this will typically be specified as a -# path relative to the BUILD.gn file containing the `package()` -# target. If the resource is generated, this will typically be -# specified relative to `$target_gen_dir`. -# -# dest (required) -# [path] Location the resource will be placed within `meta/`. -# -# binaries (optional) -# [list of scopes] Defines the binaries in the package. A binary is -# typically produced by the build system and is placed in the `bin/` -# directory of the assembled package. -# -# Entries in a scope in the binaries list: -# -# name (required) -# [string] Name of the binary. -# -# source (optional) -# [path] Location of the binary in the build directory if it is not -# at `$root_out_dir/$name`. -# -# dest (optional) -# [path] Location the binary will be placed within `bin/`. -# -# -# tests (optional) -# [list of scopes] Defines the test binaries in the package. A test is -# typically produced by the build system and is placed in the `test/` -# directory of the assembled package. -# -# Entries in a scope in the tests list: -# -# name (required) -# [string] Name of the test. -# -# dest (optional) -# [path] Location the binary will be placed within `test/`. -# -# disabled (optional) -# [bool] Whether to disable the test on continuous integration -# jobs. This can be used when a test is temporarily broken, or if -# it is too flaky or slow for CI. The test will also be skipped by -# the `runtests` command. -# -# For each tests entry this expects a corresponding cmx file in meta directory. -# -# resources (optional) -# [list of scopes] Defines the resources in the package. A resource is a -# data file that may be produced by the build system, checked in to a -# source repository, or produced by another system that runs before the -# build. Resources are placed in the `data/` directory of the assembled -# package. -# -# Entries in a scope in the resources list: -# -# path (required) -# [path] Location of resource in source or build directory. If the -# resource is checked in, this will typically be specified as a -# path relative to the BUILD.gn file containing the `package()` -# target. If the resource is generated, this will typically be -# specified relative to `$target_gen_dir`. -# -# dest (required) -# [path] Location the resource will be placed within `data/`. -# -# extra (optional) -# [list of paths] Manifest files containing extra entries, which -# might be generated by the build. -# -# deps (optional) -# public_deps (optional) -# data_deps (optional) -# Usual GN meanings. -# -template("test_package") { - forward_variables_from(invoker, - [ - "tests", - "meta", - ]) - if (!defined(meta)) { - meta = [] - } - foreach(test, tests) { - test_dest = test.name - if (defined(test.dest)) { - test_dest = test.dest - } - meta += [ - { - path = "meta/${test_dest}.cmx" - dest = "${test_dest}.cmx" - }, - ] - } - - package(target_name) { - testonly = true - forward_variables_from(invoker, - [ - "binaries", - "data_deps", - "deps", - "extra", - "public_deps", - "resources", - "drivers", - "loadable_modules", - "package_name", - ]) - } -}
diff --git a/testing/environments.gni b/testing/environments.gni deleted file mode 100644 index 448b1cf..0000000 --- a/testing/environments.gni +++ /dev/null
@@ -1,52 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -### Individual test environments ### - -qemu_env = { - dimensions = { - device_type = "QEMU" - } -} - -nuc_env = { - dimensions = { - device_type = "Intel NUC Kit NUC7i5DNHE" - } -} - -vim2_env = { - dimensions = { - device_type = "Khadas Vim2 Max" - } - # TODO(IN-571): Delete after bring-up. - label = "vim2" -} - -linux_env = { - dimensions = { - os = "Linux" - } - # TODO(IN-819): Delete after bring-up. - label = "host" -} - -mac_env = { - dimensions = { - os = "Mac" - } - # TODO(IN-819): Delete after bring-up. - label = "host" -} - - -### Select environment lists ### - -# The basic, freely usable test environments supported by the infrastructure. -basic_envs = [ qemu_env ] -if (current_cpu == "x64") { - basic_envs += [ nuc_env ] -} else if (current_cpu == "arm64") { - basic_envs += [ vim2_env ] -}
diff --git a/testing/platforms.gni b/testing/platforms.gni deleted file mode 100644 index 1b9e202..0000000 --- a/testing/platforms.gni +++ /dev/null
@@ -1,55 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This file is a source of truth for what platforms are available for testing -# and what dimensions they possess to match against. -# -# Please do not update this file; contact fuchsia-infra-team@google.com with any -# questions. -# -# Swarming is the task distribution system used by Fuchsia to run automated -# builds. A dimension is a formal Swarming concept effectively given by a -# key-value pair; it describes a bot property that can be targeted. Below are -# the published dimensions for the platforms we have available to test on. -# For more general Swarming documentation see -# https://chromium.googlesource.com/infra/luci/luci-py/+/master/appengine/swarming/doc/ - -# All Swarming dimension keys that Fuchsia test authors may use to target test -# platforms. -all_dimension_keys = [ - "device_type", - "cpu", - "os", -] - -# Scopes of dimensions for every available platform. -test_platforms = [ - { - device_type = "QEMU" - cpu = "x64" - }, - { - device_type = "QEMU" - cpu = "arm64" - }, - { - device_type = "Intel NUC Kit NUC7i5DNHE" - cpu = "x64" - }, - - # The platforms below are experimental and may not yet be targeted. - # See IN-571. - { - device_type = "Khadas Vim2 Max" - cpu = "arm64" - }, - - # See IN-819. - { - os = "Linux" - }, - { - os = "Mac" - }, -]
diff --git a/testing/secret_spec.gni b/testing/secret_spec.gni deleted file mode 100644 index ed60035..0000000 --- a/testing/secret_spec.gni +++ /dev/null
@@ -1,49 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Location of CloudKMS crypto keys within the fuchsia infra GCE project. - cloudkms_key_dir = - "projects/fuchsia-infra/locations/global/keyRings/test-secrets/cryptoKeys" -} - -# Describes a 'secret', a plaintext to be supplied to a test at runtime. The -# JSON spec of the secret and its associated ciphertext file will be written to -# $root_build_dir/secret_specs/$target_name.json -# and -# $root_build_dir/secret_spec/ciphertext/$target_name.ciphertext -# respectively. -# -# Parameters -# -# key_name -# Required: Name of the private key used for encryption. It is assumed that this key -# lives in CloudKMS at -# projects/fuchsia-infra/locations/global/keyRings/test-secrets/cryptoKeys/<key_name> -# -# ciphertext_file -# Required: Relative path to a text file containing the encrypted plaintext -# (maximum 64KiB) -template("secret_spec") { - assert(defined(invoker.key_name), "key_name must be defined.") - assert(defined(invoker.ciphertext_file), "ciphertext_file must be defined.") - - secret_spec_dir = "$root_build_dir/secret_specs" - - copy(target_name) { - sources = [ - invoker.ciphertext_file, - ] - outputs = [ - "$secret_spec_dir/ciphertext/$target_name.ciphertext", - ] - } - - secret_spec = { - cloudkms_key_path = "$cloudkms_key_dir/${invoker.key_name}" - ciphertext_file = invoker.ciphertext_file - } - - write_file("$secret_spec_dir/$target_name.json", secret_spec, "json") -}
diff --git a/testing/test_spec.gni b/testing/test_spec.gni deleted file mode 100644 index 68258c7..0000000 --- a/testing/test_spec.gni +++ /dev/null
@@ -1,227 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/testing/environments.gni") -import("//build/testing/platforms.gni") - -# Extension identifying a test spec JSON file. -_test_spec_ext = "spec.json" - -# Extension identifying the runtime dependencies of a test. -test_data_ext = "spec.data" - -# Describes the target device environment in which a test should run. This -# specification is written in JSON to the build directory, to be aggregated -# at test-time. -# -# Parameters -# -# name (required) -# [string] The test's name. -# -# location (required) -# [string]: Unique reference to a test, e.g., a filesystem path or a -# fuchsia URI. -# -# output_dir (required for fuchsia; else is optional) -# [string]: Directory where the test spec will be written. -# -# environments (optional, default: QEMU for fuchsia; else a VM) -# [list of scopes] Device environments in which the test should run. -# -# Each scope in $environments contains: -# -# dimensions (required) -# [scope] Dimensions of bots to target. Valid dimensions are -# element-wise subsets of the test platform entries defined in -# //build/testing/platforms.gni. -# -# label (optional) -# [string] A key on which tests may be grouped. Tests with a given -# label will be run (1) together, and (2) only with support from the -# Infrastructure team. Labels are used as an escape hatch from the -# default testing pipeline for special tests or environments. -# -template("test_spec") { - # A canonical target name is the name of the test itself; however that name - # must be reserved for the actual test target in the expansion of other - # templates that give both a test and its spec. With that in mind, - # `test_name` is provided as a parameter, and the choice of an alternative - # target name does not ultimately matter. - not_needed([ "target_name" ]) - - assert(defined(invoker.name), "name must be defined.") - assert(defined(invoker.location), "location must be defined.") - forward_variables_from(invoker, - [ - "environments", - "output_dir", - ]) - - # Set default environments: QEMU for a fuchsia test, and VMs for linux and mac - # tests. - if (is_fuchsia) { - assert(defined(invoker.output_dir), "output_dir must be defined.") - envs_specified = defined(environments) - - if (!envs_specified) { - environments = [ qemu_env ] - } - - if (current_cpu == "x64" && !envs_specified) { - # TODO(joshuaseaton): This is temporary until we are confident that all - # tests that need to specify hardware are doing so. - environments += [ nuc_env ] - } else if (current_cpu == "arm64" && !envs_specified) { - # TODO(IN-571): Remove after vim2s are ready to be targeted. - environments += [ vim2_env ] - } - } else if (is_linux || is_mac) { - if (defined(output_dir)) { - assert(output_dir == target_out_dir, - "tests specs must be written to target_out_dir") - } else { - output_dir = target_out_dir - } - - if (!defined(environments)) { - if (is_linux) { - environments = [ linux_env ] - } else if (is_mac) { - environments = [ mac_env ] - } - } - } else { - assert(false, "$current_os not supported") - } - - foreach(env, environments) { - empty_scope = { # Clear from previous iteration - } - assert(defined(env.dimensions) && env.dimensions != empty_scope, - "each environment must specify dimensions") - } - - # Call "expanding" the operation that takes a scope - # { - # x = a - # y = b - # z = c - # ... - # } - # and converts it to a list [{x=a}, {y=b}, {z=c},...]. - # - # Expand each scope of test platform dimensions and group them by architecture - # (i.e., cpu). The same thing is done below with each environment's dimensions - # scope to more easily compare. - target_platform_dims = [] - other_platform_dims = [] - foreach(platform, test_platforms) { - platform_dims = [] # Clear from previous iteration. - foreach(key, all_dimension_keys) { - platform_dims += [ - { - forward_variables_from(platform, [ key ]) - }, - ] - } - - # Empty scopes may have been introduced to platform_dims, corresponding to - # non-existent keys; - # Add and then subtract an empty scope to remove them. - empty_dim = { # Clear from previous iteration. - } - platform_dims += [ empty_dim ] - platform_dims -= [ empty_dim ] - - if (!defined(platform.cpu) || platform.cpu == current_cpu) { - target_platform_dims += [ platform_dims ] - } else { - other_platform_dims += [ platform_dims ] - } - } - - target_envs = [] - foreach(env, environments) { - dims = [] # Clear from previous iteration. - if (defined(env.dimensions)) { - foreach(key, all_dimension_keys) { - dims += [ - { - forward_variables_from(env.dimensions, [ key ]) - }, - ] - } - } - empty_dim = { # Clear from previous iteration. - } - dims += [ empty_dim ] - dims -= [ empty_dim ] - - # Check if the environment's dimensions match those of a platform of the - # target architecture; if a match, include the environment among the - # test spec's. - # Note that in GN "A is a subset of B" is equivalent to `A + B - B == []`. - match = false - foreach(platform_dims, target_platform_dims) { - if (dims + platform_dims - platform_dims == []) { - match = true - target_envs += [ env ] - } - } - - # If the environment's dimensions do not match a target architecture, ensure - # that they match those of a platform of another architecture. - if (!match) { - foreach(platform_dims, other_platform_dims) { - match = match || dims + platform_dims - platform_dims == [] - } - if (!match) { - print("Could not match environment specifications for '$target_name':") - print("$env") - assert( - match, - "Consult //build/testing/platforms.gni for all allowable specifications") - } - } - } - - test_spec = { - test = { - name = get_label_info(":${invoker.name}", "label_no_toolchain") - location = invoker.location - if (is_linux || is_mac) { - # Trim leading //. - location = rebase_path(location, root_build_dir) - } - os = current_os - cpu = current_cpu - } - environments = [] # Clear from above. - environments = target_envs - } - - foreach(env, target_envs) { - dims = [] # Clear from previous iteration. - dims = env.dimensions - - # TODO(IN-571): Delete this block once vim2s are ready to be targeted. - if (defined(dims.device_type) && dims.device_type == "Khadas Vim2 Max") { - assert(defined(env.label) && env.label == "vim2", - "vim2s may not yet be targeted.") - } - - # TODO(IN-819): Delete this block once Linux VMs and Macs are ready to be - # targeted. - if (defined(dims.os)) { - assert(defined(env.label) && env.label == "host", - "Linux VMs or Macs may not yet be targeted for tests.") - } - } - - # We take the basename just to make sure no other path components are given - # in the name, for which we have no guarantees. - test_name = get_path_info(invoker.name, "name") - write_file("${output_dir}/${test_name}.${_test_spec_ext}", test_spec, "json") -}
diff --git a/toolchain/BUILD.gn b/toolchain/BUILD.gn deleted file mode 100644 index c1b09f6..0000000 --- a/toolchain/BUILD.gn +++ /dev/null
@@ -1,20 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -clang_host_toolchain_suite("host_${host_cpu}") { -} - -clang_toolchain_suite("linux_x64") { - toolchain_cpu = "x64" - toolchain_os = "linux" - use_strip = true -} - -clang_toolchain_suite("linux_arm64") { - toolchain_cpu = "arm64" - toolchain_os = "linux" - use_strip = true -}
diff --git a/toolchain/ccache.gni b/toolchain/ccache.gni deleted file mode 100644 index 6813b32..0000000 --- a/toolchain/ccache.gni +++ /dev/null
@@ -1,10 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Defines the configuration of ccache. - -declare_args() { - # Set to true to enable compiling with ccache - use_ccache = false -}
diff --git a/toolchain/clang_toolchain.gni b/toolchain/clang_toolchain.gni deleted file mode 100644 index fda5884..0000000 --- a/toolchain/clang_toolchain.gni +++ /dev/null
@@ -1,565 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/clang/clang.gni") -import("//build/toolchain/ccache.gni") -import("//build/toolchain/goma.gni") - -# Each toolchain must define "stamp" and "copy" tools, -# but they are always the same in every toolchain. -stamp_command = "touch {{output}}" -stamp_description = "STAMP {{output}}" - -# We use link instead of copy; the way "copy" tool is being used is -# compatible with links since Ninja is tracking changes to the source. -copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" -copy_description = "COPY {{source}} {{output}}" - -# Defines a Clang-based toolchain. -# -# Parameters -# -# toolchain_cpu -# Required: Value of "current_cpu" inside this toolchain. -# -# toolchain_os -# Required: Value of "current_os" inside this toolchain. -# -# toolchain_args -# Optional: Scope specifying build arguments to override in this -# toolchain context. -# NOTE! Do not use this in the toolchain used as the default toolchain. -# It will have no effect, and you will be confused. -# -# use_strip -# Required: Whether to strip binaries, leaving unstripped ones -# in lib.unstripped and exe.unstripped subdirectories. -# -# prefix -# Optional: The path from which "cc", "cxx", "ar", "ld" and -# "strip" will be found (unless overridden). If not given, -# prefix defaults to $clang_prefix. -# -# cc -# cxx -# ar -# ld -# strip -# Optional: Override default tool names. -# -# use_ccache, use_goma -# Optional: Override the global setting, useful to opt out of -# ccache/goma in a particular toolchain. -# -# deps -# Optional: Dependencies of this toolchain. -# -# propagates_configs -# Optional: public_configs should escape this toolchain via deps -# -template("clang_toolchain") { - toolchain(target_name) { - assert(defined(invoker.toolchain_cpu), - "clang_toolchain() must specify a \"toolchain_cpu\"") - assert(defined(invoker.toolchain_os), - "clang_toolchain() must specify a \"toolchain_os\"") - - compiler_prefix = "" - if (defined(invoker.use_goma)) { - use_goma = invoker.use_goma - } - if (use_goma) { - compiler_prefix = "$goma_dir/gomacc " - } else { - if (defined(invoker.use_ccache)) { - use_ccache = invoker.use_ccache - } - if (use_ccache) { - compiler_prefix = "ccache " - } - } - - prefix = clang_prefix - if (defined(invoker.prefix)) { - prefix = invoker.prefix - } - - # Set all tools to defaults - cc = compiler_prefix + "${prefix}/clang" - cxx = compiler_prefix + "${prefix}/clang++" - ar = "${prefix}/llvm-ar" - ld = cxx - - forward_variables_from(invoker, [ "use_strip" ]) - if (use_strip) { - if (invoker.toolchain_os == "mac") { - strip = "xcrun strip" - } else { - strip = "${prefix}/llvm-objcopy" - } - } - - # Override any tools as requested by the invoker - if (defined(invoker.cc)) { - cc = compiler_prefix + invoker.cc - } - if (defined(invoker.cxx)) { - cxx = compiler_prefix + invoker.cxx - } - forward_variables_from(invoker, - [ - "ar", - "deps", - "ld", - "propagates_configs", - "strip", - ]) - - # These library switches can apply to all tools below. - lib_switch = "-l" - lib_dir_switch = "-L" - - tool("cc") { - depfile = "{{output}}.d" - command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "CC {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - - tool("cxx") { - depfile = "{{output}}.d" - command = "$cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "CXX {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - - tool("asm") { - depfile = "{{output}}.d" - command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "ASM {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - - tool("objc") { - depfile = "{{output}}.d" - command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "OBJC {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - - tool("objcxx") { - depfile = "{{output}}.d" - command = "$cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objcc}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "OBJCXX {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - - tool("alink") { - rspfile = "{{output}}.rsp" - command = - "rm -f {{output}} && $ar {{arflags}} rcsD {{output}} @\"$rspfile\"" - description = "AR {{output}}" - rspfile_content = "{{inputs}}" - outputs = [ - "{{output_dir}}/{{target_output_name}}{{output_extension}}", - ] - default_output_dir = "{{target_out_dir}}" - default_output_extension = ".a" - output_prefix = "lib" - } - - tool("solink") { - outname = "{{target_output_name}}{{output_extension}}" - outfile = "{{output_dir}}/$outname" - rspfile = "$outfile.rsp" - unstripped_outfile = outfile - if (use_strip) { - unstripped_outfile = "{{output_dir}}/lib.unstripped/{{target_output_name}}{{output_extension}}" - } - if (invoker.toolchain_os == "mac") { - command = "$ld -shared {{ldflags}} -Wl,-install_name,@rpath/\"{{target_output_name}}{{output_extension}}\" -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{libs}} {{solibs}}" - rspfile_content = "{{inputs_newline}}" - default_output_extension = ".dylib" - } else { - command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,--Map=\"$unstripped_outfile.map\" -Wl,-soname=\"$outname\" @\"$rspfile\"" - rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" - default_output_extension = ".so" - } - if (use_strip) { - if (invoker.toolchain_os == "mac") { - command += " && $strip -x \"$unstripped_outfile\" -o \"$outfile\"" - } else { - command += - " && $strip --strip-all" + " --build-id-link-dir=.build-id" + - " --build-id-link-input=.debug" + " --build-id-link-output=" + - " \"$unstripped_outfile\" \"$outfile\"" - } - } - description = "SOLINK $outfile" - default_output_dir = "{{root_out_dir}}" - output_prefix = "lib" - outputs = [ - outfile, - ] - if (outfile != unstripped_outfile) { - outputs += [ unstripped_outfile ] - } - } - - tool("solink_module") { - outname = "{{target_output_name}}{{output_extension}}" - outfile = "{{output_dir}}/$outname" - rspfile = "$outfile.rsp" - if (use_strip) { - unstripped_outfile = "{{root_out_dir}}/lib.unstripped/{{target_output_name}}{{output_extension}}" - } else { - unstripped_outfile = outfile - } - if (invoker.toolchain_os == "mac") { - command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{libs}} {{solibs}}" - rspfile_content = "{{inputs_newline}}" - default_output_extension = ".dylib" - } else { - command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,--Map=\"$unstripped_outfile.map\" -Wl,-soname=\"$outname\" @\"$rspfile\"" - rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" - default_output_extension = ".so" - } - if (use_strip) { - if (invoker.toolchain_os == "mac") { - command += " && $strip -x \"$unstripped_outfile\" -o \"$outfile\"" - } else { - command += - " && $strip --strip-all" + " --build-id-link-dir=.build-id" + - " --build-id-link-input=.debug" + " --build-id-link-output=" + - " \"$unstripped_outfile\" \"$outfile\"" - } - } - description = "SOLINK $outfile" - default_output_dir = "{{root_out_dir}}" - outputs = [ - outfile, - ] - if (outfile != unstripped_outfile) { - outputs += [ unstripped_outfile ] - } - } - - tool("link") { - outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = "$outfile.rsp" - unstripped_outfile = outfile - if (use_strip) { - unstripped_outfile = "{{root_out_dir}}/exe.unstripped/{{target_output_name}}{{output_extension}}" - } - if (invoker.toolchain_os == "mac") { - command = "$ld {{ldflags}} -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}}" - rspfile_content = "{{inputs_newline}}" - } else { - command = "$ld {{ldflags}} -o \"$unstripped_outfile\" -Wl,--Map=\"$unstripped_outfile.map\" -Wl,--start-group @\"$rspfile\" {{solibs}} -Wl,--end-group {{libs}}" - rspfile_content = "{{inputs}}" - } - if (use_strip) { - if (invoker.toolchain_os == "mac") { - command += " && $strip \"$unstripped_outfile\" -o \"$outfile\"" - } else { - command += - " && " + "$strip --strip-sections" + - " --build-id-link-dir=.build-id" + - " --build-id-link-input=.debug" + " --build-id-link-output=" + - " \"$unstripped_outfile\" \"$outfile\"" - } - } - description = "LINK $outfile" - default_output_dir = "{{root_out_dir}}" - outputs = [ - outfile, - ] - if (outfile != unstripped_outfile) { - outputs += [ unstripped_outfile ] - } - } - - tool("stamp") { - command = stamp_command - description = stamp_description - } - tool("copy") { - command = copy_command - description = copy_description - } - - # When invoking this toolchain not as the default one, these args will be - # passed to the build. They are ignored when this is the default toolchain. - toolchain_args = { - current_cpu = invoker.toolchain_cpu - current_os = invoker.toolchain_os - - # These values need to be passed through unchanged. - target_os = target_os - target_cpu = target_cpu - - if (defined(invoker.toolchain_args)) { - # The invoker isn't allowed to fiddle with the essential settings. - forward_variables_from(invoker.toolchain_args, - "*", - [ - "current_cpu", - "current_os", - "target_os", - "target_cpu", - ]) - } - } - } -} - -# Private subroutine of clang_toolchain_suite(), below. -template("_clang_toolchain_variant") { - this_variant = invoker.this_variant - this_invoker = invoker.this_invoker - not_needed([ "this_invoker" ]) - - # Every toolchain needs the global select_variant_canonical passed - # down explicitly via toolchain_args. See BUILDCONFIG.gn. - pass_through_canonical = select_variant_canonical - - clang_toolchain(target_name) { - forward_variables_from(invoker.clang_toolchain_args, "*") - toolchain_args = { - # GN's "can't overwrite a nonempty scope/list" rule also applies - # to shadowing bindings in inner scopes. Since there is always - # a global binding of `toolchain_variant` that is being shadowed - # here, we have to set it to the empty scope first. - toolchain_variant = { - } - toolchain_variant = { - forward_variables_from(this_variant, "*") - is_pic_default = invoker.this_pic_default - } - if (defined(this_variant.toolchain_args)) { - forward_variables_from(this_variant.toolchain_args, "*") - } - if (defined(this_invoker.toolchain_args)) { - forward_variables_from(this_invoker.toolchain_args, "*") - } - - # See comment above. - select_variant_canonical = [] - select_variant_canonical = pass_through_canonical - } - } -} - -# Defines a standard suite of Clang-based toolchains. -# -# Parameters -# -# with_shared: -# Optional: If this toolchain will have a "-shared" companion. -# (Each variant toolchain has its own "-shared" companion.) -# Pre-set to true. Set this to false if either no shared libraries -# are used in this toolchain, or it's used to build nothing but -# shared libraries anyway. -# -# See clang_toolchain for others. Most parameters are just forwarded there. -# -template("clang_toolchain_suite") { - # First get a canonicalized, flat list of variant specs that includes the - # null variant. Canonical variants don't have `host_only`/`target_only` but - # instead take the body of one or the other, have [] for any missing list - # fields, have .suffix as well as .name (or implied .name), and have .base. - is_host = defined(invoker.toolchain_os) && invoker.toolchain_os == host_os - not_needed([ "is_host" ]) - variants = [] - foreach(variant, [ false ] + known_variants) { - variants += [ - { - base = get_label_info(":$target_name", "label_no_toolchain") - configs = [] - remove_common_configs = [] - remove_shared_configs = [] - deps = [] - if (variant == false) { - name = "" - suffix = "" - } else { - if (is_host) { - if (defined(variant.host_only)) { - forward_variables_from(variant.host_only, "*") - } - } else { - if (defined(variant.target_only)) { - forward_variables_from(variant.target_only, "*") - } - } - forward_variables_from(variant, - "*", - [ - "host_only", - "target_only", - ]) - if (!defined(name)) { - name = "" - assert(configs != [], - "variant with no name must include nonempty configs") - foreach(config, configs) { - if (name != "") { - name += "-" - } - name += get_label_info(config, "name") - } - } - suffix = "-$name" - } - }, - ] - } - - # Now elaborate the list with all the universal variant combinations. - # Each universal variant becomes its own standalone variant when - # combined with the null variant. - # TODO(crbug.com/818525): The `+ []` works around a bug that crashes - # GN with heap-use-after-free: the no-op `+` forces a copy of the list - # in `variants`; without it, GN uses the same std::vector object in - # the looping logic that it mutates in place for `variants +=`. - foreach(variant, variants + []) { - foreach(universal_variant, universal_variants) { - variants += [ - { - forward_variables_from(variant, "*", [ "toolchain_args" ]) - toolchain_args = { - if (defined(variant.toolchain_args)) { - forward_variables_from(variant.toolchain_args, "*") - } - if (defined(universal_variant.toolchain_args)) { - forward_variables_from(universal_variant.toolchain_args, "*") - } - } - if (name == "") { - name = universal_variant.name - } else { - name += "-${universal_variant.name}" - } - suffix += "-${universal_variant.name}" - configs += universal_variant.configs - if (defined(universal_variant.remove_common_configs)) { - remove_common_configs += universal_variant.remove_common_configs - } - if (defined(universal_variant.remove_shared_configs)) { - remove_shared_configs += universal_variant.remove_shared_configs - } - if (defined(universal_variant.deps)) { - deps += universal_variant.deps - } - }, - ] - } - } - - # Exclude the arguments that are for us or are verboten. - invoker_clang_toolchain_args = { - forward_variables_from(invoker, - "*", - [ - "toolchain_args", - "toolchain_variant", - "with_shared", - "variants", - ]) - } - not_needed([ "invoker_clang_toolchain_args" ]) - - # Build up an array of boolean that's parallel to `select_variant`. - # Below, we'll set `selectors_used[i]` to true when `select_variant[i]` - # matches the name of some variant. - selectors_used = [] - i = 0 - foreach(selector, select_variant_canonical) { - selectors_used += [ false ] - i = i + 1 - } - - foreach(variant, variants) { - # Figure out if this variant is actually used. Don't bother to define - # toolchains for variants that are never used. This cuts down on extra - # GN processing so `gn gen` is faster. More importantly, it ensures - # that there isn't a toolchain defined using toolchain_args build - # arguments whose declare_args() block hasn't been imported because - # it's defined in a BUILD.gn file containing only configs that are - # never referenced by any target if the variant is never selected. - variant_used = variant.name == "" - if (!variant_used) { - i = 0 - foreach(selector, select_variant_canonical) { - assert(defined(selector.variant), - "`select_variant` clause missing `variant` field: $selector") - if (selector.variant == variant.name) { - variant_used = true - selectors_used[i] = true - } else if (selector.variant == false) { - selectors_used[i] = true - } - i = i + 1 - } - } - - if (variant_used) { - _clang_toolchain_variant("${target_name}${variant.suffix}") { - clang_toolchain_args = invoker_clang_toolchain_args - this_variant = variant - this_invoker = invoker - this_pic_default = false - } - if (invoker.with_shared) { - _clang_toolchain_variant("${target_name}${variant.suffix}-shared") { - clang_toolchain_args = { - forward_variables_from(invoker_clang_toolchain_args, "*") - propagates_configs = true - } - this_variant = variant - this_invoker = invoker - this_pic_default = true - } - } - } - } - - i = 0 - foreach(selector, select_variant_canonical) { - assert(selectors_used[i], - "unknown variant in `select_variant` clause: ${selector}") - i = i + 1 - } - not_needed([ "selectors_used" ]) -} - -set_defaults("clang_toolchain_suite") { - with_shared = true -} - -template("clang_host_toolchain_suite") { - not_needed([ "invoker" ]) - clang_toolchain_suite(target_name) { - toolchain_cpu = host_cpu - toolchain_os = host_os - - with_shared = false - use_strip = false - } -}
diff --git a/toolchain/fuchsia/BUILD.gn b/toolchain/fuchsia/BUILD.gn deleted file mode 100644 index 1d9e124..0000000 --- a/toolchain/fuchsia/BUILD.gn +++ /dev/null
@@ -1,18 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. 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/toolchain/clang_toolchain.gni") - -clang_toolchain_suite(target_cpu) { - toolchain_cpu = target_cpu - toolchain_os = target_os - - use_strip = true - - # Depend on the Zircon build to ensure the sysroot is available by the time - # we start compiling stuff. - deps = [ - "//zircon/public/sysroot(//build/zircon:zircon_toolchain)", - ] -}
diff --git a/toolchain/goma.gni b/toolchain/goma.gni deleted file mode 100644 index 5db0583..0000000 --- a/toolchain/goma.gni +++ /dev/null
@@ -1,13 +0,0 @@ -# Copyright 2016 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Defines the configuration of Goma. - -declare_args() { - # Set to true to enable distributed compilation using Goma. - use_goma = false - - # Absolute directory containing the Goma source code. - goma_dir = getenv("HOME") + "/goma" -}
diff --git a/toolchain/variant.gni b/toolchain/variant.gni deleted file mode 100644 index 0492fee..0000000 --- a/toolchain/variant.gni +++ /dev/null
@@ -1,44 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Template to define a config for use in the `known_variants` list. -# `variant` is used just like `config`, but it also accepts two other -# optional parameters: -# -# common_flags -# This is a shorthand for appending the same thing to cflags, -# asmflags, and ldflags. Most flags that affect code generation -# should be used uniformly in compilation, assembly, and linking. -# If cflags, asmflags, or ldflags is also specified, common_flags -# will be appended to it. -# -# deps -# This lists labels that will be automatically added to the deps list -# of each executable target built in this variant. -# -template("variant") { - config(target_name) { - asmflags = [] - cflags = [] - ldflags = [] - forward_variables_from(invoker, - "*", - [ - "common_flags", - "deps", - ]) - if (defined(invoker.common_flags)) { - asmflags += invoker.common_flags - cflags += invoker.common_flags - ldflags += invoker.common_flags - } - } - group("${target_name}_deps") { - # Propagate it as public_deps so that targets in deps can have - # public_configs that will be applied to variant executables. - if (defined(invoker.deps)) { - public_deps = invoker.deps - } - } -}
diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index 79b8b77..0000000 --- a/tools/README.md +++ /dev/null
@@ -1,5 +0,0 @@ -This directory contains a collection of tools used in the GN build: -- [JSON merge](json_merge/): merges JSON files; -- [JSON validator](json_validator/): verifies that JSON files match a given - schema; -- [Tar maker](tar_maker/): efficiently creates tarballs from file manifests.
diff --git a/tools/json_merge/BUILD.gn b/tools/json_merge/BUILD.gn deleted file mode 100644 index 0f017be..0000000 --- a/tools/json_merge/BUILD.gn +++ /dev/null
@@ -1,48 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/host.gni") -import("//build/test.gni") - -source_set("srcs") { - sources = [ - "json_merge.cc", - "json_merge.h", - ] - - public_deps = [ - "//third_party/rapidjson", - ] -} - -executable("json_merge") { - sources = [ - "main.cc", - ] - - deps = [ - ":srcs", - ] -} - -test("json_merge_test") { - sources = [ - "test.cc", - ] - - deps = [ - ":srcs", - "//third_party/googletest:gtest_main", - ] -} - -install_host_tools("install") { - deps = [ - ":json_merge", - ] - - outputs = [ - "json_merge", - ] -}
diff --git a/tools/json_merge/example/BUILD.gn b/tools/json_merge/example/BUILD.gn deleted file mode 100644 index 9d2a291..0000000 --- a/tools/json_merge/example/BUILD.gn +++ /dev/null
@@ -1,14 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/tools/json_merge/json_merge.gni") - -json_merge("merged.json") { - sources = [ - "black_white.json", - "rgb.json", - ] - - minify = true -}
diff --git a/tools/json_merge/example/black_white.json b/tools/json_merge/example/black_white.json deleted file mode 100644 index db5d907..0000000 --- a/tools/json_merge/example/black_white.json +++ /dev/null
@@ -1,14 +0,0 @@ -{ - "black": { - "code": { - "rgba": [0,0,0,1], - "hex": "#000" - } - }, - "white": { - "code": { - "rgba": [0,0,0,1], - "hex": "#FFF" - } - } -}
diff --git a/tools/json_merge/example/rgb.json b/tools/json_merge/example/rgb.json deleted file mode 100644 index 5949376..0000000 --- a/tools/json_merge/example/rgb.json +++ /dev/null
@@ -1,20 +0,0 @@ -{ - "red": { - "code": { - "rgba": [255,0,0,1], - "hex": "#F00" - } - }, - "green": { - "code": { - "rgba": [0,255,0,1], - "hex": "#0F0" - } - }, - "blue": { - "code": { - "rgba": [0,0,255,1], - "hex": "#00F" - } - } -}
diff --git a/tools/json_merge/json_merge.cc b/tools/json_merge/json_merge.cc deleted file mode 100644 index f041531..0000000 --- a/tools/json_merge/json_merge.cc +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "build/tools/json_merge/json_merge.h" - -#include "rapidjson/document.h" -#include "rapidjson/error/en.h" -#include "rapidjson/filewritestream.h" -#include "rapidjson/istreamwrapper.h" -#include "rapidjson/ostreamwrapper.h" -#include "rapidjson/prettywriter.h" -#include "rapidjson/writer.h" - -int JSONMerge(const std::vector<struct input_file>& inputs, - std::ostream& output, std::ostream& errors, bool minify) { - rapidjson::Document merged; - merged.SetObject(); - auto& allocator = merged.GetAllocator(); - - for (auto input_it = inputs.begin(); input_it != inputs.end(); ++input_it) { - rapidjson::IStreamWrapper isw(*input_it->contents.get()); - rapidjson::Document input_doc; - rapidjson::ParseResult parse_result = input_doc.ParseStream(isw); - if (!parse_result) { - errors << "Failed to parse " << input_it->name << "!\n"; - errors << rapidjson::GetParseError_En(parse_result.Code()) << " (offset " - << parse_result.Offset() << ")\n"; - return 1; - } - if (!input_doc.IsObject()) { - errors << input_it->name << " is not a JSON object!\n"; - return 1; - } - - for (auto value_it = input_doc.MemberBegin(); - value_it != input_doc.MemberEnd(); ++value_it) { - if (merged.HasMember(value_it->name)) { - errors << input_it->name << " has a conflicting value for key \"" - << value_it->name.GetString() << "\"!\n"; - return 1; - } - merged.AddMember(value_it->name, - rapidjson::Value(value_it->value, allocator).Move(), - allocator); - } - } - - rapidjson::OStreamWrapper osw(output); - if (minify) { - rapidjson::Writer<rapidjson::OStreamWrapper> writer(osw); - merged.Accept(writer); - } else { - rapidjson::PrettyWriter<rapidjson::OStreamWrapper> writer(osw); - merged.Accept(writer); - } - - return 0; -}
diff --git a/tools/json_merge/json_merge.gni b/tools/json_merge/json_merge.gni deleted file mode 100644 index 989bf6b..0000000 --- a/tools/json_merge/json_merge.gni +++ /dev/null
@@ -1,67 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/compiled_action.gni") - -# Merge one or more json files. -# -# If any input is not a valid JSON, the merge operation will fail. Consequently -# you can "merge" one JSON file to perform validation. -# If any two inputs overlap in key space, the merge operation will fail. -# Optionally the merged output can be minified. Consequently you can "merge" -# one JSON file to perform minification. -# -# Parameters -# -# sources (required) -# [files list] One or more JSON files to merge. -# -# minify (optional) -# [boolean] Whether to minify the result. -# Minified JSON is functionally equivalent but less readable to humans. -# -# testonly (optional) -# visibility (optional) -# Standard GN meaning. -# -# Example of usage: -# -# json_merge("merged.json") { -# sources = [ "one.json", "two.json" ] -# minify = true -# } -template("json_merge") { - compiled_action(target_name) { - forward_variables_from(invoker, - [ - "deps", - "sources", - "testonly", - "visibility", - "minify", - ]) - - tool = "//build/tools/json_merge" - - merged_output = "$target_out_dir/$target_name" - outputs = [ - merged_output, - ] - - args = [] - foreach(source, sources) { - args += [ - "--input", - rebase_path(source, root_build_dir), - ] - } - args += [ - "--output", - rebase_path(merged_output, root_build_dir), - ] - if (defined(minify) && minify) { - args += [ "--minify" ] - } - } -}
diff --git a/tools/json_merge/json_merge.h b/tools/json_merge/json_merge.h deleted file mode 100644 index f42d14e..0000000 --- a/tools/json_merge/json_merge.h +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BUILD_TOOLS_JSON_MERGE_JSON_MERGE_H_ -#define BUILD_TOOLS_JSON_MERGE_JSON_MERGE_H_ - -#include <iostream> -#include <memory> -#include <vector> - -struct input_file { - std::string name; - std::unique_ptr<std::istream> contents; -}; - -// Merge one or more JSON documents. -// Returns zero if successful. -// On non-zero return value, writes human-readable errors to |errors|. -// If |minify| then output merged JSON will be minified. -int JSONMerge(const std::vector<struct input_file>& inputs, - std::ostream& output, std::ostream& errors, bool minify); - -#endif // BUILD_TOOLS_JSON_MERGE_JSON_MERGE_H_
diff --git a/tools/json_merge/main.cc b/tools/json_merge/main.cc deleted file mode 100644 index 34458f7..0000000 --- a/tools/json_merge/main.cc +++ /dev/null
@@ -1,83 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <getopt.h> -#include <cstdio> -#include <fstream> -#include <iostream> -#include <memory> -#include <utility> -#include <vector> - -#include "build/tools/json_merge/json_merge.h" - -static void usage(const char* exe_name) { - fprintf( - stderr, - "Usage: %s --input [infile] [--output outfile] [--minify]\n" - "\n" - "Merge one or more JSON files to a single JSON file.\n" - "If any input is not a valid JSON, the merge operation will fail.\n" - "Consequently you can \"merge\" one JSON file to perform validation.\n" - "If any two inputs overlap in the top-level key space, the merge " - "operation will fail.\n" - "Optionally the merged output can be minified.\n" - "Consequently you can \"merge\" one JSON file to perform " - "minification.\n" - "\n" - "Example usages:\n" - "%s --input in1.json --input in2.json # merges to STDOUT\n" - "%s --input in1.json --minify --output out.json # minifies to out.json\n" - "%s --help # prints this message\n", - exe_name, exe_name, exe_name, exe_name); -} - -int main(int argc, char** argv) { - std::vector<input_file> inputs; - std::ofstream output_file; - auto output_buf = std::cout.rdbuf(); - bool minify = false; - - static struct option long_options[] = { - {"input", required_argument, 0, 'i'}, - {"output", required_argument, 0, 'o'}, - {"minify", no_argument, 0, 'm'}, - {"help", no_argument, 0, 'h'}, - }; - - int opt; - while ((opt = getopt_long(argc, argv, "iomh", long_options, nullptr)) != -1) { - switch (opt) { - case 'i': { - auto input = std::make_unique<std::ifstream>(optarg); - if (!input->is_open()) { - fprintf(stderr, "Could not read from input file %s\n", optarg); - return 1; - } - inputs.push_back({.name = optarg, .contents = std::move(input)}); - break; - } - - case 'o': - output_file.open(optarg); - if (!output_file.is_open()) { - fprintf(stderr, "Could not write to output file %s\n", optarg); - return 1; - } - output_buf = output_file.rdbuf(); - break; - - case 'm': - minify = true; - break; - - case 'h': - usage(argv[0]); - return 0; - } - } - - std::ostream output(output_buf); - return JSONMerge(inputs, output, std::cerr, minify); -}
diff --git a/tools/json_merge/test.cc b/tools/json_merge/test.cc deleted file mode 100644 index 5c412a2..0000000 --- a/tools/json_merge/test.cc +++ /dev/null
@@ -1,113 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <sstream> - -#include "build/tools/json_merge/json_merge.h" -#include "gtest/gtest.h" - -namespace { - -class JsonMerge : public ::testing::Test { - protected: - void AddInput(const std::string& filename, const std::string& input) { - inputs.push_back({.name = filename, - .contents = std::make_unique<std::istringstream>(input)}); - } - - int Merge(bool minify) { return JSONMerge(inputs, output, errors, minify); } - - std::string Output() { return output.str(); } - - std::string Errors() { return errors.str(); } - - void ExpectNoErrors() { EXPECT_TRUE(Errors().empty()); } - - void ExpectError(const std::string& expected_error) { - EXPECT_EQ(Errors(), expected_error); - } - - private: - std::vector<input_file> inputs; - std::ostringstream output; - std::ostringstream errors; -}; - -TEST_F(JsonMerge, MergeOne) { - const std::string input = R"JSON({ - "key1": { - "key2": [ - "value1", - "value2", - "value3" - ], - "key3": "value4" - } -})JSON"; - AddInput("file1.json", input); - - EXPECT_EQ(Merge(false), 0); - EXPECT_EQ(Output(), input); - ExpectNoErrors(); -} - -TEST_F(JsonMerge, MergeOneAndMinify) { - const std::string input = R"JSON({ - "key1": { - "key2": [ - "value1", - "value2", - "value3" - ], - "key3": "value4" - } -})JSON"; - AddInput("file1.json", input); - - EXPECT_EQ(Merge(true), 0); - const std::string output = - R"JSON({"key1":{"key2":["value1","value2","value3"],"key3":"value4"}})JSON"; - EXPECT_EQ(Output(), output); - ExpectNoErrors(); -} - -TEST_F(JsonMerge, MergeThree) { - const std::string input1 = R"JSON({ - "key1": "value1" -})JSON"; - AddInput("file1.json", input1); - const std::string input2 = R"JSON({ - "key2": "value2" -})JSON"; - AddInput("file2.json", input2); - const std::string input3 = R"JSON({ - "key3": "value3" -})JSON"; - AddInput("file3.json", input3); - - EXPECT_EQ(Merge(false), 0); - const std::string output = R"JSON({ - "key1": "value1", - "key2": "value2", - "key3": "value3" -})JSON"; - EXPECT_EQ(Output(), output); - ExpectNoErrors(); -} - -TEST_F(JsonMerge, MergeConflict) { - const std::string input1 = R"JSON({ - "key1": "value1" -})JSON"; - AddInput("file1.json", input1); - const std::string input2 = R"JSON({ - "key1": "value2" -})JSON"; - AddInput("file2.json", input2); - - EXPECT_NE(Merge(false), 0); - ExpectError("file2.json has a conflicting value for key \"key1\"!\n"); -} - -} // namespace
diff --git a/tools/json_validator/BUILD.gn b/tools/json_validator/BUILD.gn deleted file mode 100644 index bc071b8..0000000 --- a/tools/json_validator/BUILD.gn +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/host.gni") - -executable("json_validator") { - sources = [ - "main.cc", - ] - - deps = [ - "//third_party/rapidjson", - ] -} - -install_host_tools("install") { - deps = [ - ":json_validator", - ] - - outputs = [ - "json_validator", - ] -}
diff --git a/tools/json_validator/README.md b/tools/json_validator/README.md deleted file mode 100644 index ecbccb5..0000000 --- a/tools/json_validator/README.md +++ /dev/null
@@ -1,30 +0,0 @@ -# JSON validator - -The present tool verifies JSON files against schemas defined with -[JSON Schema][json_schema]. - -## Usage - -``` -json_validator <path to schema> <path to file to verify> [path to stamp file] -``` - -The third argument represents the path to a stamp file which gets updated when -the tool runs successfully. This argument is mostly designed for integration -with GN actions. - -## Schema references - -The schema passed to the tool may refer to other schema files. The tool will be -able to locate schema references for schemas specified as paths relative to the -folder containing the main schema. - -For example, if the tool is given a schema `/path/to/main_schema.json` and that -schema contains a reference to `file:another/sub_schema.json#/definitions/foo`, -the tool will look for the second schema at `path/to/another/sub_schema.json`. - -Paths to schemas may be specified as `file:another/sub_schema.json` or more -simply `another/sub_schema.json`. - - -[json_schema]: http://json-schema.org/
diff --git a/tools/json_validator/main.cc b/tools/json_validator/main.cc deleted file mode 100644 index e55b2f3..0000000 --- a/tools/json_validator/main.cc +++ /dev/null
@@ -1,141 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <libgen.h> - -#include <fstream> -#include <map> -#include <regex> -#include <string> - -#include "rapidjson/document.h" -#include "rapidjson/schema.h" -#include "rapidjson/stringbuffer.h" - -using namespace rapidjson; - -// Reads the content of a file into a JSON document. -bool ReadDocument(std::string file, Document* document) { - std::ifstream file_stream(file); - if (!file_stream.is_open()) { - fprintf(stderr, "Error: unable to open file %s.\n", file.c_str()); - return false; - } - std::string content((std::istreambuf_iterator<char>(file_stream)), - std::istreambuf_iterator<char>()); - file_stream.close(); - if (document->Parse(content).HasParseError()) { - fprintf(stderr, "Error: unable to parse JSON in file %s.\n", file.c_str()); - return false; - } - return true; -} - -// A schema provider that can find schemas specified as URIs/paths relative to -// the main schema. -class LocalSchemaProvider : public IRemoteSchemaDocumentProvider { - - public: - explicit LocalSchemaProvider(const std::string directory) : - directory_(directory), - has_errors_(false) {} - ~LocalSchemaProvider() override {} - - const SchemaDocument* GetRemoteDocument( - const char* uri, SizeType length) override { - std::string input(uri, length); - std::smatch matches; - std::regex pattern("^(file:)?([^/#:]+)$"); - if (!std::regex_search(input, matches, pattern)) { - fprintf(stderr, "Error: could not find schema %s.\n", input.c_str()); - has_errors_ = true; - return nullptr; - } - std::string file_name = matches[matches.size() == 2 ? 1 : 2].str(); - if (documents_[file_name]) { - return documents_[file_name].get(); - } - Document schema_document; - std::string file_path = directory_ + "/" + file_name; - if (!ReadDocument(file_path, &schema_document)) { - // ReadDocument already prints a useful error message. - has_errors_ = true; - return nullptr; - } - documents_[file_name] = std::make_unique<SchemaDocument>(schema_document); - return documents_[file_name].get(); - } - - // Returns true if some schemas could not be resolved. - // By default, missing schemas are just ignored. - bool HasErrors() { - return has_errors_; - } - - private: - // Map of resolved documents. - std::map<std::string, std::unique_ptr<SchemaDocument>> documents_; - // Base directory for schema paths. - const std::string directory_; - // Whether some schema references could not be resolved. - bool has_errors_; -}; - -// Returns the base directory of a given file. -std::string BaseDir(const std::string file) { - char* file_copy = strdup(file.c_str()); - char* base = dirname(file_copy); - std::string result(base); - free(file_copy); - return result; -} - -int main(int argc, const char** argv) { - if (argc < 3 || argc > 4) { - printf("Usage: %s <schema> <file> [stamp]\n", argv[0]); - return 1; - } - const std::string schema_path = argv[1]; - const std::string file_path = argv[2]; - - Document schema_document; - if (!ReadDocument(schema_path, &schema_document)) { - return 1; - } - Document file_document; - if (!ReadDocument(file_path, &file_document)) { - return 1; - } - - std::string schema_base = BaseDir(schema_path); - LocalSchemaProvider provider(schema_base); - SchemaDocument schema(schema_document, nullptr /* uri */, 0 /* uriLength */, - &provider); - SchemaValidator validator(schema); - if (!file_document.Accept(validator)) { - fprintf(stderr, "Error: the file %s is invalid according to schema %s.\n", - file_path.c_str(), schema_path.c_str()); - StringBuffer buffer; - validator.GetInvalidSchemaPointer().StringifyUriFragment(buffer); - fprintf(stderr, " - location in schema %s\n", buffer.GetString()); - fprintf(stderr, " - affected keyword %s\n", - validator.GetInvalidSchemaKeyword()); - buffer.Clear(); - validator.GetInvalidDocumentPointer().StringifyUriFragment(buffer); - fprintf(stderr, " - document reference %s\n", buffer.GetString()); - return 1; - } - if (provider.HasErrors()) { - return 1; - } - - if (argc == 4) { - // Write the stamp file if one was given. - std::string stamp_path = argv[3]; - std::ofstream stamp(stamp_path); - stamp.close(); - } - - return 0; -}
diff --git a/tools/tar_maker/BUILD.gn b/tools/tar_maker/BUILD.gn deleted file mode 100644 index 3163080..0000000 --- a/tools/tar_maker/BUILD.gn +++ /dev/null
@@ -1,22 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. 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/go/go_binary.gni") -import("//build/go/go_library.gni") - -go_library("lib") { - name = "fuchsia.googlesource.com/tarmaker" - - sources = [ - "main.go", - ] -} - -go_binary("tar_maker") { - gopackage = "fuchsia.googlesource.com/tarmaker" - - deps = [ - ":lib", - ] -}
diff --git a/tools/tar_maker/main.go b/tools/tar_maker/main.go deleted file mode 100755 index 4050a36..0000000 --- a/tools/tar_maker/main.go +++ /dev/null
@@ -1,154 +0,0 @@ -///bin/true ; exec /usr/bin/env go run "$0" "$@" -// Copyright 2017 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package main - -import ( - "archive/tar" - "bufio" - "compress/gzip" - "flag" - "fmt" - "io" - "log" - "os" - "path/filepath" - "strings" -) - -var output = flag.String("output", "", "Path to the generated tarball") -var manifest = flag.String("manifest", "", "Path to the file containing a description of the tarball's contents") - -func archiveFile(tw *tar.Writer, src, dest string) error { - file, err := os.Open(src) - if err != nil { - return err - } - defer file.Close() - info, err := file.Stat() - if err != nil { - return err - } - - hdr, err := tar.FileInfoHeader(info, info.Name()) - if err != nil { - return err - } - hdr.Name = dest - hdr.Uid = 0 - hdr.Gid = 0 - if err := tw.WriteHeader(hdr); err != nil { - return err - } - _, err = io.Copy(tw, file) - return err -} - -func archiveDirectory(tw *tar.Writer, src, dest string) error { - return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - fileDest := filepath.Join(dest, path[len(src)+1:]) - return archiveFile(tw, path, fileDest) - }) -} - -func createTar(archive string, mappings map[string]string) error { - file, err := os.Create(archive) - if err != nil { - return err - } - defer file.Close() - - gw := gzip.NewWriter(file) - defer gw.Close() - tw := tar.NewWriter(gw) - defer tw.Close() - - for dest, src := range mappings { - info, err := os.Stat(src) - if err != nil { - return err - } - if info.IsDir() { - err = archiveDirectory(tw, src, dest) - } else { - err = archiveFile(tw, src, dest) - } - if err != nil { - return err - } - } - - return nil -} - -func readManifest(manifest string) (map[string]string, error) { - file, err := os.Open(manifest) - if err != nil { - return nil, err - } - defer file.Close() - - result := make(map[string]string) - - scanner := bufio.NewScanner(file) - for scanner.Scan() { - parts := strings.SplitN(scanner.Text(), "=", 2) - result[parts[0]] = parts[1] - } - - if err := scanner.Err(); err != nil { - return nil, err - } - - return result, nil -} - -func generateArchive(manifest string, output string) error { - if _, err := os.Stat(output); err == nil { - // The file exists, need to remove it first. - if err := os.Remove(output); err != nil { - return err - } - } - mappings, err := readManifest(manifest) - if err != nil { - return err - } - return createTar(output, mappings) -} - -func main() { - flag.Usage = func() { - fmt.Fprintf(os.Stderr, `Usage: tar_maker --manifest path/to/manifest - -This tool creates a tarball whose contents are described in a file manifest. -Each line in the manifest should be of the form: - <path in tarball>=<path to source file or dir> - -The tarball is compressed using gzip. -`) - flag.PrintDefaults() - } - flag.Parse() - - if *output == "" { - flag.Usage() - log.Fatalf("Error: missing -output flag.") - } - if *manifest == "" { - flag.Usage() - log.Fatalf("Error: missing -manifest flag.") - } - - if err := generateArchive(*manifest, *output); err != nil { - log.Fatalf("Error: unable to create archive %s: %v", *output, err) - } -}
diff --git a/vulkan/config.gni b/vulkan/config.gni deleted file mode 100644 index a9cde0d..0000000 --- a/vulkan/config.gni +++ /dev/null
@@ -1,11 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # Consolidated build toggle for use of Vulkan across Fuchsia - fuchsia_use_vulkan = true - - # Path to Fuchsia Vulkan SDK - fuchsia_vulkan_sdk = "//third_party/vulkan_loader_and_validation_layers" -}
diff --git a/zircon/BUILD.gn b/zircon/BUILD.gn deleted file mode 100644 index 6009382..0000000 --- a/zircon/BUILD.gn +++ /dev/null
@@ -1,28 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Define a toolchain to build Zircon in. -# This allows us to let the target and host toolchains depend on Zircon, which -# in turn ensure Zircon is built before everything else. -toolchain("zircon_toolchain") { - tool("stamp") { - command = "touch {{output}}" - description = "STAMP {{output}}" - } - - tool("copy") { - # We use link instead of copy; the way "copy" tool is being used is - # compatible with links since Ninja is tracking changes to the source. - command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" - description = "COPY {{source}} {{output}}" - } - - toolchain_args = { - toolchain_variant = { - } - toolchain_variant = { - base = get_label_info(":zircon_toolchain", "label_no_toolchain") - } - } -}
diff --git a/zircon/MAINTAINERS b/zircon/MAINTAINERS deleted file mode 100644 index 851c897..0000000 --- a/zircon/MAINTAINERS +++ /dev/null
@@ -1 +0,0 @@ -pylaligand@google.com
diff --git a/zircon/README.md b/zircon/README.md deleted file mode 100644 index 2523aea..0000000 --- a/zircon/README.md +++ /dev/null
@@ -1,35 +0,0 @@ -GN support for Zircon -===================== - -This folder contains utilities that help Zircon artifacts better integrate into -the GN build without having to manually maintain GN build files in sync with the -existing `rules.mk` build files specific to Zircon. -It also makes it so that targets in upper layers don't need to know about the -structure of Zircon's output directory in order to use Zircon build artifacts, -as knowledge of that structure is confined within the generated GN build files. - -### Process - -The main build file [`//build/gn/BUILD.gn`](../gn/BUILD.gn) calls the -[`//build/zircon/create_gn_rules.py`](create_gn_rules.py) script to produce -`BUILD.gn` files for Zircon. - -That script uses a special, fast build of Zircon (`make packages`) to generate -manifests for artifacts that are meant to be consumed by upper layers of the -Fuchsia stack. These manifest are then turned into GN build files under -[`//zircon/public`][zircon-public] whose targets other parts of the codebase -can depend on. - -This script is run early in the build process, before any other build file gets -evaluated. This ensure that non-Zircon build files can safely depend on the -generated targets. - -In order to keep the generated build files up-to-date, that process is repeated -every time a file changes under `//zircon`. - -Note that the generated GN files should only depend on the Zircon source code. -Invoking the Fuchsia build with different parameters on the same codebase should -produce identical files. - - -[zircon-public]: https://fuchsia.googlesource.com/zircon/+/master/public/
diff --git a/zircon/add_library_debug_data.py b/zircon/add_library_debug_data.py deleted file mode 100755 index e6b1113..0000000 --- a/zircon/add_library_debug_data.py +++ /dev/null
@@ -1,52 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -sys.path.append(os.path.join( - os.path.dirname(__file__), - os.pardir, - "cpp", -)) -import binaries - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--base', - help='Path to the base metadata file', - required=True) - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--lib-debug-file', - help='Path to the source debug version of the library', - required=True) - parser.add_argument('--debug-mapping', - help='Path to the file where to write the file mapping for the debug library', - required=True) - args = parser.parse_args() - - # The path of the debug file in the SDK depends on its build id. - debug_path = binaries.get_sdk_debug_path(args.lib_debug_file) - with open(args.debug_mapping, 'w') as mappings_file: - mappings_file.write(debug_path + '=' + args.lib_debug_file + '\n') - - with open(args.base, 'r') as base_file: - metadata = json.load(base_file) - - metadata['binaries'].values()[0]['debug'] = debug_path - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/zircon/add_sysroot_debug_data.py b/zircon/add_sysroot_debug_data.py deleted file mode 100755 index 9a87918..0000000 --- a/zircon/add_sysroot_debug_data.py +++ /dev/null
@@ -1,55 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import sys - -sys.path.append(os.path.join( - os.path.dirname(__file__), - os.pardir, - "cpp", -)) -import binaries - - -def main(): - parser = argparse.ArgumentParser('Builds a metadata file') - parser.add_argument('--base', - help='Path to the base metadata file', - required=True) - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--lib-debug-file', - help='Path to the source debug version of the library', - action='append') - parser.add_argument('--debug-mapping', - help='Path to the file where to write the file mapping for the debug library', - required=True) - args = parser.parse_args() - - debug_files = [] - - with open(args.debug_mapping, 'w') as mappings_file: - for debug_file in args.lib_debug_file: - debug_path = binaries.get_sdk_debug_path(debug_file) - mappings_file.write(debug_path + '=' + debug_file + '\n') - debug_files.append(debug_path) - - with open(args.base, 'r') as base_file: - metadata = json.load(base_file) - - metadata['versions'].values()[0]['debug_libs'] = debug_files - - with open(args.out, 'w') as out_file: - json.dump(metadata, out_file, indent=2, sort_keys=True) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/zircon/banjo.mako b/zircon/banjo.mako deleted file mode 100644 index 788e7ca..0000000 --- a/zircon/banjo.mako +++ /dev/null
@@ -1,21 +0,0 @@ -<%include file="header.mako" /> - -import("//build/banjo/banjo.gni") - -banjo("${data.name}") { - name = "${data.library}" - - sdk_category = "partner" - - sources = [ - % for source in sorted(data.sources): - "${source}", - % endfor - ] - - deps = [ - % for dep in sorted(data.banjo_deps): - "../${dep}", - % endfor - ] -}
diff --git a/zircon/banjo_dummy.mako b/zircon/banjo_dummy.mako deleted file mode 100644 index c933a0d..0000000 --- a/zircon/banjo_dummy.mako +++ /dev/null
@@ -1,15 +0,0 @@ -<%include file="header.mako" /> - -import("//build/banjo/banjo.gni") - -banjo_dummy("${data.name}") { - name = "${data.library}" - - sdk_category = "partner" - - sources = [ - % for source in sorted(data.sources): - "${source}", - % endfor - ] -}
diff --git a/zircon/boards.mako b/zircon/boards.mako deleted file mode 100644 index ebc97ec..0000000 --- a/zircon/boards.mako +++ /dev/null
@@ -1,14 +0,0 @@ -<%include file="header.mako" /> - -% for arch, boards in sorted(data.iteritems()): -${'else ' if not loop.first else ''}if (target_cpu == "${arch}") { - zircon_boards = [ - % for board in boards: - "${board}", - % endfor - ] -} -% endfor -else { - assert(false, "Unsupported architecture: $target_cpu.") -}
diff --git a/zircon/create_gn_rules.py b/zircon/create_gn_rules.py deleted file mode 100755 index 8c2df11..0000000 --- a/zircon/create_gn_rules.py +++ /dev/null
@@ -1,562 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import errno -import os -import re -import shutil -import subprocess -import sys - - -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -FUCHSIA_ROOT = os.path.dirname( # $root - os.path.dirname( # build - SCRIPT_DIR)) # zircon -ZIRCON_ROOT = os.path.join(FUCHSIA_ROOT, 'zircon') - -sys.path += [os.path.join(FUCHSIA_ROOT, 'third_party', 'mako')] -from mako.lookup import TemplateLookup -from mako.template import Template - - -# Packages included in the sysroot. -SYSROOT_PACKAGES = ['c', 'zircon'] - -# Prefixes of Zircon headers that should not appear in SDKs. -NON_SDK_SYSROOT_HEADER_PREFIXES = [ - 'zircon/device', - 'zircon/syscalls/definitions.rs', -] -# TODO(FIDL-273): remove this allowlist. -MANDATORY_SDK_HEADERS = [ - 'zircon/device/ioctl.h', # Needed by zircon/device/ramdisk.h - 'zircon/device/ioctl-wrapper.h', # Needed by zircon/device/ramdisk.h - # TODO(ZX-2503): remove this entry. - 'zircon/device/ramdisk.h', # Needed by fs-management/ramdisk.h - 'zircon/device/sysinfo.h', # Needed by some external clients -] - -# List of libraries with header files being transitioned from -# 'include/foo/foo.h' to 'include/lib/foo/foo.h'. During the transition, both -# the library's 'include/' and 'include/lib' directories are added to the -# include path so both old and new style include work. -# TODO(ZX-1871): Once everything in Zircon is migrated, remove this mechanism. -LIBRARIES_BEING_MOVED = ['zx'] - -# Prebuilt libraries for which headers shouldn't be included in an SDK. -# While this kind of mechanism exists in the GN build, there's no equivalent in -# the make build and we have to manually curate these libraries. -LIBRARIES_WITHOUT_SDK_HEADERS = ['trace-engine'] - -# Packages which should never appear in SDKs. -# Dependencies on these packages will not be reflected in generated rules. The -# lack of distinction between public and private deps in the make build system -# is the reason why this list is needed. -NON_SDK_DEPS = ['zircon-internal'] - -def make_dir(path, is_dir=False): - '''Creates the directory at `path`.''' - target = path if is_dir else os.path.dirname(path) - try: - os.makedirs(target) - except OSError as exception: - if exception.errno == errno.EEXIST and os.path.isdir(target): - pass - else: - raise - - -def try_remove(list, element): - '''Attempts to remove an element from a list, returning `true` if - successful.''' - try: - list.remove(element) - return True - except ValueError: - return False - - -def parse_package(lines): - '''Parses the content of a package file.''' - result = {} - section_exp = re.compile('^\[([^\]]+)\]$') - attr_exp = re.compile('^([^=]+)=(.*)$') - current_section = None - - def finalize_section(): - if not current_section: - return - if current_list and current_map: - raise Exception('Found both map-style and list-style section') - result[current_section] = (current_map if current_map - else current_list) - for line in lines: - section_match = section_exp.match(line) - if section_match: - finalize_section() - current_section = section_match.group(1) - current_list = [] - current_map = {} - continue - attr_match = attr_exp.match(line) - if attr_match: - name = attr_match.group(1) - value = attr_match.group(2) - current_map[name] = value - else: - current_list.append(line.strip()) - finalize_section() - return result - - -def extract_file(name, path, context, is_tool=False): - '''Extracts file path and base folder path from a map entry.''' - # name: foo/bar.h - # path: <SOURCE|BUILD>/somewhere/under/zircon/foo/bar.h - (full_path, changes) = re.subn('^SOURCE', context.source_base, path) - build_base = context.tool_build_base if is_tool else context.user_build_base - if not changes: - (full_path, changes) = re.subn('^BUILD', build_base, path) - if not changes: - raise Exception('Unknown pattern type: %s' % path) - folder = None - if full_path.endswith(name): - folder = os.path.relpath(full_path[:-len(name)], FUCHSIA_ROOT) - file = os.path.relpath(full_path, FUCHSIA_ROOT) - return (file, folder) - - -def filter_deps(deps): - '''Sanitizes a given dependency list.''' - return filter(lambda x: x not in SYSROOT_PACKAGES, deps) - - -def filter_sdk_deps(deps): - '''Sanitizes a given SDK dependency list.''' - return filter(lambda x: x not in NON_SDK_DEPS, deps) - - -def generate_build_file(path, template_name, data, context): - '''Creates a build file based on a template.''' - make_dir(path) - template = context.templates.get_template(template_name) - contents = template.render(data=data) - with open(path, 'w') as build_file: - build_file.write(contents) - - -class SourceLibrary(object): - '''Represents a library built from sources. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self, name): - self.name = name - self.includes = {} - self.include_dirs = set() - self.sources = {} - self.deps = [] - self.sdk_deps = [] - self.fidl_deps = [] - self.banjo_deps = [] - self.libs = set() - self.depends_on_zircon = False - - -def generate_source_library(package, context): - '''Generates the build glue for a library whose sources are provided.''' - lib_name = package['package']['name'] - data = SourceLibrary(lib_name) - - # Includes. - for name, path in package.get('includes', {}).iteritems(): - (file, folder) = extract_file(name, path, context) - data.includes[name] = '//%s' % file - data.include_dirs.add('//%s' % folder) - if lib_name in LIBRARIES_BEING_MOVED: - data.include_dirs.add('//%s/lib' % folder) - - # Source files. - for name, path in package.get('src', {}).iteritems(): - (file, _) = extract_file(name, path, context) - data.sources[name] = '//%s' % file - - # Dependencies. - data.deps += filter_deps(package.get('deps', [])) - data.deps += filter_deps(package.get('static-deps', [])) - data.fidl_deps = filter_deps(package.get('fidl-deps', [])) - data.banjo_deps = filter_deps(package.get('banjo-deps', [])) - data.sdk_deps = filter_sdk_deps(data.deps) - - # Special hack for zircon library dependency: enables special codegen - # in template depending on whether we're building on Fuchsia or not. - data.depends_on_zircon = 'zircon' in package.get('deps', []) - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'lib', lib_name, 'BUILD.gn') - generate_build_file(build_path, 'source_library.mako', data, context) - - -class CompiledLibrary(object): - '''Represents a library already compiled by the Zircon build. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self, name, with_sdk_headers): - self.name = name - self.includes = {} - self.include_dirs = set() - self.deps = [] - self.sdk_deps = [] - self.fidl_deps = [] - self.banjo_deps = [] - self.lib_name = '' - self.has_impl_prebuilt = False - self.impl_prebuilt = '' - self.prebuilt = '' - self.debug_prebuilt = '' - self.with_sdk_headers = with_sdk_headers - - -def generate_compiled_library(package, context): - '''Generates the build glue for a prebuilt library.''' - lib_name = package['package']['name'] - data = CompiledLibrary(lib_name, - lib_name not in LIBRARIES_WITHOUT_SDK_HEADERS) - - # Includes. - for name, path in package.get('includes', {}).iteritems(): - (file, folder) = extract_file(name, path, context) - data.include_dirs.add('//%s' % folder) - data.includes[name] = '//%s' % file - - # Lib. - libs = package.get('lib', {}) - if len(libs) == 1: - # Static library. - is_shared = False - (name, path) = libs.items()[0] - (file, _) = extract_file(name, path, context) - data.prebuilt = '//%s' % file - data.lib_name = os.path.basename(name) - # TODO(jamesr): Delete the == 2 path once Zircon rolls up through all layers - elif len(libs) == 2 or len(libs) == 3: - # Shared library. - is_shared = True - for name, path in libs.iteritems(): - (file, _) = extract_file(name, path, context) - if 'debug/' in name: - data.debug_prebuilt = '//%s' % file - data.lib_name = os.path.basename(name) - elif '.so.strip' in file: - data.has_impl_prebuilt = True - data.impl_prebuilt = '//%s' % file - else: - data.prebuilt = '//%s' % file - else: - raise Exception('Too many files for %s: %s' % (lib_name, - ', '.join(libs.keys()))) - - # Dependencies. - data.deps += filter_deps(package.get('deps', [])) - data.deps += filter_deps(package.get('static-deps', [])) - data.fidl_deps = filter_deps(package.get('fidl-deps', [])) - data.banjo_deps = filter_deps(package.get('banjo-deps', [])) - data.sdk_deps = filter_sdk_deps(data.deps) - - # Generate the build file. - template = 'shared_library.mako' if is_shared else 'static_library.mako' - build_path = os.path.join(context.out_dir, 'lib', lib_name, 'BUILD.gn') - generate_build_file(build_path, template, data, context) - - -class Sysroot(object): - '''Represents the sysroot created by Zircon. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self): - self.files = {} - self.sdk_files = {} - self.headers = [] - self.link_libs = [] - self.dist_libs = [] - self.debug_source_libs = [] - - -def generate_sysroot(package, context): - '''Generates the build glue for the sysroot.''' - data = Sysroot() - - # Includes. - for name, path in package.get('includes', {}).iteritems(): - (file, _) = extract_file(name, path, context) - data.files['include/%s' % name] = '//%s' % file - in_sdk = True - for prefix in NON_SDK_SYSROOT_HEADER_PREFIXES: - if name.startswith(prefix) and name not in MANDATORY_SDK_HEADERS: - in_sdk = False - break - if in_sdk: - dest = 'include/%s' % name - data.sdk_files[dest] = '//%s' % file - data.headers.append(dest) - - # Lib. - for name, path in package.get('lib', {}).iteritems(): - (file, _) = extract_file(name, path, context) - label = '//%s' % file - data.files[name] = label - type_dir = os.path.dirname(name) - if type_dir == 'debug': - data.debug_source_libs.append(label) - else: - data.sdk_files[name] = label - if type_dir == 'lib': - data.link_libs.append(name) - elif type_dir == 'dist/lib': - data.dist_libs.append(name) - else: - raise Exception('Unknown library type: ' + type_dir) - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'sysroot', 'BUILD.gn') - generate_build_file(build_path, 'sysroot.mako', data, context) - - -class HostTool(object): - '''Represents a host tool. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self, name): - self.name = name - self.executable = '' - - -def generate_host_tool(package, context): - '''Generates the build glue for a host tool.''' - name = package['package']['name'] - data = HostTool(name) - - bins = package.get('bin', {}) - if len(bins) != 1 or name not in bins: - raise Exception('Host tool %s has unexpected binaries %s.' - % (name, bins)) - (file, _) = extract_file(name, bins[name], context, is_tool=True) - data.executable = '//%s' % file - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'tool', name, 'BUILD.gn') - generate_build_file(build_path, 'host_tool.mako', data, context) - - -class FidlLibrary(object): - '''Represents a FIDL library. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self, name, library): - self.name = name - self.library = library - self.sources = [] - self.fidl_deps = [] - - -def generate_fidl_library(package, context): - '''Generates the build glue for a FIDL library.''' - pkg_name = package['package']['name'] - # TODO(pylaligand): remove fallback. - data = FidlLibrary(pkg_name, package['package'].get('library', pkg_name)) - - for name, path in package.get('fidl', {}).iteritems(): - (file, _) = extract_file(name, path, context) - data.sources.append('//%s' % file) - data.fidl_deps = filter_deps(package.get('fidl-deps', [])) - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'fidl', pkg_name, 'BUILD.gn') - generate_build_file(build_path, 'fidl.mako', data, context) - - -class BanjoLibrary(object): - '''Represents a Banjo library. - - Convenience storage object to be consumed by Mako templates.''' - - def __init__(self, name, library): - self.name = name - self.library = library - self.sources = [] - self.banjo_deps = [] - - -def generate_banjo_dummy_library(package, context): - '''Generates the build glue for a dummy Banjo library.''' - pkg_name = package['package']['name'] - - data = BanjoLibrary(pkg_name, package['package']['library']) - - for name, path in package.get('banjo', {}).iteritems(): - (file, _) = extract_file(name, path, context) - data.sources.append('//%s' % file) - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'banjo', pkg_name, 'BUILD.gn') - generate_build_file(build_path, 'banjo_dummy.mako', data, context) - -def generate_banjo_library(package, context): - '''Generates the build glue for a Banjo library.''' - pkg_name = package['package']['name'] - - if "ddk-protocol" not in pkg_name: - generate_banjo_dummy_library(package, context) - return - - data = BanjoLibrary(pkg_name, package['package']['library']) - - for name, path in package.get('banjo', {}).iteritems(): - (file, _) = extract_file(name, path, context) - data.sources.append('//%s' % file) - data.banjo_deps = filter_deps(package.get('banjo-deps', [])) - data.deps = [ - '//zircon/public/lib/ddk', - '//zircon/public/lib/ddktl', - ] - - # Generate the build file. - build_path = os.path.join(context.out_dir, 'banjo', pkg_name, 'BUILD.gn') - generate_build_file(build_path, 'banjo.mako', data, context) - - -def generate_board_list(package, context): - '''Generates a configuration file with the list of target boards.''' - build_path = os.path.join(context.out_dir, 'config', 'boards.gni') - generate_build_file(build_path, 'boards.mako', package, context) - build_path = os.path.join(context.out_dir, 'config', 'BUILD.gn') - generate_build_file(build_path, 'main.mako', package, context) - - -class GenerationContext(object): - '''Describes the context in which GN rules should be generated.''' - - def __init__(self, out_dir, source_base, user_build_base, tool_build_base, - templates): - self.out_dir = out_dir - self.source_base = source_base - self.user_build_base = user_build_base - self.tool_build_base = tool_build_base - self.templates = templates - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--out', - help='Path to the output directory', - required=True) - parser.add_argument('--staging', - help='Path to the staging directory', - required=True) - parser.add_argument('--zircon-user-build', - help='Path to the Zircon "user" build directory', - required=True) - parser.add_argument('--zircon-tool-build', - help='Path to the Zircon "tools" build directory', - required=True) - parser.add_argument('--debug', - help='Whether to print out debug information', - action='store_true') - parser.add_argument('--make', - help='Path to make binary', - required=True) - args = parser.parse_args() - - out_dir = os.path.abspath(args.out) - shutil.rmtree(os.path.join(out_dir, 'config'), True) - shutil.rmtree(os.path.join(out_dir, 'fidl'), True) - shutil.rmtree(os.path.join(out_dir, 'banjo'), True) - shutil.rmtree(os.path.join(out_dir, 'lib'), True) - shutil.rmtree(os.path.join(out_dir, 'sysroot'), True) - shutil.rmtree(os.path.join(out_dir, 'tool'), True) - debug = args.debug - - # Generate package descriptions through Zircon's build. - zircon_dir = os.path.abspath(args.staging) - shutil.rmtree(zircon_dir, True) - if debug: - print('Building Zircon in: %s' % zircon_dir) - make_args = [ - args.make, - 'packages', - 'BUILDDIR=%s' % zircon_dir, - ] - - env = {} - env['PATH'] = os.environ['PATH'] - if not debug: - env['QUIET'] = '1' - subprocess.check_call(make_args, cwd=ZIRCON_ROOT, env=env) - # Parse package definitions. - packages = [] - with open(os.path.join(zircon_dir, 'export', 'manifest'), 'r') as manifest: - package_files = map(lambda line: line.strip(), manifest.readlines()) - for file in package_files: - with open(os.path.join(zircon_dir, 'export', file), 'r') as pkg_file: - packages.append(parse_package(pkg_file.readlines())) - if debug: - print('Found %s packages:' % len(packages)) - names = sorted(map(lambda p: p['package']['name'], packages)) - for name in names: - print(' - %s' % name) - - # Generate some GN glue for each package. - context = GenerationContext( - out_dir, - ZIRCON_ROOT, - os.path.abspath(args.zircon_user_build), - os.path.abspath(args.zircon_tool_build), - TemplateLookup(directories=[SCRIPT_DIR]), - ) - for package in packages: - name = package['package']['name'] - type = package['package']['type'] - arch = package['package']['arch'] - if name == 'c': - generate_sysroot(package, context) - print('Generated sysroot') - continue - if name in SYSROOT_PACKAGES: - print('Ignoring sysroot part: %s' % name) - continue - if type == 'tool': - generate_host_tool(package, context) - elif type == 'lib': - if arch == 'src': - type = 'source' - generate_source_library(package, context) - else: - type = 'prebuilt' - generate_compiled_library(package, context) - elif type == 'fidl': - generate_fidl_library(package, context) - elif type == 'banjo': - generate_banjo_library(package, context) - else: - print('(%s) Unsupported package type: %s/%s, skipping' - % (name, type, arch)) - continue - if debug: - print('Processed %s (%s)' % (name, type)) - - board_path = os.path.join(zircon_dir, 'export', 'all-boards.list') - with open(board_path, 'r') as board_file: - package = parse_package(board_file.readlines()) - generate_board_list(package, context) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/zircon/fidl.mako b/zircon/fidl.mako deleted file mode 100644 index 09a6315..0000000 --- a/zircon/fidl.mako +++ /dev/null
@@ -1,21 +0,0 @@ -<%include file="header.mako" /> - -import("//build/fidl/fidl.gni") - -fidl("${data.name}") { - name = "${data.library}" - - sdk_category = "partner" - - sources = [ - % for source in sorted(data.sources): - "${source}", - % endfor - ] - - deps = [ - % for dep in sorted(data.fidl_deps): - "../${dep}", - % endfor - ] -}
diff --git a/zircon/header.mako b/zircon/header.mako deleted file mode 100644 index cf73679..0000000 --- a/zircon/header.mako +++ /dev/null
@@ -1,6 +0,0 @@ -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# DO NOT MANUALLY EDIT! -# Generated by //build/zircon/create_gn_rules.py.
diff --git a/zircon/host_tool.mako b/zircon/host_tool.mako deleted file mode 100644 index c4ba27f..0000000 --- a/zircon/host_tool.mako +++ /dev/null
@@ -1,43 +0,0 @@ -<%include file="header.mako" /> - -import("//build/sdk/sdk_atom.gni") - -assert(current_toolchain == host_toolchain, - "The ${data.name} tool is host-only.") - -copy("${data.name}") { - sources = [ - "${data.executable}", - ] - - outputs = [ - "$root_out_dir/${data.name}", - ] -} - -file_base = "tools/${data.name}" - -sdk_atom("${data.name}_sdk") { - id = "sdk://tools/${data.name}" - category = "partner" - - meta = { - dest = "$file_base-meta.json" - schema = "host_tool" - value = { - type = "host_tool" - name = "${data.name}" - root = "tools" - files = [ - file_base, - ] - } - } - - files = [ - { - source = "${data.executable}" - dest = file_base - } - ] -}
diff --git a/zircon/list_boards.py b/zircon/list_boards.py deleted file mode 100755 index 3bed6c1..0000000 --- a/zircon/list_boards.py +++ /dev/null
@@ -1,25 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import sys - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--out', - help='Path to the output file', - required=True) - parser.add_argument('--boards', - help='Name of the supported boards', - nargs='*') - args = parser.parse_args() - - with open(args.out, 'w') as out_file: - out_file.write('\n'.join(args.boards)) - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/zircon/list_source_files.py b/zircon/list_source_files.py deleted file mode 100755 index 819309b..0000000 --- a/zircon/list_source_files.py +++ /dev/null
@@ -1,39 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Fuchsia Authors. 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 subprocess -import sys - - -FUCHSIA_ROOT = os.path.dirname( # $root - os.path.dirname( # build - os.path.dirname( # zircon - os.path.abspath(__file__)))) -ZIRCON_ROOT = os.path.join(FUCHSIA_ROOT, "zircon") - - -def list_files(deleted=False): - git_cmd = ['git', 'ls-files'] - if deleted: - git_cmd.append('-d') - output = subprocess.check_output(git_cmd, cwd=ZIRCON_ROOT) - return set(output.splitlines()) - - -def get_files(): - all_files = list_files() - deleted_files = list_files(deleted=True) - files = all_files - deleted_files - return [os.path.join(ZIRCON_ROOT, file) for file in files] - - -def main(): - for file in get_files(): - print(file) - - -if __name__ == "__main__": - sys.exit(main())
diff --git a/zircon/main.mako b/zircon/main.mako deleted file mode 100644 index db53589..0000000 --- a/zircon/main.mako +++ /dev/null
@@ -1,29 +0,0 @@ -<%include file="header.mako" /> - -action("boards") { - script = "//build/zircon/list_boards.py" - - board_file = "$root_out_dir/zircon-boards.list" - - outputs = [ - board_file, - ] - - args = [ - "--out", - rebase_path(board_file), - "--boards", - ] - % for arch, boards in sorted(data.iteritems()): - ${'else ' if not loop.first else ''}if (target_cpu == "${arch}") { - args += [ - % for board in boards: - "${board}", - % endfor - ] - } - % endfor - else { - assert(false, "Unsupported architecture: $target_cpu.") - } -}
diff --git a/zircon/shared_library.mako b/zircon/shared_library.mako deleted file mode 100644 index e1639ae..0000000 --- a/zircon/shared_library.mako +++ /dev/null
@@ -1,235 +0,0 @@ -<%include file="header.mako" /> - -import("//build/sdk/sdk_atom.gni") - -config("${data.name}_config") { - include_dirs = [ - % for include in sorted(data.include_dirs): - "${include}", - % endfor - ] - - visibility = [ - ":*", - ] -} - -if (current_toolchain != shlib_toolchain) { - - # In the main toolchain, we just redirect to the same target in the shared - # toolchain. - - group("${data.name}") { - public_deps = [ - ":${data.name}($current_toolchain-shared)", - ] - - public_configs = [ - ":${data.name}_config", - ] - } - -} else { - - # In the shared toolchain, we normally set up the library. - - _abi_lib = "$root_out_dir/${data.lib_name}" - % if data.has_impl_prebuilt: - _impl_lib = "$root_out_dir/${data.lib_name}.impl" - % endif - _debug_lib = "$root_out_dir/lib.unstripped/${data.lib_name}" - - copy("${data.name}_copy_abi_lib") { - sources = [ - "${data.prebuilt}", - ] - - outputs = [ - _abi_lib, - ] - } - - % if data.has_impl_prebuilt: - copy("${data.name}_copy_impl_lib") { - sources = [ - "${data.impl_prebuilt}", - ] - - outputs = [ - _impl_lib, - ] - } - % else: - group("${data.name}_copy_impl_lib") {} - % endif - - copy("${data.name}_copy_unstripped_lib") { - sources = [ - "${data.debug_prebuilt}", - ] - - outputs = [ - _debug_lib, - ] - } - - _linked_lib = _abi_lib - if (is_debug) { - _linked_lib = _debug_lib - } - config("${data.name}_lib_config") { - libs = [ - _linked_lib, - ] - - visibility = [ - ":*", - ] - } - - group("${data.name}") { - - public_deps = [ - ":${data.name}_copy_abi_lib", - ":${data.name}_copy_impl_lib", - ":${data.name}_copy_unstripped_lib", - % for dep in sorted(data.fidl_deps): - "../../fidl/${dep}:${dep}_c", - % endfor - % for dep in sorted(data.banjo_deps): - "../../banjo/${dep}:${dep}", - % endfor - ] - - public_configs = [ - ":${data.name}_config", - ":${data.name}_lib_config", - % for dep in sorted(data.deps): - "../${dep}:${dep}_config", - % endfor - ] - - data_deps = [ - ":${data.name}_copy_abi_lib", - ] - } - -} # current_toolchain != shlib_toolchain - -file_base = "pkg/${data.name}" -prebuilt_base = "arch/$target_cpu" -binaries_content = { - link = "$prebuilt_base/lib/${data.lib_name}" -} -% if data.has_impl_prebuilt: -binaries_content.dist = "$prebuilt_base/dist/${data.lib_name}" -% endif -metadata = { - name = "${data.name}" - type = "cc_prebuilt_library" - root = file_base - format = "shared" - include_dir = "$file_base/include" - - headers = [] - % if data.with_sdk_headers: - % for dest, _ in sorted(data.includes.iteritems()): - headers += [ "$file_base/include/${dest}" ] - % endfor - % endif - - binaries = {} - if (target_cpu == "arm64") { - binaries.arm64 = binaries_content - } else if (target_cpu == "x64") { - binaries.x64 = binaries_content - } else { - assert(false, "Unknown CPU type: %target_cpu") - } - - deps = [] - % for dep in sorted(data.sdk_deps): - deps += [ "${dep}" ] - % endfor -} - -shared_out_dir = get_label_info(":bogus($shlib_toolchain)", "root_out_dir") - -base_meta_file = "$target_gen_dir/${data.name}.base_meta.json" -write_file(base_meta_file, metadata, "json") -augmented_meta_file = "$target_gen_dir/${data.name}.full_meta.json" -debug_mapping_file = "$target_gen_dir/${data.name}.mapping.txt" -debug_lib_file = "$shared_out_dir/lib.unstripped/${data.lib_name}" - -action("${data.name}_meta") { - script = "//build/zircon/add_library_debug_data.py" - - inputs = [ - base_meta_file, - debug_lib_file, - ] - - outputs = [ - augmented_meta_file, - ] - - args = [ - "--base", - rebase_path(base_meta_file), - "--out", - rebase_path(augmented_meta_file), - "--lib-debug-file", - rebase_path(debug_lib_file), - "--debug-mapping", - rebase_path(debug_mapping_file), - ] - - deps = [ - ":${data.name}", - ] -} - -sdk_atom("${data.name}_sdk") { - id = "sdk://pkg/${data.name}" - category = "partner" - - meta = { - dest = "$file_base/meta.json" - schema = "cc_prebuilt_library" - source = augmented_meta_file - } - - files = [ - % if data.with_sdk_headers: - % for dest, source in sorted(data.includes.iteritems()): - { - source = "${source}" - dest = "$file_base/include/${dest}" - }, - % endfor - % endif - { - source = "$shared_out_dir/${data.lib_name}" - dest = "$prebuilt_base/lib/${data.lib_name}" - }, - % if data.has_impl_prebuilt: - { - source = "$shared_out_dir/${data.lib_name}.impl" - dest = "$prebuilt_base/dist/${data.lib_name}" - }, - % endif - ] - - file_list = debug_mapping_file - - deps = [ - % for dep in sorted(data.sdk_deps): - "../${dep}:${dep}_sdk", - % endfor - ] - - non_sdk_deps = [ - ":${data.name}", - ":${data.name}_meta", - ] -}
diff --git a/zircon/source_library.mako b/zircon/source_library.mako deleted file mode 100644 index 6063f9a..0000000 --- a/zircon/source_library.mako +++ /dev/null
@@ -1,116 +0,0 @@ -<%include file="header.mako" /> - -import("//build/sdk/sdk_atom.gni") - -config("${data.name}_config") { - include_dirs = [ - % for include in sorted(data.include_dirs): - "${include}", - % endfor - ] - - visibility = [ - ":*", - ] -} - -source_set("${data.name}") { - sources = [ - % for _, source in sorted(data.sources.iteritems()): - "${source}", - % endfor - % for _, source in sorted(data.includes.iteritems()): - "${source}", - % endfor - ] - - public_deps = [ - % for dep in sorted(data.deps): - "../${dep}", - % endfor - % for dep in sorted(data.fidl_deps): - "../../fidl/${dep}:${dep}_c", - % endfor - % for dep in sorted(data.banjo_deps): - "../../banjo/${dep}:${dep}", - % endfor - ] - - libs = [ - % for lib in sorted(data.libs): - "${lib}", - % endfor - ] - - public_configs = [ - ":${data.name}_config", - ] - - % if data.depends_on_zircon: - if (is_fuchsia) { - libs += ["zircon"] - } else { - public_deps += [ "//zircon/system/public" ] - } - % endif -} - -file_base = "pkg/${data.name}" -metadata = { - name = "${data.name}" - type = "cc_source_library" - root = file_base - include_dir = "$file_base/include" - - sources = [] - % for dest, _ in sorted(data.sources.iteritems()): - sources += [ "$file_base/${dest}" ] - % endfor - - headers = [] - % for dest, _ in sorted(data.includes.iteritems()): - headers += [ "$file_base/include/${dest}" ] - % endfor - - deps = [] - % for dep in sorted(data.sdk_deps): - deps += [ "${dep}" ] - % endfor - - fidl_deps = [] - banjo_deps = [] - - files = sources + headers -} - -sdk_atom("${data.name}_sdk") { - id = "sdk://pkg/${data.name}" - category = "partner" - - meta = { - dest = "$file_base/meta.json" - schema = "cc_source_library" - value = metadata - } - - files = [ - % for dest, source in sorted(data.includes.iteritems()): - { - source = "${source}" - dest = "$file_base/include/${dest}" - }, - % endfor - % for dest, source in sorted(data.sources.iteritems()): - { - source = "${source}" - dest = "$file_base/${dest}" - }, - % endfor - ] - - deps = [ - % for dep in sorted(data.sdk_deps): - "../${dep}:${dep}_sdk", - % endfor - ] -}
diff --git a/zircon/static_library.mako b/zircon/static_library.mako deleted file mode 100644 index e176e11..0000000 --- a/zircon/static_library.mako +++ /dev/null
@@ -1,117 +0,0 @@ -<%include file="header.mako" /> - -import("//build/sdk/sdk_atom.gni") - -_lib = "$target_out_dir/${data.lib_name}" - -copy("${data.name}_copy_lib") { - sources = [ - "${data.prebuilt}", - ] - - outputs = [ - _lib, - ] -} - -config("${data.name}_config") { - include_dirs = [ - % for include in sorted(data.include_dirs): - "${include}", - % endfor - ] - - libs = [ - _lib, - ] - - visibility = [ - ":*", - ] -} - -group("${data.name}") { - - public_deps = [ - ":${data.name}_copy_lib", - % for dep in sorted(data.deps): - "../${dep}", - % endfor - % for dep in sorted(data.fidl_deps): - "../../fidl/${dep}:${dep}_c", - % endfor - % for dep in sorted(data.banjo_deps): - "../../banjo/${dep}:${dep}", - % endfor - ] - - public_configs = [ - ":${data.name}_config", - ] -} - -file_base = "pkg/${data.name}" -prebuilt_base = "arch/$target_cpu" -binaries_content = { - link = "$prebuilt_base/lib/${data.lib_name}" -} -metadata = { - name = "${data.name}" - type = "cc_prebuilt_library" - root = file_base - format = "static" - include_dir = "$file_base/include" - - headers = [] - % for dest, _ in sorted(data.includes.iteritems()): - headers += [ "$file_base/include/${dest}" ] - % endfor - - binaries = {} - if (target_cpu == "arm64") { - binaries.arm64 = binaries_content - } else if (target_cpu == "x64") { - binaries.x64 = binaries_content - } else { - assert(false, "Unknown CPU type: %target_cpu") - } - - deps = [] - % for dep in sorted(data.sdk_deps): - deps += [ "${dep}" ] - % endfor -} - -sdk_atom("${data.name}_sdk") { - id = "sdk://pkg/${data.name}" - category = "partner" - - meta = { - dest = "$file_base/meta.json" - schema = "cc_prebuilt_library" - value = metadata - } - - files = [ - % for dest, source in sorted(data.includes.iteritems()): - { - source = "${source}" - dest = "$file_base/include/${dest}" - }, - % endfor - { - source = _lib - dest = "$prebuilt_base/lib/${data.lib_name}" - }, - ] - - deps = [ - % for dep in sorted(data.sdk_deps): - "../${dep}:${dep}_sdk", - % endfor - ] - - non_sdk_deps = [ - ":${data.name}", - ] -}
diff --git a/zircon/sysroot.mako b/zircon/sysroot.mako deleted file mode 100644 index 39373cc..0000000 --- a/zircon/sysroot.mako +++ /dev/null
@@ -1,127 +0,0 @@ -<%include file="header.mako" /> - -import("//build/sdk/sdk_atom.gni") - -_out_dir = get_label_info(":bogus", "target_out_dir") - -<%def name="copy_target(path)">${"copy_%s" % path.replace('/', '_').replace('.', '_')}</%def> - -% for path, file in sorted(data.files.iteritems()): -copy("${copy_target(path)}") { - sources = [ - "${file}", - ] - - outputs = [ - "$_out_dir/sysroot/${path}", - ] -} - -% endfor - -group("sysroot") { - deps = [ - % for path, file in sorted(data.files.iteritems()): - ":${copy_target(path)}", - % endfor - ] -} - -file_base = "arch/$target_cpu/sysroot" - -version_content = { - root = file_base - - include_dir = "$file_base/include" - headers = [] - % for header in sorted(data.headers): - headers += [ "$file_base/${header}" ] - % endfor - - link_libs = [] - % for lib in sorted(data.link_libs): - link_libs += [ "$file_base/${lib}" ] - % endfor - - dist_libs = [] - % for lib in sorted(data.dist_libs): - dist_libs += [ "$file_base/${lib}" ] - % endfor -} -metadata = { - type = "sysroot" - name = "sysroot" - root = "pkg/sysroot" - versions = {} - if (target_cpu == "arm64") { - versions.arm64 = version_content - } else if (target_cpu == "x64") { - versions.x64 = version_content - } else { - assert(false, "Unknown CPU type: %target_cpu") - } -} - -base_meta_file = "$target_gen_dir/sysroot.base_meta.json" -write_file(base_meta_file, metadata, "json") -augmented_meta_file = "$target_gen_dir/sysroot.full_meta.json" -debug_mapping_file = "$target_gen_dir/sysroot.mapping.txt" - -action("sysroot_meta") { - script = "//build/zircon/add_sysroot_debug_data.py" - - inputs = [ - base_meta_file, - % for lib in sorted(data.debug_source_libs): - "${lib}", - % endfor - ] - - outputs = [ - augmented_meta_file, - ] - - args = [ - "--base", - rebase_path(base_meta_file), - "--out", - rebase_path(augmented_meta_file), - "--debug-mapping", - rebase_path(debug_mapping_file), - % for lib in sorted(data.debug_source_libs): - "--lib-debug-file", - rebase_path("${lib}"), - % endfor - ] - - deps = [ - ":sysroot", - ] -} - -sdk_atom("sysroot_sdk") { - id = "sdk://pkg/sysroot" - category = "partner" - - meta = { - dest = "pkg/sysroot/meta.json" - schema = "sysroot" - source = augmented_meta_file - } - - files = [ - % for path, file in sorted(data.sdk_files.iteritems()): - { - source = "${file}" - dest = "$file_base/${path}" - }, - % endfor - ] - - file_list = debug_mapping_file - - non_sdk_deps = [ - ":sysroot", - ":sysroot_meta", - ] -}