summaryrefslogtreecommitdiff
path: root/intro2-tldr
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-08 19:30:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-08 19:30:55 +0200
commitdc7f3cd85d61ca7af6a935c30b32d71026efdffe (patch)
treec6f4cee93b1fd68f47ae557b50f13e10f3ac320a /intro2-tldr
parent64c272dfc5a40082b2a8f488e99bf758223f8a8a (diff)
Add intro2 scripts
Diffstat (limited to 'intro2-tldr')
-rwxr-xr-xintro2-tldr73
1 files changed, 73 insertions, 0 deletions
diff --git a/intro2-tldr b/intro2-tldr
new file mode 100755
index 0000000..31d5f49
--- /dev/null
+++ b/intro2-tldr
@@ -0,0 +1,73 @@
+#! /usr/bin/env bash
+
+# Test examples from the intro2, the TL;DR section.
+#
+# Usage: intro [options]
+#
+usage="usage: $0 [options]"
+
+owd=`pwd`
+trap "{ cd $owd; exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function error () { echo "$*" 1>&2; exit 1; }
+
+tmp=/tmp
+show=y
+
+function show () # <cmd> ...
+{
+ if [ $show = "y" ]; then
+ echo
+ echo "+ $*"
+ "${@}"
+ else
+ "${@}"
+ fi
+}
+
+cd "$tmp"
+
+rm -rf hello.git hello hello-gcc
+
+# Prepare hello.git repository.
+#
+bdep new -t exe -l c++ --no-init -d hello.git hello
+cd hello.git
+sed -i -re 's/version: .+/version: 0.1.0/' manifest
+git add .
+git commit -m "first commit"
+cd ..
+
+show git clone file://$tmp/hello.git
+show tree hello
+
+show cd hello
+show bdep init --config-create ../hello-gcc cc config.cxx=g++
+show b
+show hello/hello World
+
+cat <<EOF >>repositories.manifest
+:
+role: prerequisite
+location: https://git.build2.org/hello/libhello.git#v1.0.0
+EOF
+cat <<EOF >>manifest
+depends: libhello ^1.0.0
+EOF
+sed -i -re 's/#import/import/' hello/buildfile
+cat <<EOF >>hello/hello.cxx
+#include <libhello/hello.hxx>
+EOF
+
+show b
+
+sed -i -re 's/#v1.0.0//' repositories.manifest
+show bdep fetch
+bdep sync
+show bdep status -i
+
+show bdep sync libhello
+show bdep sync libhello/1.0.0
+
+cd ..