Merge "Revert "Add scripts to generate java APIs used by Mainline modules.""
This commit is contained in:
@@ -449,18 +449,23 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
|
|||||||
fmt.Fprintf(w, dist)
|
fmt.Fprintf(w, dist)
|
||||||
}
|
}
|
||||||
|
|
||||||
distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisUsedByModuleFile.String())
|
if a.apisUsedByModuleFile.String() != "" {
|
||||||
distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisBackedByModuleFile.String())
|
goal := "apps_only"
|
||||||
distCoverageFiles(w, "java_apis_used_by_apex", a.javaApisUsedByModuleFile.String())
|
distFile := a.apisUsedByModuleFile.String()
|
||||||
|
fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
|
||||||
|
" $(call dist-for-goals,%s,%s:ndk_apis_usedby_apex/$(notdir %s))\n"+
|
||||||
|
"endif\n",
|
||||||
|
goal, distFile, distFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.apisBackedByModuleFile.String() != "" {
|
||||||
|
goal := "apps_only"
|
||||||
|
distFile := a.apisBackedByModuleFile.String()
|
||||||
|
fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
|
||||||
|
" $(call dist-for-goals,%s,%s:ndk_apis_backedby_apex/$(notdir %s))\n"+
|
||||||
|
"endif\n",
|
||||||
|
goal, distFile, distFile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func distCoverageFiles(w io.Writer, dir string, distfile string) {
|
|
||||||
if distfile != "" {
|
|
||||||
goal := "apps_only"
|
|
||||||
fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
|
|
||||||
" $(call dist-for-goals,%s,%s:%s/$(notdir %s))\n"+
|
|
||||||
"endif\n", goal, distfile, dir, distfile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -424,9 +424,8 @@ type apexBundle struct {
|
|||||||
isCompressed bool
|
isCompressed bool
|
||||||
|
|
||||||
// Path of API coverage generate file
|
// Path of API coverage generate file
|
||||||
nativeApisUsedByModuleFile android.ModuleOutPath
|
apisUsedByModuleFile android.ModuleOutPath
|
||||||
nativeApisBackedByModuleFile android.ModuleOutPath
|
apisBackedByModuleFile android.ModuleOutPath
|
||||||
javaApisUsedByModuleFile android.ModuleOutPath
|
|
||||||
|
|
||||||
// Collect the module directory for IDE info in java/jdeps.go.
|
// Collect the module directory for IDE info in java/jdeps.go.
|
||||||
modulePaths []string
|
modulePaths []string
|
||||||
|
@@ -67,7 +67,6 @@ func init() {
|
|||||||
pctx.HostBinToolVariable("sload_f2fs", "sload_f2fs")
|
pctx.HostBinToolVariable("sload_f2fs", "sload_f2fs")
|
||||||
pctx.HostBinToolVariable("make_erofs", "make_erofs")
|
pctx.HostBinToolVariable("make_erofs", "make_erofs")
|
||||||
pctx.HostBinToolVariable("apex_compression_tool", "apex_compression_tool")
|
pctx.HostBinToolVariable("apex_compression_tool", "apex_compression_tool")
|
||||||
pctx.HostBinToolVariable("dexdeps", "dexdeps")
|
|
||||||
pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
|
pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,12 +707,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
"readelf": "${config.ClangBin}/llvm-readelf",
|
"readelf": "${config.ClangBin}/llvm-readelf",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
a.nativeApisUsedByModuleFile = apisUsedbyOutputFile
|
a.apisUsedByModuleFile = apisUsedbyOutputFile
|
||||||
|
|
||||||
var nativeLibNames []string
|
var libNames []string
|
||||||
for _, f := range a.filesInfo {
|
for _, f := range a.filesInfo {
|
||||||
if f.class == nativeSharedLib {
|
if f.class == nativeSharedLib {
|
||||||
nativeLibNames = append(nativeLibNames, f.stem())
|
libNames = append(libNames, f.stem())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
|
apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
|
||||||
@@ -721,25 +720,9 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
|
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
|
||||||
Output(apisBackedbyOutputFile).
|
Output(apisBackedbyOutputFile).
|
||||||
Flags(nativeLibNames)
|
Flags(libNames)
|
||||||
rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
|
rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
|
||||||
a.nativeApisBackedByModuleFile = apisBackedbyOutputFile
|
a.apisBackedByModuleFile = apisBackedbyOutputFile
|
||||||
|
|
||||||
var javaLibOrApkPath []android.Path
|
|
||||||
for _, f := range a.filesInfo {
|
|
||||||
if f.class == javaSharedLib || f.class == app {
|
|
||||||
javaLibOrApkPath = append(javaLibOrApkPath, f.builtFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
javaApiUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.xml")
|
|
||||||
javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
|
|
||||||
javaUsedByRule.Command().
|
|
||||||
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
|
|
||||||
BuiltTool("dexdeps").
|
|
||||||
Output(javaApiUsedbyOutputFile).
|
|
||||||
Inputs(javaLibOrApkPath)
|
|
||||||
javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
|
|
||||||
a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile
|
|
||||||
|
|
||||||
bundleConfig := a.buildBundleConfig(ctx)
|
bundleConfig := a.buildBundleConfig(ctx)
|
||||||
|
|
||||||
|
@@ -24,7 +24,6 @@ var PrepareForTestWithApexBuildComponents = android.GroupFixturePreparers(
|
|||||||
android.MockFS{
|
android.MockFS{
|
||||||
// Needed by apex.
|
// Needed by apex.
|
||||||
"system/core/rootdir/etc/public.libraries.android.txt": nil,
|
"system/core/rootdir/etc/public.libraries.android.txt": nil,
|
||||||
"build/soong/scripts/gen_java_usedby_apex.sh": nil,
|
|
||||||
"build/soong/scripts/gen_ndk_backedby_apex.sh": nil,
|
"build/soong/scripts/gen_ndk_backedby_apex.sh": nil,
|
||||||
// Needed by prebuilt_apex.
|
// Needed by prebuilt_apex.
|
||||||
"build/soong/scripts/unpack-prebuilt-apex.sh": nil,
|
"build/soong/scripts/unpack-prebuilt-apex.sh": nil,
|
||||||
|
@@ -3,4 +3,4 @@ per-file build-mainline-modules.sh = ngeoffray@google.com,paulduffin@google.com,
|
|||||||
per-file build-aml-prebuilts.sh = ngeoffray@google.com,paulduffin@google.com,mast@google.com
|
per-file build-aml-prebuilts.sh = ngeoffray@google.com,paulduffin@google.com,mast@google.com
|
||||||
per-file construct_context.py = ngeoffray@google.com,calin@google.com,skvadrik@google.com
|
per-file construct_context.py = ngeoffray@google.com,calin@google.com,skvadrik@google.com
|
||||||
per-file conv_linker_config.py = kiyoungkim@google.com, jiyong@google.com, jooyung@google.com
|
per-file conv_linker_config.py = kiyoungkim@google.com, jiyong@google.com, jooyung@google.com
|
||||||
per-file gen_ndk*.sh,gen_java*.sh = sophiez@google.com, allenhair@google.com
|
per-file gen_ndk*.sh = sophiez@google.com, allenhair@google.com
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
printHelp() {
|
|
||||||
echo "**************************** Usage Instructions ****************************"
|
|
||||||
echo "This script is used to generate the Mainline modules used-by Java symbols."
|
|
||||||
echo ""
|
|
||||||
echo "To run this script use: ./gen_java_usedby_apex.sh \$BINARY_DEXDEPS_PATH \$OUTPUT_FILE_PATH \$JAR_AND_APK_LIST"
|
|
||||||
echo "For example: If all jar and apk files are '/myJar.jar /myApk.apk' and output write to /myModule.txt then the command would be:"
|
|
||||||
echo "./gen_java_usedby_apex.sh \$BINARY_DEXDEPS_PATH /myModule.txt /myJar.jar /myApk.apk"
|
|
||||||
}
|
|
||||||
|
|
||||||
genUsedByList() {
|
|
||||||
dexdeps="$1"
|
|
||||||
shift
|
|
||||||
out="$1"
|
|
||||||
shift
|
|
||||||
rm -f "$out"
|
|
||||||
touch "$out"
|
|
||||||
for x in "$@"; do
|
|
||||||
"$dexdeps" "$x" >> "$out"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ "$1" == "help" ]]
|
|
||||||
then
|
|
||||||
printHelp
|
|
||||||
elif [[ "$#" -lt 2 ]]
|
|
||||||
then
|
|
||||||
echo "Wrong argument length. Expecting at least 2 argument representing dexdeps path, output path, followed by a list of jar or apk files in the Mainline module."
|
|
||||||
else
|
|
||||||
genUsedByList "$@"
|
|
||||||
fi
|
|
Reference in New Issue
Block a user