Merge: regen csrc for Windows and to fix 32 bits support
authorJean Privat <jean@pryen.org>
Mon, 6 Mar 2017 16:14:55 +0000 (11:14 -0500)
committerJean Privat <jean@pryen.org>
Mon, 6 Mar 2017 16:14:55 +0000 (11:14 -0500)
Fix #2355.

Pull-Request: #2382

contrib/oot.sh [new file with mode: 0755]
contrib/oot.txt [new file with mode: 0644]
contrib/oot/.gitignore [new file with mode: 0644]
contrib/oot/packages.ini [new file with mode: 0644]
contrib/re_parser/Makefile
lib/ini.nit
misc/jenkins/trymake.sh [new file with mode: 0755]
misc/jenkins/unitrun.sh
tests/tests.sh

diff --git a/contrib/oot.sh b/contrib/oot.sh
new file mode 100755 (executable)
index 0000000..ff29ba2
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Update out-of-tree projects from oot.txt
+# Each one is cloned in the oot/ directory.
+
+
+# Update the directory
+update_oot() {
+       if test -d "$dir"; then
+               echo "$name: git pull"
+               ../misc/jenkins/unitrun.sh "cmd-$name-pull" git --work-tree="$PWD/$dir" --git-dir="$PWD/$dir/.git" pull -f
+       else
+               echo "$name: git clone"
+               ../misc/jenkins/unitrun.sh "cmd-$name-clone" git clone "$repo" "$dir"
+       fi
+}
+
+# Run trymake with arguments
+trymake_oot() {
+       echo "$name: trymake $@"
+       ../misc/jenkins/trymake.sh "$name" "$dir" "$@"
+}
+
+cmd="$1"
+shift
+
+while read -r repo name; do
+       [[ "$repo" = "#"* ]] && continue
+       [[ "$name" = "" ]] && continue
+       dir="oot/$name"
+       case "$cmd" in
+               list) echo "$name";;
+               update) update_oot;;
+               trymake) trymake_oot "$@";;
+               pre-build) trymake_oot pre-build;;
+               all) update_oot; trymake_oot pre-build all check;;
+               ""|help) echo "usage: oot.sh command [arg...]"; exit 0;;
+               *) echo >&2 "unknown command: $cmd"; exit 1;;
+       esac
+done < oot.txt
diff --git a/contrib/oot.txt b/contrib/oot.txt
new file mode 100644 (file)
index 0000000..933c71f
--- /dev/null
@@ -0,0 +1,6 @@
+# List of out-of-tree repositories
+# Format: repo name
+https://github.com/R4PaSs/brewnit.git brewnit
+https://github.com/Morriar/Missions.git missions
+https://github.com/ppepos/pep8-dbg.git pep8dbg
+https://gitlab.com/xymus/sputnit.git sputnit
diff --git a/contrib/oot/.gitignore b/contrib/oot/.gitignore
new file mode 100644 (file)
index 0000000..72e8ffc
--- /dev/null
@@ -0,0 +1 @@
+*
diff --git a/contrib/oot/packages.ini b/contrib/oot/packages.ini
new file mode 100644 (file)
index 0000000..e69de29
index 4997227..20bd556 100644 (file)
@@ -4,6 +4,8 @@ NITUNIT=../../bin/nitunit
 
 all: re_parser re_app
 
+pre-build: grammar
+
 nitcc:
        cd ../nitcc && make nitcc
 
index 84b200c..5e7c671 100644 (file)
@@ -208,9 +208,9 @@ class ConfigTree
                                path = key
                                set_node(path, null)
                        else
-                               var parts = line.split("=")
-                               assert parts.length > 1 else
-                                       print "Error: malformed ini at line {line_number}"
+                               var parts = line.split_once_on("=")
+                               if parts.length == 1 then
+                                       continue
                                end
                                var key = parts[0].trim
                                var val = parts[1].trim
diff --git a/misc/jenkins/trymake.sh b/misc/jenkins/trymake.sh
new file mode 100755 (executable)
index 0000000..9bd7c0e
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Try to make targets (like pre-build). If the rule does on exists this does nothing instead of failing.
+# This also generate xml JUnit files
+#
+# Usage
+#
+#     trymake.sh name directory [targets]..
+#
+# Example
+#
+#     trymake.sh foo contrib/foo check android
+
+shdir="`dirname "$BASH_SOURCE"`"
+
+name="$1"
+dir="$2"
+shift
+shift
+failed=
+# Check each rules, if they exists
+for rule in "$@"; do
+       make -C "$dir" $rule -n >/dev/null 2>/dev/null || {
+               # Special case for `all` that falls back as the default target
+               if [ "$rule" = "all" ]; then
+                       echo "*** make -C $dir ***"
+                       $shdir/unitrun.sh "cmd-$name-make" make -C "$dir" ||
+                               failed="$failed $name"
+               fi
+               continue
+       }
+       echo "*** make $rule -C $dir ***"
+       $shdir/unitrun.sh "cmd-$name-make$rule" make -C "$dir" $rule ||
+       failed="$failed $name-$rule"
+done
+if test -n "$failed"; then
+       echo "FAILED: $failed"
+       exit 1
+fi
+exit 0
index 1c3d39f..dce0047 100755 (executable)
@@ -29,6 +29,8 @@ if env time --quiet -f%U true 2>/dev/null; then
        TIME="env time --quiet -f%U -o ${name}.t.out"
 elif env time -f%U true 2>/dev/null; then
        TIME="env time -f%U -o ${name}.t.out"
+elif env gtime -f%U true 2>/dev/null; then
+       TIME="env gtime -f%U -o ${name}.t.out"
 else
        TIME=
 fi
index 8168d0d..308ff84 100755 (executable)
@@ -134,6 +134,8 @@ if env time --quiet -f%U true 2>/dev/null; then
        TIME="env time --quiet -f%U"
 elif env time -f%U true 2>/dev/null; then
        TIME="env time -f%U"
+elif env gtime -f%U true 2>/dev/null; then
+       TIME="env gtime -f%U"
 else
        TIME=
 fi
@@ -146,7 +148,7 @@ else
 fi
 
 # Detect a working hostname command
-if hostname --version | grep coreutils >/dev/null 2>&1; then
+if hostname --version 2>&1 | grep coreutils >/dev/null 2>&1; then
        HOSTNAME="hostname"
 else
        HOSTNAME="hostname -s"