Skip to content

Commit

Permalink
Fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kekekeks committed Dec 2, 2018
1 parent f8d3046 commit fce7a6d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 168 deletions.
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions appveyor.yml

This file was deleted.

6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet --info
printenv
nuke --target="CiAzureLinux" --configuration="Release"
nuke --target CiAzureLinux --configuration=Release
- task: PublishTestResults@2
inputs:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet --info
printenv
nuke --target="CiAzureOSX" --configuration="Release"
nuke --target CiAzureOSX --configuration Release
- task: PublishTestResults@2
inputs:
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
inputs:
script: |
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
nuke --target="CiAzureWindows" --configuration="Release"
nuke --target CiAzureWindows --configuration Release
- task: PublishTestResults@2
inputs:
Expand Down
89 changes: 25 additions & 64 deletions nukebuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,43 +48,48 @@ protected override void OnBuildInitialized()
Information("IsLocalBuild: " + Parameters.IsLocalBuild);
Information("IsRunningOnUnix: " + Parameters.IsRunningOnUnix);
Information("IsRunningOnWindows: " + Parameters.IsRunningOnWindows);
Information("IsRunningOnAppVeyor: " + Parameters.IsRunningOnAppVeyor);
Information("IsRunnongOnAzure:" + Parameters.IsRunningOnAzure);
Information("IsRunningOnAzure:" + Parameters.IsRunningOnAzure);
Information("IsPullRequest: " + Parameters.IsPullRequest);
Information("IsMainRepo: " + Parameters.IsMainRepo);
Information("IsMasterBranch: " + Parameters.IsMasterBranch);
Information("IsReleaseBranch: " + Parameters.IsReleaseBranch);
Information("IsTagged: " + Parameters.IsTagged);
Information("IsReleasable: " + Parameters.IsReleasable);
Information("IsMyGetRelease: " + Parameters.IsMyGetRelease);
Information("IsNuGetRelease: " + Parameters.IsNuGetRelease);
}

Target Clean => _ => _.Executes(() =>
{
var data = Parameters;
DeleteDirectories(data.BuildDirs);
EnsureCleanDirectories(data.BuildDirs);
EnsureCleanDirectory(data.ArtifactsDir);
EnsureCleanDirectory(data.NugetRoot);
EnsureCleanDirectory(data.ZipRoot);
EnsureCleanDirectory(data.TestResultsRoot);
DeleteDirectories(Parameters.BuildDirs);
EnsureCleanDirectories(Parameters.BuildDirs);
EnsureCleanDirectory(Parameters.ArtifactsDir);
EnsureCleanDirectory(Parameters.NugetRoot);
EnsureCleanDirectory(Parameters.ZipRoot);
EnsureCleanDirectory(Parameters.TestResultsRoot);
});


class MsBuildSettingsWithRestore : MSBuildSettings
{
protected override Arguments ConfigureArguments(Arguments arguments)
{
arguments.Add("/restore");
return base.ConfigureArguments(arguments);
}
}

