summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matthew Maurer <mmaurer@google.com> 2021-08-20 13:02:25 -0700
committer Matthew Maurer <mmaurer@google.com> 2021-08-20 13:08:16 -0700
commitca68c49621d2653298e2ff4c53523cd904e744df (patch)
treecfc0b49f20c2c31864b1e14223cd847f522bf164
parent0dd067d30908d1cc6d4bfa5e68d6c1c197ecd1d7 (diff)
rust: doc: Zip up docs when done
Fetching artifacts from the build server doesn't go well with large numbers of files in nested directories. Produce an additional rustdoc.zip artifact to make this easier. This change also prevents ${DIST} from receiving the unpacked rustdoc site. This can be changed if b/188822051 is fixed. Bug: 162741284 Test: m rustdoc; check resulting zip contents manually Change-Id: I80b6a8fa6e274d2d8c3419d8734251afd4d7dba7
-rw-r--r--rust/doc.go12
-rwxr-xr-xscripts/build-rustdocs.sh2
2 files changed, 12 insertions, 2 deletions
diff --git a/rust/doc.go b/rust/doc.go
index e7f137198..fe3581b42 100644
--- a/rust/doc.go
+++ b/rust/doc.go
@@ -29,6 +29,14 @@ func RustdocSingleton() android.Singleton {
type rustdocSingleton struct{}
func (n *rustdocSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ docDir := android.PathForOutput(ctx, "rustdoc")
+ docZip := android.PathForOutput(ctx, "rustdoc.zip")
+ rule := android.NewRuleBuilder(pctx, ctx)
+ zipCmd := rule.Command().BuiltTool("soong_zip").
+ FlagWithOutput("-o ", docZip).
+ FlagWithArg("-C ", docDir.String()).
+ FlagWithArg("-D ", docDir.String())
+
ctx.VisitAllModules(func(module android.Module) {
if !module.Enabled() {
return
@@ -36,8 +44,10 @@ func (n *rustdocSingleton) GenerateBuildActions(ctx android.SingletonContext) {
if m, ok := module.(*Module); ok {
if m.docTimestampFile.Valid() {
- ctx.Phony("rustdoc", m.docTimestampFile.Path())
+ zipCmd.Implicit(m.docTimestampFile.Path())
}
}
})
+ rule.Build("rustdoc-zip", "Zipping all built Rust documentation...")
+ ctx.Phony("rustdoc", docZip)
}
diff --git a/scripts/build-rustdocs.sh b/scripts/build-rustdocs.sh
index ad8ba16d5..fda9688c8 100755
--- a/scripts/build-rustdocs.sh
+++ b/scripts/build-rustdocs.sh
@@ -27,5 +27,5 @@ m rustdoc
if [ -n "${DIST_DIR}" ]; then
mkdir -p ${DIST_DIR}
- cp -r ${OUT_DIR}/soong/rustdoc $DIST_DIR/rustdoc
+ cp ${OUT_DIR}/soong/rustdoc.zip $DIST_DIR
fi