Loading android/arch.go +4 −1 Original line number Diff line number Diff line Loading @@ -1566,7 +1566,10 @@ type archConfig struct { abi []string } // getNdkAbisConfig returns a list of archConfigs for the ABIs supported by the NDK. // getNdkAbisConfig returns the list of archConfigs that are used for bulding // the API stubs and static libraries that are included in the NDK. These are // built *without Neon*, because non-Neon is still supported and building these // with Neon will break those users. func getNdkAbisConfig() []archConfig { return []archConfig{ {"arm", "armv7-a", "", []string{"armeabi-v7a"}}, Loading cc/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -65,9 +65,10 @@ bootstrap_go_package { "test.go", "toolchain_library.go", "ndk_prebuilt.go", "ndk_abi.go", "ndk_headers.go", "ndk_library.go", "ndk_prebuilt.go", "ndk_sysroot.go", "llndk_library.go", Loading cc/cc.go +9 −0 Original line number Diff line number Diff line Loading @@ -2117,6 +2117,15 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { } } if c.isNDKStubLibrary() { // NDK stubs depend on their implementation because the ABI dumps are // generated from the implementation library. actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation(), blueprint.Variation{Mutator: "link", Variation: "shared"}, ), stubImplementation, c.BaseModuleName()) } // sysprop_library has to support both C++ and Java. So sysprop_library internally creates one // C++ implementation library and one Java implementation library. When a module links against // sysprop_library, the C++ implementation library has to be linked. syspropImplLibraries is a Loading cc/library.go +17 −6 Original line number Diff line number Diff line Loading @@ -865,16 +865,23 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa if library.stubsVersion() != "" { vndkVer = library.stubsVersion() } objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Llndk.Symbol_file), vndkVer, "--llndk") nativeAbiResult := parseNativeAbiDefinition(ctx, String(library.Properties.Llndk.Symbol_file), android.ApiLevelOrPanic(ctx, vndkVer), "--llndk") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) if !Bool(library.Properties.Llndk.Unversioned) { library.versionScriptPath = android.OptionalPathForPath(versionScript) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) } return objs } if ctx.IsVendorPublicLibrary() { objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Vendor_public_library.Symbol_file), "current", "") nativeAbiResult := parseNativeAbiDefinition(ctx, String(library.Properties.Vendor_public_library.Symbol_file), android.FutureApiLevel, "") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) if !Bool(library.Properties.Vendor_public_library.Unversioned) { library.versionScriptPath = android.OptionalPathForPath(versionScript) library.versionScriptPath = android.OptionalPathForPath(nativeAbiResult.versionScript) } return objs } Loading @@ -884,8 +891,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa ctx.PropertyErrorf("symbol_file", "%q doesn't have .map.txt suffix", symbolFile) return Objects{} } objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "--apex") library.versionScriptPath = android.OptionalPathForPath(versionScript) nativeAbiResult := parseNativeAbiDefinition(ctx, symbolFile, android.ApiLevelOrPanic(ctx, library.MutatedProperties.StubsVersion), "--apex") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) return objs } Loading cc/ndk_abi.go 0 → 100644 +102 −0 Original line number Diff line number Diff line // Copyright 2021 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 ( "android/soong/android" ) func init() { android.RegisterSingletonType("ndk_abi_dump", NdkAbiDumpSingleton) android.RegisterSingletonType("ndk_abi_diff", NdkAbiDiffSingleton) } func getNdkAbiDumpInstallBase(ctx android.PathContext) android.OutputPath { return android.PathForOutput(ctx).Join(ctx, "abi-dumps/ndk") } func getNdkAbiDumpTimestampFile(ctx android.PathContext) android.OutputPath { return android.PathForOutput(ctx, "ndk_abi_dump.timestamp") } func NdkAbiDumpSingleton() android.Singleton { return &ndkAbiDumpSingleton{} } type ndkAbiDumpSingleton struct{} func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { if !module.Enabled() { return } if m, ok := module.(*Module); ok { if installer, ok := m.installer.(*stubDecorator); ok { if canDumpAbi(m) { depPaths = append(depPaths, installer.abiDumpPath) } } } }) // `m dump-ndk-abi` will dump the NDK ABI. // `development/tools/ndk/update_ndk_abi.sh` will dump the NDK ABI and // update the golden copies in prebuilts/abi-dumps/ndk. ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkAbiDumpTimestampFile(ctx), Implicits: depPaths, }) ctx.Phony("dump-ndk-abi", getNdkAbiDumpTimestampFile(ctx)) } func getNdkAbiDiffTimestampFile(ctx android.PathContext) android.WritablePath { return android.PathForOutput(ctx, "ndk_abi_diff.timestamp") } func NdkAbiDiffSingleton() android.Singleton { return &ndkAbiDiffSingleton{} } type ndkAbiDiffSingleton struct{} func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(android.Module); ok && !m.Enabled() { return } if m, ok := module.(*Module); ok { if installer, ok := m.installer.(*stubDecorator); ok { depPaths = append(depPaths, installer.abiDiffPaths...) } } }) depPaths = append(depPaths, getNdkAbiDumpTimestampFile(ctx)) // `m diff-ndk-abi` will diff the NDK ABI. ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkAbiDiffTimestampFile(ctx), Implicits: depPaths, }) ctx.Phony("diff-ndk-abi", getNdkAbiDiffTimestampFile(ctx)) } Loading
android/arch.go +4 −1 Original line number Diff line number Diff line Loading @@ -1566,7 +1566,10 @@ type archConfig struct { abi []string } // getNdkAbisConfig returns a list of archConfigs for the ABIs supported by the NDK. // getNdkAbisConfig returns the list of archConfigs that are used for bulding // the API stubs and static libraries that are included in the NDK. These are // built *without Neon*, because non-Neon is still supported and building these // with Neon will break those users. func getNdkAbisConfig() []archConfig { return []archConfig{ {"arm", "armv7-a", "", []string{"armeabi-v7a"}}, Loading
cc/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -65,9 +65,10 @@ bootstrap_go_package { "test.go", "toolchain_library.go", "ndk_prebuilt.go", "ndk_abi.go", "ndk_headers.go", "ndk_library.go", "ndk_prebuilt.go", "ndk_sysroot.go", "llndk_library.go", Loading
cc/cc.go +9 −0 Original line number Diff line number Diff line Loading @@ -2117,6 +2117,15 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { } } if c.isNDKStubLibrary() { // NDK stubs depend on their implementation because the ABI dumps are // generated from the implementation library. actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation(), blueprint.Variation{Mutator: "link", Variation: "shared"}, ), stubImplementation, c.BaseModuleName()) } // sysprop_library has to support both C++ and Java. So sysprop_library internally creates one // C++ implementation library and one Java implementation library. When a module links against // sysprop_library, the C++ implementation library has to be linked. syspropImplLibraries is a Loading
cc/library.go +17 −6 Original line number Diff line number Diff line Loading @@ -865,16 +865,23 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa if library.stubsVersion() != "" { vndkVer = library.stubsVersion() } objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Llndk.Symbol_file), vndkVer, "--llndk") nativeAbiResult := parseNativeAbiDefinition(ctx, String(library.Properties.Llndk.Symbol_file), android.ApiLevelOrPanic(ctx, vndkVer), "--llndk") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) if !Bool(library.Properties.Llndk.Unversioned) { library.versionScriptPath = android.OptionalPathForPath(versionScript) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) } return objs } if ctx.IsVendorPublicLibrary() { objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Vendor_public_library.Symbol_file), "current", "") nativeAbiResult := parseNativeAbiDefinition(ctx, String(library.Properties.Vendor_public_library.Symbol_file), android.FutureApiLevel, "") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) if !Bool(library.Properties.Vendor_public_library.Unversioned) { library.versionScriptPath = android.OptionalPathForPath(versionScript) library.versionScriptPath = android.OptionalPathForPath(nativeAbiResult.versionScript) } return objs } Loading @@ -884,8 +891,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa ctx.PropertyErrorf("symbol_file", "%q doesn't have .map.txt suffix", symbolFile) return Objects{} } objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "--apex") library.versionScriptPath = android.OptionalPathForPath(versionScript) nativeAbiResult := parseNativeAbiDefinition(ctx, symbolFile, android.ApiLevelOrPanic(ctx, library.MutatedProperties.StubsVersion), "--apex") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) return objs } Loading
cc/ndk_abi.go 0 → 100644 +102 −0 Original line number Diff line number Diff line // Copyright 2021 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 ( "android/soong/android" ) func init() { android.RegisterSingletonType("ndk_abi_dump", NdkAbiDumpSingleton) android.RegisterSingletonType("ndk_abi_diff", NdkAbiDiffSingleton) } func getNdkAbiDumpInstallBase(ctx android.PathContext) android.OutputPath { return android.PathForOutput(ctx).Join(ctx, "abi-dumps/ndk") } func getNdkAbiDumpTimestampFile(ctx android.PathContext) android.OutputPath { return android.PathForOutput(ctx, "ndk_abi_dump.timestamp") } func NdkAbiDumpSingleton() android.Singleton { return &ndkAbiDumpSingleton{} } type ndkAbiDumpSingleton struct{} func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { if !module.Enabled() { return } if m, ok := module.(*Module); ok { if installer, ok := m.installer.(*stubDecorator); ok { if canDumpAbi(m) { depPaths = append(depPaths, installer.abiDumpPath) } } } }) // `m dump-ndk-abi` will dump the NDK ABI. // `development/tools/ndk/update_ndk_abi.sh` will dump the NDK ABI and // update the golden copies in prebuilts/abi-dumps/ndk. ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkAbiDumpTimestampFile(ctx), Implicits: depPaths, }) ctx.Phony("dump-ndk-abi", getNdkAbiDumpTimestampFile(ctx)) } func getNdkAbiDiffTimestampFile(ctx android.PathContext) android.WritablePath { return android.PathForOutput(ctx, "ndk_abi_diff.timestamp") } func NdkAbiDiffSingleton() android.Singleton { return &ndkAbiDiffSingleton{} } type ndkAbiDiffSingleton struct{} func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(android.Module); ok && !m.Enabled() { return } if m, ok := module.(*Module); ok { if installer, ok := m.installer.(*stubDecorator); ok { depPaths = append(depPaths, installer.abiDiffPaths...) } } }) depPaths = append(depPaths, getNdkAbiDumpTimestampFile(ctx)) // `m diff-ndk-abi` will diff the NDK ABI. ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkAbiDiffTimestampFile(ctx), Implicits: depPaths, }) ctx.Phony("diff-ndk-abi", getNdkAbiDiffTimestampFile(ctx)) }