Created
December 16, 2014 07:48
-
-
Save nacho4d/8fc985b0ca84da677000 to your computer and use it in GitHub Desktop.
Compile file for C# CodeRunner. It runs even when gmcs gives warnings. (After showing them)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# This is a CodeRunner compilation script. Compilation scripts are used to | |
# compile code before being run using the run command specified in CodeRunner | |
# preferences. This script should have the following properties: | |
# | |
# Launch directory ($PWD): Will be the same as the file being run | |
# | |
# Exit status: Should be 0 on success (will cause CodeRunner | |
# to continue and execute the run command) | |
# | |
# Output (stdout): On success, one line of text which can be accessed | |
# using the $compiler variable in the run command | |
# | |
# Output (stderr): Anything outputted here will be displayed in | |
# the CodeRunner console | |
# | |
# Arguments: $1 Filename of the source file | |
# $2 Encoding of the source file | |
# $3 Compilation flags set in CodeRunner preferences | |
# $4 Path of a temporary directory (without / suffix) | |
# | |
# The encoding argument may be used to specify to the compiler which encoding | |
# the source file uses. It will be one of the integers in the following array: | |
enc[4]="" # UTF-8 | |
enc[10]="" # UTF-16 | |
enc[5]="" # ISO Latin 1 | |
enc[9]="" # ISO Latin 2 | |
enc[30]="" # Mac OS Roman | |
enc[12]="" # Windows Latin 1 | |
enc[3]="" # Japanese (EUC) | |
enc[8]="" # Japanese (Shift JIS) | |
enc[1]="" # ASCII | |
# Temporal log file. Compiler output should be piped to here | |
buildlog="${1}.`date`.log" | |
compname=`echo "$1" | sed 's/\(.*\)\..*/\1/'`.exe | |
/usr/local/bin/gmcs "${1}" ${3} > buildlog | |
status=$? | |
rm -f "$buildlog" | |
if [ $status -eq 0 ] | |
then | |
echo $compname | |
exit 0 | |
elif [ $status -eq 127 ] | |
then | |
echo -e "\nIn order to run C# code, you need to have Mono installed. You can get it at http://mono-project.com" | |
fi | |
exit $status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment