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

Merge future to master #917

Merged
merged 42 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b9b16f6
Bump future's minor version
nguerrera Dec 7, 2016
d4b6277
Merge pull request #467 from nguerrera/bump-version
nguerrera Dec 7, 2016
3deebc0
Merge remote-tracking branch 'refs/remotes/upstream/master'
eerhardt Jan 9, 2017
076054b
Update NuGet to include new TFMs for .NET Core 2.0.
eerhardt Jan 10, 2017
5352d82
Merge pull request #617 from eerhardt/UpdateNuGet
eerhardt Jan 10, 2017
6e119bc
Compose cache
ramarag Dec 30, 2016
6043430
Integration Test for ComposeCache
ramarag Jan 18, 2017
dc0b6ea
Merge pull request #591 from ramarag/dotnet-cache
ramarag Jan 21, 2017
a07294d
Adding a FilterProfile option to filter out the closure of specified …
ramarag Jan 14, 2017
c11f9f7
Integration test for publish filter profile
ramarag Jan 19, 2017
2d2957d
Merge pull request #685 from ramarag/dotnet-filter
ramarag Jan 27, 2017
00a3037
Merge master into future
dsplaisted Jan 31, 2017
73e5700
Fixed the download scripts to consume cli rel/1.0.0 branch
333fred Jan 24, 2017
ac9f638
Merge pull request #770 from ramarag/point_fix_future
nguerrera Feb 1, 2017
feb7131
Fix Global user path
ramarag Jan 30, 2017
89dd925
Fix test for new runtimeconfig.json property.
eerhardt Feb 1, 2017
146a103
Refactoring Crossgen and enabling parallel execution of Crossgen
ramarag Jan 31, 2017
9ea4f2e
Merge pull request #761 from ramarag/parallelize_Cache
ramarag Feb 2, 2017
306c5ed
Creating an Intermediate directory for cache to work in
ramarag Feb 3, 2017
a9e9c84
Merge pull request #800 from ramarag/create_working_dir_for_cache
ramarag Feb 3, 2017
2c87d5e
Merge branch 'master' into merge-master
nguerrera Feb 3, 2017
542d3e9
Merge branch 'future' into merge-master
nguerrera Feb 3, 2017
756966e
Set VS Install location environment variables in netci.groovy
dsplaisted Jan 26, 2017
6929f00
Merge pull request #808 from ramarag/future_is_2017
ramarag Feb 3, 2017
9e76a59
Merge remote-tracking branch 'upstream/future' into merge-master
ramarag Feb 3, 2017
8a3bb94
Try fixing groovy script
dsplaisted Jan 26, 2017
19641cb
Don't set environment variables for VS SDK during CI runs
dsplaisted Jan 26, 2017
1a1c295
Use Dev15 CI machines for Windows builds
dsplaisted Jan 27, 2017
fc6c001
Build with VS 15 dev tools
dsplaisted Jan 26, 2017
acf87a3
Merge pull request #812 from ramarag/fututre_shoulbe_2017
ramarag Feb 4, 2017
d70eec0
Merge pull request #767 from dsplaisted/merge-master
ramarag Feb 4, 2017
437e2c0
Remove Default FX_Version, as we let it to default to CLI in usage
ramarag Feb 7, 2017
3c65076
Merge pull request #827 from ramarag/fix_FX_version
ramarag Feb 7, 2017
b3ee71d
Filter out System files during caching step
ramarag Feb 9, 2017
9cbb171
Merge pull request #837 from ramarag/remove_system_files
ramarag Feb 9, 2017
f5c65ef
Merge remote-tracking branch 'refs/remotes/upstream/master'
eerhardt Feb 10, 2017
1f2a62b
Merge pull request #857 from eerhardt/merge-master
eerhardt Feb 10, 2017
5adcbb6
Merge pull request #882 from dotnet/master
srivatsn Feb 17, 2017
7b03b20
Merge branch 'master' into merge-master
nguerrera Feb 24, 2017
4878186
Fix test expectation to match project change coming from master
nguerrera Feb 24, 2017
f1590d1
fixing iteration of publish filter list
ramarag Feb 24, 2017
44c528d
Merge pull request #913 from nguerrera/merge-master
nguerrera Feb 25, 2017
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
2 changes: 1 addition & 1 deletion Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!-- Reset $(BuildEpoch) whenever $(VersionPrefix) increments. We subtract this from YYYYMMDD portion of build
number below to obtain the fourth part of file version that must fit in 16 bits. We can produce builds
for seven years from every epoch reset. -->
<VersionPrefix Condition="'$(VersionPrefix)' == ''">1.0.0</VersionPrefix>
<VersionPrefix Condition="'$(VersionPrefix)' == ''">1.1.0</VersionPrefix>
<BuildEpoch>20170101</BuildEpoch>
<VersionPrereleasePrefix Condition="'$(VersionPrereleasePrefix)' == ''">alpha</VersionPrereleasePrefix>
<!-- When running on VSO (for official builds) use a real number. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
</PackageReference>
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions TestAssets/TestProjects/SimpleCache/SimpleCache.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<ItemGroup>
<PackageReference Include="System.Private.Uri" Version="4.4.0-beta-24821-02" />
<PackageReference Include="Microsoft.NETCore.CoreDisTools" Version="1.0.1-prerelease-00001" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions TestAssets/TestProjects/UnmanagedCache/UnmanagedCache.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.CoreDisTools" Version="1.0.1-prerelease-00001" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ public void ItResolvesAssembliesFromProjectLockFiles(string projectName, string
.BeEquivalentTo(expectedResolvedFiles);
}

