Skip to content

Commit 8584cfc

Browse files
committed
Fix issues with OS detection, and update MKBundle build steps.
1 parent 216204c commit 8584cfc

18 files changed

+101
-58
lines changed

Algo/ALEC/ALEC.cs

+18-1
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,22 @@ public static void Compile(string file)
178178
}
179179

180180
Log("MKBundle has finished executing.");
181+
182+
//Delete the main executable.
183+
Log("Attempting to clean up...");
184+
try
185+
{
186+
File.Delete(ProjectName + ".exe");
187+
}
188+
catch(Exception e)
189+
{
190+
Error.WarningCompile("Failed to clean up Windows executable, given error '" + e.Message + "'.");
191+
}
181192
}
182-
else
193+
else if (AlgoPlatformInfo.IsWindows)
183194
{
184195
//It's Windows, use ILRepack instead.
196+
Log("Windows detected as the operating system, attempting to create a native binary...");
185197
Log("Attempting to bundle dependencies into packed executable...");
186198
RepackOptions opt = new RepackOptions();
187199
opt.OutputFile = ProjectName + "_packed.exe";
@@ -216,6 +228,11 @@ public static void Compile(string file)
216228
Error.WarningCompile("Packing the executable's dependencies failed, with error '" + e.Message + "'. You will need to include algo.exe and all it's dependencies along with the built executable for it to run.");
217229
}
218230
}
231+
else
232+
{
233+
Error.FatalCompile("Could not detect the operating system to compile native binary.");
234+
return;
235+
}
219236

220237
//Print the compile footer.
221238
PrintCompileFooter();

Algo/Algo.csproj

+1-10
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@
2323
<DefineConstants>DEBUG;TRACE</DefineConstants>
2424
<ErrorReport>prompt</ErrorReport>
2525
<WarningLevel>4</WarningLevel>
26-
<CustomCommands>
27-
<CustomCommands>
28-
<Command>
29-
<type>BeforeBuild</type>
30-
<command>
31-
</command>
32-
</Command>
33-
</CustomCommands>
34-
</CustomCommands>
3526
<PlatformTarget>AnyCPU</PlatformTarget>
3627
<Prefer32Bit>false</Prefer32Bit>
3728
</PropertyGroup>
@@ -159,4 +150,4 @@
159150
<Import Project="..\packages\Antlr4.CodeGenerator.4.6.6\build\Antlr4.CodeGenerator.targets" Condition="Exists('..\packages\Antlr4.CodeGenerator.4.6.6\build\Antlr4.CodeGenerator.targets')" />
160151
<PropertyGroup>
161152
</PropertyGroup>
162-
</Project>
153+
</Project>

Algo/Platform Libraries/AlgoPlatformInfo.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Linq;
45
using System.Runtime.InteropServices;
56
using System.Text;
@@ -10,7 +11,8 @@ namespace Algo
1011
//Static class containing platform information for .NET and Algo.
1112
public static class AlgoPlatformInfo
1213
{
13-
public static bool IsLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
14-
public static bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
14+
//This is a rudamentary bugfix while Mono is broken.
15+
public static bool IsLinux = Directory.Exists("/");
16+
public static bool IsWindows = !IsLinux;
1517
}
1618
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoLexer.cs
2-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoParser.cs
3-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoListener.cs
4-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoBaseListener.cs
5-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoVisitor.cs
6-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoBaseVisitor.cs
1+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoLexer.cs
2+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoParser.cs
3+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoListener.cs
4+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoBaseListener.cs
5+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoVisitor.cs
6+
/home/c272/Repos/algo-lang/Algo/obj/Debug/algoBaseVisitor.cs

Algo/obj/Debug/Algo.csproj.CopyComplete

Whitespace-only changes.

Algo/obj/Debug/Algo.csproj.FileListAbsolute.txt

