diff options
| author | 2021-03-19 15:06:02 -0700 | |
|---|---|---|
| committer | 2021-04-16 13:38:01 -0700 | |
| commit | 06feee9352b80ebd2a2a3f186ac746f5d1d7026e (patch) | |
| tree | 969542d073006c9def63f99c1b618f53c71102b5 /rust/rust.go | |
| parent | 744fb40e5fce2243c4635a315fca363d845b640c (diff) | |
Rustdoc support.
Adds `m rustdoc` which generates documentation for all Rust libraries
to $OUT_DIR/soong/rustdoc.
Follow up work:
* Generate an index page that lists all modules.
* Preserve the artifacts so we can have an always-up-to-date go link.
Test: m rustdoc
Bug: None
Change-Id: Id2d6b9cbab5b02e36b575567563d7cc7606b9401
Diffstat (limited to 'rust/rust.go')
| -rw-r--r-- | rust/rust.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/rust.go b/rust/rust.go index 9738b467f..78a793de9 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -58,6 +58,7 @@ type Flags struct { RustFlags []string // Flags that apply to rust LinkFlags []string // Flags that apply to linker ClippyFlags []string // Flags that apply to clippy-driver, during the linting + RustdocFlags []string // Flags that apply to rustdoc Toolchain config.Toolchain Coverage bool Clippy bool @@ -124,6 +125,7 @@ type Module struct { // as a library. The stripped output which is used for installation can be found via // compiler.strippedOutputFile if it exists. unstrippedOutputFile android.OptionalPath + docTimestampFile android.OptionalPath hideApexVariantFromMake bool } @@ -355,10 +357,12 @@ type compiler interface { compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path compilerDeps(ctx DepsContext, deps Deps) Deps crateName() string + rustdoc(ctx ModuleContext, flags Flags, deps PathDeps) android.OptionalPath // Output directory in which source-generated code from dependencies is // copied. This is equivalent to Cargo's OUT_DIR variable. CargoOutDir() android.OptionalPath + inData() bool install(ctx ModuleContext) relativeInstallPath() string @@ -755,6 +759,8 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { mod.unstrippedOutputFile = android.OptionalPathForPath(unstrippedOutputFile) bloaty.MeasureSizeForPaths(ctx, mod.compiler.strippedOutputFilePath(), mod.unstrippedOutputFile) + mod.docTimestampFile = mod.compiler.rustdoc(ctx, flags, deps) + apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo) if mod.installable(apexInfo) { mod.compiler.install(ctx) |