forked from icsharpcode/AvaloniaILSpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build scripts and fix errors on win/osx
- Loading branch information
Showing
11 changed files
with
549 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Reflection; | ||
using Avalonia; | ||
using Avalonia.Logging.Serilog; | ||
|
||
namespace AvaloniaILSpy | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
.LogToDebug() | ||
.Start<MainWindow>(); | ||
} | ||
} | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); | ||
|
||
AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
#if DEBUG | ||
.LogToDebug() | ||
#endif | ||
.Start<MainWindow>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
os: Visual Studio 2017 | ||
install: | ||
|
||
before_build: | ||
- cmd: git submodule update --init --recursive | ||
|
||
build_script: | ||
- cmd: dotnet --info | ||
- ps: .\build.ps1 -Platform "AnyCPU" -Configuration "Release" | ||
|
||
test: off | ||
|
||
artifacts: | ||
- path: artifacts/zips/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
var target = Argument("target", "Default"); | ||
var platform = Argument("platform", "AnyCPU"); | ||
var configuration = Argument("configuration", "Release"); | ||
|
||
var editbin = @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\editbin.exe"; | ||
|
||
var artifactsDir = (DirectoryPath)Directory("./artifacts"); | ||
var zipRootDir = artifactsDir.Combine("zips"); | ||
|
||
var fileZipSuffix = ".zip"; | ||
|
||
var netCoreAppsRoot= "."; | ||
var netCoreApp = "AvaloniaILSpy"; | ||
|
||
var buildDirs = | ||
GetDirectories($"{netCoreAppsRoot}/**/bin/**") + | ||
GetDirectories($"{netCoreAppsRoot}/**/obj/**") + | ||
GetDirectories($"{netCoreAppsRoot}/artifacts/**/zip/**"); | ||
|
||
var netCoreProject = new { | ||
Path = $"{netCoreAppsRoot}/{netCoreApp}", | ||
Name = netCoreApp, | ||
Framework = XmlPeek($"{netCoreAppsRoot}/{netCoreApp}/{netCoreApp}.csproj", "//*[local-name()='TargetFramework']/text()"), | ||
Runtimes = XmlPeek($"{netCoreAppsRoot}/{netCoreApp}/{netCoreApp}.csproj", "//*[local-name()='RuntimeIdentifiers']/text()").Split(';') | ||
}; | ||
|
||
|
||
Task("Clean") | ||
.Does(()=>{ | ||
CleanDirectories(buildDirs); | ||
}); | ||
|
||
Task("Restore-NetCore") | ||
.IsDependentOn("Clean") | ||
.Does(() => | ||
{ | ||
DotNetCoreRestore(netCoreProject.Path); | ||
}); | ||
|
||
Task("Build-NetCore") | ||
.IsDependentOn("Restore-NetCore") | ||
.Does(() => | ||
{ | ||
Information("Building: {0}", netCoreProject.Name); | ||
DotNetCoreBuild(netCoreProject.Path, new DotNetCoreBuildSettings { | ||
Configuration = configuration | ||
}); | ||
}); | ||
|
||
Task("Publish-NetCore") | ||
.IsDependentOn("Restore-NetCore") | ||
.Does(() => | ||
{ | ||
foreach(var runtime in netCoreProject.Runtimes) | ||
{ | ||
var outputDir = artifactsDir.Combine(runtime); | ||
|
||
Information("Publishing: {0}, runtime: {1}", netCoreProject.Name, runtime); | ||
DotNetCorePublish(netCoreProject.Path, new DotNetCorePublishSettings { | ||
Framework = netCoreProject.Framework, | ||
Configuration = configuration, | ||
Runtime = runtime, | ||
OutputDirectory = outputDir.FullPath | ||
}); | ||
|
||
if (IsRunningOnWindows() && (runtime == "win7-x86" || runtime == "win7-x64")) | ||
{ | ||
Information("Patching executable subsystem for: {0}, runtime: {1}", netCoreProject.Name, runtime); | ||
var targetExe = outputDir.CombineWithFilePath(netCoreProject.Name + ".exe"); | ||
var exitCodeWithArgument = StartProcess(editbin, new ProcessSettings { | ||
Arguments = "/subsystem:windows " + targetExe.FullPath | ||
}); | ||
Information("The editbin command exit code: {0}", exitCodeWithArgument); | ||
} | ||
} | ||
}); | ||
|
||
Task("Zip-NetCore") | ||
.IsDependentOn("Publish-NetCore") | ||
.Does(() => | ||
{ | ||
EnsureDirectoryExists(zipRootDir); | ||
foreach(var runtime in netCoreProject.Runtimes) | ||
{ | ||
var workingDir = artifactsDir.Combine(runtime); | ||
Information("Zipping {0} artifacts to {1}", runtime, zipRootDir); | ||
Zip(workingDir.FullPath, zipRootDir.CombineWithFilePath(netCoreProject.Name + "-" + runtime + "-" + configuration + fileZipSuffix), | ||
GetFiles(workingDir.FullPath + "/*.*")); | ||
} | ||
}); | ||
|
||
Task("Default") | ||
.IsDependentOn("Restore-NetCore") | ||
.IsDependentOn("Publish-NetCore") | ||
.IsDependentOn("Zip-NetCore"); | ||
|
||
RunTarget(target); |
Oops, something went wrong.