Target Compile => _ => _
.DependsOn(Clean)
.Executes(() =>
{
var data = Parameters;
if (data.IsRunningOnWindows)
MSBuild(data.MSBuildSolution, c => c
.SetConfiguration(data.Configuration)

if (Parameters.IsRunningOnWindows)
MSBuild(Parameters.MSBuildSolution, c => new MsBuildSettingsWithRestore()
.SetConfiguration(Parameters.Configuration)
.SetVerbosity(MSBuildVerbosity.Minimal)
.AddProperty("PackageVersion", Parameters.Version)
.AddProperty("iOSRoslynPathHackRequired", "true")
.SetToolsVersion(MSBuildToolsVersion._15_0)
.AddTargets("Restore", "Build")
.AddTargets("Build")
);

else
Expand Down Expand Up @@ -126,7 +131,6 @@ void RunCoreTest(string project, bool coreOnly = false)
.DependsOn(Compile)
.Executes(() =>
{

RunCoreTest("./tests/Avalonia.Base.UnitTests", false);
RunCoreTest("./tests/Avalonia.Controls.UnitTests", false);
RunCoreTest("./tests/Avalonia.Input.UnitTests", false);
Expand All @@ -138,7 +142,6 @@ void RunCoreTest(string project, bool coreOnly = false)
RunCoreTest("./tests/Avalonia.Visuals.UnitTests", false);
RunCoreTest("./tests/Avalonia.Skia.UnitTests", false);
RunCoreTest("./tests/Avalonia.ReactiveUI.UnitTests", false);

});

Target RunRenderTests => _ => _
Expand All @@ -165,39 +168,6 @@ void RunCoreTest(string project, bool coreOnly = false)
.DependsOn(Compile)
.Executes(() =>
{

var dotMemoryUnitPath =
ToolPathResolver.GetPackageExecutable("JetBrains.dotMemoryUnit", "dotMemoryUnit.exe");
var xunitRunnerPath =
ToolPathResolver.GetPackageExecutable("xunit.runner.console", "xunit.console.x86.exe");
var args = new[]
{
Path.GetFullPath(xunitRunnerPath),
"--propagate-exit-code",
"--",
"tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll"
};
var cargs = string.Join(" ", args.Select(a => '"' + a + '"'));

var proc = Process.Start(new ProcessStartInfo(dotMemoryUnitPath, cargs)
{
UseShellExecute = false
});

if (!proc.WaitForExit(120000))
{
proc.Kill();
throw new Exception("Leak tests timed out");
}

var leakTestsExitCode = proc.ExitCode;

if (leakTestsExitCode != 0)
{
throw new Exception("Leak Tests failed");
}


var testAssembly = "tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll";
DotMemoryUnit(
$"{XunitPath.DoubleQuoteIfNeeded()} --propagate-exit-code -- {testAssembly}",
Expand All @@ -210,9 +180,7 @@ void RunCoreTest(string project, bool coreOnly = false)
{
var data = Parameters;
Zip(data.ZipCoreArtifacts, data.BinRoot);

Zip(data.ZipNuGetArtifacts, data.NugetRoot);

Zip(data.ZipTargetControlCatalogDesktopDir,
GlobFiles(data.ZipSourceControlCatalogDesktopDir, "*.dll").Concat(
GlobFiles(data.ZipSourceControlCatalogDesktopDir, "*.config")).Concat(
Expand All @@ -234,7 +202,7 @@ void RunCoreTest(string project, bool coreOnly = false)
.AddProperty("PackageVersion", Parameters.Version)
.AddProperty("iOSRoslynPathHackRequired", "true")
.SetToolsVersion(MSBuildToolsVersion._15_0)
.AddTargets("Restore", "Pack"));
.AddTargets("Pack"));
else
DotNetPack(Parameters.MSBuildSolution, c =>
c.SetConfiguration(Parameters.Configuration)
Expand All @@ -251,21 +219,14 @@ void RunCoreTest(string project, bool coreOnly = false)
.DependsOn(RunTests)
.DependsOn(CreateNugetPackages);

Target CiAppVeyor => _ => _
.DependsOn(Package)
.DependsOn(ZipFiles);

Target CiTravis => _ => _
.DependsOn(RunTests);

Target CiAsuzeLinux => _ => _
Target CiAzureLinux => _ => _
.DependsOn(RunTests);

Target CiAsuzeOSX => _ => _
Target CiAzureOSX => _ => _
.DependsOn(Package)
.DependsOn(ZipFiles);

Target CiAsuzeWindows => _ => _
Target CiAzureWindows => _ => _
.DependsOn(Package)
.DependsOn(ZipFiles);

Expand Down
60 changes: 7 additions & 53 deletions nukebuild/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ public class BuildParameters
public bool IsLocalBuild { get; }
public bool IsRunningOnUnix { get; }
public bool IsRunningOnWindows { get; }
public bool IsRunningOnAppVeyor { get; }
public bool IsRunningOnAzure { get; }
public bool IsPullRequest { get; }
public bool IsMainRepo { get; }
public bool IsMasterBranch { get; }
public bool IsReleaseBranch { get; }
public bool IsTagged { get; }
public bool IsReleasable { get; }
public bool IsMyGetRelease { get; }
public bool IsNuGetRelease { get; }
Expand All @@ -64,9 +62,6 @@ public class BuildParameters

public BuildParameters(Build b)
{
var buildSystem = Host;


// ARGUMENTS
Configuration = b.NukeArgConfiguration ?? "Release";
SkipTests = b.NukeArgSkipTests;
Expand All @@ -79,77 +74,36 @@ public BuildParameters(Build b)
MSBuildSolution = RootDirectory / "dirs.proj";

// PARAMETERS
IsLocalBuild = buildSystem == HostType.Console;
IsLocalBuild = Host == HostType.Console;
IsRunningOnUnix = Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX;
IsRunningOnWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
IsRunningOnAppVeyor = buildSystem == HostType.AppVeyor;
IsRunningOnAzure = buildSystem == HostType.TeamServices ||
IsRunningOnAzure = Host == HostType.TeamServices ||
Environment.GetEnvironmentVariable("LOGNAME") == "vsts";

string tagName = null;
if (IsRunningOnAppVeyor)
{
IsPullRequest = AppVeyor.Instance.PullRequestNumber != 0;
RepositoryName = Environment.GetEnvironmentVariable("BUILD_REPOSITORY_URI");
RepositoryBranch = Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH");

IsReleaseBranch =
(Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH") ?? "").StartsWith(ReleaseBranchPrefix,
StringComparison.OrdinalIgnoreCase);
IsTagged = AppVeyor.Instance.RepositoryTag
&& !string.IsNullOrWhiteSpace(AppVeyor.Instance.RepositoryTagName);

tagName = AppVeyor.Instance.RepositoryTagName;
}
else if (IsRunningOnAzure)
if (IsRunningOnAzure)
{
RepositoryName = TeamServices.Instance.RepositoryUri;
RepositoryBranch = TeamServices.Instance.SourceBranch;
IsPullRequest = TeamServices.Instance.PullRequestId.HasValue;
IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, TeamServices.Instance.RepositoryUri);

// TODO???
IsTagged = false;
tagName = null;
}
IsMainRepo =
StringComparer.OrdinalIgnoreCase.Equals(MainRepo,
RepositoryName);
IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch,
RepositoryBranch);
IsReleaseBranch = RepositoryBranch?.StartsWith(ReleaseBranchPrefix, StringComparison.OrdinalIgnoreCase) ==
true;


IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration);
IsMyGetRelease = !IsTagged && IsReleasable;
IsMyGetRelease = IsReleasable;
IsNuGetRelease = IsMainRepo && IsReleasable && IsReleaseBranch;

// VERSION
Version = b.NukeArgForceNugetVersion ?? GetVersion();

if (IsRunningOnAppVeyor)
{
string tagVersion = null;
if (IsTagged)
{
var tag = tagName;
var nugetReleasePrefix = "nuget-release-";
IsNuGetRelease = IsTagged && IsReleasable && tag.StartsWith(nugetReleasePrefix);
if (IsNuGetRelease)
tagVersion = tag.Substring(nugetReleasePrefix.Length);
}

if (tagVersion != null)
{
Version = tagVersion;
}
else
{
// Use AssemblyVersion with Build as version
Version += "-build" + Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-beta";
}
}
else if (IsRunningOnAzure)
if (IsRunningOnAzure)
{
if (!IsNuGetRelease)
{
Expand Down
1 change: 0 additions & 1 deletion nukebuild/Shims.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void AddFile(string path, string relativePath)

foreach (var path in paths)
{

if (Directory.Exists(path))
{
var dirInfo = new DirectoryInfo(path);
Expand Down

0 comments on commit fce7a6d

Please sign in to comment.