misc/sf
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 30 Nov 2020 00:06:15 +0000
changeset 379 5616b45d656f
parent 341 e9d5287c3107
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
341
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
#!/bin/sh
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
###set -e
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
trap "exit" INT
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
function scala_compile {
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null) 
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
}
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
files=${1:-assignment2019scala-*/Part10}
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
name="bf.scala"
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
for sd in $files; do
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
    scalafix -r DisableSyntax --settings.DisableSyntax.noVars=true --settings.DisableSyntax.noReturns=true --settings.DisableSyntax.noWhileLoops=true $sd/$name 2> /dev/null 1> /dev/null
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
   ts=$(( $? )) 
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
   if [ $ts -ne 0 ]
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
   then
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
     echo $sd  
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
     echo $ts
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
   else
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
       if (scala_compile $sd/$name)
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
       then	  
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
         ts=$(( 0 ))
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
       else
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
         echo $sd  
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
         echo $ts  
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
       fi	   
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
   fi  
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
done
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
e9d5287c3107 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35