Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix design-time build for Antlr-generated files #1002

Merged
merged 3 commits into from
Oct 31, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
@@ -378,9 +378,27 @@ Task("PrepareTestAssets")
.ExceptionOnError($"Failed to build '{folder}'.");
}

var platform = Platform.Current;

// Restore and build Windows-only test assets
if (platform.IsWindows)
{
foreach (var project in buildPlan.WindowsOnlyTestAssets)
{
Information("Restoring and building: {0} (windows-only)...", project);

var folder = CombinePaths(env.Folders.TestAssets, "test-projects", project);

RunTool(env.DotNetCommand, "restore", folder)
.ExceptionOnError($"Failed to restore '{folder}'.");

RunTool(env.DotNetCommand, "build", folder)
.ExceptionOnError($"Failed to build '{folder}'.");
}
}

if (AllowLegacyTests())
{
var platform = Platform.Current;
if (platform.IsMacOS && platform.Version.Major == 10 && platform.Version.Minor == 12)
{
// Trick to allow older .NET Core SDK to run on Sierra.
6 changes: 4 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
@@ -35,8 +35,7 @@
"ProjectAndSolution",
"ProjectAndSolutionWithProjectSection",
"TwoProjectsWithSolution",
"ProjectWithGeneratedFile",
"AntlrGeneratedFiles"
"ProjectWithGeneratedFile"
],
"LegacyTestAssets": [
"LegacyNUnitTestProject",
@@ -46,5 +45,8 @@
],
"CakeTestAssets": [
"CakeProject"
],
"WindowsOnlyTestAssets": [
"AntlrGeneratedFiles"
]
}
1 change: 1 addition & 0 deletions scripts/common.cake
Original file line number Diff line number Diff line change
@@ -272,6 +272,7 @@ public class BuildPlan
public string[] TestAssets { get; set; }
public string[] LegacyTestAssets { get; set; }
public string[] CakeTestAssets { get; set; }
public string[] WindowsOnlyTestAssets { get; set; }

public static BuildPlan Load(BuildEnvironment env)
{
2 changes: 1 addition & 1 deletion tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ public async Task ProjectWithSdkProperty()
}
}

[Fact]
[ConditionalFact(typeof(WindowsOnly))]
public async Task AntlrGeneratedFiles()
{
using (var testProject = await TestAssets.Instance.GetTestProjectAsync("AntlrGeneratedFiles"))
6 changes: 6 additions & 0 deletions tests/TestUtility/ConditionalFactAttribute.cs
Original file line number Diff line number Diff line change
@@ -48,6 +48,12 @@ public class NotOnAppVeyor : SkipCondition
public override string SkipReason => "Can't run on AppVeyor";
}

public class WindowsOnly : SkipCondition
{
public override bool ShouldSkip => !PlatformHelper.IsWindows;
public override string SkipReason => "Can only be run on Windows";
}

public class IsLegacyTest : SkipCondition
{
public override bool ShouldSkip