Merge "Create flattened variants for soong apex module"
diff --git a/Android.bp b/Android.bp
index 537b58b..25038c6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -208,7 +208,6 @@
"cc/prebuilt_test.go",
"cc/proto_test.go",
"cc/test_data_test.go",
- "cc/util_test.go",
],
pluginFor: ["soong_build"],
}
diff --git a/android/util.go b/android/util.go
index e02cca1..0102442 100644
--- a/android/util.go
+++ b/android/util.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "path/filepath"
"reflect"
"regexp"
"runtime"
@@ -292,3 +293,29 @@
}
return strings.HasPrefix(str, pat[:i]) && strings.HasSuffix(str, pat[i+1:])
}
+
+var shlibVersionPattern = regexp.MustCompile("(?:\\.\\d+(?:svn)?)+")
+
+// splitFileExt splits a file name into root, suffix and ext. root stands for the file name without
+// the file extension and the version number (e.g. "libexample"). suffix stands for the
+// concatenation of the file extension and the version number (e.g. ".so.1.0"). ext stands for the
+// file extension after the version numbers are trimmed (e.g. ".so").
+func SplitFileExt(name string) (string, string, string) {
+ // Extract and trim the shared lib version number if the file name ends with dot digits.
+ suffix := ""
+ matches := shlibVersionPattern.FindAllStringIndex(name, -1)
+ if len(matches) > 0 {
+ lastMatch := matches[len(matches)-1]
+ if lastMatch[1] == len(name) {
+ suffix = name[lastMatch[0]:lastMatch[1]]
+ name = name[0:lastMatch[0]]
+ }
+ }
+
+ // Extract the file name root and the file extension.
+ ext := filepath.Ext(name)
+ root := strings.TrimSuffix(name, ext)
+ suffix = ext + suffix
+
+ return root, suffix, ext
+}
diff --git a/android/util_test.go b/android/util_test.go
index 2e5eb07..1df1c5a 100644
--- a/android/util_test.go
+++ b/android/util_test.go
@@ -404,3 +404,68 @@
// b = ["foo" "bar"]
// c = ["foo" "baz"]
}
+
+func TestSplitFileExt(t *testing.T) {
+ t.Run("soname with version", func(t *testing.T) {
+ root, suffix, ext := SplitFileExt("libtest.so.1.0.30")
+ expected := "libtest"
+ if root != expected {
+ t.Errorf("root should be %q but got %q", expected, root)
+ }
+ expected = ".so.1.0.30"
+ if suffix != expected {
+ t.Errorf("suffix should be %q but got %q", expected, suffix)
+ }
+ expected = ".so"
+ if ext != expected {
+ t.Errorf("ext should be %q but got %q", expected, ext)
+ }
+ })
+
+ t.Run("soname with svn version", func(t *testing.T) {
+ root, suffix, ext := SplitFileExt("libtest.so.1svn")
+ expected := "libtest"
+ if root != expected {
+ t.Errorf("root should be %q but got %q", expected, root)
+ }
+ expected = ".so.1svn"
+ if suffix != expected {
+ t.Errorf("suffix should be %q but got %q", expected, suffix)
+ }
+ expected = ".so"
+ if ext != expected {
+ t.Errorf("ext should be %q but got %q", expected, ext)
+ }
+ })
+
+ t.Run("version numbers in the middle should be ignored", func(t *testing.T) {
+ root, suffix, ext := SplitFileExt("libtest.1.0.30.so")
+ expected := "libtest.1.0.30"
+ if root != expected {
+ t.Errorf("root should be %q but got %q", expected, root)
+ }
+ expected = ".so"
+ if suffix != expected {
+ t.Errorf("suffix should be %q but got %q", expected, suffix)
+ }
+ expected = ".so"
+ if ext != expected {
+ t.Errorf("ext should be %q but got %q", expected, ext)
+ }
+ })
+
+ t.Run("no known file extension", func(t *testing.T) {
+ root, suffix, ext := SplitFileExt("test.exe")
+ expected := "test"
+ if root != expected {
+ t.Errorf("root should be %q but got %q", expected, root)
+ }
+ expected = ".exe"
+ if suffix != expected {
+ t.Errorf("suffix should be %q but got %q", expected, suffix)
+ }
+ if ext != expected {
+ t.Errorf("ext should be %q but got %q", expected, ext)
+ }
+ })
+}
diff --git a/apex/apex.go b/apex/apex.go
index b608d17..b32cc0f 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1554,7 +1554,7 @@
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
- } else if fi.class == nativeSharedLib || fi.class == nativeExecutable {
+ } else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
if cc, ok := fi.module.(*cc.Module); ok {
if cc.UnstrippedOutputFile() != nil {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 4b0cb31..66dd838 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -207,7 +207,7 @@
library.androidMkWriteExportedFlags(w)
library.androidMkWriteAdditionalDependenciesForSourceAbiDiff(w)
- _, _, ext := splitFileExt(outputFile.Base())
+ _, _, ext := android.SplitFileExt(outputFile.Base())
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
@@ -319,7 +319,7 @@
func (library *toolchainLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Class = "STATIC_LIBRARIES"
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
- _, suffix, _ := splitFileExt(outputFile.Base())
+ _, suffix, _ := android.SplitFileExt(outputFile.Base())
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
})
}
@@ -334,7 +334,7 @@
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
path := installer.path.RelPathString()
dir, file := filepath.Split(path)
- stem, suffix, _ := splitFileExt(file)
+ stem, suffix, _ := android.SplitFileExt(file)
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
@@ -347,7 +347,7 @@
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
path, file := filepath.Split(c.installPath.String())
- stem, suffix, _ := splitFileExt(file)
+ stem, suffix, _ := android.SplitFileExt(file)
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path)
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
@@ -361,7 +361,7 @@
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
c.libraryDecorator.androidMkWriteExportedFlags(w)
- _, _, ext := splitFileExt(outputFile.Base())
+ _, _, ext := android.SplitFileExt(outputFile.Base())
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
@@ -380,7 +380,7 @@
path := c.path.RelPathString()
dir, file := filepath.Split(path)
- stem, suffix, ext := splitFileExt(file)
+ stem, suffix, ext := android.SplitFileExt(file)
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
@@ -398,7 +398,7 @@
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
c.libraryDecorator.androidMkWriteExportedFlags(w)
- _, _, ext := splitFileExt(outputFile.Base())
+ _, _, ext := android.SplitFileExt(outputFile.Base())
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index e754ad5..d7d8955 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -120,6 +120,8 @@
"libmedia_omx",
"libmemtrack",
"libnetutils",
+ "libprotobuf-cpp-full",
+ "libprotobuf-cpp-lite",
"libpuresoftkeymasterdevice",
"libradio_metadata",
"libselinux",
diff --git a/cc/fuzz.go b/cc/fuzz.go
index d44c02d..b0fb262 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -15,9 +15,12 @@
package cc
import (
+ "path/filepath"
+
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/cc/config"
- "github.com/google/blueprint/proptools"
)
func init() {
@@ -78,21 +81,14 @@
}
func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
- fuzz.binaryDecorator.baseInstaller.dir = "fuzz"
- fuzz.binaryDecorator.baseInstaller.dir64 = "fuzz"
+ fuzz.binaryDecorator.baseInstaller.dir = filepath.Join("fuzz", ctx.Target().Arch.ArchType.String())
+ fuzz.binaryDecorator.baseInstaller.dir64 = filepath.Join("fuzz", ctx.Target().Arch.ArchType.String())
fuzz.binaryDecorator.baseInstaller.install(ctx, file)
}
func NewFuzz(hod android.HostOrDeviceSupported) *Module {
module, binary := NewBinary(hod)
- // TODO(mitchp): The toolchain does not currently export the x86 (32-bit)
- // variant of libFuzzer for host. There is no way to only disable the host
- // 32-bit variant, so we specify cc_fuzz targets as 64-bit only. This doesn't
- // hurt anyone, as cc_fuzz is mostly for experimental targets as of this
- // moment.
- module.multilib = "64"
-
binary.baseInstaller = NewFuzzInstaller()
module.sanitize.SetSanitizer(fuzzer, true)
diff --git a/cc/util.go b/cc/util.go
index 7b8ad18..2f7bec2 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -104,32 +104,6 @@
return list
}
-var shlibVersionPattern = regexp.MustCompile("(?:\\.\\d+(?:svn)?)+")
-
-// splitFileExt splits a file name into root, suffix and ext. root stands for the file name without
-// the file extension and the version number (e.g. "libexample"). suffix stands for the
-// concatenation of the file extension and the version number (e.g. ".so.1.0"). ext stands for the
-// file extension after the version numbers are trimmed (e.g. ".so").
-func splitFileExt(name string) (string, string, string) {
- // Extract and trim the shared lib version number if the file name ends with dot digits.
- suffix := ""
- matches := shlibVersionPattern.FindAllStringIndex(name, -1)
- if len(matches) > 0 {
- lastMatch := matches[len(matches)-1]
- if lastMatch[1] == len(name) {
- suffix = name[lastMatch[0]:lastMatch[1]]
- name = name[0:lastMatch[0]]
- }
- }
-
- // Extract the file name root and the file extension.
- ext := filepath.Ext(name)
- root := strings.TrimSuffix(name, ext)
- suffix = ext + suffix
-
- return root, suffix, ext
-}
-
// linkDirOnDevice/linkName -> target
func makeSymlinkCmd(linkDirOnDevice string, linkName string, target string) string {
dir := filepath.Join("$(PRODUCT_OUT)", linkDirOnDevice)
diff --git a/cc/util_test.go b/cc/util_test.go
deleted file mode 100644
index 7c718ea..0000000
--- a/cc/util_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2018 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 cc
-
-import (
- "testing"
-)
-
-func TestSplitFileExt(t *testing.T) {
- t.Run("soname with version", func(t *testing.T) {
- root, suffix, ext := splitFileExt("libtest.so.1.0.30")
- expected := "libtest"
- if root != expected {
- t.Errorf("root should be %q but got %q", expected, root)
- }
- expected = ".so.1.0.30"
- if suffix != expected {
- t.Errorf("suffix should be %q but got %q", expected, suffix)
- }
- expected = ".so"
- if ext != expected {
- t.Errorf("ext should be %q but got %q", expected, ext)
- }
- })
-
- t.Run("soname with svn version", func(t *testing.T) {
- root, suffix, ext := splitFileExt("libtest.so.1svn")
- expected := "libtest"
- if root != expected {
- t.Errorf("root should be %q but got %q", expected, root)
- }
- expected = ".so.1svn"
- if suffix != expected {
- t.Errorf("suffix should be %q but got %q", expected, suffix)
- }
- expected = ".so"
- if ext != expected {
- t.Errorf("ext should be %q but got %q", expected, ext)
- }
- })
-
- t.Run("version numbers in the middle should be ignored", func(t *testing.T) {
- root, suffix, ext := splitFileExt("libtest.1.0.30.so")
- expected := "libtest.1.0.30"
- if root != expected {
- t.Errorf("root should be %q but got %q", expected, root)
- }
- expected = ".so"
- if suffix != expected {
- t.Errorf("suffix should be %q but got %q", expected, suffix)
- }
- expected = ".so"
- if ext != expected {
- t.Errorf("ext should be %q but got %q", expected, ext)
- }
- })
-
- t.Run("no known file extension", func(t *testing.T) {
- root, suffix, ext := splitFileExt("test.exe")
- expected := "test"
- if root != expected {
- t.Errorf("root should be %q but got %q", expected, root)
- }
- expected = ".exe"
- if suffix != expected {
- t.Errorf("suffix should be %q but got %q", expected, suffix)
- }
- if ext != expected {
- t.Errorf("ext should be %q but got %q", expected, ext)
- }
- })
-}
diff --git a/java/aar.go b/java/aar.go
index f5d7e97..6a883d3 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -220,14 +220,13 @@
manifestPath := manifestFixer(ctx, manifestSrcPath, sdkContext, sdkLibraries,
a.isLibrary, a.useEmbeddedNativeLibs, a.usesNonSdkApis, a.useEmbeddedDex, a.hasNoCode)
- a.transitiveManifestPaths = append(android.Paths{manifestPath}, transitiveStaticLibManifests...)
+ // Add additional manifest files to transitive manifests.
+ additionalManifests := android.PathsForModuleSrc(ctx, a.aaptProperties.Additional_manifests)
+ a.transitiveManifestPaths = append(android.Paths{manifestPath}, additionalManifests...)
+ a.transitiveManifestPaths = append(a.transitiveManifestPaths, transitiveStaticLibManifests...)
- if len(transitiveStaticLibManifests) > 0 {
- // Merge additional manifest files with app manifest.
- additionalManifests := android.PathsForModuleSrc(ctx, a.aaptProperties.Additional_manifests)
- additionalManifests = append(additionalManifests, transitiveStaticLibManifests...)
-
- a.mergedManifestFile = manifestMerger(ctx, manifestPath, additionalManifests, a.isLibrary)
+ if len(a.transitiveManifestPaths) > 1 {
+ a.mergedManifestFile = manifestMerger(ctx, a.transitiveManifestPaths[0], a.transitiveManifestPaths[1:], a.isLibrary)
if !a.isLibrary {
// Only use the merged manifest for applications. For libraries, the transitive closure of manifests
// will be propagated to the final application and merged there. The merged manifest for libraries is
diff --git a/rust/androidmk.go b/rust/androidmk.go
index c9056e1..107959f 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -18,7 +18,6 @@
"fmt"
"io"
"path/filepath"
- "regexp"
"strings"
"android/soong/android"
@@ -119,37 +118,9 @@
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
path := compiler.path.RelPathString()
dir, file := filepath.Split(path)
- stem, suffix, _ := splitFileExt(file)
+ stem, suffix, _ := android.SplitFileExt(file)
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
})
}
-
-//TODO: splitFileExt copied from cc/util.go; move this to android/util.go and refactor usages.
-
-// splitFileExt splits a file name into root, suffix and ext. root stands for the file name without
-// the file extension and the version number (e.g. "libexample"). suffix stands for the
-// concatenation of the file extension and the version number (e.g. ".so.1.0"). ext stands for the
-// file extension after the version numbers are trimmed (e.g. ".so").
-var shlibVersionPattern = regexp.MustCompile("(?:\\.\\d+(?:svn)?)+")
-
-func splitFileExt(name string) (string, string, string) {
- // Extract and trim the shared lib version number if the file name ends with dot digits.
- suffix := ""
- matches := shlibVersionPattern.FindAllStringIndex(name, -1)
- if len(matches) > 0 {
- lastMatch := matches[len(matches)-1]
- if lastMatch[1] == len(name) {
- suffix = name[lastMatch[0]:lastMatch[1]]
- name = name[0:lastMatch[0]]
- }
- }
-
- // Extract the file name root and the file extension.
- ext := filepath.Ext(name)
- root := strings.TrimSuffix(name, ext)
- suffix = ext + suffix
-
- return root, suffix, ext
-}
diff --git a/rust/config/global.go b/rust/config/global.go
index 2e08a8c..7f9f993 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -22,7 +22,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.35.0"
+ RustDefaultVersion = "1.37.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{