+27-25
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,30 @@ Z:/Algo/Algo/obj/Debug/Algo.csprojAssemblyReference.cache
4646
/home/c272/Repos/algo-lang/Algo/obj/Debug/Algo.csproj.CopyComplete
4747
/home/c272/Repos/algo-lang/Algo/obj/Debug/Algo.exe
4848
/home/c272/Repos/algo-lang/Algo/obj/Debug/Algo.pdb
49-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoLexer.cs
50-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoParser.cs
51-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoListener.cs
52-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoBaseListener.cs
53-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoVisitor.cs
54-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\algoBaseVisitor.cs
55-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.csproj.Antlr4GeneratedCodeFileListAbsolute.txt
56-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.exe
57-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.pdb
58-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Algo.exe.config
59-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Algo.exe
60-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Algo.pdb
61-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\AlgoSDK.dll
62-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Antlr4.Runtime.dll
63-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\MathNet.Numerics.dll
64-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Newtonsoft.Json.dll
65-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\System.Runtime.InteropServices.RuntimeInformation.dll
66-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\AlgoSDK.pdb
67-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Antlr4.Runtime.xml
68-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\MathNet.Numerics.xml
69-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\Newtonsoft.Json.xml
70-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.csprojAssemblyReference.cache
71-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.csproj.CoreCompileInputs.cache
72-
D:\Files\Programming\GitHub\algo\Algo\bin\Debug\ILRepack.dll
73-
D:\Files\Programming\GitHub\algo\Algo\obj\Debug\Algo.csproj.CopyComplete
49+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoLexer.cs
50+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoParser.cs
51+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoListener.cs
52+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoBaseListener.cs
53+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoVisitor.cs
54+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/algoBaseVisitor.cs
55+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.csproj.Antlr4GeneratedCodeFileListAbsolute.txt
56+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.exe
57+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.pdb
58+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Algo.exe.config
59+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Algo.exe
60+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Algo.pdb
61+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/AlgoSDK.dll
62+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Antlr4.Runtime.dll
63+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/MathNet.Numerics.dll
64+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Newtonsoft.Json.dll
65+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/System.Runtime.InteropServices.RuntimeInformation.dll
66+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/AlgoSDK.pdb
67+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Antlr4.Runtime.xml
68+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/MathNet.Numerics.xml
69+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/Newtonsoft.Json.xml
70+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.csprojAssemblyReference.cache
71+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.csproj.CoreCompileInputs.cache
72+
D:/Files/Programming/GitHub/algo/Algo/bin/Debug/ILRepack.dll
73+
D:/Files/Programming/GitHub/algo/Algo/obj/Debug/Algo.csproj.CopyComplete
74+
/home/c272/Repos/algo-lang/Algo/bin/Debug/ILRepack.dll
75+
/home/c272/Repos/algo-lang/Algo/obj/Debug/Algo.exe.config

Algo/obj/Debug/Algo.exe.config

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="mscorlib" publicKeyToken="b77a5c561934e089" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
11+
</dependentAssembly>
12+
</assemblyBinding>
13+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
14+
<dependentAssembly>
15+
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral" />
16+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
17+
</dependentAssembly>
18+
</assemblyBinding>
19+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
20+
<dependentAssembly>
21+
<assemblyIdentity name="System.Core" publicKeyToken="b77a5c561934e089" culture="neutral" />
22+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
23+
</dependentAssembly>
24+
</assemblyBinding>
25+
</runtime>
26+
</configuration>

Algo/obj/Debug/algo.tokens

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INTEGER=1
1+
INTEGER=1
22
FLOAT=2
33
BOOLEAN=3
44
STRING=4

Algo/obj/Debug/algoBaseListener.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Algo/obj/Debug/algoBaseVisitor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Algo/obj/Debug/algoLexer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Algo/obj/Debug/algoLexer.tokens

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INTEGER=1
1+
INTEGER=1
22
FLOAT=2
33
BOOLEAN=3
44
STRING=4

Algo/obj/Debug/algoListener.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Algo/obj/Debug/algoParser.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Algo/obj/Debug/algoVisitor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//------------------------------------------------------------------------------
1+
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
44
// ANTLR Version: 4.6.6
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from D:\Files\Programming\GitHub\algo\Algo\Parsing\algo.g4 by ANTLR 4.6.6
11+
// Generated from /home/c272/Repos/algo-lang/Algo/Parsing/algo.g4 by ANTLR 4.6.6
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

AlgoSDK/obj/Debug/AlgoSDK.csproj.CopyComplete

Whitespace-only changes.

AlgoSDK/obj/Debug/AlgoSDK.dll

0 Bytes
Binary file not shown.

BuildLinux.sh

+5
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ mkdir std
1717
mkdir packages
1818
cd ..
1919
cp Algo/Standard\ Library/Algo\ Scripts/* Builds/std
20+
21+
# Copy over the main executable and Antlr dependencies for compile purposes.
22+
cp Algo/bin/Debug/Algo.exe Builds/
23+
cp Algo/bin/Debug/Antlr4.Runtime.dll Builds/
24+
2025
echo BUILD COMPLETE!

0 commit comments

Comments
 (0)