Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions eng/restore-toolset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function InitializeCustomSDKToolset {
InstallDotNetSharedFramework "2.1.0"
InstallDotNetSharedFramework "2.2.8"
InstallDotNetSharedFramework "3.1.0"

CreateBuildEnvScript
}

# Installs additional shared frameworks for testing purposes
Expand All @@ -37,4 +39,22 @@ function InstallDotNetSharedFramework {
fi
}

function CreateBuildEnvScript {
mkdir -p $artifacts_dir
scriptPath="$artifacts_dir/sdk-build-env.sh"
scriptContents="
#!/bin/bash
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0

export DOTNET_ROOT=$DOTNET_INSTALL_DIR
export DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$DOTNET_INSTALL_DIR

export PATH=$DOTNET_INSTALL_DIR:\$PATH
export NUGET_PACKAGES=$NUGET_PACKAGES
"

echo "$scriptContents" > ${scriptPath}
}

InitializeCustomSDKToolset
1 change: 1 addition & 0 deletions src/Tasks/Common/MetadataKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal static class MetadataKeys
public const string OriginalItemSpec = "OriginalItemSpec";
public const string SDKRootFolder = "SDKRootFolder";
public const string ShimRuntimeIdentifier = "ShimRuntimeIdentifier";
public const string RuntimePackAlwaysCopyLocal = "RuntimePackAlwaysCopyLocal";

// Foreign Keys
public const string ParentTarget = "ParentTarget";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using FluentAssertions;
using Microsoft.Build.Framework;
using Xunit;

namespace Microsoft.NET.Build.Tasks.UnitTests
Expand Down Expand Up @@ -40,7 +38,7 @@ public void ItCanGenerateWithoutAssetFile()
{
var task = new TestableGenerateRuntimeConfigurationFiles
{
BuildEngine = new MockBuildEngine4(),
BuildEngine = new MockNeverCacheBuildEngine4(),
TargetFrameworkMoniker = ".NETCoreApp,Version=v3.0",
TargetFramework = "netcoreapp3.0",
RuntimeConfigPath = _runtimeConfigPath,
Expand Down Expand Up @@ -82,7 +80,7 @@ public void Given3RuntimeFrameworksItCanGenerateWithoutAssetFile()
{
var task = new TestableGenerateRuntimeConfigurationFiles
{
BuildEngine = new MockBuildEngine4(),
BuildEngine = new MockNeverCacheBuildEngine4(),
TargetFrameworkMoniker = ".NETCoreApp,Version=v3.0",
TargetFramework = "netcoreapp3.0",
RuntimeConfigPath = _runtimeConfigPath,
Expand Down Expand Up @@ -143,7 +141,7 @@ public void Given2RuntimeFrameworksItCanGenerateWithoutAssetFile()
{
var task = new TestableGenerateRuntimeConfigurationFiles
{
BuildEngine = new MockBuildEngine4(),
BuildEngine = new MockNeverCacheBuildEngine4(),
TargetFrameworkMoniker = ".NETCoreApp,Version=v3.0",
TargetFramework = "netcoreapp3.0",
RuntimeConfigPath = _runtimeConfigPath,
Expand Down Expand Up @@ -194,55 +192,5 @@ public void PublicExecuteCore()
base.ExecuteCore();
}
}

private class MockBuildEngine4 : MockBuildEngine, IBuildEngine4
{
public bool IsRunningMultipleNodes => throw new NotImplementedException();

public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties,
IDictionary targetOutputs, string toolsVersion)
{
throw new NotImplementedException();
}

public BuildEngineResult BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames,
IDictionary[] globalProperties, IList<string>[] removeGlobalProperties, string[] toolsVersion,
bool returnTargetOutputs)
{
throw new NotImplementedException();
}

public bool BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames,
IDictionary[] globalProperties, IDictionary[] targetOutputsPerProject, string[] toolsVersion,
bool useResultsCache, bool unloadProjectsOnCompletion)
{
throw new NotImplementedException();
}

public object GetRegisteredTaskObject(object key, RegisteredTaskObjectLifetime lifetime)
{
return null;
}

public void Reacquire()
{
throw new NotImplementedException();
}

public void RegisterTaskObject(object key, object obj, RegisteredTaskObjectLifetime lifetime,
bool allowEarlyCollection)
{
}

public object UnregisterTaskObject(object key, RegisteredTaskObjectLifetime lifetime)
{
throw new NotImplementedException();
}

public void Yield()
{
throw new NotImplementedException();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Build.Framework;

namespace Microsoft.NET.Build.Tasks.UnitTests
{
internal class MockNeverCacheBuildEngine4 : MockBuildEngine, IBuildEngine4
{
public bool IsRunningMultipleNodes => throw new NotImplementedException();

public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties,
IDictionary targetOutputs, string toolsVersion)
{
throw new NotImplementedException();
}

public BuildEngineResult BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames,
IDictionary[] globalProperties, IList<string>[] removeGlobalProperties, string[] toolsVersion,
bool returnTargetOutputs)
{
throw new NotImplementedException();
}

public bool BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames,
IDictionary[] globalProperties, IDictionary[] targetOutputsPerProject, string[] toolsVersion,
bool useResultsCache, bool unloadProjectsOnCompletion)
{
throw new NotImplementedException();
}

public object GetRegisteredTaskObject(object key, RegisteredTaskObjectLifetime lifetime)
{
return null;
}

public void Reacquire()
{
throw new NotImplementedException();
}

public void RegisterTaskObject(object key, object obj, RegisteredTaskObjectLifetime lifetime,
bool allowEarlyCollection)
{
}

public object UnregisterTaskObject(object key, RegisteredTaskObjectLifetime lifetime)
{
throw new NotImplementedException();
}

public void Yield()
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public IDictionary CloneCustomMetadata()

public void CopyMetadataTo(ITaskItem destinationItem)
{
throw new NotImplementedException();
foreach (var kv in _metadata)
{
destinationItem.SetMetadata(kv.Key, kv.Value);
}
}

public string GetMetadata(string metadataName)
Expand Down
Loading