From 93d7525ac43460939cdfb0fae72442dc77d20852 Mon Sep 17 00:00:00 2001 From: de4dot Date: Wed, 25 Sep 2019 20:20:56 +0200 Subject: [PATCH] Update build files --- .github/workflows/build.yml | 58 ++++++++++++++++++++++++++++++++----- appveyor.yml | 16 +--------- build.cmd | 17 +++++++++++ clean-all.cmd | 15 ++++++++++ 4 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 clean-all.cmd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 465a64318..c806bca1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ name: GitHub CI -on: [push, pull_request] +on: push jobs: build: @@ -9,7 +9,6 @@ jobs: - uses: actions/checkout@v1 with: submodules: true - fetch-depth: 1 - name: Install .NET Core shell: pwsh @@ -17,6 +16,7 @@ jobs: Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1" & $env:temp\dotnet-install.ps1 -Version 3.0.100 -InstallDir "$env:ProgramFiles\dotnet" -Architecture x64 + # build.cmd needs to use msbuild since dotnet build doesn't support COMReference: https://github.com/0xd4d/dnSpy/issues/1053 - name: Install VS build tools shell: pwsh run: | @@ -26,22 +26,64 @@ jobs: & "$env:TEMP\vs_BuildTools.exe" --quiet --wait --norestart --installPath "C:\vsbuildtools" --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools Wait-Process vs_BuildTools - - name: Build + # Build each tfm separately since building all requires too much diskspace + - name: Build .NET Framework x86 + x64 files + shell: pwsh run: | - set path=C:\vsbuildtools\MSBuild\Current\Bin\amd64;%path% - build.cmd + $env:Path = "C:\vsbuildtools\MSBuild\Current\Bin\amd64;%PATH%;" + $env:Path + .\build.cmd net + New-Item -ItemType directory -Path "C:\builtfiles" -Force + Compress-Archive -Path "dnSpy\dnSpy\bin\Release\net472" -DestinationPath C:\builtfiles\dnSpy-net472.zip + .\clean-all.cmd + + - name: Build .NET Core x86 files + shell: pwsh + run: | + $env:Path = "C:\vsbuildtools\MSBuild\Current\Bin\amd64;%PATH%;" + $env:Path + .\build.cmd corex86 + New-Item -ItemType directory -Path "C:\builtfiles" -Force + Compress-Archive -Path "dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish" -DestinationPath C:\builtfiles\dnSpy-netcore-win32.zip + .\clean-all.cmd + + - name: Build .NET Core x64 files + shell: pwsh + run: | + $env:Path = "C:\vsbuildtools\MSBuild\Current\Bin\amd64;%PATH%;" + $env:Path + .\build.cmd corex64 + New-Item -ItemType directory -Path "C:\builtfiles" -Force + Compress-Archive -Path "dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish" -DestinationPath C:\builtfiles\dnSpy-netcore-win64.zip + .\clean-all.cmd - uses: actions/upload-artifact@v1 with: name: dnSpy-net472 - path: dnSpy/dnSpy/bin/Release/net472 + path: C:\builtfiles\dnSpy-net472.zip - uses: actions/upload-artifact@v1 with: name: dnSpy-netcore-win32 - path: dnSpy/dnSpy/bin/Release/netcoreapp3.0/win-x86/publish + path: C:\builtfiles\dnSpy-netcore-win32.zip - uses: actions/upload-artifact@v1 with: name: dnSpy-netcore-win64 - path: dnSpy/dnSpy/bin/Release/netcoreapp3.0/win-x64/publish + path: C:\builtfiles\dnSpy-netcore-win64.zip + + # Create a new release: create a tag, then git push origin , wait for it to build + - name: Release + uses: softprops/action-gh-release@b28d815 #@v1 + with: + files: | + C:\builtfiles\dnSpy-net472.zip + C:\builtfiles\dnSpy-netcore-win32.zip + C:\builtfiles\dnSpy-netcore-win64.zip + body: | + `dnSpy-net472.zip` requires .NET Framework 4.7.2 or later. + + `dnSpy-netcore-win32.zip` and `dnSpy-netcore-win64.zip` don't depend on .NET Framework, but use .NET Core instead which is included in the zip files. If `dnSpy.exe` fails to start, try: + + - Install VC dependencies: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads + - Windows 7: Must have KB2999226 and KB2533623 installed + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/appveyor.yml b/appveyor.yml index 5dd9e441a..2387d2ecf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ install: start /wait vs_BuildTools.exe --quiet --wait --norestart --installPath "C:\vsbuildtools" --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools build_script: - cmd: | - set path=C:\vsbuildtools\MSBuild\Current\Bin\amd64;%path% + set PATH=C:\vsbuildtools\MSBuild\Current\Bin\amd64;%PATH% build.cmd test: off artifacts: @@ -21,17 +21,3 @@ artifacts: name: dnSpy-netcore-win32 - path: dnSpy/dnSpy/bin/Release/netcoreapp3.0/win-x64/publish name: dnSpy-netcore-win64 -deploy: -- provider: GitHub - description: New release - on: - APPVEYOR_REPO_TAG: true - auth_token: - secure: A8Xfg1Sr7/XmTlvOyNEBQVwMARF+uyigNNJXQYq4pQFaR3Z3x0iaXGZMLlvA0oTO -notifications: -- provider: Email - to: - - de4dot@gmail.com - on_build_success: false - on_build_failure: true - on_build_status_changed: false diff --git a/build.cmd b/build.cmd index 1e019f86a..2a582a159 100644 --- a/build.cmd +++ b/build.cmd @@ -14,6 +14,11 @@ REM ...add commands to patch apphost and move files to bin sub dir, see below... REM dotnet publish -c Release -f netcoreapp3.0 -r win-x64 --self-contained REM ...add commands to patch apphost and move files to bin sub dir, see below... +msbuild -v:m -restore -t:Build -p:Configuration=Release -p:TargetFramework=net472 Build\AppHostPatcher\AppHostPatcher.csproj + +if "%1"=="" set build_this=y +if "%1"=="net" set build_this=y +if not "%build_this%"=="y" goto :skip_netframework echo Building .NET Framework x86 and x64 binaries msbuild -v:m -restore -t:Build -p:Configuration=Release -p:TargetFramework=net472 || goto :error REM move all files to a bin sub dir but keep the exe files @@ -29,7 +34,12 @@ move dnSpy\dnSpy\bin\Release\net472\bin\dnSpy.pdb dnSpy\dnSpy\bin\Release\net472 move dnSpy\dnSpy\bin\Release\net472\bin\dnSpy.Console.exe dnSpy\dnSpy\bin\Release\net472 || goto :error move dnSpy\dnSpy\bin\Release\net472\bin\dnSpy.Console.exe.config dnSpy\dnSpy\bin\Release\net472 || goto :error move dnSpy\dnSpy\bin\Release\net472\bin\dnSpy.Console.pdb dnSpy\dnSpy\bin\Release\net472 || goto :error +:skip_netframework +set build_this= +if "%1"=="" set build_this=y +if "%1"=="corex86" set build_this=y +if not "%build_this%"=="y" goto :skip_corex86 echo Building .NET Core x86 binaries msbuild -v:m -restore -t:Publish -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x86 -p:SelfContained=True || goto :error REM move all files to a bin sub dir but keep the exe apphosts @@ -41,7 +51,12 @@ move dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish\bin\dnSpy.exe dnSpy\d move dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish\bin\dnSpy.Console.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish || goto :error Build\AppHostPatcher\bin\Release\net472\AppHostPatcher.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish\dnSpy.exe -d bin || goto :error Build\AppHostPatcher\bin\Release\net472\AppHostPatcher.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x86\publish\dnSpy.Console.exe -d bin || goto :error +:skip_corex86 +set build_this= +if "%1"=="" set build_this=y +if "%1"=="corex64" set build_this=y +if not "%build_this%"=="y" goto :corex64 echo Building .NET Core x64 binaries msbuild -v:m -restore -t:Publish -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x64 -p:SelfContained=True || goto :error REM move all files to a bin sub dir but keep the exe apphosts @@ -53,6 +68,8 @@ move dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish\bin\dnSpy.exe dnSpy\d move dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish\bin\dnSpy.Console.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish || goto :error Build\AppHostPatcher\bin\Release\net472\AppHostPatcher.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish\dnSpy.exe -d bin || goto :error Build\AppHostPatcher\bin\Release\net472\AppHostPatcher.exe dnSpy\dnSpy\bin\Release\netcoreapp3.0\win-x64\publish\dnSpy.Console.exe -d bin || goto :error +:corex64 +set build_this= goto :EOF diff --git a/clean-all.cmd b/clean-all.cmd new file mode 100644 index 000000000..6c4cb6d00 --- /dev/null +++ b/clean-all.cmd @@ -0,0 +1,15 @@ +@echo off + +pushd Extensions\ILSpy.Decompiler\NRefactory && git clean -xdf && popd || goto :error +pushd Libraries\ICSharpCode.TreeView && git clean -xdf && popd || goto :error +pushd Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler && git clean -xdf && popd || goto :error +pushd dnSpy\dnSpy.Images && git clean -xdf && popd || goto :error +pushd Extensions\dnSpy.Debugger\netcorefiles && git clean -xdf && popd || goto :error +pushd dnSpy\Roslyn\Roslyn.ExpressionCompiler && git clean -xdf && popd || goto :error +pushd Extensions\dnSpy.Debugger\Mono.Debugger.Soft && git clean -xdf && popd || goto :error +git clean -xdf || goto :error + +goto :EOF + +:error +exit /b %errorlevel%