diff options
author | David Dietrich <drdietri@google.com> | 2020-11-02 21:55:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-11-02 21:55:13 +0000 |
commit | e1e33a25af532f3d2b7c52f7c6f039dce06c4895 (patch) | |
tree | ed7ad0690804253d1a10d764186bc773b9140940 | |
parent | aafd939b2ce081546f5314448b2d6e5797da0cd3 (diff) | |
parent | 10ed76345143a3d293066149d2bde4dab0309c52 (diff) | |
download | soong-e1e33a25af532f3d2b7c52f7c6f039dce06c4895.tar.gz |
Merge "Default to not creating stubs for droiddoc" into mainline-prod
-rw-r--r-- | java/droiddoc.go | 8 | ||||
-rw-r--r-- | java/java_test.go | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/java/droiddoc.go b/java/droiddoc.go index 862f2bb32..66eec2cf9 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -191,7 +191,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 { @@ -857,6 +857,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") || @@ -879,7 +883,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/java_test.go b/java/java_test.go index 266cada35..fc8dd7ecb 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1001,8 +1001,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()) @@ -1011,7 +1016,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) } |