Skip to content

Commit

Permalink
Add initial implementation of Microsoft.DotNet.Build.Tasks.IO
Browse files Browse the repository at this point in the history
Add tasks:
 - Chmod
 - DownloadFile
 - GetFileHash
 - UnzipArchive
 - VerifyFileHash
 - ZipArchive
  • Loading branch information
Nate McMaster committed Mar 2, 2018
1 parent 54a6350 commit f509125
Show file tree
Hide file tree
Showing 32 changed files with 1,848 additions and 121 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
*.sh eol=lf
*.bin binary
21 changes: 21 additions & 0 deletions Arcade.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ VisualStudioVersion = 15.0.27411.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Tasks.Feed", "src\Microsoft.DotNet.Build.Tasks.Feed\Microsoft.DotNet.Build.Tasks.Feed.csproj", "{941D335B-AA65-4089-9502-F306B108D182}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{730AF68A-22FD-4372-9341-5F67D7701DA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Tasks.IO", "src\Microsoft.DotNet.Build.Tasks.IO\Microsoft.DotNet.Build.Tasks.IO.csproj", "{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7900BB3A-3FCC-4A0E-908D-14155048E6B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Tasks.IO.Tests", "test\Microsoft.DotNet.Build.Tasks.IO.Tests\Microsoft.DotNet.Build.Tasks.IO.Tests.csproj", "{5B35A0EA-5348-4242-8D2F-984328EB9063}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,10 +23,23 @@ Global
{941D335B-AA65-4089-9502-F306B108D182}.Debug|Any CPU.Build.0 = Debug|Any CPU
{941D335B-AA65-4089-9502-F306B108D182}.Release|Any CPU.ActiveCfg = Release|Any CPU
{941D335B-AA65-4089-9502-F306B108D182}.Release|Any CPU.Build.0 = Release|Any CPU
{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1}.Release|Any CPU.Build.0 = Release|Any CPU
{5B35A0EA-5348-4242-8D2F-984328EB9063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B35A0EA-5348-4242-8D2F-984328EB9063}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B35A0EA-5348-4242-8D2F-984328EB9063}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B35A0EA-5348-4242-8D2F-984328EB9063}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{941D335B-AA65-4089-9502-F306B108D182} = {730AF68A-22FD-4372-9341-5F67D7701DA7}
{91B7A947-C0CC-4D57-B3D2-D208A4F5CFA1} = {730AF68A-22FD-4372-9341-5F67D7701DA7}
{5B35A0EA-5348-4242-8D2F-984328EB9063} = {7900BB3A-3FCC-4A0E-908D-14155048E6B6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06E6CFF5-C54E-4623-9587-71A9E3F041D9}
EndGlobalSection
Expand Down
12 changes: 9 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
</PropertyGroup>

<PropertyGroup>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup>
<!-- Respect environment variable for the NuGet Packages Root if set; otherwise, use the current default location -->
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(NUGET_PACKAGES)</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(RepoRoot)' != ''">$(RepoRoot)packages\</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(MSBuildThisFileDirectory)packages\</NuGetPackageRoot>
<NuGetPackageRoot Condition="!HasTrailingSlash('$(NuGetPackageRoot)')">$(NuGetPackageRoot)\</NuGetPackageRoot>
<RestorePackagesPath>$(NuGetPackageRoot)</RestorePackagesPath>
</PropertyGroup>
</PropertyGroup>

<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<!-- Place 'NetFxTfm' in the 'TargetFramework' property of a csproj to include building framework version if building on Windows but to skip building against the framwork on non-Windows platforms.
Building targeting the framework is not supported on Linux
ie. <TargetFrameworks>netcoreapp2.0;$(NetFxTfm)</TargetFrameworks> -->
<NetFxTfm>net45</NetFxTfm>
</PropertyGroup>
</Project>

</Project>
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ source="${BASH_SOURCE[0]}"
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the

# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
. "$scriptroot/build/build.sh" --build --restore $@
"$scriptroot/build/build.sh" --build --restore $@
132 changes: 67 additions & 65 deletions build/SignToolData.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
{
"sign": [
{
"certificate": "MicrosoftSHA2",
"strongName": "MsSharedLib72",
"values": [
"bin/Microsoft.DotNet.Build.Tasks.Feed/netstandard1.5/Microsoft.DotNet.Build.Tasks.Feed.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/netstandard1.5/*/Microsoft.DotNet.Build.Tasks.Feed.resources.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/net45/Microsoft.DotNet.Build.Tasks.Feed.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/net45/*/Microsoft.DotNet.Build.Tasks.Feed.resources.dll"
]
},
{
"certificate": null,
"strongName": null,
"values": [
"packages/*.nupkg"
]
}
],
"exclude": [
"Microsoft.Azure.KeyVault.Core.dll",
"Microsoft.Build.Framework.dll",
"Microsoft.Build.Utilities.Core.dll",
"Microsoft.CSharp.dll",
"Microsoft.Data.Edm.dll",
"Microsoft.Data.OData.dll",
"Microsoft.Data.Services.Client.dll",
"Microsoft.DiaSymReader.dll",
"Microsoft.DiaSymReader.PortablePdb.dll",
"Microsoft.DotNet.VersionTools.dll",
"Microsoft.WindowsAzure.Storage.dll",
"Newtonsoft.Json.dll",
"NuGet.Common.dll",
"NuGet.Frameworks.dll",
"NuGet.Packaging.Core.dll",
"NuGet.Packaging.dll",
"NuGet.Versioning.dll",
"SleetLib.dll",
"System.Buffers.dll",
"System.Collections.Concurrent.dll",
"System.Collections.Immutable.dll",
"System.Collections.NonGeneric.dll",
"System.Diagnostics.DiagnosticSource.dll",
"System.Dynamic.Runtime.dll",
"System.IO.Compression.ZipFile.dll",
"System.IO.FileSystem.Primitives.dll",
"System.ObjectModel.dll",
"System.Reflection.Emit.dll",
"System.Reflection.Emit.ILGeneration.dll",
"System.Reflection.Metadata.dll",
"System.Reflection.TypeExtensions.dll",
"System.Runtime.InteropServices.RuntimeInformation.dll",
"System.Runtime.Numerics.dll",
"System.Runtime.Serialization.Primitives.dll",
"System.Security.Cryptography.Primitives.dll",
"System.Spatial.dll",
"System.Threading.dll",
"System.Threading.Tasks.Extensions.dll",
"System.Threading.Thread.dll",
"System.Threading.ThreadPool.dll",
"System.Xml.ReaderWriter.dll",
"System.Xml.XDocument.dll",
"System.Xml.XmlDocument.dll"
]
}
"sign": [
{
"certificate": "MicrosoftSHA2",
"strongName": "MsSharedLib72",
"values": [
"bin/Microsoft.DotNet.Build.Tasks.Feed/netstandard1.5/Microsoft.DotNet.Build.Tasks.Feed.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/netstandard1.5/*/Microsoft.DotNet.Build.Tasks.Feed.resources.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/net45/Microsoft.DotNet.Build.Tasks.Feed.dll",
"bin/Microsoft.DotNet.Build.Tasks.Feed/net45/*/Microsoft.DotNet.Build.Tasks.Feed.resources.dll",
"bin/Microsoft.DotNet.Build.Tasks.IO/netcoreapp2.0/Microsoft.DotNet.Build.Tasks.IO.dll",
"bin/Microsoft.DotNet.Build.Tasks.IO/net45/Microsoft.DotNet.Build.Tasks.IO.dll"
]
},
{
"certificate": null,
"strongName": null,
"values": [
"packages/*.nupkg"
]
}
],
"exclude": [
"Microsoft.Azure.KeyVault.Core.dll",
"Microsoft.Build.Framework.dll",
"Microsoft.Build.Utilities.Core.dll",
"Microsoft.CSharp.dll",
"Microsoft.Data.Edm.dll",
"Microsoft.Data.OData.dll",
"Microsoft.Data.Services.Client.dll",
"Microsoft.DiaSymReader.dll",
"Microsoft.DiaSymReader.PortablePdb.dll",
"Microsoft.DotNet.VersionTools.dll",
"Microsoft.WindowsAzure.Storage.dll",
"Newtonsoft.Json.dll",
"NuGet.Common.dll",
"NuGet.Frameworks.dll",
"NuGet.Packaging.Core.dll",
"NuGet.Packaging.dll",
"NuGet.Versioning.dll",
"SleetLib.dll",
"System.Buffers.dll",
"System.Collections.Concurrent.dll",
"System.Collections.Immutable.dll",
"System.Collections.NonGeneric.dll",
"System.Diagnostics.DiagnosticSource.dll",
"System.Dynamic.Runtime.dll",
"System.IO.Compression.ZipFile.dll",
"System.IO.FileSystem.Primitives.dll",
"System.ObjectModel.dll",
"System.Reflection.Emit.dll",
"System.Reflection.Emit.ILGeneration.dll",
"System.Reflection.Metadata.dll",
"System.Reflection.TypeExtensions.dll",
"System.Runtime.InteropServices.RuntimeInformation.dll",
"System.Runtime.Numerics.dll",
"System.Runtime.Serialization.Primitives.dll",
"System.Security.Cryptography.Primitives.dll",
"System.Spatial.dll",
"System.Threading.dll",
"System.Threading.Tasks.Extensions.dll",
"System.Threading.Thread.dll",
"System.Threading.ThreadPool.dll",
"System.Xml.ReaderWriter.dll",
"System.Xml.XDocument.dll",
"System.Xml.XmlDocument.dll"
]
}
16 changes: 9 additions & 7 deletions build/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
<!-- This repo version -->
<VersionBase>1.0.0</VersionBase>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>

