Commit 47ef029b authored by Yuke Liao's avatar Yuke Liao Committed by Commit Bot

[lacros] Support also_build_ash_chrome in lacros build

This CL supports also_build_ash_chrome arg to allow building ash-chrome
in an alternate toolchain.

A few other fixes are required to work, but they will be landed in
separate CLs because they could affect existing builds, so landing them
separately will make it easier to reason and detect potential breakages.

Bug: 1129223
Change-Id: I94dc3dc1ca2bc96f029fea3c4f4d6e41d018e2ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416999
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#808611}
parent 4ebd0722
...@@ -2,13 +2,17 @@ ...@@ -2,13 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# TODO(crbug.com.1052397): Remove this and |chromeos_is_browser_only| usage once
# |is_chromeos| is true in a LaCrOS build.
import("//build/config/chromeos/ui_mode.gni")
# Logic separated out from config.gni so that it can be used by compiler.gni # Logic separated out from config.gni so that it can be used by compiler.gni
# without introducing a circular dependency. # without introducing a circular dependency.
# NOTE: Because Chrome OS builds may depend on targets built with the Android # NOTE: Because Chrome OS builds may depend on targets built with the Android
# toolchain, this GNI file may be read and processed from within Chrome OS # toolchain, this GNI file may be read and processed from within Chrome OS
# toolchains. Checking |is_android| here would therefore be too restrictive. # toolchains. Checking |is_android| here would therefore be too restrictive.
assert(is_android || is_chromeos) assert(is_android || is_chromeos || (is_linux && chromeos_is_browser_only))
declare_args() { declare_args() {
# Adds intrumentation to each function. Writes a file with the order that # Adds intrumentation to each function. Writes a file with the order that
......
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# TODO(crbug.com.1052397): Remove this and |chromeos_is_browser_only| usage once
# |is_chromeos| is true in a LaCrOS build.
import("//build/config/chromeos/ui_mode.gni")
# This file contains common system config stuff for the Android build. # This file contains common system config stuff for the Android build.
# NOTE: Because Chrome OS builds may depend on targets built with the Android # NOTE: Because Chrome OS builds may depend on targets built with the Android
# toolchain, this GNI file may be read and processed from within Chrome OS # toolchain, this GNI file may be read and processed from within Chrome OS
# toolchains. Checking |is_android| here would therefore be too restrictive. # toolchains. Checking |is_android| here would therefore be too restrictive.
if (is_android || is_chromeos) { if (is_android || is_chromeos || (is_linux && chromeos_is_browser_only)) {
import("//build/config/chromecast_build.gni") import("//build/config/chromecast_build.gni")
import("//build_overrides/build.gni") import("//build_overrides/build.gni")
import("abi.gni") import("abi.gni")
......
...@@ -9,4 +9,10 @@ declare_args() { ...@@ -9,4 +9,10 @@ declare_args() {
# TODO(crbug.com/1052397): After the clean up, this should be # TODO(crbug.com/1052397): After the clean up, this should be
# replaced with 'target_os = "chromeos" && ui_mode == "browser"'. # replaced with 'target_os = "chromeos" && ui_mode == "browser"'.
chromeos_is_browser_only = false chromeos_is_browser_only = false
# Setting this to true when building LaCrOS-chrome will cause it to
# *also* build ash-chrome in a subdirectory using an alternate toolchain.
# Don't set this unless you're sure you want it, because it'll double
# your build time.
also_build_ash_chrome = false
} }
...@@ -63,6 +63,16 @@ android_clang_toolchain("android_clang_x86") { ...@@ -63,6 +63,16 @@ android_clang_toolchain("android_clang_x86") {
# Therefore we need to turn off 'use_clang_coverage' for this toolchain. # Therefore we need to turn off 'use_clang_coverage' for this toolchain.
# TODO(crbug.com/865376) # TODO(crbug.com/865376)
use_clang_coverage = false use_clang_coverage = false
# This turns off all of the LaCrOS-specific flags. A LaCrOS build may use
# |ash_clang_x64| toolchain, which is a chromeos toolchain, to build
# Ash-Chrome in a subdirectory, and because chromeos toolchain uses android
# toolchain, which eventually resulted in that android toolchains being used
# inside a LaCrOS build.
also_build_ash_chrome = false
chromeos_is_browser_only = false
ozone_platform = ""
ozone_platform_wayland = false
} }
} }
...@@ -90,6 +100,16 @@ android_clang_toolchain("android_clang_x64") { ...@@ -90,6 +100,16 @@ android_clang_toolchain("android_clang_x64") {
# Therefore we need to turn off 'use_clang_coverage' for this toolchain. # Therefore we need to turn off 'use_clang_coverage' for this toolchain.
# TODO(crbug.com/865376) # TODO(crbug.com/865376)
use_clang_coverage = false use_clang_coverage = false
# This turns off all of the LaCrOS-specific flags. A LaCrOS build may use
# |ash_clang_x64| toolchain, which is a chromeos toolchain, to build
# Ash-Chrome in a subdirectory, and because chromeos toolchain uses android
# toolchain, which eventually resulted in that android toolchains being used
# inside a LaCrOS build.
also_build_ash_chrome = false
chromeos_is_browser_only = false
ozone_platform = ""
ozone_platform_wayland = false
} }
} }
......
...@@ -152,6 +152,23 @@ clang_toolchain("clang_x64_v8_mips64") { ...@@ -152,6 +152,23 @@ clang_toolchain("clang_x64_v8_mips64") {
} }
} }
# In a LaCrOS build, this toolchain is intended to be used as an alternate
# toolchain to build Ash-Chrome in a subdirectory.
clang_toolchain("ash_clang_x64") {
toolchain_args = {
# This turns the toolchain into the "Linux ChromeOS" build
current_os = "chromeos"
target_os = "chromeos"
current_cpu = current_cpu
# This turns off all of the LaCrOS-specific flags.
also_build_ash_chrome = false
chromeos_is_browser_only = false
ozone_platform = ""
ozone_platform_wayland = false
}
}
gcc_toolchain("x64") { gcc_toolchain("x64") {
cc = "gcc" cc = "gcc"
cxx = "g++" cxx = "g++"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//components/nacl/features.gni") import("//components/nacl/features.gni")
...@@ -455,8 +456,11 @@ test("components_unittests") { ...@@ -455,8 +456,11 @@ test("components_unittests") {
deps += [ "//components/pdf/renderer:unit_tests" ] deps += [ "//components/pdf/renderer:unit_tests" ]
} }
# No components should depend on Chrome. # On LaCrOS, tests use ash-chrome as a window manager, thus the dependency.
assert_no_deps = [ "//chrome/*" ] # On other platforms, no components should depend on Chrome.
if (!chromeos_is_browser_only) {
assert_no_deps = [ "//chrome/*" ]
}
if (is_ios) { if (is_ios) {
assert_no_deps += ios_assert_no_deps assert_no_deps += ios_assert_no_deps
...@@ -696,7 +700,11 @@ if (!is_ios && !is_fuchsia) { ...@@ -696,7 +700,11 @@ if (!is_ios && !is_fuchsia) {
] ]
} }
assert_no_deps = [ "//chrome/*" ] # On LaCrOS, tests use ash-chrome as a window manager, thus the dependency.
# On other platforms, no components should depend on Chrome.
if (!chromeos_is_browser_only) {
assert_no_deps = [ "//chrome/*" ]
}
} }
test("components_perftests") { test("components_perftests") {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//media/media_options.gni") import("//media/media_options.gni")
...@@ -215,8 +216,11 @@ test("midi_unittests") { ...@@ -215,8 +216,11 @@ test("midi_unittests") {
sources += [ "midi_manager_alsa_unittest.cc" ] sources += [ "midi_manager_alsa_unittest.cc" ]
} }
# This target should not require the Chrome executable to run. # On LaCrOS, tests use ash-chrome as a window manager, thus the dependency.
assert_no_deps = [ "//chrome" ] # On other platforms, this target should not require the Chrome to run.
if (!chromeos_is_browser_only) {
assert_no_deps = [ "//chrome" ]
}
} }
fuzzer_test("midi_webmidi_data_validator_fuzzer") { fuzzer_test("midi_webmidi_data_validator_fuzzer") {
......
...@@ -405,6 +405,13 @@ template("test") { ...@@ -405,6 +405,13 @@ template("test") {
_use_xvfb = false _use_xvfb = false
} }
# When use_xvfb is set by the invoker, it indicates that running this test
# target requires a window, and in lacros build, ash-chrome serves as the
# display server. Note that even though the tests themselves do not require
# xvfb anymore, xvfb.py is still needed to invoke the lacros test runner
# because ash-chrome is based on x11.
_use_ash_chrome = _use_xvfb
generate_wrapper(_gen_runner_target) { generate_wrapper(_gen_runner_target) {
testonly = true testonly = true
wrapper_script = "$root_build_dir/bin/run_" + _executable wrapper_script = "$root_build_dir/bin/run_" + _executable
...@@ -425,12 +432,6 @@ template("test") { ...@@ -425,12 +432,6 @@ template("test") {
"--test-launcher-bot-mode", "--test-launcher-bot-mode",
] ]
# When use_xvfb is set by the invoker, it indicates that running this test
# target requires a window, and in lacros build, ash-chrome serves as the
# display server. Note that even though the tests themselves do not
# require xvfb anymore, xvfb.py is still needed to invoke the lacros test
# runner because ash-chrome is based on x11.
_use_ash_chrome = _use_xvfb
if (_use_ash_chrome) { if (_use_ash_chrome) {
executable_args += [ "--ash-chrome-version=for_bots" ] executable_args += [ "--ash-chrome-version=for_bots" ]
} }
...@@ -463,9 +464,17 @@ template("test") { ...@@ -463,9 +464,17 @@ template("test") {
deps = [] deps = []
} }
if (!defined(data_deps)) {
data_deps = []
}
testonly = true testonly = true
write_runtime_deps = _runtime_deps_file write_runtime_deps = _runtime_deps_file
deps += [ ":$_gen_runner_target" ] deps += [ ":$_gen_runner_target" ]
if (_use_ash_chrome && also_build_ash_chrome) {
data_deps +=
[ "//chrome:chrome(//build/toolchain/linux:ash_clang_x64)" ]
}
} }
} else { } else {
if (is_mac || is_win) { if (is_mac || is_win) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment