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

#1513: Print source of assemblies dependencies in dnu list --assembly #1611

Merged
merged 11 commits into from
Apr 16, 2015

Conversation

troydai
Copy link
Contributor

@troydai troydai commented Apr 7, 2015

Issue: #1513

Sample:

Command: 

dnu list --assebmly

C:\Users\trdai\.dnx\packages\System.AppContext\4.0.0-beta-22806\lib\aspnetcore50\System.AppContext.dll
    from package: System.AppContext
C:\Users\trdai\.dnx\packages\System.Collections.Concurrent\4.0.10-beta-22806\lib\aspnetcore50\System.Collections.Concurrent.dll
    from package: System.Collections.Concurrent
C:\Users\trdai\.dnx\packages\System.Collections\4.0.10-beta-22806\lib\aspnetcore50\System.Collections.dll
    from package: System.Collections
    from assembly: System.Linq, System.Collections.Concurrent, System.IO.FileSystem
C:\Users\trdai\.dnx\packages\System.ComponentModel\4.0.0-beta-22806\lib\aspnetcore50\System.ComponentModel.dll
    from package: System.ComponentModel
C:\Users\trdai\.dnx\packages\System.Console\4.0.0-beta-22806\lib\aspnetcore50\System.Console.dll
    from package: System.Console
C:\Users\trdai\.dnx\packages\System.Diagnostics.Debug\4.0.10-beta-22806\lib\aspnetcore50\System.Diagnostics.Debug.dll
    from package: System.Diagnostics.Debug
    from assembly: System.Linq, System.Collections.Concurrent
C:\Users\trdai\.dnx\packages\System.IO.FileSystem.Primitives\4.0.0-beta-22806\lib\aspnetcore50\System.IO.FileSystem.Primitives.dll
    from package: System.IO.FileSystem.Primitives
    from assembly: System.Console, System.IO.FileSystem
C:\Users\trdai\.dnx\packages\System.IO.FileSystem\4.0.0-beta-22806\lib\aspnetcore50\System.IO.FileSystem.dll
    from package: System.IO.FileSystem
C:\Users\trdai\.dnx\packages\System.IO\4.0.10-beta-22806\lib\aspnetcore50\System.IO.dll
    from package: System.IO
    from assembly: System.Console, System.IO.FileSystem
C:\Users\trdai\.dnx\packages\System.Linq\4.0.0-beta-22806\lib\aspnetcore50\System.Linq.dll

To get a clean list, using

dnu list --assembly --hide-dependents

@ghost ghost added the cla-not-required label Apr 7, 2015
@troydai
Copy link
Contributor Author

troydai commented Apr 7, 2015

{
// determine if keep walking down the path
if (ancestors.Any(a => a == assembly))
if (ancestors.Any(a => a == assemblyName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string.Equals

@troydai
Copy link
Contributor Author

troydai commented Apr 8, 2015

Ping ⌚

root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries, assemblies));
root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries));


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much /r/n!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will clean up.

@davidfowl
Copy link
Member

I think you should invert it. Have a --detailed or a --verbose flag that shows more information.

@troydai
Copy link
Contributor Author

troydai commented Apr 9, 2015

We need to ensure the same experience between listing packages and assembly. So both by default just list the dependencies and use --detailed to show more information. How about that?

@troydai troydai changed the title Print source of assemblies dependencies in dnu list --assembly #1513: Print source of assemblies dependencies in dnu list --assembly Apr 9, 2015
@troydai troydai force-pushed the trdai/issue1513 branch 4 times, most recently from d04ee4e to c8fac7b Compare April 10, 2015 07:09
@troydai
Copy link
Contributor Author

troydai commented Apr 10, 2015

rebased and updated.

/cc @davidfowl

@troydai troydai force-pushed the trdai/issue1513 branch 2 times, most recently from 7739575 to e803d3d Compare April 13, 2015 21:52
@troydai
Copy link
Contributor Author

troydai commented Apr 14, 2015

/cc @davidfowl @BrennanConroy @ChengTian

Adding functional actually testing dnu list.

  1. Each combination of dnx will be uncompressed only once throughout the same test class. It is implemented using a class fixture.
  2. The test will create package dynamically to mimic a dependencies, so that the dnu restore won't rely on an external source. The dependencies will be manageable. @BrennanConroy this can be reused in dnu restore functional tests.

{
var assemblies = new HashSet<string>();
_assemblyFilePaths = new HashSet<string>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StringComparer.Ordinal (also for the dictionaries).

@troydai
Copy link
Contributor Author

troydai commented Apr 14, 2015

Looks like test fails on mono. I'm looking at it.

@troydai
Copy link
Contributor Author

troydai commented Apr 14, 2015

⌚ /cc @davidfowl

@troydai
Copy link
Contributor Author

troydai commented Apr 14, 2015

Also address: #1644

string stdOut, stdErr;
Assert.Equal(0, DnuTestUtils.ExecDnu(runtimeHomePath, "list", "--details", out stdOut, out stdErr, environment: null, workingDir: _workingDir.DirPath));

string[] outputLines = stdOut.Split(Environment.NewLine[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you grabbing potentially only part of the newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment.NewLine[0] in both situation is \n. In the following assertions string.Contains is used to examine the content. It is safe.

@BrennanConroy
Copy link
Member

⌚ comments

string stdOut, stdErr;
Assert.Equal(0, DnuTestUtils.ExecDnu(runtimeHomePath, "list", "", out stdOut, out stdErr, environment: null, workingDir: _workingDir.DirPath));

var hits = stdOut.Split('\n').Where(line => line.Contains("* alpha 0.1.0"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using newline.

@troydai
Copy link
Contributor Author

troydai commented Apr 15, 2015

CI build fails because of myget failing.

@davidfowl
Copy link
Member

No they aren't:

Microsoft.Framework.PackageManager.DnuPublishTests.PublishExcludeWithLongPath [SKIP]
      Creating long path file failed on Windows Server 2012 R2
   Microsoft.Framework.PackageManager.FunctionalTests.DnuListTests.DnuList_Unresolved(flavor: "mono", os: null, architecture: null) [FAIL]
      System.AggregateException : One or more errors occurred
      ---- System.FormatException : Input string was not in a correct format.
      ---- The following constructor parameters did not have matching fixture data: DnuListTestContext context
      Stack Trace:

         ----- Inner Stack Trace #1 (System.FormatException) -----
           at System.String.ParseFormatSpecifier (System.String str, System.Int32& ptr, System.Int32& n, System.Int32& width, System.Boolean& left_align, System.String& format) [0x00000] in <filename unknown>:0 
           at System.String.FormatHelper (System.Text

@troydai
Copy link
Contributor Author

troydai commented Apr 15, 2015

You caught me. Failure indeed happens on AppVeyor after I put out the statement.

@troydai
Copy link
Contributor Author

troydai commented Apr 15, 2015

continuous-integration/travis-ci/pr fails for

The command "sudo apt-get install -qq mono-complete mono-vbnc fsharp nuget referenceassemblies-pcl" failed and exited with 100 during .

@troydai
Copy link
Contributor Author

troydai commented Apr 15, 2015

/cc @davidfowl @BrennanConroy

@BrennanConroy
Copy link
Member

Looks good to go.

@troydai
Copy link
Contributor Author

troydai commented Apr 15, 2015

Ping @davidfowl

@troydai
Copy link
Contributor Author

troydai commented Apr 16, 2015

I'll merge this change today.

@davidfowl
Copy link
Member

:shipit:

@troydai troydai merged commit 5b4d445 into dev Apr 16, 2015
@troydai troydai deleted the trdai/issue1513 branch April 18, 2015 06:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants