Default to not creating stubs for droiddoc
This will allow us to remove `create_stubs: false` throughout the codebase easily, then remove the functionslity to create stubs from droiddoc. Test: m docs Test: m checkapi Test: m updateapi Bug: 144248501 Bug: 143136634 Change-Id: Ib95f68bc064fbe1475e4b25433bee6292bc005dc
This commit is contained in:
@@ -198,7 +198,7 @@ type DroiddocProperties struct {
|
|||||||
// the generated removed Dex API filename by Doclava.
|
// the generated removed Dex API filename by Doclava.
|
||||||
Removed_dex_api_filename *string
|
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
|
Create_stubs *bool
|
||||||
|
|
||||||
Check_api struct {
|
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) {
|
func (d *Droiddoc) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsDir android.WritablePath) {
|
||||||
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") ||
|
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") ||
|
||||||
apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") ||
|
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)
|
cmd.FlagWithOutput("-removedDexApi ", d.removedDexApiFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if BoolDefault(d.properties.Create_stubs, true) {
|
if d.createStubs() {
|
||||||
cmd.FlagWithArg("-stubs ", stubsDir.String())
|
cmd.FlagWithArg("-stubs ", stubsDir.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1107,8 +1107,13 @@ func TestDroiddoc(t *testing.T) {
|
|||||||
"bar-doc/a.java": nil,
|
"bar-doc/a.java": nil,
|
||||||
"bar-doc/b.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
|
var javaSrcs []string
|
||||||
for _, i := range barDoc.Inputs {
|
for _, i := range barDoc.Inputs {
|
||||||
javaSrcs = append(javaSrcs, i.Base())
|
javaSrcs = append(javaSrcs, i.Base())
|
||||||
@@ -1117,7 +1122,7 @@ func TestDroiddoc(t *testing.T) {
|
|||||||
t.Errorf("inputs of bar-doc must be []string{\"a.java\"}, but was %#v.", javaSrcs)
|
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) {
|
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)
|
t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user