diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..deb6486 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: csharp +mono: none +dotnet: 2.0.0 +before_script: + - npm install electron-packager --global +script: + - ./buildAll.sh \ No newline at end of file diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 9e3913f..3637e26 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -34,11 +34,6 @@ namespace ElectronNET.CLI.Commands } - string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop"); - - Console.WriteLine("Executing dotnet publish in this directory: " + tempPath); - - string tempBinPath = Path.Combine(tempPath, "bin"); string netCorePublishRid = string.Empty; string electronPackerPlatform = string.Empty; @@ -60,16 +55,19 @@ namespace ElectronNET.CLI.Commands default: if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { + desiredPlatform = "win"; netCorePublishRid = "win10-x64"; electronPackerPlatform = "win32"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { + desiredPlatform = "osx"; netCorePublishRid = "osx-x64"; electronPackerPlatform = "darwin"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { + desiredPlatform = "linux"; netCorePublishRid = "ubuntu-x64"; electronPackerPlatform = "linux"; } @@ -77,6 +75,13 @@ namespace ElectronNET.CLI.Commands break; } + + string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform); + + Console.WriteLine("Executing dotnet publish in this directory: " + tempPath); + + string tempBinPath = Path.Combine(tempPath, "bin"); + Console.WriteLine($"Build ASP.NET Core App for {netCorePublishRid}..."); ProcessHelper.CmdExecute($"dotnet publish -r {netCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory()); @@ -116,7 +121,7 @@ namespace ElectronNET.CLI.Commands if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - // Works proper on Windows... + // Works proper on Windows... ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath); } else @@ -128,6 +133,7 @@ namespace ElectronNET.CLI.Commands Console.WriteLine("Build Electron Desktop Application..."); string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop"); + Console.WriteLine("Executing electron magic in this directory: " + buildPath); // ToDo: Need a solution for --asar support diff --git a/buildAll.sh b/buildAll.sh index 68e41e1..38c6694 100755 --- a/buildAll.sh +++ b/buildAll.sh @@ -1,17 +1,26 @@ +dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) echo "Start building Electron.NET dev stack..." echo "Restore & Build API" -cd ElectronNet.API +cd $dir/ElectronNET.API dotnet restore dotnet build cd .. echo "Restore & Build API" -cd ElectronNet.CLI +cd $dir/ElectronNET.CLI dotnet restore dotnet build cd .. echo "Restore & Build WebApp Demo" -cd ElectronNet.WebApp +cd $dir/ElectronNET.WebApp dotnet restore dotnet build + echo "Invoke electronize build in WebApp Demo" -dotnet electronize build \ No newline at end of file +echo "-- win" +dotnet electronize build win + +echo "-- linux" +dotnet electronize build linux + +echo "-- osx" +dotnet electronize build osx