<!-- Opt-out repo features -->
<UsingToolXliff>false</UsingToolXliff>
<UsingToolMicrosoftNetCompilers>false</UsingToolMicrosoftNetCompilers>

<!-- Libs -->
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<MoqVersion>4.5.21</MoqVersion>
<NuGetVersioningVersion>4.4.0</NuGetVersioningVersion>
<MicrosoftBuildVersion>14.3.0</MicrosoftBuildVersion>
<MicrosoftBuildTasksCoreVersion>14.3.0</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildVersion>14.3.0</MicrosoftBuildVersion>
<MicrosoftDotNetVersionToolsVersion>2.1.0-preview2-02521-02</MicrosoftDotNetVersionToolsVersion>
<MicrosoftNETTestSdkVersion>15.6.0</MicrosoftNETTestSdkVersion>
<MonoPosixNETStandardVersion>1.0.0-beta5</MonoPosixNETStandardVersion>
<MoqVersion>4.5.21</MoqVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<NuGetVersioningVersion>4.4.0</NuGetVersioningVersion>
<SleetLibVersion>2.2.24</SleetLibVersion>
</PropertyGroup>

Expand All @@ -24,5 +26,5 @@
$(RestoreSources);
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
</RestoreSources>
</PropertyGroup>
</PropertyGroup>
</Project>
28 changes: 16 additions & 12 deletions build/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,26 @@ done
# Result: Sets 'readjsonvalue' to the value of the provided json key
# Note: this method may return unexpected results if there are duplicate
# keys in the json
function ReadJson {
function ReadJson {
local unamestr="$(uname)"
local sedextended='-r'
if [[ "$unamestr" == 'Darwin' ]]; then
sedextended='-E'
fi;
fi;

readjsonvalue="$(grep -m 1 "\"${2}\"" ${1} | sed ${sedextended} 's/^ *//;s/.*: *"//;s/",?//')"
if [[ ! "$readjsonvalue" ]]; then
echo "Error: Cannot find \"${2}\" in ${1}" >&2;
ExitWithExitCode 1
fi;
fi;
}