[Theory]
[MemberData("ProjectData1")]
public void ItResolvesAssembliesFromProjectLockFilesWithCacheLayout(string projectName, string runtime, object[] expectedResolvedFiles)
{
LockFile lockFile = TestLockFiles.GetLockFile(projectName);
ProjectContext projectContext = lockFile.CreateProjectContext(
FrameworkConstants.CommonFrameworks.NetCoreApp10,
runtime,
Constants.DefaultPlatformLibrary);

IEnumerable<ResolvedFile> resolvedFiles = new PublishAssembliesResolver(new MockPackageResolver())
.WithPreserveCacheLayout(true)
.Resolve(projectContext);

resolvedFiles
.Should()
.BeEquivalentTo(expectedResolvedFiles);

}

public static IEnumerable<object[]> ProjectData
{
get
Expand Down Expand Up @@ -69,7 +89,7 @@ public static IEnumerable<object[]> ProjectData
"all.asset.types",
"osx.10.11-x64",
new object[] {
CreateNativeResolvedFile("Libuv", "1.9.0", "runtimes/osx/native/libuv.dylib", destinationSubDirectory: null),
CreateNativeResolvedFile("Libuv", "1.9.0", "runtimes/osx/native/libuv.dylib", destinationSubDirectory: null, preserveCacheLayout: false),
CreateResolvedFileForTFM("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa"),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "de"),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "zh-Hant"),
Expand All @@ -79,42 +99,96 @@ public static IEnumerable<object[]> ProjectData
}
}

private static ResolvedFile CreateResolvedFileForTFM(string packageId, string version, string tfm)
public static IEnumerable<object[]> ProjectData1
{
return CreateResolvedFile(packageId, version, $"lib/{tfm}/{packageId}.dll", null);
get
{
return new[]
{
new object[] {
"dotnet.new",
null,
new object[] { }
},
new object[] {
"simple.dependencies",
null,
new object[] {
CreateResolvedFileForTFM("Newtonsoft.Json", "9.0.1", "netstandard1.0", true),
CreateResolvedFileForTFM("System.Runtime.Serialization.Primitives", "4.1.1", "netstandard1.3", true),
CreateResolvedFileForTFM("System.Collections.NonGeneric", "4.0.1", "netstandard1.3", true),
}
},
new object[] {
"all.asset.types",
null,
new object[] {
CreateNativeResolvedFile("Libuv", "1.9.0", "runtimes/osx/native/libuv.dylib", true),
CreateNativeResolvedFile("Libuv", "1.9.0", "runtimes/win7-x64/native/libuv.dll", true),
CreateResolvedFileForTFM("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", true),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "de", true),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "zh-Hant", true),
}
},
new object[] {
"all.asset.types",
"osx.10.11-x64",
new object[] {
CreateNativeResolvedFile("Libuv", "1.9.0", "runtimes/osx/native/libuv.dylib", destinationSubDirectory: null, preserveCacheLayout: true),
CreateResolvedFileForTFM("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", true),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "de", true),
CreateResourceResolvedFile("System.Spatial", "5.7.0", "portable-net45+wp8+win8+wpa", "zh-Hant", true),
}
},
};
}
}
private static ResolvedFile CreateResolvedFileForTFM(string packageId, string version, string tfm, bool preserveCacheLayout = false)
{
return CreateResolvedFile(packageId, version, $"lib/{tfm}/{packageId}.dll", null, preserveCacheLayout, AssetType.Runtime);
}

