Generate stub libraries for unreleased API levels.

Generating released API levels and android-current is not sufficient
in a trunk-stable world. One branch will have the stable APIs and
possibly multiple unreleased API levels. We need to generate stubs
for each unreleased API level up to our current target.

I still need to add support for things like `# introduced=O` before
this is really done.

Whether or not we still need something like "current" that would map
to the absolute latest even it hasn't been assigned a code name yet
is uncertain.

Test: make ndk
Bug: None
Change-Id: I282be1347ab39c56fa887d4d71c03bb12c300dc5
This commit is contained in:
Dan Albert
2017-03-28 15:00:46 -07:00
parent dd29407e74
commit 49927d29d5
2 changed files with 40 additions and 8 deletions

View File

@@ -30,10 +30,11 @@ var (
genStubSrc = pctx.AndroidStaticRule("genStubSrc",
blueprint.RuleParams{
Command: "$toolPath --arch $arch --api $apiLevel $vndk $in $out",
Command: "$toolPath --arch $arch --api $apiLevel --api-map " +
"$apiMap $vndk $in $out",
Description: "genStubSrc $out",
CommandDeps: []string{"$toolPath"},
}, "arch", "apiLevel", "vndk")
}, "arch", "apiLevel", "apiMap", "vndk")
ndkLibrarySuffix = ".ndk"
@@ -205,6 +206,7 @@ func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorat
for version := firstGenVersion; version <= platformVersion; version++ {
versionStrs = append(versionStrs, strconv.Itoa(version))
}
versionStrs = append(versionStrs, mctx.AConfig().PlatformVersionAllCodenames()...)
versionStrs = append(versionStrs, "current")
modules := mctx.CreateVariations(versionStrs...)
@@ -247,13 +249,16 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
stubSrcPath := android.PathForModuleGen(ctx, "stub.c")
versionScriptPath := android.PathForModuleGen(ctx, "stub.map")
symbolFilePath := android.PathForModuleSrc(ctx, symbolFile)
apiLevelsJson := android.GetApiLevelsJson(ctx)
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: genStubSrc,
Outputs: []android.WritablePath{stubSrcPath, versionScriptPath},
Input: symbolFilePath,
Rule: genStubSrc,
Outputs: []android.WritablePath{stubSrcPath, versionScriptPath},
Input: symbolFilePath,
Implicits: []android.Path{apiLevelsJson},
Args: map[string]string{
"arch": arch,
"apiLevel": apiLevel,
"apiMap": apiLevelsJson.String(),
"vndk": vndk,
},
})