aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/export.build10
-rw-r--r--build/root.build13
-rw-r--r--libbutl/manifest-parser.bash14
-rw-r--r--tests/build/root.build2
-rw-r--r--tests/manifest-parser/buildfile4
-rwxr-xr-xtests/manifest-parser/driver31
-rw-r--r--tests/manifest-parser/driver.in20
l---------tests/manifest-parser/libbutl1
8 files changed, 43 insertions, 52 deletions
diff --git a/build/export.build b/build/export.build
new file mode 100644
index 0000000..4f9f5c7
--- /dev/null
+++ b/build/export.build
@@ -0,0 +1,10 @@
+# file : build/export.build
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+$out_root/
+{
+ include libbutl/
+}
+
+export $src_root/libbutl/$import.target
diff --git a/build/root.build b/build/root.build
index 236b359..fdcf92b 100644
--- a/build/root.build
+++ b/build/root.build
@@ -2,15 +2,4 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-# Bash module target type.
-#
-# We install it into the same location where the scripts that use it would
-# presumably go.
-#
-# @@ Path/string cast is ugly, should go away once have implicit to-untyped
-# conversion during function call.
-#
-define bash: file
-bash{*}: extension = bash
-bash{*}: install = bin/$path.base($project)/
-bash{*}: install.mode = 644
+using bash
diff --git a/libbutl/manifest-parser.bash b/libbutl/manifest-parser.bash
index 5fa53ce..e726298 100644
--- a/libbutl/manifest-parser.bash
+++ b/libbutl/manifest-parser.bash
@@ -2,12 +2,12 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-function parse_manifest ()
+function butl_parse_manifest ()
{
- printf ": 1\0"
- printf "name: foo\0"
- printf "version: 1.2.3\0"
- printf "description: foo\nexecutable\0"
- printf "depends: libfoo\0"
- printf "depends: libbar\0"
+ printf ":1\0"
+ printf "name:foo\0"
+ printf "version:1.2.3\0"
+ printf "description:foo\nexecutable\0"
+ printf "depends:libfoo\0"
+ printf "depends:libbar\0"
}
diff --git a/tests/build/root.build b/tests/build/root.build
index 1f267eb..f4d2a1c 100644
--- a/tests/build/root.build
+++ b/tests/build/root.build
@@ -2,6 +2,8 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
+using bash
+
# Every exe{} in this subproject is by default a test.
#
exe{*}: test = true
diff --git a/tests/manifest-parser/buildfile b/tests/manifest-parser/buildfile
index 1dfe0d3..c572f3a 100644
--- a/tests/manifest-parser/buildfile
+++ b/tests/manifest-parser/buildfile
@@ -2,4 +2,6 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-exe{driver}: testscript
+import mods = libbutl.bash%bash{manifest-parser}
+
+exe{driver}: in{driver} $mods testscript
diff --git a/tests/manifest-parser/driver b/tests/manifest-parser/driver
deleted file mode 100755
index 4cbea3e..0000000
--- a/tests/manifest-parser/driver
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-
-function import ()
-{
- # Here we don't assume the errors are trapped. If all goes well, our exit
- # code is that of source (which fails if the file is not found).
- #
- local e; if ! e="$(realpath ${BASH_SOURCE[0]})"; then return 1; fi
- local d; if ! d="$(dirname "$e")"; then return 1; fi
- source "$d/$1.bash"
-}
-
-trap "{ exit 1; }" ERR
-set -o errtrace # Trap ERR in functions.
-
-import libbutl/manifest-parser
-
-# @@ parse_manifest failure ignored
-#
-# @@ what would be equivalent serialization interface? Just serialize one
-# name/value in manifest format (so explicit version).
-#
-while IFS=': ' read -r -d '' n v; do
- if [ -z "$n" ]; then
- echo "$v"
- else
- echo # Extra newline after first pair.
- echo "$n"
- echo "$v"
- fi
-done < <(parse_manifest)
diff --git a/tests/manifest-parser/driver.in b/tests/manifest-parser/driver.in
new file mode 100644
index 0000000..90dc0e3
--- /dev/null
+++ b/tests/manifest-parser/driver.in
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# file : tests/manifest-parser/driver.in
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+trap "{ exit 1; }" ERR
+set -o errtrace # Trap ERR in functions.
+
+@import libbutl/manifest-parser@
+
+while IFS=: read -r -d '' n v; do
+ if [ -z "$n" ]; then
+ echo "$v"
+ else
+ echo # Extra newline after first pair.
+ echo "$n"
+ echo "$v"
+ fi
+done < <(butl_parse_manifest)
diff --git a/tests/manifest-parser/libbutl b/tests/manifest-parser/libbutl
deleted file mode 120000
index 6d1c4c0..0000000
--- a/tests/manifest-parser/libbutl
+++ /dev/null
@@ -1 +0,0 @@
-../../libbutl \ No newline at end of file