private static ResolvedFile CreateResourceResolvedFile(string packageId, string version, string tfm, string locale)
private static ResolvedFile CreateResourceResolvedFile(string packageId, string version, string tfm, string locale, bool preserveCacheLayout = false)
{
return CreateResolvedFile(packageId, version, $"lib/{tfm}/{locale}/{packageId}.resources.dll", locale);
return CreateResolvedFile(packageId, version, $"lib/{tfm}/{locale}/{packageId}.resources.dll", locale, preserveCacheLayout, AssetType.Resources);
}

private static ResolvedFile CreateNativeResolvedFile(string packageId, string version, string filePath)
private static ResolvedFile CreateNativeResolvedFile(string packageId, string version, string filePath, bool preserveCacheLayout = false)
{
return CreateNativeResolvedFile(packageId, version, filePath, Path.GetDirectoryName(filePath));
return CreateNativeResolvedFile(packageId, version, filePath, Path.GetDirectoryName(filePath), preserveCacheLayout);
}

private static ResolvedFile CreateNativeResolvedFile(
string packageId,
string version,
string filePath,
string destinationSubDirectory)
string destinationSubDirectory,
bool preserveCacheLayout)
{
return CreateResolvedFile(packageId, version, filePath, destinationSubDirectory);
return CreateResolvedFile(packageId, version, filePath, destinationSubDirectory, preserveCacheLayout, AssetType.Native);
}

private static ResolvedFile CreateResolvedFile(
string packageId,
string version,
string filePath,
string destinationSubDirectory)
string destinationSubDirectory,
bool preserveCacheLayout,
AssetType assetType)
{
string packageRoot;
string packageDirectory = new MockPackageResolver()
.GetPackageDirectory(packageId, NuGetVersion.Parse(version));
.GetPackageDirectory(packageId, NuGetVersion.Parse(version), out packageRoot);

assetType.Should().NotBe(AssetType.None);

string sourcepath = Path.Combine(packageDirectory, filePath);
string sourcedir = Path.GetDirectoryName(sourcepath);
string destinationSubDirPath = preserveCacheLayout ? sourcedir.Substring(packageRoot.Length): destinationSubDirectory;
return new ResolvedFile(
Path.Combine(packageDirectory, filePath),
destinationSubDirectory);
sourcepath,
destinationSubDirPath,
assetType);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ public MockPackageResolver(string root = "/root")
{
_root = root;
}

