diff options
author | 2021-06-15 16:49:50 +0100 | |
---|---|---|
committer | 2021-06-17 12:59:33 +0100 | |
commit | b98371cc1353145fb846017e577e11c9c8b2d9af (patch) | |
tree | 224a47fce57bfeee99a5ed3e29c6748c4d947d6d /java/classpath_fragment.go | |
parent | 68c8dd019ce159b738f5a0925f7e3cb875ef0221 (diff) |
Add classpath fragment property to skip proto generation.
This must always be true for updatable apexes, but is not necessary
for non-updatable apexes like com.android.i18n.
In a follow up this will be used to figure out whether apex boot jars
should be bundled into platform_bootclasspath.
Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: Ib7dc5b057cb24955222fb97f3ff9da079f30ed77
Diffstat (limited to 'java/classpath_fragment.go')
-rw-r--r-- | java/classpath_fragment.go | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go index 4c1e749de..3d7258086 100644 --- a/java/classpath_fragment.go +++ b/java/classpath_fragment.go @@ -19,6 +19,7 @@ package java import ( "fmt" "github.com/google/blueprint" + "github.com/google/blueprint/proptools" "strings" "android/soong/android" @@ -44,6 +45,11 @@ func (c classpathType) String() string { } type classpathFragmentProperties struct { + // Whether to generated classpaths.proto config instance for the fragment. If the config is not + // generated, then relevant boot jars are added to platform classpath, i.e. platform_bootclasspath + // or platform_systemserverclasspath. This is useful for non-updatable APEX boot jars, to keep + // them as part of dexopt on device. Defaults to true. + Generate_classpaths_proto *bool } // classpathFragment interface is implemented by a module that contributes jars to a *CLASSPATH @@ -101,24 +107,28 @@ func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars } func (c *ClasspathFragmentBase) generateClasspathProtoBuildActions(ctx android.ModuleContext, jars []classpathJar) { - outputFilename := strings.ToLower(c.classpathType.String()) + ".pb" - c.outputFilepath = android.PathForModuleOut(ctx, outputFilename).OutputPath - c.installDirPath = android.PathForModuleInstall(ctx, "etc", "classpaths") - - generatedJson := android.PathForModuleOut(ctx, outputFilename+".json") - writeClasspathsJson(ctx, generatedJson, jars) - - rule := android.NewRuleBuilder(pctx, ctx) - rule.Command(). - BuiltTool("conv_classpaths_proto"). - Flag("encode"). - Flag("--format=json"). - FlagWithInput("--input=", generatedJson). - FlagWithOutput("--output=", c.outputFilepath) - - rule.Build("classpath_fragment", "Compiling "+c.outputFilepath.String()) + generateProto := proptools.BoolDefault(c.properties.Generate_classpaths_proto, true) + if generateProto { + outputFilename := strings.ToLower(c.classpathType.String()) + ".pb" + c.outputFilepath = android.PathForModuleOut(ctx, outputFilename).OutputPath + c.installDirPath = android.PathForModuleInstall(ctx, "etc", "classpaths") + + generatedJson := android.PathForModuleOut(ctx, outputFilename+".json") + writeClasspathsJson(ctx, generatedJson, jars) + + rule := android.NewRuleBuilder(pctx, ctx) + rule.Command(). + BuiltTool("conv_classpaths_proto"). + Flag("encode"). + Flag("--format=json"). + FlagWithInput("--input=", generatedJson). + FlagWithOutput("--output=", c.outputFilepath) + + rule.Build("classpath_fragment", "Compiling "+c.outputFilepath.String()) + } classpathProtoInfo := ClasspathFragmentProtoContentInfo{ + ClasspathFragmentProtoGenerated: generateProto, ClasspathFragmentProtoInstallDir: c.installDirPath, ClasspathFragmentProtoOutput: c.outputFilepath, } @@ -164,6 +174,9 @@ func (c *ClasspathFragmentBase) androidMkEntries() []android.AndroidMkEntries { var ClasspathFragmentProtoContentInfoProvider = blueprint.NewProvider(ClasspathFragmentProtoContentInfo{}) type ClasspathFragmentProtoContentInfo struct { + // Whether the classpaths.proto config is generated for the fragment. + ClasspathFragmentProtoGenerated bool + // ClasspathFragmentProtoOutput is an output path for the generated classpaths.proto config of this module. // // The file should be copied to a relevant place on device, see ClasspathFragmentProtoInstallDir |