[fractal] build: Add 'doc' task



commit 839f4082554b7434e4a3224c01dea5cc17663218
Author: Christopher Davis <brainblasted disroot org>
Date:   Sun Apr 28 15:12:59 2019 -0400

    build: Add 'doc' task
    
    Using raw `cargo doc` lead to a situation where the
    documentation tried to generate without being
    aware of the resources we need to build.

 .gitlab-ci.yml              | 14 ++------------
 Cargo.lock                  | 14 ++++++++------
 fractal-gtk/src/meson.build | 12 ++++++++++++
 meson.build                 |  1 +
 scripts/cargo-doc.sh        | 10 ++++++++++
 5 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e5694988..3081f1ff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -101,20 +101,10 @@ pages:
         - flatpak-builder --stop-at=${FLATPAK_MODULE} --force-clean app ${MANIFEST_PATH}
         - flatpak-builder --run app ${MANIFEST_PATH} meson _build
 
-        - |
-          flatpak-builder --run \
-              --env=CARGO_HOME="target/cargo-home" \
-              app ${MANIFEST_PATH} \
-              cargo doc --no-deps
-
-        - |
-          flatpak-builder --run \
-              --env=CARGO_HOME="target/cargo-home" \
-              app ${MANIFEST_PATH} \
-              cargo rustdoc -p fractal-gtk -- --document-private-items
+        - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build doc
 
         - rm -rf public
-        - mv target/doc/ public
+        - mv _build/target/doc/ public
     artifacts:
         paths:
           - public
diff --git a/Cargo.lock b/Cargo.lock
index c25ded79..6ab8a049 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,3 +1,5 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
 [[package]]
 name = "MacTypes-sys"
 version = "2.1.0"
@@ -455,7 +457,7 @@ dependencies = [
  "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gettext-rs 0.4.1 (git+https://github.com/danigm/gettext-rs?branch=no-gettext)",
+ "gettext-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gspell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -624,16 +626,16 @@ dependencies = [
 [[package]]
 name = "gettext-rs"
 version = "0.4.1"
-source = 
"git+https://github.com/danigm/gettext-rs?branch=no-gettext#c514bbe52ef892e3c0689eb474c564949d15e145";
+source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "gettext-sys 0.19.8 (git+https://github.com/danigm/gettext-rs?branch=no-gettext)",
+ "gettext-sys 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "locale_config 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "gettext-sys"
 version = "0.19.8"
-source = 
"git+https://github.com/danigm/gettext-rs?branch=no-gettext#c514bbe52ef892e3c0689eb474c564949d15e145";
+source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2605,8 +2607,8 @@ dependencies = [
 "checksum gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"08284f16ce4d909b10d785a763ba190e222d2c1557b29908bf0a661e27a8ac3b"
 "checksum gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"108548ebf5329b551f2b97ab356908d14627905abb74b936c3372de1535aee81"
 "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
-"checksum gettext-rs 0.4.1 (git+https://github.com/danigm/gettext-rs?branch=no-gettext)" = "<none>"
-"checksum gettext-sys 0.19.8 (git+https://github.com/danigm/gettext-rs?branch=no-gettext)" = "<none>"
+"checksum gettext-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b2502071e088651bd5fec87a896be2a5b908e817070d350a534a305abc9c6048"
+"checksum gettext-sys 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"62c644c0b8b73706fb8c7420533fd30abf6f41c2703994bc6f0826fceb7fb3d6"
 "checksum gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"29a44b051990573448edc80b1995237f8b97b5734d2aec05105b9242aa10af11"
 "checksum gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6975ada29f7924dc1c90b30ed3b32d777805a275556c05e420da4fbdc22eb250"
 "checksum glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7a333edf5b9f1411c246ef14e7881b087255f04c56dbef48c64a0cb039b4b340"
diff --git a/fractal-gtk/src/meson.build b/fractal-gtk/src/meson.build
index a5a23ebd..8fbd197d 100644
--- a/fractal-gtk/src/meson.build
+++ b/fractal-gtk/src/meson.build
@@ -32,6 +32,18 @@ run_command(
   check: true
 )
 
+run_target(
+  'doc',
+  command: [
+    doc_script,
+    '@SOURCE_ROOT@',
+    '@OUTPUT@',
+    meson.build_root(),
+    profile
+  ],
+  depends: fractal_resources
+)
+
 # Keep in alphabetical order
 app_sources = files(
   'actions/account_settings.rs',
diff --git a/meson.build b/meson.build
index 0630527c..b003c122 100644
--- a/meson.build
+++ b/meson.build
@@ -72,6 +72,7 @@ gresource = find_program('glib-compile-resources', required: false)
 cargo_vendor = find_program('cargo-vendor', required: false)
 cargo_script = find_program('scripts/cargo.sh')
 test_script = find_program('scripts/test.sh')
+doc_script = find_program('scripts/cargo-doc.sh')
 
 cargo_manifests = files(
   'Cargo.toml',
diff --git a/scripts/cargo-doc.sh b/scripts/cargo-doc.sh
new file mode 100644
index 00000000..06df3acf
--- /dev/null
+++ b/scripts/cargo-doc.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+export OUTPUT="$2"
+export CARGO_TARGET_DIR="$3"/target
+export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
+export FRACTAL_PROFILE="$4"
+
+echo "GENERATING DOCUMENTATION"
+cargo doc --manifest-path $1/Cargo.toml -p fractal-matrix-api --no-deps &&
+cargo rustdoc --manifest-path $1/Cargo.toml -p fractal-gtk -- --document-private-items


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]