This repository has been archived by the owner on Dec 18, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
#1513: Print source of assemblies dependencies in dnu list --assembly #1611
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
83f0164
Print source of assemblies dependencies
troydai 9cbb225
Compare assembly name using string.Equals
troydai 23a7dd9
Unless --details is specified, hide dependency sources
troydai 4e09f4f
Add functional test for dnu list
troydai f288c8c
Remove DnuListTestEnvironment
troydai ab59ed2
Revert changes in TestUtils.cs
troydai f7a1e3d
Futher clean up the test codes
troydai 55a3379
User ordinal string comparer in AssemblyWalker
troydai 5c6202a
Make test Cross-platform
troydai 87676c1
Update DnuListTests and AssemblyWalker to use new C# feature
troydai 5b4d445
React to TestUtil change
troydai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
81 changes: 81 additions & 0 deletions
81
test/Microsoft.Framework.PackageManager.FunctionalTests/DnuListTestContext.cs
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,81 @@ | ||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using Microsoft.Framework.CommonTestUtils; | ||
|
||
namespace Microsoft.Framework.PackageManager.FunctionalTests | ||
{ | ||
public class DnuListTestContext : IDisposable | ||
{ | ||
private readonly IDictionary<Tuple<string, string, string>, DisposableDir> _runtimeHomeDirs = | ||
new Dictionary<Tuple<string, string, string>, DisposableDir>(); | ||
|
||
private readonly DisposableDir _contextDir; | ||
|
||
public DnuListTestContext() | ||
{ | ||
_contextDir = TestUtils.CreateTempDir(); | ||
PackageSource = Path.Combine(_contextDir.DirPath, "packages"); | ||
Directory.CreateDirectory(PackageSource); | ||
|
||
CreateNewPackage("alpha", "0.1.0"); | ||
} | ||
|
||
public string GetRuntimeHome(string flavor, string os, string architecture) | ||
{ | ||
DisposableDir result; | ||
if (!_runtimeHomeDirs.TryGetValue(Tuple.Create(flavor, os, architecture), out result)) | ||
{ | ||
result = TestUtils.GetRuntimeHomeDir(flavor, os, architecture); | ||
_runtimeHomeDirs.Add(Tuple.Create(flavor, os, architecture), result); | ||
} | ||
|
||
return result.DirPath; | ||
} | ||
|
||
public string PackageSource { get; } | ||
|
||
private void CreateNewPackage(string name, string version) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it should be separate from this class, a static method somewhere so that other tests can use it. Right now this class is specific to DnuList. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Next time. |
||
{ | ||
var runtimeForPacking = TestUtils.GetClrRuntimeComponents().FirstOrDefault(); | ||
if (runtimeForPacking == null) | ||
{ | ||
throw new InvalidOperationException("Can't find a CLR runtime to pack test packages."); | ||
} | ||
|
||
var runtimeHomePath = GetRuntimeHome((string)runtimeForPacking[0], | ||
(string)runtimeForPacking[1], | ||
(string)runtimeForPacking[2]); | ||
|
||
using (var tempdir = TestUtils.CreateTempDir()) | ||
{ | ||
var dir = new DirectoryInfo(tempdir); | ||
var projectDir = dir.CreateSubdirectory(name); | ||
var outputDir = dir.CreateSubdirectory("output"); | ||
var projectJson = Path.Combine(projectDir.FullName, "project.json"); | ||
|
||
File.WriteAllText(projectJson, "{\"version\": \"" + version + "\"}"); | ||
DnuTestUtils.ExecDnu(runtimeHomePath, "pack", projectJson + " --out " + outputDir.FullName, environment: null, workingDir: null); | ||
|
||
var packageName = string.Format("{0}.{1}.nupkg", name, version); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 will do |
||
var packageFile = Path.Combine(outputDir.FullName, "Debug", packageName); | ||
|
||
File.Copy(packageFile, Path.Combine(PackageSource, packageName), overwrite: true); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
foreach (var each in _runtimeHomeDirs.Values) | ||
{ | ||
each.Dispose(); | ||
} | ||
|
||
_contextDir.Dispose(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringComparer.Ordinal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will skip this one. The order is for presentation only.