From 21b94273801c0f3321ad1ef2f92d8d8c7b26a5ab Mon Sep 17 00:00:00 2001 From: Doug Horn Date: Wed, 16 Jan 2019 12:06:11 -0800 Subject: [PATCH] Initial Fuchsia support. This change adds Fuchsia as a valid OS. Future changes will add proper toolchain support. Bug: 119831161 Test: Compile walleye. Confirm that adding `fuchsia` to the os-specific declaration of an arbitrary target does not throw a build error. Change-Id: I64eb928afb7512f3fbe32abb313b4c3efe16b169 --- android/arch.go | 9 ++++++++- android/config.go | 4 ++++ android/module.go | 5 +++++ android/variable.go | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/android/arch.go b/android/arch.go index 0180b8715..bb8cc0235 100644 --- a/android/arch.go +++ b/android/arch.go @@ -391,6 +391,7 @@ var ( LinuxBionic = NewOsType("linux_bionic", Host, false) Windows = NewOsType("windows", HostCross, true) Android = NewOsType("android", Device, false) + Fuchsia = NewOsType("fuchsia", Device, false) osArchTypeMap = map[OsType][]ArchType{ Linux: []ArchType{X86, X86_64}, @@ -398,6 +399,7 @@ var ( Darwin: []ArchType{X86_64}, Windows: []ArchType{X86, X86_64}, Android: []ArchType{Arm, Arm64, Mips, Mips64, X86, X86_64}, + Fuchsia: []ArchType{Arm64, X86_64}, } ) @@ -1191,7 +1193,12 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) { } if variables.DeviceArch != nil && *variables.DeviceArch != "" { - addTarget(Android, *variables.DeviceArch, variables.DeviceArchVariant, + var target = Android + if Bool(variables.Fuchsia) { + target = Fuchsia + } + + addTarget(target, *variables.DeviceArch, variables.DeviceArchVariant, variables.DeviceCpuVariant, variables.DeviceAbi) if variables.DeviceSecondaryArch != nil && *variables.DeviceSecondaryArch != "" { diff --git a/android/config.go b/android/config.go index 7c1278e58..09d9cbc4e 100644 --- a/android/config.go +++ b/android/config.go @@ -586,6 +586,10 @@ func (c *config) UnbundledBuildPrebuiltSdks() bool { return Bool(c.productVariables.Unbundled_build) && !Bool(c.productVariables.Unbundled_build_sdks_from_source) } +func (c *config) Fuchsia() bool { + return Bool(c.productVariables.Fuchsia) +} + func (c *config) IsPdkBuild() bool { return Bool(c.productVariables.Pdk) } diff --git a/android/module.go b/android/module.go index 303d8c68e..aed16b3fd 100644 --- a/android/module.go +++ b/android/module.go @@ -64,6 +64,7 @@ type androidBaseContext interface { Host() bool Device() bool Darwin() bool + Fuchsia() bool Windows() bool Debug() bool PrimaryArch() bool @@ -1121,6 +1122,10 @@ func (a *androidBaseContextImpl) Darwin() bool { return a.target.Os == Darwin } +func (a *androidBaseContextImpl) Fuchsia() bool { + return a.target.Os == Fuchsia +} + func (a *androidBaseContextImpl) Windows() bool { return a.target.Os == Windows } diff --git a/android/variable.go b/android/variable.go index ddaf166a3..e19d8581d 100644 --- a/android/variable.go +++ b/android/variable.go @@ -243,6 +243,8 @@ type productVariables struct { Product_is_iot *bool `json:",omitempty"` + Fuchsia *bool `json:",omitempty"` + DeviceKernelHeaders []string `json:",omitempty"` ExtraVndkVersions []string `json:",omitempty"`