Merge "Add "legacy_android10_support" to "apex""
diff --git a/Android.bp b/Android.bp
index f72d624..d469f41 100644
--- a/Android.bp
+++ b/Android.bp
@@ -186,6 +186,7 @@
"cc/binary.go",
"cc/fuzz.go",
"cc/library.go",
+ "cc/library_sdk_member.go",
"cc/object.go",
"cc/test.go",
"cc/toolchain_library.go",
@@ -346,6 +347,7 @@
"rust/config/whitelist.go",
"rust/config/x86_darwin_host.go",
"rust/config/x86_linux_host.go",
+ "rust/config/x86_device.go",
"rust/config/x86_64_device.go",
],
}
diff --git a/android/config.go b/android/config.go
index 271a54a..e1db55d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1103,6 +1103,10 @@
return Bool(c.productVariables.EnforceProductPartitionInterface)
}
+func (c *config) InstallExtraFlattenedApexes() bool {
+ return Bool(c.productVariables.InstallExtraFlattenedApexes)
+}
+
func (c *config) ProductHiddenAPIStubs() []string {
return c.productVariables.ProductHiddenAPIStubs
}
diff --git a/android/paths.go b/android/paths.go
index 1a37a34..85c861d 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -512,8 +512,12 @@
}
func FilterPathList(list []Path, filter []Path) (remainder []Path, filtered []Path) {
+ return FilterPathListPredicate(list, func(p Path) bool { return inPathList(p, filter) })
+}
+
+func FilterPathListPredicate(list []Path, predicate func(Path) bool) (remainder []Path, filtered []Path) {
for _, l := range list {
- if inPathList(l, filter) {
+ if predicate(l) {
filtered = append(filtered, l)
} else {
remainder = append(remainder, l)
diff --git a/android/variable.go b/android/variable.go
index 25a5dc0..628408e 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -311,6 +311,8 @@
MissingUsesLibraries []string `json:",omitempty"`
EnforceProductPartitionInterface *bool `json:",omitempty"`
+
+ InstallExtraFlattenedApexes *bool `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/apex/apex.go b/apex/apex.go
index 0fa3b2a..be86d80 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -915,6 +915,10 @@
} else {
a.suffix = ""
a.primaryApexType = true
+
+ if ctx.Config().InstallExtraFlattenedApexes() {
+ a.externalDeps = append(a.externalDeps, a.Name()+flattenedSuffix)
+ }
}
case zipApex:
if proptools.String(a.properties.Payload_type) == "zip" {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index d2884b9..3aa72e3 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2458,6 +2458,29 @@
ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n")
}
+func TestInstallExtraFlattenedApexes(t *testing.T) {
+ ctx, config := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `, func(fs map[string][]byte, config android.Config) {
+ config.TestProductVariables.InstallExtraFlattenedApexes = proptools.BoolPtr(true)
+ })
+ ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ ensureListContains(t, ab.externalDeps, "myapex.flattened")
+ mk := android.AndroidMkDataForTest(t, config, "", ab)
+ var builder strings.Builder
+ mk.Custom(&builder, ab.Name(), "TARGET_", "", mk)
+ androidMk := builder.String()
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += myapex.flattened")
+}
+
func TestApexUsesOtherApex(t *testing.T) {
ctx, _ := testApex(t, `
apex {
diff --git a/apex/builder.go b/apex/builder.go
index 213f9ea..cbbf5f8 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -138,6 +138,8 @@
Command: `${zip2zip} -i $in -o $out ` +
`apex_payload.img:apex/${abi}.img ` +
`apex_manifest.json:root/apex_manifest.json ` +
+ `apex_pubkey:root/apex_pubkey ` +
+ `apex_manifest.pb:root/apex_manifest.pb ` +
`AndroidManifest.xml:manifest/AndroidManifest.xml ` +
`assets/NOTICE.html.gz:assets/NOTICE.html.gz`,
CommandDeps: []string{"${zip2zip}"},
diff --git a/cc/cc.go b/cc/cc.go
index e8df8e6..512fe8e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -38,7 +38,7 @@
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("vndk", VndkMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
- ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
+ ctx.BottomUp("ndk_api", NdkApiMutator).Parallel()
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
ctx.BottomUp("version", VersionMutator).Parallel()
ctx.BottomUp("begin", BeginMutator).Parallel()
diff --git a/cc/library.go b/cc/library.go
index a147956..04130c4 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -24,7 +24,6 @@
"strings"
"sync"
- "github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
"android/soong/android"
@@ -1437,247 +1436,3 @@
return outputFile
}
-
-var SharedLibrarySdkMemberType = &librarySdkMemberType{
- prebuiltModuleType: "cc_prebuilt_library_shared",
- linkTypes: []string{"shared"},
-}
-
-var StaticLibrarySdkMemberType = &librarySdkMemberType{
- prebuiltModuleType: "cc_prebuilt_library_static",
- linkTypes: []string{"static"},
-}
-
-type librarySdkMemberType struct {
- prebuiltModuleType string
-
- // The set of link types supported, set of "static", "shared".
- linkTypes []string
-}
-
-func (mt *librarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
- targets := mctx.MultiTargets()
- for _, lib := range names {
- for _, target := range targets {
- name, version := StubsLibNameAndVersion(lib)
- if version == "" {
- version = LatestStubsVersionFor(mctx.Config(), name)
- }
- for _, linkType := range mt.linkTypes {
- mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
- {Mutator: "image", Variation: android.CoreVariation},
- {Mutator: "link", Variation: linkType},
- {Mutator: "version", Variation: version},
- }...), dependencyTag, name)
- }
- }
- }
-}
-
-func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
- _, ok := module.(*Module)
- return ok
-}
-
-// copy exported header files and stub *.so files
-func (mt *librarySdkMemberType) BuildSnapshot(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
- info := mt.organizeVariants(member)
- buildSharedNativeLibSnapshot(sdkModuleContext, info, builder, member)
-}
-
-// Organize the variants by architecture.
-func (mt *librarySdkMemberType) organizeVariants(member android.SdkMember) *nativeLibInfo {
- info := &nativeLibInfo{
- name: member.Name(),
- memberType: mt,
- }
-
- for _, variant := range member.Variants() {
- ccModule := variant.(*Module)
-
- info.archVariants = append(info.archVariants, archSpecificNativeLibInfo{
- name: ccModule.BaseModuleName(),
- archType: ccModule.Target().Arch.ArchType.String(),
- exportedIncludeDirs: ccModule.ExportedIncludeDirs(),
- exportedSystemIncludeDirs: ccModule.ExportedSystemIncludeDirs(),
- exportedFlags: ccModule.ExportedFlags(),
- exportedGeneratedHeaders: ccModule.ExportedGeneratedHeaders(),
- outputFile: ccModule.OutputFile().Path(),
- })
- }
-
- // Determine if include dirs and flags for each variant are different across arch-specific
- // variants or not. And set hasArchSpecificFlags accordingly
- // by default, include paths and flags are assumed to be the same across arches
- info.hasArchSpecificFlags = false
- oldSignature := ""
- for _, av := range info.archVariants {
- newSignature := av.signature()
- if oldSignature == "" {
- oldSignature = newSignature
- }
- if oldSignature != newSignature {
- info.hasArchSpecificFlags = true
- break
- }
- }
-
- return info
-}
-
-func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder, member android.SdkMember) {
- // a function for emitting include dirs
- printExportedDirCopyCommandsForNativeLibs := func(lib archSpecificNativeLibInfo) {
- includeDirs := lib.exportedIncludeDirs
- includeDirs = append(includeDirs, lib.exportedSystemIncludeDirs...)
- if len(includeDirs) == 0 {
- return
- }
- for _, dir := range includeDirs {
- if _, gen := dir.(android.WritablePath); gen {
- // generated headers are copied via exportedGeneratedHeaders. See below.
- continue
- }
- targetDir := nativeIncludeDir
- if info.hasArchSpecificFlags {
- targetDir = filepath.Join(lib.archType, targetDir)
- }
-
- // TODO(jiyong) copy headers having other suffixes
- headers, _ := sdkModuleContext.GlobWithDeps(dir.String()+"/**/*.h", nil)
- for _, file := range headers {
- src := android.PathForSource(sdkModuleContext, file)
- dest := filepath.Join(targetDir, file)
- builder.CopyToSnapshot(src, dest)
- }
- }
-
- genHeaders := lib.exportedGeneratedHeaders
- for _, file := range genHeaders {
- targetDir := nativeGeneratedIncludeDir
- if info.hasArchSpecificFlags {
- targetDir = filepath.Join(lib.archType, targetDir)
- }
- dest := filepath.Join(targetDir, lib.name, file.Rel())
- builder.CopyToSnapshot(file, dest)
- }
- }
-
- if !info.hasArchSpecificFlags {
- printExportedDirCopyCommandsForNativeLibs(info.archVariants[0])
- }
-
- // for each architecture
- for _, av := range info.archVariants {
- builder.CopyToSnapshot(av.outputFile, nativeLibraryPathFor(av))
-
- if info.hasArchSpecificFlags {
- printExportedDirCopyCommandsForNativeLibs(av)
- }
- }
-
- info.generatePrebuiltLibrary(sdkModuleContext, builder, member)
-}
-
-func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
-
- // a function for emitting include dirs
- addExportedDirsForNativeLibs := func(lib archSpecificNativeLibInfo, properties android.BpPropertySet, systemInclude bool) {
- includeDirs := nativeIncludeDirPathsFor(lib, systemInclude, info.hasArchSpecificFlags)
- if len(includeDirs) == 0 {
- return
- }
- var propertyName string
- if !systemInclude {
- propertyName = "export_include_dirs"
- } else {
- propertyName = "export_system_include_dirs"
- }
- properties.AddProperty(propertyName, includeDirs)
- }
-
- pbm := builder.AddPrebuiltModule(member, info.memberType.prebuiltModuleType)
-
- if !info.hasArchSpecificFlags {
- addExportedDirsForNativeLibs(info.archVariants[0], pbm, false /*systemInclude*/)
- addExportedDirsForNativeLibs(info.archVariants[0], pbm, true /*systemInclude*/)
- }
-
- archProperties := pbm.AddPropertySet("arch")
- for _, av := range info.archVariants {
- archTypeProperties := archProperties.AddPropertySet(av.archType)
- archTypeProperties.AddProperty("srcs", []string{nativeLibraryPathFor(av)})
- if info.hasArchSpecificFlags {
- // export_* properties are added inside the arch: {<arch>: {...}} block
- addExportedDirsForNativeLibs(av, archTypeProperties, false /*systemInclude*/)
- addExportedDirsForNativeLibs(av, archTypeProperties, true /*systemInclude*/)
- }
- }
- pbm.AddProperty("stl", "none")
- pbm.AddProperty("system_shared_libs", []string{})
-}
-
-const (
- nativeIncludeDir = "include"
- nativeGeneratedIncludeDir = "include_gen"
- nativeStubDir = "lib"
-)
-
-// path to the native library. Relative to <sdk_root>/<api_dir>
-func nativeLibraryPathFor(lib archSpecificNativeLibInfo) string {
- return filepath.Join(lib.archType,
- nativeStubDir, lib.outputFile.Base())
-}
-
-// paths to the include dirs of a native shared library. Relative to <sdk_root>/<api_dir>
-func nativeIncludeDirPathsFor(lib archSpecificNativeLibInfo, systemInclude bool, archSpecific bool) []string {
- var result []string
- var includeDirs []android.Path
- if !systemInclude {
- includeDirs = lib.exportedIncludeDirs
- } else {
- includeDirs = lib.exportedSystemIncludeDirs
- }
- for _, dir := range includeDirs {
- var path string
- if _, gen := dir.(android.WritablePath); gen {
- path = filepath.Join(nativeGeneratedIncludeDir, lib.name)
- } else {
- path = filepath.Join(nativeIncludeDir, dir.String())
- }
- if archSpecific {
- path = filepath.Join(lib.archType, path)
- }
- result = append(result, path)
- }
- return result
-}
-
-// archSpecificNativeLibInfo represents an arch-specific variant of a native lib
-type archSpecificNativeLibInfo struct {
- name string
- archType string
- exportedIncludeDirs android.Paths
- exportedSystemIncludeDirs android.Paths
- exportedFlags []string
- exportedGeneratedHeaders android.Paths
- outputFile android.Path
-}
-
-func (lib *archSpecificNativeLibInfo) signature() string {
- return fmt.Sprintf("%v %v %v %v",
- lib.name,
- lib.exportedIncludeDirs.Strings(),
- lib.exportedSystemIncludeDirs.Strings(),
- lib.exportedFlags)
-}
-
-// nativeLibInfo represents a collection of arch-specific modules having the same name
-type nativeLibInfo struct {
- name string
- memberType *librarySdkMemberType
- archVariants []archSpecificNativeLibInfo
- // hasArchSpecificFlags is set to true if modules for each architecture all have the same
- // include dirs, flags, etc, in which case only those of the first arch is selected.
- hasArchSpecificFlags bool
-}
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
new file mode 100644
index 0000000..6b09c12
--- /dev/null
+++ b/cc/library_sdk_member.go
@@ -0,0 +1,320 @@
+// Copyright 2019 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 (
+ "path/filepath"
+ "reflect"
+
+ "android/soong/android"
+ "github.com/google/blueprint"
+)
+
+// This file contains support for using cc library modules within an sdk.
+
+var SharedLibrarySdkMemberType = &librarySdkMemberType{
+ prebuiltModuleType: "cc_prebuilt_library_shared",
+ linkTypes: []string{"shared"},
+}
+
+var StaticLibrarySdkMemberType = &librarySdkMemberType{
+ prebuiltModuleType: "cc_prebuilt_library_static",
+ linkTypes: []string{"static"},
+}
+
+type librarySdkMemberType struct {
+ prebuiltModuleType string
+
+ // The set of link types supported, set of "static", "shared".
+ linkTypes []string
+}
+
+func (mt *librarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
+ targets := mctx.MultiTargets()
+ for _, lib := range names {
+ for _, target := range targets {
+ name, version := StubsLibNameAndVersion(lib)
+ if version == "" {
+ version = LatestStubsVersionFor(mctx.Config(), name)
+ }
+ for _, linkType := range mt.linkTypes {
+ mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
+ {Mutator: "image", Variation: android.CoreVariation},
+ {Mutator: "link", Variation: linkType},
+ {Mutator: "version", Variation: version},
+ }...), dependencyTag, name)
+ }
+ }
+ }
+}
+
+func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
+ _, ok := module.(*Module)
+ return ok
+}
+
+// copy exported header files and stub *.so files
+func (mt *librarySdkMemberType) BuildSnapshot(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
+ info := mt.organizeVariants(member)
+ buildSharedNativeLibSnapshot(sdkModuleContext, info, builder, member)
+}
+
+// Organize the variants by architecture.
+func (mt *librarySdkMemberType) organizeVariants(member android.SdkMember) *nativeLibInfo {
+ memberName := member.Name()
+ info := &nativeLibInfo{
+ name: memberName,
+ memberType: mt,
+ }
+
+ for _, variant := range member.Variants() {
+ ccModule := variant.(*Module)
+
+ // Separate out the generated include dirs (which are arch specific) from the
+ // include dirs (which may not be).
+ exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
+ ccModule.ExportedIncludeDirs(), isGeneratedHeaderDirectory)
+
+ info.archVariantProperties = append(info.archVariantProperties, nativeLibInfoProperties{
+ name: memberName,
+ archType: ccModule.Target().Arch.ArchType.String(),
+ ExportedIncludeDirs: exportedIncludeDirs,
+ ExportedGeneratedIncludeDirs: exportedGeneratedIncludeDirs,
+ ExportedSystemIncludeDirs: ccModule.ExportedSystemIncludeDirs(),
+ ExportedFlags: ccModule.ExportedFlags(),
+ exportedGeneratedHeaders: ccModule.ExportedGeneratedHeaders(),
+ outputFile: ccModule.OutputFile().Path(),
+ })
+ }
+
+ // Initialize the unexported properties that will not be set during the
+ // extraction process.
+ info.commonProperties.name = memberName
+
+ // Extract common properties from the arch specific properties.
+ extractCommonProperties(&info.commonProperties, info.archVariantProperties)
+
+ return info
+}
+
+func isGeneratedHeaderDirectory(p android.Path) bool {
+ _, gen := p.(android.WritablePath)
+ return gen
+}
+
+// Extract common properties from a slice of property structures of the same type.
+//
+// All the property structures must be of the same type.
+// commonProperties - must be a pointer to the structure into which common properties will be added.
+// inputPropertiesSlice - must be a slice of input properties structures.
+//
+// Iterates over each exported field (capitalized name) and checks to see whether they
+// have the same value (using DeepEquals) across all the input properties. If it does not then no
+// change is made. Otherwise, the common value is stored in the field in the commonProperties
+// and the field in each of the input properties structure is set to its default value.
+func extractCommonProperties(commonProperties interface{}, inputPropertiesSlice interface{}) {
+ commonStructValue := reflect.ValueOf(commonProperties).Elem()
+ propertiesStructType := commonStructValue.Type()
+
+ // Create an empty structure from which default values for the field can be copied.
+ emptyStructValue := reflect.New(propertiesStructType).Elem()
+
+ for f := 0; f < propertiesStructType.NumField(); f++ {
+ // Check to see if all the structures have the same value for the field. The commonValue
+ // is nil on entry to the loop and if it is nil on exit then there is no common value,
+ // otherwise it points to the common value.
+ var commonValue *reflect.Value
+ sliceValue := reflect.ValueOf(inputPropertiesSlice)
+
+ for i := 0; i < sliceValue.Len(); i++ {
+ structValue := sliceValue.Index(i)
+ fieldValue := structValue.Field(f)
+ if !fieldValue.CanInterface() {
+ // The field is not exported so ignore it.
+ continue
+ }
+
+ if commonValue == nil {
+ // Use the first value as the commonProperties value.
+ commonValue = &fieldValue
+ } else {
+ // If the value does not match the current common value then there is
+ // no value in common so break out.
+ if !reflect.DeepEqual(fieldValue.Interface(), commonValue.Interface()) {
+ commonValue = nil
+ break
+ }
+ }
+ }
+
+ // If the fields all have a common value then store it in the common struct field
+ // and set the input struct's field to the empty value.
+ if commonValue != nil {
+ emptyValue := emptyStructValue.Field(f)
+ commonStructValue.Field(f).Set(*commonValue)
+ for i := 0; i < sliceValue.Len(); i++ {
+ structValue := sliceValue.Index(i)
+ fieldValue := structValue.Field(f)
+ fieldValue.Set(emptyValue)
+ }
+ }
+ }
+}
+
+func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder, member android.SdkMember) {
+ // a function for emitting include dirs
+ addExportedDirCopyCommandsForNativeLibs := func(lib nativeLibInfoProperties) {
+ // Do not include ExportedGeneratedIncludeDirs in the list of directories whose
+ // contents are copied as they are copied from exportedGeneratedHeaders below.
+ includeDirs := lib.ExportedIncludeDirs
+ includeDirs = append(includeDirs, lib.ExportedSystemIncludeDirs...)
+ for _, dir := range includeDirs {
+ // lib.ArchType is "" for common properties.
+ targetDir := filepath.Join(lib.archType, nativeIncludeDir)
+
+ // TODO(jiyong) copy headers having other suffixes
+ headers, _ := sdkModuleContext.GlobWithDeps(dir.String()+"/**/*.h", nil)
+ for _, file := range headers {
+ src := android.PathForSource(sdkModuleContext, file)
+ dest := filepath.Join(targetDir, file)
+ builder.CopyToSnapshot(src, dest)
+ }
+ }
+
+ genHeaders := lib.exportedGeneratedHeaders
+ for _, file := range genHeaders {
+ // lib.ArchType is "" for common properties.
+ targetDir := filepath.Join(lib.archType, nativeGeneratedIncludeDir)
+
+ dest := filepath.Join(targetDir, lib.name, file.Rel())
+ builder.CopyToSnapshot(file, dest)
+ }
+ }
+
+ addExportedDirCopyCommandsForNativeLibs(info.commonProperties)
+
+ // for each architecture
+ for _, av := range info.archVariantProperties {
+ builder.CopyToSnapshot(av.outputFile, nativeLibraryPathFor(av))
+
+ addExportedDirCopyCommandsForNativeLibs(av)
+ }
+
+ info.generatePrebuiltLibrary(sdkModuleContext, builder, member)
+}
+
+func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
+
+ // a function for emitting include dirs
+ addExportedDirsForNativeLibs := func(lib nativeLibInfoProperties, properties android.BpPropertySet, systemInclude bool) {
+ includeDirs := nativeIncludeDirPathsFor(lib, systemInclude)
+ if len(includeDirs) == 0 {
+ return
+ }
+ var propertyName string
+ if !systemInclude {
+ propertyName = "export_include_dirs"
+ } else {
+ propertyName = "export_system_include_dirs"
+ }
+ properties.AddProperty(propertyName, includeDirs)
+ }
+
+ pbm := builder.AddPrebuiltModule(member, info.memberType.prebuiltModuleType)
+
+ addExportedDirsForNativeLibs(info.commonProperties, pbm, false /*systemInclude*/)
+ addExportedDirsForNativeLibs(info.commonProperties, pbm, true /*systemInclude*/)
+
+ archProperties := pbm.AddPropertySet("arch")
+ for _, av := range info.archVariantProperties {
+ archTypeProperties := archProperties.AddPropertySet(av.archType)
+ archTypeProperties.AddProperty("srcs", []string{nativeLibraryPathFor(av)})
+
+ // export_* properties are added inside the arch: {<arch>: {...}} block
+ addExportedDirsForNativeLibs(av, archTypeProperties, false /*systemInclude*/)
+ addExportedDirsForNativeLibs(av, archTypeProperties, true /*systemInclude*/)
+ }
+ pbm.AddProperty("stl", "none")
+ pbm.AddProperty("system_shared_libs", []string{})
+}
+
+const (
+ nativeIncludeDir = "include"
+ nativeGeneratedIncludeDir = "include_gen"
+ nativeStubDir = "lib"
+)
+
+// path to the native library. Relative to <sdk_root>/<api_dir>
+func nativeLibraryPathFor(lib nativeLibInfoProperties) string {
+ return filepath.Join(lib.archType,
+ nativeStubDir, lib.outputFile.Base())
+}
+
+// paths to the include dirs of a native shared library. Relative to <sdk_root>/<api_dir>
+func nativeIncludeDirPathsFor(lib nativeLibInfoProperties, systemInclude bool) []string {
+ var result []string
+ var includeDirs []android.Path
+ if !systemInclude {
+ // Include the generated include dirs in the exported include dirs.
+ includeDirs = append(lib.ExportedIncludeDirs, lib.ExportedGeneratedIncludeDirs...)
+ } else {
+ includeDirs = lib.ExportedSystemIncludeDirs
+ }
+ for _, dir := range includeDirs {
+ var path string
+ if isGeneratedHeaderDirectory(dir) {
+ path = filepath.Join(nativeGeneratedIncludeDir, lib.name)
+ } else {
+ path = filepath.Join(nativeIncludeDir, dir.String())
+ }
+
+ // lib.ArchType is "" for common properties.
+ path = filepath.Join(lib.archType, path)
+ result = append(result, path)
+ }
+ return result
+}
+
+// nativeLibInfoProperties represents properties of a native lib
+//
+// The exported (capitalized) fields will be examined and may be changed during common value extraction.
+// The unexported fields will be left untouched.
+type nativeLibInfoProperties struct {
+ // The name of the library, is not exported as this must not be changed during optimization.
+ name string
+
+ // archType is not exported as if set (to a non default value) it is always arch specific.
+ // This is "" for common properties.
+ archType string
+
+ ExportedIncludeDirs android.Paths
+ ExportedGeneratedIncludeDirs android.Paths
+ ExportedSystemIncludeDirs android.Paths
+ ExportedFlags []string
+
+ // exportedGeneratedHeaders is not exported as if set it is always arch specific.
+ exportedGeneratedHeaders android.Paths
+
+ // outputFile is not exported as it is always arch specific.
+ outputFile android.Path
+}
+
+// nativeLibInfo represents a collection of arch-specific modules having the same name
+type nativeLibInfo struct {
+ name string
+ memberType *librarySdkMemberType
+ archVariantProperties []nativeLibInfoProperties
+ commonProperties nativeLibInfoProperties
+}
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index c47cbf0..d529622 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -228,7 +228,7 @@
}
}
-func ndkApiMutator(mctx android.BottomUpMutatorContext) {
+func NdkApiMutator(mctx android.BottomUpMutatorContext) {
if m, ok := mctx.Module().(*Module); ok {
if m.Enabled() {
if compiler, ok := m.compiler.(*stubDecorator); ok {
@@ -389,7 +389,7 @@
// ndk_library creates a stub library that exposes dummy implementation
// of functions and variables for use at build time only.
-func ndkLibraryFactory() android.Module {
+func NdkLibraryFactory() android.Module {
module := newStubLibrary()
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
module.ModuleBase.EnableNativeBridgeSupportByDefault()
diff --git a/cc/ndk_prebuilt.go b/cc/ndk_prebuilt.go
index 4356732..e849aee 100644
--- a/cc/ndk_prebuilt.go
+++ b/cc/ndk_prebuilt.go
@@ -23,8 +23,8 @@
)
func init() {
- android.RegisterModuleType("ndk_prebuilt_object", ndkPrebuiltObjectFactory)
- android.RegisterModuleType("ndk_prebuilt_static_stl", ndkPrebuiltStaticStlFactory)
+ android.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory)
+ android.RegisterModuleType("ndk_prebuilt_static_stl", NdkPrebuiltStaticStlFactory)
android.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory)
}
@@ -68,7 +68,7 @@
// operations. Soong's module name format is ndk_<NAME>.o.<sdk_version> where
// the object is located under
// ./prebuilts/ndk/current/platforms/android-<sdk_version>/arch-$(HOST_ARCH)/usr/lib/<NAME>.o.
-func ndkPrebuiltObjectFactory() android.Module {
+func NdkPrebuiltObjectFactory() android.Module {
module := newBaseModule(android.DeviceSupported, android.MultilibBoth)
module.ModuleBase.EnableNativeBridgeSupportByDefault()
module.linker = &ndkPrebuiltObjectLinker{
@@ -126,7 +126,7 @@
// library (stl) library for linking operation. The soong's module name format
// is ndk_<NAME>.a where the library is located under
// ./prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/$(HOST_ARCH)/<NAME>.a.
-func ndkPrebuiltStaticStlFactory() android.Module {
+func NdkPrebuiltStaticStlFactory() android.Module {
module, library := NewLibrary(android.DeviceSupported)
library.BuildOnlyStatic()
module.compiler = nil
diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go
index f6de4ef..56fd54b 100644
--- a/cc/ndk_sysroot.go
+++ b/cc/ndk_sysroot.go
@@ -58,7 +58,7 @@
func init() {
android.RegisterModuleType("ndk_headers", ndkHeadersFactory)
- android.RegisterModuleType("ndk_library", ndkLibraryFactory)
+ android.RegisterModuleType("ndk_library", NdkLibraryFactory)
android.RegisterModuleType("versioned_ndk_headers", versionedNdkHeadersFactory)
android.RegisterModuleType("preprocessed_ndk_headers", preprocessedNdkHeadersFactory)
android.RegisterSingletonType("ndk", NdkSingleton)
diff --git a/cc/testing.go b/cc/testing.go
index 18cc83f..417ea4a 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -265,6 +265,7 @@
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory)
+ ctx.RegisterModuleType("ndk_library", NdkLibraryFactory)
ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory)
ctx.RegisterModuleType("cc_object", ObjectFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
diff --git a/rust/binary.go b/rust/binary.go
index d4b6614..fda056e 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -57,7 +57,7 @@
module := newModule(hod, android.MultilibFirst)
binary := &binaryDecorator{
- baseCompiler: NewBaseCompiler("bin", ""),
+ baseCompiler: NewBaseCompiler("bin", "", InstallInSystem),
}
module.compiler = binary
diff --git a/rust/compiler.go b/rust/compiler.go
index 88e3fb2..4593165 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -36,14 +36,22 @@
compiler.Properties.No_stdlibs = proptools.BoolPtr(true)
}
-func NewBaseCompiler(dir, dir64 string) *baseCompiler {
+func NewBaseCompiler(dir, dir64 string, location installLocation) *baseCompiler {
return &baseCompiler{
Properties: BaseCompilerProperties{},
dir: dir,
dir64: dir64,
+ location: location,
}
}
+type installLocation int
+
+const (
+ InstallInSystem installLocation = 0
+ InstallInData = iota
+)
+
type BaseCompilerProperties struct {
// whether to pass "-D warnings" to rustc. Defaults to true.
Deny_warnings *bool
@@ -109,10 +117,15 @@
subDir string
relative string
path android.InstallPath
+ location installLocation
}
var _ compiler = (*baseCompiler)(nil)
+func (compiler *baseCompiler) inData() bool {
+ return compiler.location == InstallInData
+}
+
func (compiler *baseCompiler) compilerProps() []interface{} {
return []interface{}{&compiler.Properties}
}
diff --git a/rust/config/x86_device.go b/rust/config/x86_device.go
new file mode 100644
index 0000000..ec19b3c
--- /dev/null
+++ b/rust/config/x86_device.go
@@ -0,0 +1,97 @@
+// Copyright 2019 The Android Open Source Project
+//
+// 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 config
+
+import (
+ "strings"
+
+ "android/soong/android"
+)
+
+var (
+ x86RustFlags = []string{}
+ x86ArchFeatureRustFlags = map[string][]string{}
+ x86LinkFlags = []string{}
+
+ x86ArchVariantRustFlags = map[string][]string{
+ "": []string{},
+ "atom": []string{"-C target-cpu=atom"},
+ "broadwell": []string{"-C target-cpu=broadwell"},
+ "haswell": []string{"-C target-cpu=haswell"},
+ "ivybridge": []string{"-C target-cpu=ivybridge"},
+ "sandybridge": []string{"-C target-cpu=sandybridge"},
+ "silvermont": []string{"-C target-cpu=silvermont"},
+ "skylake": []string{"-C target-cpu=skylake"},
+ //TODO: Add target-cpu=stoneyridge when rustc supports it.
+ "stoneyridge": []string{""},
+ // use prescott for x86_64, like cc/config/x86_device.go
+ "x86_64": []string{"-C target-cpu=prescott"},
+ }
+)
+
+func init() {
+ registerToolchainFactory(android.Android, android.X86, x86ToolchainFactory)
+
+ pctx.StaticVariable("X86ToolchainRustFlags", strings.Join(x86RustFlags, " "))
+ pctx.StaticVariable("X86ToolchainLinkFlags", strings.Join(x86LinkFlags, " "))
+
+ for variant, rustFlags := range x86ArchVariantRustFlags {
+ pctx.StaticVariable("X86"+variant+"VariantRustFlags",
+ strings.Join(rustFlags, " "))
+ }
+
+}
+
+type toolchainX86 struct {
+ toolchain32Bit
+ toolchainRustFlags string
+}
+
+func (t *toolchainX86) RustTriple() string {
+ return "i686-linux-android"
+}
+
+func (t *toolchainX86) ToolchainLinkFlags() string {
+ return "${config.DeviceGlobalLinkFlags} ${config.X86ToolchainLinkFlags}"
+}
+
+func (t *toolchainX86) ToolchainRustFlags() string {
+ return t.toolchainRustFlags
+}
+
+func (t *toolchainX86) RustFlags() string {
+ return "${config.X86ToolchainRustFlags}"
+}
+
+func (t *toolchainX86) Supported() bool {
+ return true
+}
+
+func x86ToolchainFactory(arch android.Arch) Toolchain {
+ toolchainRustFlags := []string{
+ "${config.X86ToolchainRustFlags}",
+ "${config.X86" + arch.ArchVariant + "VariantRustFlags}",
+ }
+
+ toolchainRustFlags = append(toolchainRustFlags, deviceGlobalRustFlags...)
+
+ for _, feature := range arch.ArchFeatures {
+ toolchainRustFlags = append(toolchainRustFlags, x86ArchFeatureRustFlags[feature]...)
+ }
+
+ return &toolchainX86{
+ toolchainRustFlags: strings.Join(toolchainRustFlags, " "),
+ }
+}
diff --git a/rust/library.go b/rust/library.go
index ba47541..43819ce 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -290,7 +290,7 @@
BuildShared: true,
BuildStatic: true,
},
- baseCompiler: NewBaseCompiler("lib", "lib64"),
+ baseCompiler: NewBaseCompiler("lib", "lib64", InstallInSystem),
}
module.compiler = library
diff --git a/rust/proc_macro.go b/rust/proc_macro.go
index 0da87da..10ea1e3 100644
--- a/rust/proc_macro.go
+++ b/rust/proc_macro.go
@@ -53,7 +53,7 @@
module := newModule(hod, android.MultilibFirst)
procMacro := &procMacroDecorator{
- baseCompiler: NewBaseCompiler("lib", "lib64"),
+ baseCompiler: NewBaseCompiler("lib", "lib64", InstallInSystem),
}
module.compiler = procMacro
diff --git a/rust/rust.go b/rust/rust.go
index a3266f7..0eab8d2 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -226,6 +226,7 @@
compilerDeps(ctx DepsContext, deps Deps) Deps
crateName() string
+ inData() bool
install(ctx ModuleContext, path android.Path)
relativeInstallPath() string
}
@@ -681,6 +682,13 @@
return depPaths
}
+func (mod *Module) InstallInData() bool {
+ if mod.compiler == nil {
+ return false
+ }
+ return mod.compiler.inData()
+}
+
func linkPathFromFilePath(filepath android.Path) string {
return strings.Split(filepath.String(), filepath.Base())[0]
}
diff --git a/rust/test.go b/rust/test.go
index b391103..04f844c 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -55,8 +55,7 @@
test := &testDecorator{
binaryDecorator: &binaryDecorator{
- // TODO(chh): set up dir64?
- baseCompiler: NewBaseCompiler("testcases", ""),
+ baseCompiler: NewBaseCompiler("nativetest", "nativetest64", InstallInData),
},
}
@@ -79,22 +78,26 @@
}
func (test *testDecorator) install(ctx ModuleContext, file android.Path) {
- name := ctx.ModuleName() // default executable name
- if ctx.Device() { // on device, use mutated module name
- name = name + test.getMutatedModuleSubName(name)
- } else { // on host, use stem name in relative_install_path
- if stem := String(test.baseCompiler.Properties.Stem); stem != "" {
- name = stem
+ name := ctx.ModuleName()
+ path := test.baseCompiler.relativeInstallPath()
+ // on device, use mutated module name
+ name = name + test.getMutatedModuleSubName(name)
+ if !ctx.Device() { // on host, use mutated module name + arch type + stem name
+ stem := String(test.baseCompiler.Properties.Stem)
+ if stem == "" {
+ stem = name
}
- if path := test.baseCompiler.relativeInstallPath(); path != "" {
- name = path + "/" + name
- }
+ name = filepath.Join(name, ctx.Arch().ArchType.String(), stem)
}
test.testConfig = tradefed.AutoGenRustTestConfig(ctx, name,
test.Properties.Test_config,
test.Properties.Test_config_template,
test.Properties.Test_suites,
test.Properties.Auto_gen_config)
+ // default relative install path is module name
+ if path == "" {
+ test.baseCompiler.relative = ctx.ModuleName()
+ }
test.binaryDecorator.install(ctx, file)
}
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index bc22dbb..53109ec 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -24,10 +24,11 @@
t.Helper()
fs := map[string][]byte{
- "Test.cpp": nil,
- "include/Test.h": nil,
- "libfoo.so": nil,
- "aidl/foo/bar/Test.aidl": nil,
+ "Test.cpp": nil,
+ "include/Test.h": nil,
+ "arm64/include/Arm64Test.h": nil,
+ "libfoo.so": nil,
+ "aidl/foo/bar/Test.aidl": nil,
}
return testSdkWithFs(t, bp, fs)
}
@@ -181,6 +182,83 @@
)
}
+// Verify that when the shared library has some common and some arch specific properties that the generated
+// snapshot is optimized properly.
+func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
+ result := testSdkWithCc(t, `
+ sdk {
+ name: "mysdk",
+ native_shared_libs: ["mynativelib"],
+ }
+
+ cc_library_shared {
+ name: "mynativelib",
+ srcs: [
+ "Test.cpp",
+ "aidl/foo/bar/Test.aidl",
+ ],
+ export_include_dirs: ["include"],
+ arch: {
+ arm64: {
+ export_system_include_dirs: ["arm64/include"],
+ },
+ },
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+
+ result.CheckSnapshot("mysdk", "android_common", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ export_include_dirs: ["include/include"],
+ arch: {
+ arm64: {
+ srcs: ["arm64/lib/mynativelib.so"],
+ export_system_include_dirs: ["arm64/include/arm64/include"],
+ },
+ arm: {
+ srcs: ["arm/lib/mynativelib.so"],
+ },
+ },
+ stl: "none",
+ system_shared_libs: [],
+}
+
+cc_prebuilt_library_shared {
+ name: "mynativelib",
+ prefer: false,
+ export_include_dirs: ["include/include"],
+ arch: {
+ arm64: {
+ srcs: ["arm64/lib/mynativelib.so"],
+ export_system_include_dirs: ["arm64/include/arm64/include"],
+ },
+ arm: {
+ srcs: ["arm/lib/mynativelib.so"],
+ },
+ },
+ stl: "none",
+ system_shared_libs: [],
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ native_shared_libs: ["mysdk_mynativelib@current"],
+}
+`),
+ checkAllCopyRules(`
+include/Test.h -> include/include/Test.h
+.intermediates/mynativelib/android_arm64_armv8-a_core_shared/mynativelib.so -> arm64/lib/mynativelib.so
+arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h
+.intermediates/mynativelib/android_arm_armv7-a-neon_core_shared/mynativelib.so -> arm/lib/mynativelib.so`),
+ )
+}
+
func TestSnapshotWithCcSharedLibrary(t *testing.T) {
result := testSdkWithCc(t, `
sdk {
@@ -210,20 +288,15 @@
cc_prebuilt_library_shared {
name: "mysdk_mynativelib@current",
sdk_member_name: "mynativelib",
+ export_include_dirs: ["include/include"],
arch: {
arm64: {
srcs: ["arm64/lib/mynativelib.so"],
- export_include_dirs: [
- "arm64/include/include",
- "arm64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm64/include_gen/mynativelib"],
},
arm: {
srcs: ["arm/lib/mynativelib.so"],
- export_include_dirs: [
- "arm/include/include",
- "arm/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm/include_gen/mynativelib"],
},
},
stl: "none",
@@ -233,20 +306,15 @@
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
+ export_include_dirs: ["include/include"],
arch: {
arm64: {
srcs: ["arm64/lib/mynativelib.so"],
- export_include_dirs: [
- "arm64/include/include",
- "arm64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm64/include_gen/mynativelib"],
},
arm: {
srcs: ["arm/lib/mynativelib.so"],
- export_include_dirs: [
- "arm/include/include",
- "arm/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm/include_gen/mynativelib"],
},
},
stl: "none",
@@ -259,13 +327,12 @@
}
`),
checkAllCopyRules(`
+include/Test.h -> include/include/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_shared/mynativelib.so -> arm64/lib/mynativelib.so
-include/Test.h -> arm64/include/include/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_shared/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/android_arm64_armv8-a_core_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BpTest.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_shared/mynativelib.so -> arm/lib/mynativelib.so
-include/Test.h -> arm/include/include/Test.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_shared/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BpTest.h
@@ -311,20 +378,15 @@
sdk_member_name: "mynativelib",
device_supported: false,
host_supported: true,
+ export_include_dirs: ["include/include"],
arch: {
x86_64: {
srcs: ["x86_64/lib/mynativelib.so"],
- export_include_dirs: [
- "x86_64/include/include",
- "x86_64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
x86: {
srcs: ["x86/lib/mynativelib.so"],
- export_include_dirs: [
- "x86/include/include",
- "x86/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86/include_gen/mynativelib"],
},
},
stl: "none",
@@ -336,20 +398,15 @@
prefer: false,
device_supported: false,
host_supported: true,
+ export_include_dirs: ["include/include"],
arch: {
x86_64: {
srcs: ["x86_64/lib/mynativelib.so"],
- export_include_dirs: [
- "x86_64/include/include",
- "x86_64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
x86: {
srcs: ["x86/lib/mynativelib.so"],
- export_include_dirs: [
- "x86/include/include",
- "x86/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86/include_gen/mynativelib"],
},
},
stl: "none",
@@ -364,13 +421,12 @@
}
`),
checkAllCopyRules(`
+include/Test.h -> include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so
-include/Test.h -> x86_64/include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h
.intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> x86/lib/mynativelib.so
-include/Test.h -> x86/include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BpTest.h
@@ -407,20 +463,15 @@
cc_prebuilt_library_static {
name: "mysdk_mynativelib@current",
sdk_member_name: "mynativelib",
+ export_include_dirs: ["include/include"],
arch: {
arm64: {
srcs: ["arm64/lib/mynativelib.a"],
- export_include_dirs: [
- "arm64/include/include",
- "arm64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm64/include_gen/mynativelib"],
},
arm: {
srcs: ["arm/lib/mynativelib.a"],
- export_include_dirs: [
- "arm/include/include",
- "arm/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm/include_gen/mynativelib"],
},
},
stl: "none",
@@ -430,20 +481,15 @@
cc_prebuilt_library_static {
name: "mynativelib",
prefer: false,
+ export_include_dirs: ["include/include"],
arch: {
arm64: {
srcs: ["arm64/lib/mynativelib.a"],
- export_include_dirs: [
- "arm64/include/include",
- "arm64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm64/include_gen/mynativelib"],
},
arm: {
srcs: ["arm/lib/mynativelib.a"],
- export_include_dirs: [
- "arm/include/include",
- "arm/include_gen/mynativelib",
- ],
+ export_include_dirs: ["arm/include_gen/mynativelib"],
},
},
stl: "none",
@@ -456,13 +502,12 @@
}
`),
checkAllCopyRules(`
+include/Test.h -> include/include/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_static/mynativelib.a -> arm64/lib/mynativelib.a
-include/Test.h -> arm64/include/include/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_static/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/android_arm64_armv8-a_core_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/android_arm64_armv8-a_core_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BpTest.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_static/mynativelib.a -> arm/lib/mynativelib.a
-include/Test.h -> arm/include/include/Test.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_static/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/android_arm_armv7-a-neon_core_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BpTest.h
@@ -508,20 +553,15 @@
sdk_member_name: "mynativelib",
device_supported: false,
host_supported: true,
+ export_include_dirs: ["include/include"],
arch: {
x86_64: {
srcs: ["x86_64/lib/mynativelib.a"],
- export_include_dirs: [
- "x86_64/include/include",
- "x86_64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
x86: {
srcs: ["x86/lib/mynativelib.a"],
- export_include_dirs: [
- "x86/include/include",
- "x86/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86/include_gen/mynativelib"],
},
},
stl: "none",
@@ -533,20 +573,15 @@
prefer: false,
device_supported: false,
host_supported: true,
+ export_include_dirs: ["include/include"],
arch: {
x86_64: {
srcs: ["x86_64/lib/mynativelib.a"],
- export_include_dirs: [
- "x86_64/include/include",
- "x86_64/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
x86: {
srcs: ["x86/lib/mynativelib.a"],
- export_include_dirs: [
- "x86/include/include",
- "x86/include_gen/mynativelib",
- ],
+ export_include_dirs: ["x86/include_gen/mynativelib"],
},
},
stl: "none",
@@ -561,13 +596,12 @@
}
`),
checkAllCopyRules(`
+include/Test.h -> include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a
-include/Test.h -> x86_64/include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h
.intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> x86/lib/mynativelib.a
-include/Test.h -> x86/include/include/Test.h
.intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/aidl/foo/bar/Test.h
.intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BnTest.h
.intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BpTest.h