function InstallDotNetCli {
local dotnetinstallverbosity=''

ReadJson "$globaljsonfile" "version"
local dotnetcliversion="$readjsonvalue"

if [[ -z "$DOTNET_INSTALL_DIR" ]]; then
export DOTNET_INSTALL_DIR="$reporoot/artifacts/.dotnet/$dotnetcliversion"
fi
Expand Down Expand Up @@ -201,7 +201,7 @@ function InstallDotNetCli {
# https://github.com/dotnet/cli/issues/6589
# Currently, SDK's always get resolved to the global location, but we want our packages
# to all be installed into a local folder (prevent machine contamination from global state).
#
#
# We are restoring all of our packages locally and setting nugetpackageroot to reference the
# local location, but this breaks Custom SDK's which are expecting the SDK to be available
# from the global user folder.
Expand All @@ -219,7 +219,7 @@ function InstallToolset {
mkdir -p "$tempdir"
echo '<Project Sdk="RoslynTools.RepoToolset"><Target Name="NoOp"/></Project>' > $toolsetproj

dotnet msbuild $toolsetproj /t:NoOp /m /nologo /clp:Summary /warnaserror /p:nugetpackageroot=$nugetpackageroot /v:$verbosity
dotnet msbuild $toolsetproj /t:NoOp /m /nologo /clp:Summary /warnaserror "/p:NuGetPackageRoot=$nugetpackageroot/" /v:$verbosity
local lastexitcode=$?

if [[ $lastexitcode != 0 ]]; then
Expand All @@ -232,7 +232,7 @@ function InstallToolset {
function Build {
InstallDotNetCli

if [[ $prepareMachine ]]; then
if [[ "$prepareMachine" == true ]]; then
mkdir -p "$nugetpackageroot"
dotnet nuget locals all --clear
local lastexitcode=$?
Expand All @@ -244,10 +244,10 @@ function Build {
fi

InstallToolset
MakeGlobalSdkAvailableLocal
MakeGlobalSdkAvailableLocal

local logcmd=''
if [[ $ci || $log ]]; then
if [[ "$ci" == true || "$log" == true ]] ; then
mkdir -p $logdir
logcmd="/bl:$logdir/Build.binlog"
fi
Expand All @@ -256,7 +256,11 @@ function Build {
solution="$reporoot/Arcade.sln"
fi

dotnet msbuild $toolsetbuildproj /m /nologo /clp:Summary /warnaserror /v:$verbosity $logcmd /p:Configuration=$configuration /p:SolutionPath=$solution /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci /p:RestorePackagesPath=$nugetpackageroot /p:nugetpackageroot=$nugetpackageroot $properties
dotnet msbuild $toolsetbuildproj /m /nologo /clp:Summary /warnaserror \
/v:$verbosity $logcmd /p:Configuration=$configuration /p:SolutionPath=$solution \
/p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci \
"/p:RestorePackagesPath=$nugetpackageroot/" "/p:NuGetPackageRoot=$nugetpackageroot/" \
$properties
local lastexitcode=$?

if [[ $lastexitcode != 0 ]]; then
Expand All @@ -266,7 +270,7 @@ function Build {
}

function ExitWithExitCode {
if [[ $ci && $prepareMachine ]]; then
if [[ "$ci" == true && "$prepareMachine" == true ]]; then
StopProcesses
fi
exit $1
Expand Down Expand Up @@ -307,4 +311,4 @@ function Main {
ExitWithExitCode $?
}

Main
Main
8 changes: 4 additions & 4 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static addGithubPRTriggerForBranch(def job, def branchName, def jobName) {
static addXUnitDotNETResults(def job, def configName) {
def resultFilePattern = "**/artifacts/${configName}/TestResults/*.xml"
def skipIfNoTestFiles = false

Utilities.addXUnitDotNETResults(job, resultFilePattern, skipIfNoTestFiles)
}

Expand Down Expand Up @@ -69,13 +69,13 @@ static addBuildSteps(def job, def projectName, def os, def configName, def isPR)
} else {
Utilities.addGithubPushTrigger(myJob)
}

addArchival(myJob, filesToArchive, filesToExclude)
// addXUnitDotNETResults(myJob, configName)
addXUnitDotNETResults(myJob, configName)

Utilities.setMachineAffinity(myJob, os, machineAffinity)

addBuildSteps(myJob, projectName, os, configName, isPR)
}
}
}
}
Loading

0 comments on commit f509125

Please sign in to comment.