summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-04-08 15:06:40 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-04-08 17:56:42 +0000
commit2538905e4fa529d07b9ccf343e0d6123acb5fd40 (patch)
treea71a2bfebdd92313078329aca5e0228c975feec8
parentda2c4191b470fba44ed5a4cd4679d3fcee887f69 (diff)
Install ci-tools and get tokstyle via the script it provides.
-rwxr-xr-x.travis/cmake-linux21
-rwxr-xr-xother/astyle/format-source7
2 files changed, 10 insertions, 18 deletions
diff --git a/.travis/cmake-linux b/.travis/cmake-linux
index 0deeaacc..e2f44195 100755
--- a/.travis/cmake-linux
+++ b/.travis/cmake-linux
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2 2
3ACTION="$1" 3ACTION="$1"
4 4
@@ -8,22 +8,11 @@ CACHEDIR="$HOME/cache"
8NPROC=`nproc` 8NPROC=`nproc`
9ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle" 9ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle"
10ASTYLE_VERSION=3.1 10ASTYLE_VERSION=3.1
11 11TRAVIS_TOOL="https://raw.githubusercontent.com/TokTok/ci-tools/master/bin/travis-haskell"
12install_tool() {
13 SLUG="$1"
14 TOOL="$2"
15 TARGET="$3"
16
17 VERSION=$(curl -L -s -H 'Accept: application/json' \
18 "https://github.com/$SLUG/releases/latest" \
19 | egrep -o '"v[0-9][^"]+"' \
20 | egrep -o '[^"]+')
21 URL="https://github.com/$SLUG/releases/download/$VERSION/$TOOL-x86_64-linux-$VERSION.tar.gz"
22 curl -L -s "$URL" | tar xzv -C "$TARGET"
23}
24 12
25travis_install() { 13travis_install() {
26 install_tool TokTok/hs-tokstyle tokstyle "$HOME/.local" 14 bash <(curl -s "$TRAVIS_TOOL") download
15 travis-haskell download TokTok/hs-tokstyle tokstyle "$HOME/.local"
27 16
28 which coveralls || { 17 which coveralls || {
29 # Install cpp-coveralls to upload test coverage results. 18 # Install cpp-coveralls to upload test coverage results.
@@ -48,7 +37,7 @@ run_static_analysis() {
48 pylint -E other/analysis/check_recursion 37 pylint -E other/analysis/check_recursion
49 38
50 export CPPFLAGS="-isystem $CACHEDIR/include" 39 export CPPFLAGS="-isystem $CACHEDIR/include"
51 export LDFLAGS="-L $CACHEDIR/lib" 40 export LDFLAGS="-L$CACHEDIR/lib"
52 cat toxav/*.c toxcore/*.c toxencryptsave/*.c \ 41 cat toxav/*.c toxcore/*.c toxencryptsave/*.c \
53 | clang `pkg-config --cflags libsodium opus vpx` \ 42 | clang `pkg-config --cflags libsodium opus vpx` \
54 -Itoxav -Itoxcore -Itoxencryptsave -S -emit-llvm -xc - -o- \ 43 -Itoxav -Itoxcore -Itoxencryptsave -S -emit-llvm -xc - -o- \
diff --git a/other/astyle/format-source b/other/astyle/format-source
index 7fa8b677..711823d8 100755
--- a/other/astyle/format-source
+++ b/other/astyle/format-source
@@ -35,10 +35,10 @@ FROM_JSON='s/\\"/"/g;s/^"(.*)"$/$1/;s/\\\\/\\/g;s/\\n/\n/g'
35 35
36apidsl_request() { 36apidsl_request() {
37 TMPFILE=$(mktemp /tmp/apidsl.XXXXXX) 37 TMPFILE=$(mktemp /tmp/apidsl.XXXXXX)
38 curl -o "$TMPFILE" -X POST --data @<( 38 curl -s -o "$TMPFILE" -X POST --data @<(
39 echo '["Request",'; 39 echo '["Request",';
40 cat $2; 40 cat $2;
41 echo ']') https://apidsl2.herokuapp.com/$1 41 echo ']') https://apidsl.herokuapp.com/$1
42 if grep '\[1,"' "$TMPFILE" > /dev/null; then 42 if grep '\[1,"' "$TMPFILE" > /dev/null; then
43 echo "Error: $(grep -o '".*"' /tmp/apidsl-$$ | perl -0777 -pe "$FROM_JSON")" >&2 43 echo "Error: $(grep -o '".*"' /tmp/apidsl-$$ | perl -0777 -pe "$FROM_JSON")" >&2
44 rm "$TMPFILE" 44 rm "$TMPFILE"
@@ -49,12 +49,14 @@ apidsl_request() {
49} 49}
50 50
51apidsl_curl() { 51apidsl_curl() {
52 echo "apidsl_curl $@" >&2
52 apidsl_request "c" <( 53 apidsl_request "c" <(
53 apidsl_request "parse" <( 54 apidsl_request "parse" <(
54 perl -0777 -pe "$TO_JSON" $1)) | perl -0777 -pe "$FROM_JSON" 55 perl -0777 -pe "$TO_JSON" $1)) | perl -0777 -pe "$FROM_JSON"
55} 56}
56 57
57# Check if apidsl generated sources are up to date. 58# Check if apidsl generated sources are up to date.
59set +x
58$APIDSL toxcore/LAN_discovery.api.h > toxcore/LAN_discovery.h & 60$APIDSL toxcore/LAN_discovery.api.h > toxcore/LAN_discovery.h &
59$APIDSL toxcore/crypto_core.api.h > toxcore/crypto_core.h & 61$APIDSL toxcore/crypto_core.api.h > toxcore/crypto_core.h &
60$APIDSL toxcore/ping.api.h > toxcore/ping.h & 62$APIDSL toxcore/ping.api.h > toxcore/ping.h &
@@ -62,6 +64,7 @@ $APIDSL toxcore/ping_array.api.h > toxcore/ping_array.h &
62$APIDSL toxcore/tox.api.h > toxcore/tox.h & 64$APIDSL toxcore/tox.api.h > toxcore/tox.h &
63$APIDSL toxav/toxav.api.h > toxav/toxav.h & 65$APIDSL toxav/toxav.api.h > toxav/toxav.h &
64$APIDSL toxencryptsave/toxencryptsave.api.h > toxencryptsave/toxencryptsave.h & 66$APIDSL toxencryptsave/toxencryptsave.api.h > toxencryptsave/toxencryptsave.h &
67set -x
65 68
66wait; wait; wait; wait; wait; wait; wait 69wait; wait; wait; wait; wait; wait; wait
67 70