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

Commit

Permalink
New lock file format to handle new package conventions.
Browse files Browse the repository at this point in the history
- Added NuGet conventions for compile (ref), and native.
- Updated to lock file format to take runtime ids into account.
- Made things work end to end with the old runtime and new lock file
- Changed how compiled dependencies work (do it properly). Look at the
closure relative to that project for compilation.
Make publish work with new lock file layout
- Make publish run restore after to generate the correct
lock file.
- Prune package content after creating the final layout with correct
lock file on disk.
- Fix the servicable flag generation.
- Refactored feed options so it could be used outside of command
line arguments.
- Reuse dnu packages add command PublishProject and PublishPackage
- Updated tests
  • Loading branch information
davidfowl committed Apr 25, 2015
1 parent 2d82c20 commit be5bb7b
Show file tree
Hide file tree
Showing 38 changed files with 1,734 additions and 558 deletions.
50 changes: 31 additions & 19 deletions makefile.shade
Expand Up @@ -112,15 +112,9 @@ var RUNTIME_TARGETS='${new List<RuntimeTarget>()}'
-// Replace repo-initialize with a less greedy restore
#repo-initialize target='initialize'
git gitCommand="submodule update --init"
for each='var projectFile in Files.Include("src/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("test/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("samples/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
@{
DoRestore();
}

- // k-standard-goal overrides
#native-compile
Expand Down Expand Up @@ -789,6 +783,24 @@ var CI_DARWIN_DROP_PATH = '${Environment.GetEnvironmentVariable("CI_DARWIN_DROP_
}
}

// We need to run restore with the new runtime (just one of them)
// On windows, grab a random windows target, otherwise use mono
string path = null;

if (CanBuildForWindows)
{
path = binPaths[RUNTIME_CLR_WIN_x86_NAME];
}
else
{
path = binPaths[RUNTIME_MONO_NAME];
}

ExecuteWithPath(path, () =>
{
DoRestore();
});

// Group by operation system since we only want to run unit tests on a single bitness
// any = [dnx-mono]
// win = [dnx-clr-win-x86, dnx-clr-win-x64, dnx-coreclr-win-x86, dnx-coreclr-win-x64]
Expand Down Expand Up @@ -883,6 +895,16 @@ var CI_DARWIN_DROP_PATH = '${Environment.GetEnvironmentVariable("CI_DARWIN_DROP_
}

- // ===================== SHARED UTILITIES =====================
macro name='DoRestore'
for each='var projectFile in Files.Include("src/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("test/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("samples/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"

#update-tpa .copy-coreclr
@{
Expand Down Expand Up @@ -965,16 +987,6 @@ functions @{
{
projectFolder = Path.GetDirectoryName(projectFolder);

// Make sure we use the newly built runtime to generate lock file for tests
if (IsMono)
{
Exec("dnu", string.Format("restore {0}", projectFolder));
}
else
{
Exec("cmd", string.Format("/C dnu restore {0}", projectFolder));
}

var testArgs = IsMono ? " -parallel none" : "";
K(("test" + testArgs), projectFolder, "");
}
Expand Down
107 changes: 49 additions & 58 deletions src/Microsoft.Framework.PackageManager/FeedOptions.cs
Expand Up @@ -8,104 +8,95 @@ namespace Microsoft.Framework.PackageManager
{
public class FeedOptions
{
public IList<string> FallbackSources
{
get
{
return FallbackSourceOptions.Values;
}
}
public IList<string> FallbackSources { get; set; } = new List<string>();

public bool IgnoreFailedSources
{
get
{
return IgnoreFailedSourcesOptions.HasValue();
}
}
public bool NoCache
{
get
{
return NoCacheOptions.HasValue();
}
}
public string TargetPackagesFolder
{
get
{
return TargetPackagesFolderOptions.Value();
}
}
public string Proxy
{
get
{
return ProxyOptions.Value();
}
}
public IList<string> Sources
{
get
{
return SourceOptions.Values;
}
}
public bool IgnoreFailedSources { get; set; }

public bool Quiet
{
get
{
return QuietOptions.HasValue();
}
}
public bool NoCache { get; set; }

public string TargetPackagesFolder { get; set; }

public string Proxy { get; set; }

public IList<string> Sources { get; set; } = new List<string>();

public bool Quiet { get; set; }

/// <summary>
/// Gets or sets a flag that determines if restore is performed on multiple project.json files in parallel.
/// </summary>
public bool Parallel { get; set; }
}

public class FeedCommandLineOptions
{
internal CommandOption FallbackSourceOptions { get; private set; }
internal CommandOption IgnoreFailedSourcesOptions { get; private set; }
internal CommandOption NoCacheOptions { get; private set; }
internal CommandOption TargetPackagesFolderOptions { get; private set; }
internal CommandOption ProxyOptions { get; private set; }
internal CommandOption SourceOptions { get; private set; }
internal CommandOption QuietOptions { get; private set; }
internal CommandOption ParallelOptions { get; private set; }

internal static FeedOptions Add(CommandLineApplication c)
internal static FeedCommandLineOptions Add(CommandLineApplication app)
{
var options = new FeedOptions();
var options = new FeedCommandLineOptions();

options.SourceOptions = c.Option(
options.SourceOptions = app.Option(
"-s|--source <FEED>",
"A list of packages sources to use for this command",
CommandOptionType.MultipleValue);

options.FallbackSourceOptions = c.Option(
options.FallbackSourceOptions = app.Option(
"-f|--fallbacksource <FEED>",
"A list of packages sources to use as a fallback",
CommandOptionType.MultipleValue);

options.ProxyOptions = c.Option(
options.ProxyOptions = app.Option(
"-p|--proxy <ADDRESS>",
"The HTTP proxy to use when retrieving packages",
CommandOptionType.SingleValue);

options.NoCacheOptions = c.Option(
options.NoCacheOptions = app.Option(
"--no-cache",
"Do not use local cache",
CommandOptionType.NoValue);

options.TargetPackagesFolderOptions = c.Option(
options.TargetPackagesFolderOptions = app.Option(
"--packages",
"Path to restore packages",
CommandOptionType.SingleValue);

options.IgnoreFailedSourcesOptions = c.Option(
options.IgnoreFailedSourcesOptions = app.Option(
"--ignore-failed-sources",
"Ignore failed remote sources if there are local packages meeting version requirements",
CommandOptionType.NoValue);

options.QuietOptions = c.Option(
options.QuietOptions = app.Option(
"--quiet", "Do not show output such as HTTP request/cache information",
CommandOptionType.NoValue);

options.ParallelOptions = app.Option("--parallel",
"Restores in parallel when more than one project.json is discovered.",
CommandOptionType.NoValue);

return options;
}

public FeedOptions GetOptions()
{
var options = new FeedOptions();

options.FallbackSources = FallbackSourceOptions.Values ?? options.FallbackSources;
options.Sources = SourceOptions.Values ?? options.Sources;
options.IgnoreFailedSources = IgnoreFailedSourcesOptions.HasValue();
options.NoCache = NoCacheOptions.HasValue();
options.Parallel = ParallelOptions.HasValue();
options.Quiet = QuietOptions.HasValue();
options.Proxy = ProxyOptions.Value();
options.TargetPackagesFolder = TargetPackagesFolderOptions.Value();

return options;
}
}
Expand Down
Expand Up @@ -62,7 +62,7 @@ public async Task<bool> Execute(string packageId, string packageVersion)

if (string.IsNullOrEmpty(FeedOptions.TargetPackagesFolder))
{
FeedOptions.TargetPackagesFolderOptions.Values.Add(_commandsRepository.PackagesRoot.Root);
FeedOptions.Sources.Add(_commandsRepository.PackagesRoot.Root);
}

var temporaryProjectFileFullPath = CreateTemporaryProject(FeedOptions.TargetPackagesFolder, packageId, packageVersion);
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task<bool> Execute(string packageId, string packageVersion)
var packagePath = Path.GetFullPath(packageId);
var packageDirectory = Path.GetDirectoryName(packagePath);
var zipPackage = new NuGet.ZipPackage(packagePath);
FeedOptions.FallbackSourceOptions.Values.Add(packageDirectory);
FeedOptions.FallbackSources.Add(packageDirectory);

return new Tuple<string, string>(
zipPackage.Id,
Expand Down
15 changes: 15 additions & 0 deletions src/Microsoft.Framework.PackageManager/NuGet/ContentModel/Asset.cs
@@ -0,0 +1,15 @@
using System;

namespace NuGet.ContentModel
{
public class Asset
{
public string Path { get; set; }
public string Link { get; set; }

public override string ToString()
{
return Path;
}
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;

namespace NuGet.ContentModel
{
public class ContentItem
{
public string Path { get; set; }
public string PhysicalPath { get; set; }
public IDictionary<string, object> Properties { get; set; }

public ContentItem()
{
Properties = new Dictionary<string, object>();
}

public override string ToString()
{
return Path + " -> " + PhysicalPath;
}
}
}

0 comments on commit be5bb7b

Please sign in to comment.