Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Ignore global.json files when emitting projects during publish to fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo committed Sep 16, 2015
1 parent 91d1193 commit a37ecf3
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 1 deletion.
6 changes: 6 additions & 0 deletions misc/GlobalJsonInProjectDir/Expected/approot/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": [
"src"
],
"packages": "packages"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": {
},

"frameworks" : {
"dnx451": { },
"dnxcore50": { }
}
}
2 changes: 2 additions & 0 deletions misc/GlobalJsonInProjectDir/Project/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
9 changes: 9 additions & 0 deletions misc/GlobalJsonInProjectDir/Project/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": {
},

"frameworks" : {
"dnx451": { },
"dnxcore50": { }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Dnx.Runtime/ProjectFilesCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.Dnx.Runtime
public class ProjectFilesCollection
{
public static readonly string[] DefaultCompileBuiltInPatterns = new[] { @"**/*.cs" };
public static readonly string[] DefaultPublishExcludePatterns = new[] { @"obj/**/*.*", @"bin/**/*.*", @"**/.*/**" };
public static readonly string[] DefaultPublishExcludePatterns = new[] { @"obj/**/*.*", @"bin/**/*.*", @"**/.*/**", @"**/global.json" };
public static readonly string[] DefaultPreprocessPatterns = new[] { @"compiler/preprocess/**/*.cs" };
public static readonly string[] DefaultSharedPatterns = new[] { @"compiler/shared/**/*.cs" };
public static readonly string[] DefaultResourcesBuiltInPatterns = new[] { @"compiler/resources/**/*", "**/*.resx" };
Expand Down
34 changes: 34 additions & 0 deletions test/Microsoft.Dnx.Tooling.FunctionalTests/DnuPublishTests2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.IO;
using Microsoft.Dnx.Testing;
using Xunit;

namespace Microsoft.Dnx.Tooling.FunctionalTests
{
[Collection(nameof(ToolingFunctionalTestCollection))]
public class DnuPublishTests2 : DnxSdkFunctionalTestBase
{
[Theory]
[MemberData(nameof(DnxSdks))]
public void GlobalJsonInProjectDir(DnxSdk sdk)
{
const string solutionName = "GlobalJsonInProjectDir";

var solution = TestUtils.GetSolution<DnuPublishTests>(sdk, solutionName);
var projectPath = Path.Combine(solution.RootPath, "Project");
var outputPath = Path.Combine(solution.RootPath, "Output");
var expectedOutputPath = Path.Combine(solution.RootPath, "Expected");

var result = sdk.Dnu.Publish(
projectPath,
outputPath);
result.EnsureSuccess();

var actualOutputStructure = new Dir(outputPath);
var expectedOutputStructure = new Dir(expectedOutputPath);
DirAssert.Equal(expectedOutputStructure, actualOutputStructure);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Xunit;

namespace Microsoft.Dnx.Tooling.FunctionalTests
{

[CollectionDefinition(nameof(ToolingFunctionalTestCollection))]
public class ToolingFunctionalTestCollection : ICollectionFixture<ToolingFunctionalTestFixture>
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.Dnx.Testing;

namespace Microsoft.Dnx.Tooling.FunctionalTests
{
public class ToolingFunctionalTestFixture : IDisposable
{
public ToolingFunctionalTestFixture()
{
Console.WriteLine($@"
Environment information:
DNX_HOME: {Environment.GetEnvironmentVariable("DNX_HOME")}
DNX_SDK_VERSION_FOR_TESTING: {Environment.GetEnvironmentVariable("DNX_SDK_VERSION_FOR_TESTING")}
Information of DNX under testing:
DNX Home: {DnxSdk.GetRuntimeHome()}
DNX Version: {DnxSdkFunctionalTestBase.SdkVersionForTesting}
");
}

public void Dispose()
{

}
}
}
1 change: 1 addition & 0 deletions test/Microsoft.Dnx.Tooling.FunctionalTests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Microsoft.AspNet.Testing": "1.0.0-*",
"Microsoft.Dnx.CommonTestUtils": "1.0.0-*",
"Microsoft.Dnx.Runtime.Sources": "1.0.0-*",
"Microsoft.Dnx.Testing.CommonUtils": "1.0.0-*",
"Microsoft.Dnx.Tooling": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
Expand Down

0 comments on commit a37ecf3

Please sign in to comment.