Skip to content

Commit

Permalink
yarn: created command to build example tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
e8johan committed Aug 20, 2021
1 parent 01e749b commit d1ed22a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ build-*

# Examples build output
_examples/
examples.tar.gz

# Python
.venv
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ You can always find the latest version of the book built at [https://distracted-
# Contents

1. Building the Book Locally
2. For Reviewers
3. For Authors
2. Building for Release
3. For Reviewers
4. For Authors

# 1. Building the Book Locally

Expand Down Expand Up @@ -37,12 +38,25 @@ $ CMAKE_PREFIX_PATH=/path/to/Qt/6.2.0/gcc_64/lib/cmake/ yarnpkg run examples:bui

Subsequent calls do not need `CMAKE_PREFIX_PATH` to be specified.

# 2. For Reviewers
# 2. Building for Release

To build for release, first build the docs, then package the examples into a tar-ball:

```
$ yarnpkg run docs:build
$ yarnpkg run examples:package
```

This creates `examples.tar.gz` in your package root, as well as where VuePress places the output, i.e. `docs/.vuepress/dist/`.

Notice that the `examples:package` command assumes that the VuePress `dist/` directory exists.

# 3. For Reviewers

Pick chapters to review from the [Project Board](https://github.com/qmlbook/qt6book/projects/1). Also look for issues tagged as [Questions](https://github.com/qmlbook/qt6book/issues?q=is%3Aissue+is%3Aopen+label%3Aquestion) in the project.

Reviews are welcome both as issues, or as pull requests. Pick the approach that is the easiest for you!

# 3. For Authors
# 4. For Authors

Chapters are outlined in `docs/.vuepress/config.js`. Please tag chapters as `Qt5`, `Qt6 Draft`, and `Qt 6` respectively.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"scripts": {
"docs:dev": "vuepress dev docs --host 127.0.0.1",
"docs:build": "vuepress build docs",
"examples:build": "./build-examples.sh"
"examples:build": "./scripts/build-examples.sh",
"examples:package": "./scripts/package-examples.sh"
}
}
File renamed without changes.
40 changes: 40 additions & 0 deletions scripts/package-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

#
# Script to build a tarball of all examples from Qt6 Book
#
# Moves the docs/CHAPTER/src/EXAMPLE into a qt6book/CHAPTER/EXAMPLE structure
#

set -e

tmpdir=$(mktemp -d)
mkdir -p $tmpdir/qt6book

for exdir in docs/*/src; do
chname=$(echo $exdir | sed 's/^docs\///;s/\/src$//;')
mkdir -p "$tmpdir/qt6book/$chname"

cd docs/$chname/src
for exexdir in *; do
# Skip build- dirs (created by Qt Creator)
if [[ $exexdir == build-* ]]; then
continue
fi
# Skip screenshots.qml file
if [[ $exexdir == "screenshots.qml" ]]; then
continue
fi

tar cf - $exexdir | (cd $tmpdir/qt6book/$chname; tar xfp -)
done
cd ../../..
done

# Create a resulting examples.tar.gz file where vuepress places the built site and at $(pwd)
destdir=$(pwd)
(cd $tmpdir; tar cvfz $destdir/examples.tar.gz qt6book/ > /dev/null)
cp examples.tar.gz docs/.vuepress/dist/

# Clean up the temporary directory
rm -rf $tmpdir

0 comments on commit d1ed22a

Please sign in to comment.