diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/androidmk.go | 2 | ||||
-rwxr-xr-x | java/app.go | 12 | ||||
-rw-r--r-- | java/app_test.go | 10 | ||||
-rw-r--r-- | java/droiddoc.go | 8 | ||||
-rw-r--r-- | java/hiddenapi_singleton.go | 16 | ||||
-rw-r--r-- | java/java_test.go | 13 |
6 files changed, 36 insertions, 25 deletions
diff --git a/java/androidmk.go b/java/androidmk.go index 25dd32931..081fcb25d 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -728,7 +728,7 @@ func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(entries *android.AndroidMkEntries) { entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged()) - entries.SetString("LOCAL_APK_SET_MASTER_FILE", apkSet.masterFile) + entries.SetString("LOCAL_APK_SET_INSTALL_FILE", apkSet.InstallFile()) entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", apkSet.properties.Overrides...) }, diff --git a/java/app.go b/java/app.go index 4031cfeb1..1ede34ebc 100755 --- a/java/app.go +++ b/java/app.go @@ -78,7 +78,7 @@ type AndroidAppSet struct { properties AndroidAppSetProperties packedOutput android.WritablePath - masterFile string + installFile string apkcertsFile android.ModuleOutPath } @@ -102,8 +102,8 @@ func (as *AndroidAppSet) OutputFile() android.Path { return as.packedOutput } -func (as *AndroidAppSet) MasterFile() string { - return as.masterFile +func (as *AndroidAppSet) InstallFile() string { + return as.installFile } func (as *AndroidAppSet) APKCertsFile() android.Path { @@ -136,10 +136,10 @@ func SupportedAbis(ctx android.ModuleContext) []string { func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) { as.packedOutput = android.PathForModuleOut(ctx, ctx.ModuleName()+".zip") as.apkcertsFile = android.PathForModuleOut(ctx, "apkcerts.txt") - // We are assuming here that the master file in the APK + // We are assuming here that the install file in the APK // set has `.apk` suffix. If it doesn't the build will fail. // APK sets containing APEX files are handled elsewhere. - as.masterFile = as.BaseModuleName() + ".apk" + as.installFile = as.BaseModuleName() + ".apk" screenDensities := "all" if dpis := ctx.Config().ProductAAPTPrebuiltDPI(); len(dpis) > 0 { screenDensities = strings.ToUpper(strings.Join(dpis, ",")) @@ -167,7 +167,7 @@ func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) // android_app_set extracts a set of APKs based on the target device // configuration and installs this set as "split APKs". -// The extracted set always contains 'master' APK whose name is +// The extracted set always contains an APK whose name is // _module_name_.apk and every split APK matching target device. // The extraction of the density-specific splits depends on // PRODUCT_AAPT_PREBUILT_DPI variable. If present (its value should diff --git a/java/app_test.go b/java/app_test.go index d4323bbdc..efb4fd2a6 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -161,11 +161,11 @@ func TestAndroidAppSet(t *testing.T) { t.Errorf("wrong partition value: '%s', expected 'system'", s) } mkEntries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0] - actualMaster := mkEntries.EntryMap["LOCAL_APK_SET_MASTER_FILE"] - expectedMaster := []string{"foo.apk"} - if !reflect.DeepEqual(actualMaster, expectedMaster) { - t.Errorf("Unexpected LOCAL_APK_SET_MASTER_FILE value: '%s', expected: '%s',", - actualMaster, expectedMaster) + actualInstallFile := mkEntries.EntryMap["LOCAL_APK_SET_INSTALL_FILE"] + expectedInstallFile := []string{"foo.apk"} + if !reflect.DeepEqual(actualInstallFile, expectedInstallFile) { + t.Errorf("Unexpected LOCAL_APK_SET_INSTALL_FILE value: '%s', expected: '%s',", + actualInstallFile, expectedInstallFile) } } diff --git a/java/droiddoc.go b/java/droiddoc.go index 935b83915..d2f8d8331 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -198,7 +198,7 @@ type DroiddocProperties struct { // the generated removed Dex API filename by Doclava. Removed_dex_api_filename *string - // if set to false, don't allow droiddoc to generate stubs source files. Defaults to true. + // if set to false, don't allow droiddoc to generate stubs source files. Defaults to false. Create_stubs *bool Check_api struct { @@ -870,6 +870,10 @@ func (d *Droiddoc) doclavaDocsFlags(ctx android.ModuleContext, cmd *android.Rule } } +func (d *Droiddoc) createStubs() bool { + return BoolDefault(d.properties.Create_stubs, false) +} + func (d *Droiddoc) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsDir android.WritablePath) { if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") || apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") || @@ -892,7 +896,7 @@ func (d *Droiddoc) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuilde cmd.FlagWithOutput("-removedDexApi ", d.removedDexApiFile) } - if BoolDefault(d.properties.Create_stubs, true) { + if d.createStubs() { cmd.FlagWithArg("-stubs ", stubsDir.String()) } diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index bff591cb0..7afba2a79 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -208,7 +208,7 @@ func stubFlagsRule(ctx android.SingletonContext) { } // flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and -// the greylists. +// the unsupported API. func flagsRule(ctx android.SingletonContext) android.Path { var flagsCSV android.Paths var greylistRemovedApis android.Paths @@ -247,18 +247,18 @@ func flagsRule(ctx android.SingletonContext) android.Path { Tool(android.PathForSource(ctx, "frameworks/base/tools/hiddenapi/generate_hiddenapi_lists.py")). FlagWithInput("--csv ", stubFlags). Inputs(flagsCSV). - FlagWithInput("--greylist ", + FlagWithInput("--unsupported ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist.txt")). - FlagWithInput("--greylist-ignore-conflicts ", combinedRemovedApis). - FlagWithInput("--greylist-max-q ", + FlagWithInput("--unsupported-ignore-conflicts ", combinedRemovedApis). + FlagWithInput("--max-target-q ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-max-q.txt")). - FlagWithInput("--greylist-max-p ", + FlagWithInput("--max-target-p ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-max-p.txt")). - FlagWithInput("--greylist-max-o-ignore-conflicts ", + FlagWithInput("--max-target-o-ignore-conflicts ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-max-o.txt")). - FlagWithInput("--blacklist ", + FlagWithInput("--blocked ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blacklist.txt")). - FlagWithInput("--greylist-packages ", + FlagWithInput("--unsupported-packages ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-packages.txt")). FlagWithOutput("--output ", tempPath) diff --git a/java/java_test.go b/java/java_test.go index 73e6792b4..a3c78540f 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -96,6 +96,8 @@ func testContext() *android.TestContext { ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory)) ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory)) + android.RegisterPrebuiltMutators(ctx) + // Register module types and mutators from cc needed for JNI testing cc.RegisterRequiredBuildComponentsForTest(ctx) @@ -489,7 +491,7 @@ func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) { ctx, _ := testJavaWithConfig(t, config) - // first, sanity check that the -g flag is added to target modules + // first, check that the -g flag is added to target modules targetLibrary := ctx.ModuleForTests("target_library", "android_common") targetJavaFlags := targetLibrary.Module().VariablesForTests()["javacFlags"] if !strings.Contains(targetJavaFlags, "-g:source,lines") { @@ -1107,8 +1109,13 @@ func TestDroiddoc(t *testing.T) { "bar-doc/a.java": nil, "bar-doc/b.java": nil, }) + barDocModule := ctx.ModuleForTests("bar-doc", "android_common") + barDoc := barDocModule.Rule("javadoc") + notExpected := " -stubs " + if strings.Contains(barDoc.RuleParams.Command, notExpected) { + t.Errorf("bar-doc command contains flag %q to create stubs, but should not", notExpected) + } - barDoc := ctx.ModuleForTests("bar-doc", "android_common").Rule("javadoc") var javaSrcs []string for _, i := range barDoc.Inputs { javaSrcs = append(javaSrcs, i.Base()) @@ -1117,7 +1124,7 @@ func TestDroiddoc(t *testing.T) { t.Errorf("inputs of bar-doc must be []string{\"a.java\"}, but was %#v.", javaSrcs) } - aidl := ctx.ModuleForTests("bar-doc", "android_common").Rule("aidl") + aidl := barDocModule.Rule("aidl") if g, w := barDoc.Implicits.Strings(), aidl.Output.String(); !inList(w, g) { t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g) } |