Skip to content

Commit

Permalink
adding linux build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pracplay committed Dec 1, 2020
1 parent 2334e61 commit 79801c1
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

all:
./build.sh
./convert.sh
./runtest.sh
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CSharp.lua is a C# to Lua compiler. Write C# then run on lua VM.

* Self-Compiling, run "./test/self-compiling/self.bat".

* Self-Compiling (linux), run "./make" (if no errors, will prompt for fibbonacci 'N' value and generate fib sequence in lua)

* Used by .NET Core, Ability to across platforms.

## Sample
Expand Down Expand Up @@ -77,6 +79,7 @@ Options
Make sure that .NET 5.0 is installed.
https://dotnet.microsoft.com/download/dotnet/5.0


### Download
https://github.com/yanghuan/CSharp.lua/releases

Expand Down
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# build solution
dotnet build /p:Configuration=Release CSharp.lua.sln
berr=$?
if [ "$berr" != 0 ]; then
echo "errors occuring during build, please fix and retry...">&2
exit $berr
fi
echo "build ok."
20 changes: 20 additions & 0 deletions convert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
srcp=$1
dstp="./out"

if [ -z "$srcp" ]; then
echo "no source directory for conversion supplied, using fibonacci src as default...">&2
srcp=./test/fibonacci/src
fi

if ! [ -d "$dstp" ]; then mkdir "$dstp"; fi
dotnet ./CSharp.lua.Launcher/bin/Release/net5.0/CSharp.lua.Launcher.dll -s "$srcp" -d "$dstp/."
converterr=$?
if [ $converterr != 0 ]; then
echo "errors occurred during convert">&2
exit 2
fi
echo "convert ok to $dstp.">&2
echo "run ./runtest.sh to attempt to interpret output.">&2
exit 0

5 changes: 5 additions & 0 deletions runtest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package.path = package.path .. ";./CSharp.lua/CoreSystem.Lua/?.lua"
require ("All")()
require("out.manifest")("out")
Test.Program.Main()
os.exit()
2 changes: 2 additions & 0 deletions runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
lua -i runtest.lua
1 change: 1 addition & 0 deletions test/fibonacci/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void Main(string[] args) {
Console.Write(v);
Console.Write(',');
}
Console.WriteLine("");
}

private static int FibonacciN(int n) {
Expand Down

0 comments on commit 79801c1

Please sign in to comment.