Merge "Set the OS name in the metrics protobuf file"
diff --git a/android/Android.bp b/android/Android.bp
index ff14a70..a1b5159 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -41,6 +41,7 @@
"paths.go",
"phony.go",
"prebuilt.go",
+ "prebuilt_build_tool.go",
"proto.go",
"register.go",
"rule_builder.go",
diff --git a/android/config.go b/android/config.go
index 92a21a7..10a78a5 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1248,6 +1248,10 @@
return c.config.productVariables.BoardKernelBinaries
}
+func (c *deviceConfig) BoardKernelModuleInterfaceVersions() []string {
+ return c.config.productVariables.BoardKernelModuleInterfaceVersions
+}
+
// The ConfiguredJarList struct provides methods for handling a list of (apex, jar) pairs.
// Such lists are used in the build system for things like bootclasspath jars or system server jars.
// The apex part is either an apex name, or a special names "platform" or "system_ext". Jar is a
diff --git a/android/defs.go b/android/defs.go
index 4552224..83daa03 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -69,7 +69,7 @@
// A symlink rule.
Symlink = pctx.AndroidStaticRule("Symlink",
blueprint.RuleParams{
- Command: "ln -f -s $fromPath $out",
+ Command: "rm -f $out && ln -f -s $fromPath $out",
Description: "symlink $out",
},
"fromPath")
diff --git a/android/prebuilt_build_tool.go b/android/prebuilt_build_tool.go
new file mode 100644
index 0000000..1dcf199
--- /dev/null
+++ b/android/prebuilt_build_tool.go
@@ -0,0 +1,94 @@
+// Copyright 2020 Google Inc. All rights reserved.
+//
+// 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.
+
+package android
+
+func init() {
+ RegisterModuleType("prebuilt_build_tool", prebuiltBuildToolFactory)
+}
+
+type prebuiltBuildToolProperties struct {
+ // Source file to be executed for this build tool
+ Src *string `android:"path,arch_variant"`
+
+ // Extra files that should trigger rules using this tool to rebuild
+ Deps []string `android:"path,arch_variant"`
+
+ // Create a make variable with the specified name that contains the path to
+ // this prebuilt built tool, relative to the root of the source tree.
+ Export_to_make_var *string
+}
+
+type prebuiltBuildTool struct {
+ ModuleBase
+ prebuilt Prebuilt
+
+ properties prebuiltBuildToolProperties
+
+ toolPath OptionalPath
+}
+
+func (t *prebuiltBuildTool) Name() string {
+ return t.prebuilt.Name(t.ModuleBase.Name())
+}
+
+func (t *prebuiltBuildTool) Prebuilt() *Prebuilt {
+ return &t.prebuilt
+}
+
+func (t *prebuiltBuildTool) DepsMutator(ctx BottomUpMutatorContext) {
+ if t.properties.Src == nil {
+ ctx.PropertyErrorf("src", "missing prebuilt source file")
+ }
+}
+
+func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
+ sourcePath := t.prebuilt.SingleSourcePath(ctx)
+ installedPath := PathForModuleOut(ctx, t.ModuleBase.Name())
+ deps := PathsForModuleSrc(ctx, t.properties.Deps)
+
+ ctx.Build(pctx, BuildParams{
+ Rule: Symlink,
+ Output: installedPath,
+ Input: sourcePath,
+ Implicits: deps,
+ Args: map[string]string{
+ "fromPath": "$$PWD/" + sourcePath.String(),
+ },
+ })
+
+ t.toolPath = OptionalPathForPath(installedPath)
+}
+
+func (t *prebuiltBuildTool) MakeVars(ctx MakeVarsModuleContext) {
+ if makeVar := String(t.properties.Export_to_make_var); makeVar != "" {
+ ctx.StrictRaw(makeVar, t.toolPath.String())
+ }
+}
+
+func (t *prebuiltBuildTool) HostToolPath() OptionalPath {
+ return t.toolPath
+}
+
+var _ HostToolProvider = &prebuiltBuildTool{}
+
+// prebuilt_build_tool is to declare prebuilts to be used during the build, particularly for use
+// in genrules with the "tools" property.
+func prebuiltBuildToolFactory() Module {
+ module := &prebuiltBuildTool{}
+ module.AddProperties(&module.properties)
+ InitSingleSourcePrebuiltModule(module, &module.properties, "Src")
+ InitAndroidArchModule(module, HostSupportedNoCross, MultilibFirst)
+ return module
+}
diff --git a/android/variable.go b/android/variable.go
index c1e1b42..8799d58 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -345,7 +345,8 @@
BoardUsesRecoveryAsBoot *bool `json:",omitempty"`
- BoardKernelBinaries []string `json:",omitempty"`
+ BoardKernelBinaries []string `json:",omitempty"`
+ BoardKernelModuleInterfaceVersions []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/rust/rust.go b/rust/rust.go
index edfa5d8..113b0b2 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -807,8 +807,8 @@
directSrcProvidersDeps = append(directSrcProvidersDeps, rustDep)
}
- //Append the dependencies exportedDirs
- if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok {
+ //Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
+ if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag {
depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...)
depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...)
}
diff --git a/third_party/zip/android.go b/third_party/zip/android.go
index 8d387cc..f8e45c5 100644
--- a/third_party/zip/android.go
+++ b/third_party/zip/android.go
@@ -43,6 +43,15 @@
offset: uint64(w.cw.count),
}
w.dir = append(w.dir, h)
+ if !fh.isZip64() {
+ // Some writers will generate 64 bit sizes and set 32 bit fields to
+ // uint32max even if the actual size fits in 32 bit. So we should
+ // make sure CompressedSize contains the correct value in such
+ // cases. With out the two lines below we would be writing invalid(-1)
+ // sizes in such case.
+ fh.CompressedSize = uint32(fh.CompressedSize64)
+ fh.UncompressedSize = uint32(fh.UncompressedSize64)
+ }
if err := writeHeader(w.cw, fh); err != nil {
return err