Commit d037abc3 authored by Yuke Liao's avatar Yuke Liao Committed by Commit Bot

Reland "[lacros] Support also_build_ash_chrome in lacros build"

Reason for reland: Original CL broke two classes of builders, and they
have been fixed:
1. Third party projects, such as ANGLE, and the fix was landed in:
https://chromium-review.googlesource.com/c/chromium/src/+/2427423
2. Code search builders, and the fix is in patchset #2.

This CL is a reland of:
https://chromium-review.googlesource.com/c/chromium/src/+/2416999.

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: I5a29eef63a12a622d512f74d23098720aa9530aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425201Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814429}
parent 482fcef3
...@@ -2,13 +2,18 @@ ...@@ -2,13 +2,18 @@
# 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 && also_build_ash_chrome))
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,17 @@ ...@@ -2,12 +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")
# 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 && also_build_ash_chrome)) {
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")
......
...@@ -15,6 +15,12 @@ declare_args() { ...@@ -15,6 +15,12 @@ declare_args() {
# is_lacros = chromeos_product == "browser" # is_lacros = chromeos_product == "browser"
# is_ash = chromeos_product == "ash" # is_ash = chromeos_product == "ash"
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
} }
is_ash = is_chromeos && !chromeos_is_browser_only is_ash = is_chromeos && !chromeos_is_browser_only
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/clang/clang.gni") import("//build/config/clang/clang.gni")
import("//build/config/ozone.gni")
import("//build/config/sysroot.gni") # Imports android/config.gni. import("//build/config/sysroot.gni") # Imports android/config.gni.
import("//build/toolchain/gcc_toolchain.gni") import("//build/toolchain/gcc_toolchain.gni")
...@@ -63,6 +64,16 @@ android_clang_toolchain("android_clang_x86") { ...@@ -63,6 +64,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 +101,16 @@ android_clang_toolchain("android_clang_x64") { ...@@ -90,6 +101,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
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# 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.
import("//build/config/ozone.gni")
import("//build/config/sysroot.gni") import("//build/config/sysroot.gni")
import("//build/toolchain/gcc_toolchain.gni") import("//build/toolchain/gcc_toolchain.gni")
...@@ -152,6 +153,23 @@ clang_toolchain("clang_x64_v8_mips64") { ...@@ -152,6 +153,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")
...@@ -463,8 +464,11 @@ test("components_unittests") { ...@@ -463,8 +464,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
...@@ -703,7 +707,11 @@ if (!is_ios && !is_fuchsia) { ...@@ -703,7 +707,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")
...@@ -217,8 +218,11 @@ test("midi_unittests") { ...@@ -217,8 +218,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") {
......
...@@ -406,6 +406,13 @@ template("test") { ...@@ -406,6 +406,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
...@@ -426,12 +433,6 @@ template("test") { ...@@ -426,12 +433,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" ]
} }
...@@ -464,9 +465,17 @@ template("test") { ...@@ -464,9 +465,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