Skip to content

Commit

Permalink
[Fuchsia] Run fuchsia-gn-sdk from chromium
Browse files Browse the repository at this point in the history
The latest build rules have the ffuchsia-api-level.
Need https://crrev.com/c/5586319.

Bug: fuchsia:42085580, fuchsia:327691011
Change-Id: I21383e02f9fff3db9405c0dbe42051122a325003
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5585353
Commit-Queue: Zijie He <zijiehe@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
  • Loading branch information
zijiehe-google-com authored and Crashpad LUCI CQ committed Jun 5, 2024
1 parent 0bebda6 commit 25c079d
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 355 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Keep sorted

*.Makefile
*.ninja
*.pyc
*.target.mk
*.xcodeproj
*~
.*.sw?
.cache
.DS_Store
.cache
.gdb_history
.gdbinit
/Makefile
/build/fuchsia
/out
/third_party/edo/edo
/third_party/fuchsia-gn-sdk
/third_party/fuchsia/.cipd
/third_party/fuchsia/clang
/third_party/fuchsia/qemu
/third_party/fuchsia/sdk
/third_party/googletest/googletest
/third_party/gyp/gyp
/third_party/libfuzzer
/third_party/linux/.cipd
/third_party/linux/clang
/third_party/linux/sysroot
/third_party/lss/lss
/third_party/gyp/gyp
/third_party/mini_chromium/mini_chromium
/third_party/ninja/linux
/third_party/ninja/mac*
Expand Down
34 changes: 31 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ deps = {
'9719c1e1e676814c456b55f5f070eabad6709d31',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'5856e1ea610f6d1b47ee2e9c905498a05a1634e8',
'bd56f6933f2fa021a44766ced638a18f477ef1c1',
'crashpad/third_party/libfuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
'fda403cf93ecb8792cb1d061564d89a6553ca020',
Expand Down Expand Up @@ -86,6 +86,16 @@ deps = {
'dep_type': 'cipd',
'condition': 'host_os == "win"',
},
'crashpad/build/fuchsia': {
'packages': [
{
'package': 'chromium/fuchsia/test-scripts',
'version': 'latest',
}
],
'condition': 'checkout_fuchsia',
'dep_type': 'cipd',
},
'crashpad/third_party/linux/clang/linux-amd64': {
'packages': [
{
Expand Down Expand Up @@ -117,9 +127,14 @@ deps = {
'dep_type': 'cipd'
},
'crashpad/third_party/fuchsia-gn-sdk': {
'url': Var('chromium_git') + '/chromium/src/third_party/fuchsia-gn-sdk.git@' +
'0d6902558d92fe3d49ba9a8f638ddea829be595b',
'packages': [
{
'package': 'chromium/fuchsia/gn-sdk',
'version': 'latest'
},
],
'condition': 'checkout_fuchsia',
'dep_type': 'cipd'
},
'crashpad/third_party/fuchsia/sdk/linux-amd64': {
'packages': [
Expand Down Expand Up @@ -244,12 +259,25 @@ hooks = [
'crashpad/build/install_linux_sysroot.py',
],
},
{
# Avoid introducing unnecessary PRESUBMIT.py file from build/fuchsia.
# Never fail and ignore the error if the file does not exist.
'name': 'Remove the PRESUBMIT.py from build/fuchsia',
'pattern': '.',
'condition': 'checkout_fuchsia',
'action': [
'rm',
'-f',
'crashpad/build/fuchsia/PRESUBMIT.py',
],
},
{
'name': 'Generate Fuchsia Build Definitions',
'pattern': '.',
'condition': 'checkout_fuchsia',
'action': [
'python3',
'crashpad/build/fuchsia_envs.py',
'crashpad/build/fuchsia/gen_build_defs.py'
],
},
Expand Down
8 changes: 8 additions & 0 deletions build/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ if (crashpad_use_libfuzzer) {
_default_configs += [ "//build/config:crashpad_fuzzer_flags" ]
}

if (current_os == "fuchsia") {
_default_configs += [
"//third_party/fuchsia-gn-sdk/src/config:compiler",
"//third_party/fuchsia-gn-sdk/src/config:runtime_library",
]
import("//third_party/fuchsia-gn-sdk/src/gn_configs.gni")
}

_default_executable_configs = _default_configs + [
"$_mini_chromium_dir/build/config:executable",
"$_mini_chromium_dir/build/config:win_console",
Expand Down
62 changes: 62 additions & 0 deletions build/config/fuchsia/gn_configs.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2024 The Crashpad Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is copied from
# https://crsrc.org/c/build/config/fuchsia/gn_configs.gni?q=gn_configs.gni
# with some local modifications to match the crashpad setup.

# Path to the fuchsia SDK. This is intended for use in other templates &
# rules to reference the contents of the fuchsia SDK.
fuchsia_sdk = "//third_party/fuchsia/sdk/linux-amd64"

# ID uniquely identifying the Fuchsia IDK build. This is exposed as a
# property so it can be used to locate images and packages on GCS and
# as a marker to indicate the "version" of the IDK.
# Defaults to the id found in the manifest.json file of the SDK.
fuchsia_sdk_id = ""

# The target API level for this repository. Embedders should override this
# value to specify the API level the packages produced from this repository
# should be targeting, e.g. in their top-level //.gn file. A value of -1
# means that no API level will be passed to the tools that consumes it.
fuchsia_target_api_level = 18

# The SDK manifest file. This is useful to include as a dependency
# for some targets in order to cause a rebuild when the version of the
# SDK is changed.
fuchsia_sdk_manifest_file = "${fuchsia_sdk}/meta/manifest.json"

# fuchsia_tool_dir is used to specify the directory in the SDK to locate
# tools for the host cpu architecture. If the host_cpu is not recognized,
# then tool dir defaults to x64.
fuchsia_tool_dir = "${fuchsia_sdk}/tools/${host_cpu}"

if (fuchsia_sdk_id == "") {
# Note: If we need to expose more than just the id in the future,
# we should consider exposing the entire json object for the metadata vs.
# adding a bunch of variables.
_meta = read_file(fuchsia_sdk_manifest_file, "json")
fuchsia_sdk_id = _meta.id
}

declare_args() {
# Specify a readelf_exec path to use. If not specified, the host's system
# executable will be used. Passed to populate_build_id_dir.py and
# prepare_package_inputs.py via the --readelf-exec flag.
# Must be a GN path (not an absolute path) since it is adjusted with
# rebase_path().
if (!defined(fuchsia_sdk_readelf_exec)) {
fuchsia_sdk_readelf_exec = ""
}
}
3 changes: 3 additions & 0 deletions build/crashpad_buildconfig.gni
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ if (crashpad_is_in_chromium) {
crashpad_is_posix = mini_chromium_is_posix

crashpad_is_clang = mini_chromium_is_clang

# fuchsia-gn-sdk from chromium uses "is_fuchsia" condition.
is_fuchsia = crashpad_is_fuchsia
}

crashpad_flock_always_supported = !(crashpad_is_android || crashpad_is_fuchsia)
Expand Down
Loading

0 comments on commit 25c079d

Please sign in to comment.