public string GetPackageDirectory(string packageId, NuGetVersion version)
{
string packageRoot = null;
return GetPackageDirectory(packageId, version, out packageRoot);
}
public string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot)
{
packageRoot = _root;
return Path.Combine(_root, packageId, version.ToNormalizedString(), "path");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class GenerateRuntimeConfigurationFiles : TaskBase
[Required]
public string TargetFramework { get; set; }

[Required]
public string TargetFrameworkMoniker { get; set; }

[Required]
public string RuntimeConfigPath { get; set; }

Expand All @@ -52,7 +55,7 @@ protected override void ExecuteCore()
{
LockFile lockFile = new LockFileCache(BuildEngine4).GetLockFile(AssetsFilePath);
ProjectContext projectContext = lockFile.CreateProjectContext(
NuGetUtils.ParseFrameworkName(TargetFramework),
NuGetUtils.ParseFrameworkName(TargetFrameworkMoniker),
RuntimeIdentifier,
PlatformLibraryName);

Expand Down Expand Up @@ -93,6 +96,7 @@ private void AddFramework(RuntimeOptions runtimeOptions, ProjectContext projectC
framework.Version = platformLibrary.Version.ToNormalizedString();

runtimeOptions.Framework = framework;
runtimeOptions.tfm = TargetFramework;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/IPackageResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ namespace Microsoft.NET.Build.Tasks
public interface IPackageResolver
{
string GetPackageDirectory(string packageId, NuGetVersion version);
string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot);
}
}
12 changes: 10 additions & 2 deletions src/Tasks/Microsoft.NET.Build.Tasks/LockFileExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static ProjectContext CreateProjectContext(
this LockFile lockFile,
NuGetFramework framework,
string runtime,
string platformLibraryName)
string platformLibraryName,
LockFile filterlockFile = null)
{
if (lockFile == null)
{
Expand All @@ -28,6 +29,12 @@ public static ProjectContext CreateProjectContext(
}

LockFileTarget lockFileTarget = lockFile.GetTarget(framework, runtime);
LockFileTarget filterlockFileTarget = null;

if (filterlockFile != null)
{
filterlockFileTarget = filterlockFile.GetTarget(framework, runtime);
}

if (lockFileTarget == null)
{
Expand All @@ -39,7 +46,7 @@ public static ProjectContext CreateProjectContext(
throw new BuildErrorException(Strings.AssetsFileMissingTarget, lockFile.Path, targetMoniker, framework.GetShortFolderName(), runtime);
}

return new ProjectContext(lockFile, lockFileTarget, platformLibraryName);
return new ProjectContext(lockFile, lockFileTarget, platformLibraryName, filterlockFileTarget);
}

public static LockFileTargetLibrary GetLibrary(this LockFileTarget lockFileTarget, string libraryName)
Expand Down Expand Up @@ -76,6 +83,7 @@ public static Dictionary<string, string> GetProjectFileDependencies(this LockFil

return projectDeps;
}


public static HashSet<string> GetPlatformExclusionList(
this LockFileTarget lockFileTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
<None Include="build\Microsoft.NET.Publish.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="build\Microsoft.NET.ComposeCache.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="build\Microsoft.NET.CrossGen.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="build\Microsoft.NET.TargetFrameworkInference.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -168,4 +174,4 @@
</EmbeddedResource>
</ItemGroup>
<Import Project="..\..\..\build\Targets\Signing.Imports.targets" />
</Project>
</Project>
12 changes: 11 additions & 1 deletion src/Tasks/Microsoft.NET.Build.Tasks/NuGetPackageResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ public NuGetPackageResolver(string userPackageFolder, IEnumerable<string> fallba
{
_packagePathResolver = new FallbackPackagePathResolver(userPackageFolder, fallbackPackageFolders);
}

public string GetPackageDirectory(string packageId, NuGetVersion version)
{
string packageRoot = null;
return GetPackageDirectory(packageId, version, out packageRoot);
}
public string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot)
{
packageRoot = null;
var pkginfo = _packagePathResolver.GetPackageInfo(packageId,version);
if (pkginfo != null)
{
packageRoot = pkginfo.PathResolver.GetVersionListPath(""); //TODO Remove Once Nuget is updated to use FallbackPackagePathInfo.PathResolver.RootPath
}
return _packagePathResolver.GetPackageDirectory(packageId, version);
}

Expand Down
43 changes: 42 additions & 1 deletion src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Microsoft.NET.Build.Tasks
public class ProjectContext
{
private readonly LockFile _lockFile;
private readonly LockFileTarget _filterlockFileTarget;
private readonly LockFileTarget _lockFileTarget;
private readonly string _platformLibraryName;

Expand All @@ -21,9 +22,10 @@ public class ProjectContext
public LockFile LockFile => _lockFile;
public LockFileTarget LockFileTarget => _lockFileTarget;

public ProjectContext(LockFile lockFile, LockFileTarget lockFileTarget, string platformLibraryName)
public ProjectContext(LockFile lockFile, LockFileTarget lockFileTarget, string platformLibraryName, LockFileTarget filterlockFileTarget = null)
{
_lockFile = lockFile;
_filterlockFileTarget = filterlockFileTarget;
_lockFileTarget = lockFileTarget;
_platformLibraryName = platformLibraryName;

Expand Down Expand Up @@ -54,6 +56,14 @@ public IEnumerable<LockFileTargetLibrary> GetRuntimeLibraries(IEnumerable<string
allExclusionList.UnionWith(privateAssetsExclusionList);
}

if(_filterlockFileTarget != null)
{
IEnumerable<LockFileTargetLibrary> filterLibraries = _filterlockFileTarget.Libraries;
Dictionary<string, LockFileTargetLibrary> filterLookup = filterLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase);

allExclusionList.UnionWith(GetIntersection(filterLookup, libraryLookup));
}

return runtimeLibraries.Filter(allExclusionList).ToArray();
}

Expand Down Expand Up @@ -171,5 +181,36 @@ public HashSet<string> GetPrivateAssetsExclusionList(

return privateAssetsToExclude;
}
private static HashSet<string> GetIntersection(
IDictionary<string, LockFileTargetLibrary> collection1,
IDictionary<string, LockFileTargetLibrary> collection2)
{
var exclusionList = new HashSet<string>();
var iterated = collection1;
var lookup = collection2;

if (collection1.Count > collection2.Count)
{
iterated = collection2;
lookup = collection1;
}
foreach (var entry in iterated)
{

LockFileTargetLibrary library;

if (lookup.TryGetValue(entry.Key, out library))
{
LockFileTargetLibrary dependency = entry.Value;

if (library.Version.Equals(dependency.Version))
{
exclusionList.Add(entry.Key);
}
}
}

return exclusionList;
}
}
}
Loading