Merge "Add api_dirs property and use module name as prefix"
diff --git a/android/variable.go b/android/variable.go
index af414cb..4cd5313 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -62,6 +62,11 @@
Cflags []string
}
+ // Product_is_iot is true for Android Things devices.
+ Product_is_iot struct {
+ Cflags []string
+ }
+
// treble_linker_namespaces is true when the system/vendor linker namespace separation is
// enabled.
Treble_linker_namespaces struct {
@@ -201,6 +206,8 @@
Override_rs_driver *string `json:",omitempty"`
+ Product_is_iot *bool `json:",omitempty"`
+
DeviceKernelHeaders []string `json:",omitempty"`
DistDir *string `json:",omitempty"`
diff --git a/cc/binary.go b/cc/binary.go
index 4a6eb93..82e1941 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -41,9 +41,6 @@
// extension (if any) appended
Symlinks []string `android:"arch_variant"`
- // do not pass -pie
- No_pie *bool `android:"arch_variant"`
-
DynamicLinker string `blueprint:"mutated"`
// Names of modules to be overridden. Listed modules can only be other binaries
@@ -216,9 +213,6 @@
if ctx.Host() && !binary.static() {
if !ctx.Config().IsEnvTrue("DISABLE_HOST_PIE") {
flags.LdFlags = append(flags.LdFlags, "-pie")
- if ctx.Windows() {
- flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
- }
}
}
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 22e428f..36afc68 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -173,19 +173,16 @@
// this new warning are fixed.
"-Wno-null-pointer-arithmetic",
- // http://b/72330874 Disable -Wenum-compare until the instances detected by this new
- // warning are fixed.
- "-Wno-enum-compare",
- "-Wno-enum-compare-switch",
-
// Disable c++98-specific warning since Android is not concerned with C++98
// compatibility.
"-Wno-c++98-compat-extra-semi",
}, " "))
- // Extra cflags for projects under external/ directory
+ // Extra cflags for projects under external/ directory to disable warnings that are infeasible
+ // to fix in all the external projects and their upstream repos.
pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{
- // TODO(yikong): Move -Wno flags here
+ "-Wno-enum-compare",
+ "-Wno-enum-compare-switch",
}, " "))
}
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index a20d556..5d53a8c 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -19,6 +19,13 @@
"strings"
)
+// clang-tidy doesn't recognize every flag that clang does. This is unlikely to
+// be a complete list, but we can populate this with the ones we know to avoid
+// issues with clang-diagnostic-unused-command-line-argument.
+var ClangTidyUnknownCflags = sorted([]string{
+ "-Wa,%",
+})
+
func init() {
// Most Android source files are not clang-tidy clean yet.
// Global tidy checks include only google*, performance*,
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 6fbff9f..4cb8fa4 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -45,7 +45,6 @@
windowsIncludeFlags = []string{
"-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
- "-isystem ${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/include",
}
windowsClangCppflags = []string{
@@ -79,22 +78,34 @@
"-m32",
"-Wl,--large-address-aware",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib32",
+ "-static-libgcc",
}
windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{
+ "-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
+ "-pthread",
+ // Bug: http://b/109759970 - WAR until issue with ld.bfd's
+ // inability to handle Clang-generated section names is fixed.
+ "-Wl,--allow-multiple-definition",
}...)
windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)
windowsX8664Ldflags = []string{
"-m64",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
+ "-static-libgcc",
}
windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
+ "-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
+ "-pthread",
+ // Bug: http://b/109759970 - WAR until issue with ld.bfd's
+ // inability to handle Clang-generated section names is fixed.
+ "-Wl,--allow-multiple-definition",
}...)
windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)
@@ -220,7 +231,7 @@
}
func (t *toolchainWindows) ClangSupported() bool {
- return false
+ return true
}
func (t *toolchainWindowsX86) ClangTriple() string {
diff --git a/cc/linker.go b/cc/linker.go
index f6223a7..6bbf015 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -246,6 +246,10 @@
if ctx.Darwin() {
return false
}
+ // http://b/110800681 - lld cannot link Android's Windows modules yet.
+ if ctx.Windows() {
+ return false
+ }
if linker.Properties.Use_clang_lld != nil {
return Bool(linker.Properties.Use_clang_lld)
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 5a912e1..88d4639 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -75,6 +75,7 @@
ctx.Strict("LLVM_OBJCOPY", "${config.ClangBin}/llvm-objcopy")
ctx.Strict("LLVM_STRIP", "${config.ClangBin}/llvm-strip")
ctx.Strict("PATH_TO_CLANG_TIDY", "${config.ClangBin}/clang-tidy")
+ ctx.Strict("CLANG_TIDY_UNKNOWN_CFLAGS", strings.Join(config.ClangTidyUnknownCflags, " "))
ctx.StrictSorted("CLANG_CONFIG_UNKNOWN_CFLAGS", strings.Join(config.ClangUnknownCflags, " "))
ctx.Strict("RS_LLVM_PREBUILTS_VERSION", "${config.RSClangVersion}")
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 080ac09..4c8a611 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -155,7 +155,9 @@
if ctx.clang() {
if ctx.Host() {
- globalSanitizers = ctx.Config().SanitizeHost()
+ if !ctx.Windows() {
+ globalSanitizers = ctx.Config().SanitizeHost()
+ }
} else {
arches := ctx.Config().SanitizeDeviceArch()
if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
diff --git a/java/builder.go b/java/builder.go
index 1944e69..15e9631 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -41,10 +41,11 @@
blueprint.RuleParams{
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
+ `(if [ -s $srcJarDir/list ] || [ -s $out.rsp ] ; then ` +
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
`$processorpath $javacFlags $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
- `-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
+ `-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list ; fi ) && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
CommandDeps: []string{
"${config.JavacCmd}",
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 9821bcf..1eb935f 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -640,20 +640,17 @@
var bootClasspathArgs string
javaVersion := getJavaVersion(ctx, String(d.Javadoc.properties.Java_version), String(d.Javadoc.properties.Sdk_version))
- if javaVersion == "1.9" {
- if len(deps.bootClasspath) > 0 {
- var systemModules classpath
- if deps.systemModules != nil {
- systemModules = append(systemModules, deps.systemModules)
- }
- bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
- bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
- }
- } else {
- if len(deps.bootClasspath.Strings()) > 0 {
- // For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
- bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath")
- }
+ // Doclava has problem with "-source 1.9", so override javaVersion when Doclava
+ // is running with EXPERIMENTAL_USE_OPENJDK9=true. And eventually Doclava will be
+ // replaced by Metalava.
+ if !Bool(d.properties.Metalava_enabled) {
+ javaVersion = "1.8"
+ }
+ // continue to use -bootclasspath even if Metalava under -source 1.9 is enabled
+ // since it doesn't support system modules yet.
+ if len(deps.bootClasspath.Strings()) > 0 {
+ // For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
+ bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath")
}
classpathArgs := deps.classpath.FormJavaClassPath("-classpath")
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 55da533..5dfc32f 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -99,6 +99,9 @@
// These libraries are not compiled into the stubs jar.
Static_libs []string `android:"arch_variant"`
+ // List of Java libraries that will be in the classpath when building stubs
+ Stub_only_libs []string `android:"arch_variant"`
+
// list of package names that will be documented and publicized as API
Api_packages []string
@@ -297,6 +300,7 @@
Name *string
Srcs []string
Sdk_version *string
+ Libs []string
Soc_specific *bool
Device_specific *bool
Product_specific *bool
@@ -314,6 +318,7 @@
// sources are generated from the droiddoc
props.Srcs = []string{":" + module.docsName(apiScope)}
props.Sdk_version = proptools.StringPtr(module.sdkVersion(apiScope))
+ props.Libs = module.properties.Stub_only_libs
// Unbundled apps will use the prebult one from /prebuilts/sdk
props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false)
props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)