Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b13a015c authored by Pete Gillin's avatar Pete Gillin
Browse files

Turn droiddoc's metalava_merge_annotations_dir into a list.

This change replaces droiddoc's metalava_merge_annotations_dir
parameter (which takes a single value) with
metalava_merge_annotations_dirs (which takes a list). This will makes
it possible to merge libcore annotations in from a separate directory
under ojluni, instead of adding them in a preprocessing step.

It is implemented by passing the --merge-annotations argument to
metalava multiple times, which is already supported by metalava's
command line parsing.

Test: `make metalava-api-stubs-docs` with a local change to add a second directory in //frameworks/base/Android.bp
Bug: 111639530
Change-Id: I53d31f1dd45c13405b4511c2b44cbeb7f0e439d1
parent a03c43a4
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -262,8 +262,8 @@ type DroiddocProperties struct {
	// is set to true, Metalava will allow framework SDK to contain annotations.
	Metalava_annotations_enabled *bool

	// a top level directory contains XML files set to merge annotations.
	Metalava_merge_annotations_dir *string
	// a list of top-level directories containing files to merge annotations from.
	Metalava_merge_annotations_dirs []string
}

type Javadoc struct {
@@ -970,14 +970,16 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
			d.annotationsZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"_annotations.zip")
			implicitOutputs = append(implicitOutputs, d.annotationsZip)

			if String(d.properties.Metalava_merge_annotations_dir) == "" {
				ctx.PropertyErrorf("metalava_merge_annotations",
			if len(d.properties.Metalava_merge_annotations_dirs) == 0 {
				ctx.PropertyErrorf("metalava_merge_annotations_dirs",
					"has to be non-empty if annotations was enabled!")
			}
			mergeAnnotationsDirs := android.PathsForSource(ctx, d.properties.Metalava_merge_annotations_dirs)

			mergeAnnotationsDir := android.PathForSource(ctx, String(d.properties.Metalava_merge_annotations_dir))

			opts += " --extract-annotations " + d.annotationsZip.String() + " --merge-annotations " + mergeAnnotationsDir.String()
			opts += " --extract-annotations " + d.annotationsZip.String()
			for _, mergeAnnotationsDir := range mergeAnnotationsDirs {
				opts += " --merge-annotations " + mergeAnnotationsDir.String()
			}
			// TODO(tnorbye): find owners to fix these warnings when annotation was enabled.
			opts += " --hide HiddenTypedefConstant --hide SuperfluousPrefix --hide AnnotationExtraction"
		}