diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 2767eca..daa29e2 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -78,8 +78,14 @@ "enum": [ "Clean", "Compile", + "CompileSample", "CreatePackages", "Default", + "ElectronizeCustomWin7TargetSample", + "ElectronizeGenericTargetSample", + "ElectronizeLinuxTargetSample", + "ElectronizeMacOsTargetSample", + "ElectronizeWindowsTargetSample", "Package", "PrePublish", "Publish", @@ -103,8 +109,14 @@ "enum": [ "Clean", "Compile", + "CompileSample", "CreatePackages", "Default", + "ElectronizeCustomWin7TargetSample", + "ElectronizeGenericTargetSample", + "ElectronizeLinuxTargetSample", + "ElectronizeMacOsTargetSample", + "ElectronizeWindowsTargetSample", "Package", "PrePublish", "Publish", diff --git a/README.md b/README.md index 7870f25..b2b1620 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/raw/main/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET) -[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://ci.appveyor.com/api/projects/status/q95h4xt14papwi05/branch/main?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/main) +[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml) Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC). @@ -30,11 +30,13 @@ Also you should have installed: Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`. +If you want to sponsor the further maintenance and development of this project [see the donate section](#🙏-donate). + ## 👩‍🏫 Usage To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app. -``` +```ps1 PM> Install-Package ElectronNET.API ``` @@ -198,7 +200,7 @@ Please make sure all commits are properly documented. This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws) -This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux). +This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux). If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories. diff --git a/buildAll.cmd b/buildAll.cmd deleted file mode 100755 index 31f75f7..0000000 --- a/buildAll.cmd +++ /dev/null @@ -1,45 +0,0 @@ -echo "Start building Electron.NET dev stack..." - -echo "Restore & Build API" -cd ElectronNet.API -dotnet restore -dotnet build -cd .. -echo "Restore & Build CLI" -cd ElectronNet.CLI -dotnet restore -dotnet build -cd .. -echo "Restore & Build WebApp Demo" -cd ElectronNet.WebApp -dotnet restore -dotnet build - -echo "Invoke electronize build in WebApp Demo" - -echo "Install CLI" - -dotnet tool uninstall ElectronNET.CLI -g -dotnet tool install ElectronNET.CLI -g - -echo "/target xxx (dev-build)" -electronize build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params "--publish never" - -echo "/target win (dev-build)" -electronize build /target win /electron-params "--publish never" - -echo "/target custom win7-x86;win (dev-build)" - -electronize build /target custom win7-x86;win /electron-params "--publish never" - -:: Be aware, that for non-electronnet-dev environments the correct -:: invoke command would be dotnet electronize ... - -:: Not supported on Windows Systems, because of SymLinks... -:: echo "/target osx" -:: dotnet electronize build /target osx - -:: Linux and Mac is not supported on with this buildAll.cmd test file, because the electron bundler does some strange stuff -:: Help welcome! -:: echo "/target linux (dev-build)" -:: electronize build /target linux /electron-params "--publish never" diff --git a/nuke/Build.cs b/nuke/Build.cs index 0258f41..b01c00f 100644 --- a/nuke/Build.cs +++ b/nuke/Build.cs @@ -52,7 +52,6 @@ class Build : NukeBuild GitHubActions GitHubActions => GitHubActions.Instance; - // Note: The ChangeLogTasks from Nuke itself look buggy. So using the Cake source code. IReadOnlyList ChangeLog { get; set; } ReleaseNotes LatestReleaseNotes { get; set; } @@ -167,6 +166,69 @@ class Build : NukeBuild }); }); + Target CompileSample => _ => _ + .DependsOn(Compile) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName / $"{DemoTargetLibName}.csproj"; + DotNetBuild(s => s.SetProjectFile(sample).SetConfiguration(Configuration)); + }); + + Target ElectronizeGenericTargetSample => _ => _ + .DependsOn(CompileSample) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName; + var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj"; + var args = "build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--publish never\""; + + DotNet($"run --project {cli} -- {args}", sample); + }); + + Target ElectronizeWindowsTargetSample => _ => _ + .DependsOn(CompileSample) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName; + var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj"; + var args = "build /target win /electron-params \"--publish never\""; + + DotNet($"run --project {cli} -- {args}", sample); + }); + + Target ElectronizeCustomWin7TargetSample => _ => _ + .DependsOn(CompileSample) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName; + var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj"; + var args = "build /target custom win7-x86;win /electron-params \"--publish never\""; + + DotNet($"run --project {cli} -- {args}", sample); + }); + + Target ElectronizeMacOsTargetSample => _ => _ + .DependsOn(CompileSample) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName; + var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj"; + var args = "build /target osx /electron-params \"--publish never\""; + + DotNet($"run --project {cli} -- {args}", sample); + }); + + Target ElectronizeLinuxTargetSample => _ => _ + .DependsOn(CompileSample) + .Executes(() => + { + var sample = SourceDirectory / DemoTargetLibName; + var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj"; + var args = "build /target linux /electron-params \"--publish never\""; + + DotNet($"run --project {cli} -- {args}", sample); + }); + Target PublishPackages => _ => _ .DependsOn(CreatePackages) .DependsOn(RunUnitTests) diff --git a/start.cmd b/start.cmd deleted file mode 100644 index a898fde..0000000 --- a/start.cmd +++ /dev/null @@ -1,9 +0,0 @@ -echo Bundle ASP.NET Core Project into EXE - -cd ElectronNET.WebApp -dotnet restore -dotnet publish -r win-x64 --output ../ElectronNET.Host/bin/ - -echo Start Electron with bundled EXE -cd ..\ElectronNET.Host -..\ElectronNET.Host\node_modules\.bin\electron.cmd "..\ElectronNET.Host\main.js" \ No newline at end of file