diff --git a/README.md b/README.md index 02abd5534..5adb08db1 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ There are a couple of things to keep in mind: * We welcome any and all issues that relate to MSBuild-based tools, so feel free to try them out and leave comments and file any bugs/problems. ### Download links - -* Instructions and links for download: [Preview 4 download links](https://github.com/dotnet/core/blob/master/release-notes/preview4-download.md). +* Instructions and links for download: [RC3 download links](https://github.com/dotnet/core/blob/master/release-notes/rc3-download.md). * Directory for future Preview release notes: [.NET Core release notes](https://github.com/dotnet/core/tree/master/release-notes). Found an issue? diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/Program.cs b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/Program.cs new file mode 100755 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/project.json b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/project.json new file mode 100755 index 000000000..a93ee629a --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/ProjectB/project.json @@ -0,0 +1,23 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": { + "ProjectA": { + "target": "project" + } + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/backup/src/ProjectA/project.json b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/backup/src/ProjectA/project.json new file mode 100755 index 000000000..ce67b3a46 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/backup/src/ProjectA/project.json @@ -0,0 +1,19 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/global.json b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/global.json new file mode 100644 index 000000000..b0323e428 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "src" ] +} \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/Program.cs b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/Program.cs new file mode 100755 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/ProjectA.csproj b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/ProjectA.csproj new file mode 100755 index 000000000..e8474ecd4 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJHalfMigrated/src/ProjectA/ProjectA.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp1.0 + portable + ProjectA + Exe + ProjectA + $(PackageTargetFallback);dnxcore50 + 1.0.3 + + + diff --git a/TestAssets/TestProjects/LibraryWithUnresolvablePackageReference/LibraryWithUnresolvablePackageReference.csproj b/TestAssets/TestProjects/LibraryWithUnresolvablePackageReference/LibraryWithUnresolvablePackageReference.csproj new file mode 100755 index 000000000..66c164859 --- /dev/null +++ b/TestAssets/TestProjects/LibraryWithUnresolvablePackageReference/LibraryWithUnresolvablePackageReference.csproj @@ -0,0 +1,11 @@ + + + + netstandard1.5 + + + + + + + diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/global.json b/TestAssets/TestProjects/TestAppDependencyGraph/global.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/TestAssets/TestProjects/TestAppDependencyGraph/global.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithUnqualifiedDependencies/global.json b/TestAssets/TestProjects/TestAppWithUnqualifiedDependencies/global.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithUnqualifiedDependencies/global.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/build/Microsoft.DotNet.Cli.BundledTemplates.props b/build/Microsoft.DotNet.Cli.BundledTemplates.props index 9280486a0..6f9987424 100644 --- a/build/Microsoft.DotNet.Cli.BundledTemplates.props +++ b/build/Microsoft.DotNet.Cli.BundledTemplates.props @@ -2,9 +2,9 @@ - - - - + + + + diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 63a33309e..19293f728 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -8,8 +8,9 @@ 1.0.0-alpha-20170125-1 4.0.0-rc3-2193 - 1.0.0-alpha-20170120-3-249 + 1.0.0-alpha-20170130-3-281 15.0.0-preview-20170125-04 - 1.0.0-beta1-20170126-102 + 1.0.0-beta1-20170202-111 + 1.0.0-beta1-20170131-110 diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index 608d3e932..2c8bde586 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -7,7 +7,7 @@ + DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages" /> + + - - - <_DotNetNewFolder>$(RepoRoot)/src/dotnet/commands/dotnet-new - - - - - - - - - - - - - - diff --git a/build/Microsoft.DotNet.Cli.Publish.targets b/build/Microsoft.DotNet.Cli.Publish.targets index 66b3d84d3..9c66a492c 100644 --- a/build/Microsoft.DotNet.Cli.Publish.targets +++ b/build/Microsoft.DotNet.Cli.Publish.targets @@ -52,7 +52,7 @@ - + diff --git a/build/Microsoft.DotNet.Cli.Signing.proj b/build/Microsoft.DotNet.Cli.Signing.proj new file mode 100644 index 000000000..b7a0e6092 --- /dev/null +++ b/build/Microsoft.DotNet.Cli.Signing.proj @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + $(RepoRoot)/artifacts/$(Rid) + $(BaseOutputDirectory)/stage2 + $(BaseOutputDirectory)/stage2compilation + $(BaseOutputDirectory)/packages + + + $(BaseOutputDirectory) + $(BaseOutputDirectory)/intermediate + + + + + + + + + + $(ExternalCertificateId) + + + + $(InternalCertificateId) + + + + $(InternalCertificateId) + + + + + + + + + $(RepoRoot)/src/Microsoft.DotNet.Cli.Utils + + + + + $(InternalCertificateId) + + + + + + + + + $(PackagesDirectory) + + + + $(InternalCertificateId) + + + $(InternalCertificateId) + + + + + + + + + $(PackagesDirectory) + + + + $(InternalCertificateId) + + + + + + + + + $(PackagesDirectory) + + + + $(InternalCertificateId) + + + + + + diff --git a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets index 276c39d70..6c77865d6 100644 --- a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets +++ b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets @@ -86,14 +86,25 @@ Lines="$(NuGetConfigContent)" /> + TemplateType="Mvc" + TemplateArgs="-au Individual --debug:ephemeral-hive" + WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" /> + + + + @@ -108,6 +119,9 @@ + + + nuGetPackagesArchive.$(NuGetPackagesArchiveVersion).lzma $(IntermediateDirectory)/NuGetPackagesArchiveProject diff --git a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets index c1d1474d3..365c15b9b 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets @@ -26,12 +26,6 @@ $(InstallerOutputDirectory)/VS.Redist.Common.Net.Core.SDK.$(Architecture).$(NugetVersion).nupkg - - - - - @@ -80,9 +74,7 @@ + Condition=" '$(OS)' == 'Windows_NT'"> i.ItemType == "PackageReference").ToList(); @@ -62,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build } } - dataToHash += SharedFrameworkVersion; + Directory.Delete(targetDir, true); } Log.LogMessage($"NuGet Packages Archive Data To Hash: '{dataToHash}'"); diff --git a/buildpipeline/DotNet-CLI-CentOS-x64.json b/buildpipeline/DotNet-CLI-CentOS-x64.json new file mode 100644 index 000000000..a2a9fa9d8 --- /dev/null +++ b/buildpipeline/DotNet-CLI-CentOS-x64.json @@ -0,0 +1,172 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker centos --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "DotNet-CLI-CentOS-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/DotNet-CLI-opensuse13.2-x64.json b/buildpipeline/DotNet-CLI-opensuse13.2-x64.json new file mode 100644 index 000000000..c2c80915c --- /dev/null +++ b/buildpipeline/DotNet-CLI-opensuse13.2-x64.json @@ -0,0 +1,172 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker opensuse.13.2 --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "DotNet-CLI-opensuse13.2-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Debian8-x64.json b/buildpipeline/Dotnet-CLI-Debian8-x64.json new file mode 100644 index 000000000..d125391a7 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Debian8-x64.json @@ -0,0 +1,172 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker debian --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Debian8-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Fedora23-x64.json b/buildpipeline/Dotnet-CLI-Fedora23-x64.json new file mode 100644 index 000000000..8926d72b2 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Fedora23-x64.json @@ -0,0 +1,172 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker fedora.23 --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Fedora23-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-OSX-x64.json b/buildpipeline/Dotnet-CLI-OSX-x64.json new file mode 100644 index 000000000..5d8c064b8 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-OSX-x64.json @@ -0,0 +1,175 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + }, + "PUBLISH_LZMA_TO_AZURE_BLOB": { + "value": "true" + } + }, + "demands": [ + "Agent.OS -equals darwin" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-OSX-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-RHEL7-x64.json b/buildpipeline/Dotnet-CLI-RHEL7-x64.json new file mode 100644 index 000000000..097342660 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-RHEL7-x64.json @@ -0,0 +1,190 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": true, + "alwaysRun": false, + "displayName": "Clean docker containers", + "timeoutInMinutes": 0, + "task": { + "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "bash", + "arguments": "-c \"docker ps -a -q -f status=exited | xargs --no-run-if-empty docker rm -v\"", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Run build in Docker container", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "scripts/dockerrun-as-current-user.sh", + "args": "-t --rm --sig-proxy=true --name $(Build.BuildId) -v $(Build.SourcesDirectory):/opt/code -w /opt/code -e CHANNEL -e CONNECTION_STRING -e REPO_ID -e REPO_USER -e REPO_PASS -e REPO_SERVER -e DOTNET_BUILD_SKIP_CROSSGEN -e PUBLISH_TO_AZURE_BLOB -e NUGET_FEED_URL -e NUGET_API_KEY -e GITHUB_PASSWORD -e ARTIFACT_STORAGE_KEY -e ARTIFACT_STORAGE_ACCOUNT -e ARTIFACT_STORAGE_CONTAINER -e CHECKSUM_STORAGE_KEY -e CHECKSUM_STORAGE_ACCOUNT -e CHECKSUM_STORAGE_CONTAINER chcosta/dotnetcore:rhel7_prereqs /bin/bash -c \"HOME=/opt/code; git clean -X -d -f; ./build.sh $(BuildArguments)\"", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --targets Default /p:BranchName=sandbox", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-RHEL7-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Signing-Windows-x64.json b/buildpipeline/Dotnet-CLI-Signing-Windows-x64.json new file mode 100644 index 000000000..56d87e9fc --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Signing-Windows-x64.json @@ -0,0 +1,547 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Install Signing Plugin", + "timeoutInMinutes": 0, + "task": { + "id": "30666190-6959-11e5-9f96-f56098202fef", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "signType": "$(PB_SignType)", + "zipSources": "false", + "version": "", + "feedSource": "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Compile", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:Compile", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Assemblies", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:PostCompileSign $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "x64", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign NuPkg Contents", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignNuPkgContents $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "x64", + "msbuildLocation": "" + } + }, + { + "enabled": false, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Test", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:Test", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Package", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:Package", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign MSI and CAB", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignMsiAndCab $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "x64", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Generate Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:Package", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Extract Engine from Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:ExtractEngineFromSdkBundle", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Engine", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignEngine $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "x64", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Reattach Engine to Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /t:ReattachEngineToSdkBundle", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignCliBundle $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "x64", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Perform Cleanup Tasks", + "timeoutInMinutes": 0, + "task": { + "id": "521a94ea-9e68-468a-8167-6dcf361ea776", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Download NuGet.exe", + "timeoutInMinutes": 0, + "task": { + "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "scriptType": "inlineScript", + "scriptName": "", + "arguments": "", + "inlineScript": "# Download nuget.exe to .nuget/nuget.exe\n$NuGetDir = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \".nuget\"\n$NuGetExe = Join-Path $NuGetDir \"nuget.exe\"\n \nif (-not (Test-Path $NuGetDir))\n{\n New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null\n}\n\nif (-not (Test-Path $NuGetExe)) {\n Write-Host 'Downloading nuget.exe to ' + $NuGetExe\n wget https://dist.nuget.org/win-x86-commandline/v3.5.0-rc1/NuGet.exe -OutFile $NuGetExe\n}", + "workingFolder": "", + "failOnStandardError": "true" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Publish NuGet Packages", + "timeoutInMinutes": 0, + "task": { + "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "scriptType": "inlineScript", + "scriptName": "", + "arguments": "$(MygetApiKey)", + "inlineScript": "$NuGetExe = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \".nuget\\nuget.exe\"\n\n& $NuGetExe push -Source https://dotnet.myget.org/F/dotnet-cli-private/ -ApiKey $args[0] artifacts\\$env:RID\\packages\\Microsoft*.nupkg", + "workingFolder": "", + "failOnStandardError": "true" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Publish Build Artifacts", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "/p:Configuration=$(BuildConfiguration) /p:BranchName=sandbox /t:Publish", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Publish Windows Installer NuPkg to VS Feed", + "timeoutInMinutes": 0, + "task": { + "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "scriptType": "inlineScript", + "scriptName": "", + "arguments": "$(VS_FEED_PASSWORD)", + "inlineScript": "$NuGetExe = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \".nuget\\nuget.exe\"\n$Nupkg = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \"artifacts\\$env:RID\\packages\\VS.Redist.Common.Net.Core.SDK.x64*.nupkg\"\n\n& $NuGetExe sources Add -Name \"VS\" -Source $env:VS_FEED_URL -username foobar -password $args[0]\n\n& $NuGetExe push -Source \"VS\" -ApiKey VSTS $Nupkg", + "workingFolder": "", + "failOnStandardError": "true" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "-Configuration ${BuildConfiguration} -Targets Default -NoPackage", + "allowOverride": true + }, + "COREHOST_TRACE": { + "value": "0", + "allowOverride": true + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ProductMoniker": { + "value": "Microsoft .NET Core 1.0.1 - SDK 1.0.0 Preview 4 (x64)" + }, + "VS_FEED_URL": { + "value": "https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-cli-test/nuget/v3/index.json" + }, + "VS_FEED_PASSWORD": { + "value": null, + "isSecret": true + }, + "MygetApiKey": { + "value": null, + "isSecret": true + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true", + "allowOverride": true + }, + "InternalCertificateId": { + "value": "400" + }, + "ExternalCertificateId": { + "value": "135020001" + }, + "RID": { + "value": "win81-x64" + }, + "MsbuildSigningArguments": { + "value": "/p:Rid=$(RID) /p:Architecture=x64 /v:detailed" + }, + "TeamName": { + "value": "DotNetCore" + }, + "system.debug": { + "value": "false" + } + }, + "demands": [ + "Agent.OS -equals Windows_NT" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ + "build.SourceLabel" + ], + "artifactTypesToDelete": [ ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 120, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Signing-Windows-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Signing-Windows-x86.json b/buildpipeline/Dotnet-CLI-Signing-Windows-x86.json new file mode 100644 index 000000000..39429e805 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Signing-Windows-x86.json @@ -0,0 +1,498 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Install Signing Plugin", + "timeoutInMinutes": 0, + "task": { + "id": "30666190-6959-11e5-9f96-f56098202fef", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "signType": "$(PB_SignType)", + "zipSources": "false", + "version": "", + "feedSource": "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Compile", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:Compile /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Assemblies", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:PostCompileSign $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "$(BuildArchitecture)", + "msbuildLocation": "" + } + }, + { + "enabled": false, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Test", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:Compile /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Package", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:Package /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign MSI and CAB", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignMsiAndCab $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "$(BuildArchitecture)", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Generate Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:Package /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Extract Engine from Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:ExtractEngineFromSdkBundle /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Engine", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignEngine $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "$(BuildArchitecture)", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Reattach Engine to Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /t:ReattachEngineToSdkBundle /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Sign Bundle", + "timeoutInMinutes": 0, + "task": { + "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "solution": "build\\Microsoft.DotNet.Cli.Signing.proj", + "platform": "", + "configuration": "$(BuildConfiguration)", + "msbuildArguments": "/t:SignCliBundle $(MsbuildSigningArguments)", + "clean": "false", + "maximumCpuCount": "false", + "restoreNugetPackages": "false", + "logProjectEvents": "false", + "createLogFile": "false", + "msbuildLocationMethod": "version", + "msbuildVersion": "15.0", + "msbuildArchitecture": "$(BuildArchitecture)", + "msbuildLocation": "" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Perform Cleanup Tasks", + "timeoutInMinutes": 0, + "task": { + "id": "521a94ea-9e68-468a-8167-6dcf361ea776", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Publish Build Artifacts", + "timeoutInMinutes": 0, + "task": { + "id": "bfc8bf76-e7ac-4a8c-9a55-a944a9f632fd", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "build.cmd", + "arguments": "-Architecture $(BuildArchitecture) /p:Configuration=$(BuildConfiguration) /p:BranchName=sandbox /t:Publish /v:normal", + "modifyEnvironment": "false", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Download NuGet.exe", + "timeoutInMinutes": 0, + "task": { + "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "scriptType": "inlineScript", + "scriptName": "", + "arguments": "", + "inlineScript": "# Download nuget.exe to .nuget/nuget.exe\n$NuGetDir = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \".nuget\"\n$NuGetExe = Join-Path $NuGetDir \"nuget.exe\"\n \nif (-not (Test-Path $NuGetDir))\n{\n New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null\n}\n\nif (-not (Test-Path $NuGetExe)) {\n Write-Host 'Downloading nuget.exe to ' + $NuGetExe\n wget https://dist.nuget.org/win-x86-commandline/v3.5.0-rc1/NuGet.exe -OutFile $NuGetExe\n}", + "workingFolder": "", + "failOnStandardError": "true" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Publish Windows Installer Nupkg to VS Feed", + "timeoutInMinutes": 0, + "task": { + "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "scriptType": "inlineScript", + "scriptName": "", + "arguments": "$(VS_FEED_PASSWORD)", + "inlineScript": "$NuGetExe = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \".nuget\\nuget.exe\"\n$Nupkg = Join-Path $env:BUILD_REPOSITORY_LOCALPATH \"artifacts\\$env:RID\\packages\\VS.Redist.Common.Net.Core.SDK.x86*.nupkg\"\n\n& $NuGetExe sources Add -Name \"VS\" -Source $env:VS_FEED_URL -username foobar -password $args[0]\n\n& $NuGetExe push -Source \"VS\" -ApiKey VSTS $Nupkg", + "workingFolder": "", + "failOnStandardError": "true" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "-Configuration ${BuildConfiguration} -Targets Default -NoPackage", + "allowOverride": true + }, + "COREHOST_TRACE": { + "value": "0", + "allowOverride": true + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "BuildArchitecture": { + "value": "x86" + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ProductMoniker": { + "value": "Microsoft .NET Core 1.0.1 - SDK 1.0.0 Preview 4 (x86)" + }, + "VS_FEED_URL": { + "value": "https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-cli-test/nuget/v3/index.json" + }, + "VS_FEED_PASSWORD": { + "value": null, + "isSecret": true + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CLIBUILD_SKIP_TESTS": { + "value": "true" + }, + "InternalCertificateId": { + "value": "400" + }, + "ExternalCertificateId": { + "value": "135020001" + }, + "RID": { + "value": "win81-x86" + }, + "MsbuildSigningArguments": { + "value": "/p:Rid=$(RID) /p:Architecture=x86 /v:detailed" + }, + "TeamName": { + "value": "DotNetCore" + }, + "system.debug": { + "value": "false" + } + }, + "demands": [ + "Agent.OS -equals Windows_NT" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ + "build.SourceLabel" + ], + "artifactTypesToDelete": [ ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 120, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Signing-Windows-x86", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Ubuntu14.04-x64.json b/buildpipeline/Dotnet-CLI-Ubuntu14.04-x64.json new file mode 100644 index 000000000..ba1b16245 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Ubuntu14.04-x64.json @@ -0,0 +1,182 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker ubuntu.14.04 --targets Default /p:BranchName=sandbox /p:SkipPublishToDebianRepo=true", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "REPO_ID": { + "value": "562fbfe0b2d7d0e0a43780c4" + }, + "REPO_USER": { + "value": "dotnet" + }, + "REPO_PASS": { + "value": "PassedViaPipeBuild" + }, + "REPO_SERVER": { + "value": "azure-apt-cat.cloudapp.net" + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ + "build.SourceLabel" + ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Ubuntu14.04-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/Dotnet-CLI-Ubuntu16.04-x64.json b/buildpipeline/Dotnet-CLI-Ubuntu16.04-x64.json new file mode 100644 index 000000000..9a660ed29 --- /dev/null +++ b/buildpipeline/Dotnet-CLI-Ubuntu16.04-x64.json @@ -0,0 +1,180 @@ +{ + "build": [ + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Shell Script build.sh", + "timeoutInMinutes": 0, + "task": { + "id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "scriptPath": "build.sh", + "args": "$(BuildArguments)", + "disableAutoCwd": "false", + "cwd": "", + "failOnStandardError": "false" + } + } + ], + "options": [ + { + "enabled": false, + "definition": { + "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" + }, + "inputs": { + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" + }, + "inputs": { + "multipliers": "[]", + "parallel": "false", + "continueOnError": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + "inputs": { + "workItemType": "4777", + "assignToRequestor": "true", + "additionalFields": "{}" + } + }, + { + "enabled": false, + "definition": { + "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" + }, + "inputs": { + "additionalFields": "{}" + } + } + ], + "variables": { + "BuildConfiguration": { + "value": "Release", + "allowOverride": true + }, + "BuildArguments": { + "value": "--skip-prereqs --configuration $(BuildConfiguration) --docker ubuntu.16.04 --targets Default /p:BranchName=sandbox /p:SkipPublishToDebianRepo=true", + "allowOverride": true + }, + "CONNECTION_STRING": { + "value": "PassedViaPipeBuild" + }, + "PUBLISH_TO_AZURE_BLOB": { + "value": "true", + "allowOverride": true + }, + "REPO_ID": { + "value": "562fbfe0b2d7d0e0a43780c4" + }, + "REPO_USER": { + "value": "dotnet" + }, + "REPO_PASS": { + "value": "PassedViaPipeBuild" + }, + "REPO_SERVER": { + "value": "azure-apt-cat.cloudapp.net" + }, + "GITHUB_PASSWORD": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "ARTIFACT_STORAGE_ACCOUNT": { + "value": "dotnetcli" + }, + "ARTIFACT_STORAGE_CONTAINER": { + "value": "mlorbe" + }, + "CHECKSUM_STORAGE_KEY": { + "value": "PassedViaPipeBuild" + }, + "CHECKSUM_STORAGE_ACCOUNT": { + "value": "dotnetclichecksums" + }, + "CHECKSUM_STORAGE_CONTAINER": { + "value": "mlorbe" + } + }, + "demands": [ + "Agent.OS -equals linux" + ], + "retentionRules": [ + { + "branches": [ + "+refs/heads/*" + ], + "artifacts": [ ], + "artifactTypesToDelete": [ + "FilePath", + "SymbolStore" + ], + "daysToKeep": 2, + "minimumToKeep": 1, + "deleteBuildRecord": true, + "deleteTestResults": true + } + ], + "buildNumberFormat": "$(Date:yyyMMdd)$(Rev:.r)", + "jobAuthorizationScope": "projectCollection", + "jobTimeoutInMinutes": 90, + "badgeEnabled": true, + "repository": { + "properties": { + "connectedServiceId": "f4c31735-42d2-4c3a-bc47-7ac06fd0dccc", + "apiUrl": "https://api.github.com/repos/dotnet/cli", + "branchesUrl": "https://api.github.com/repos/dotnet/cli/branches", + "cloneUrl": "https://github.com/dotnet/cli.git", + "refsUrl": "https://api.github.com/repos/dotnet/cli/git/refs", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "fetchDepth": "0", + "cleanOptions": "0" + }, + "id": "https://github.com/dotnet/cli.git", + "type": "GitHub", + "name": "dotnet/cli", + "url": "https://github.com/dotnet/cli.git", + "defaultBranch": "rel/1.0.0", + "clean": "true", + "checkoutSubmodules": false + }, + "quality": "definition", + "queue": { + "pool": { + "id": 39, + "name": "DotNet-Build" + }, + "id": 36, + "name": "DotNet-Build" + }, + "path": "\\", + "type": "build", + "id": 1, + "name": "Dotnet-CLI-Ubuntu16.04-x64", + "project": { + "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "name": "DevDiv", + "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", + "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", + "state": "wellFormed", + "revision": 418097459 + } +} diff --git a/buildpipeline/pipeline.json b/buildpipeline/pipeline.json new file mode 100644 index 000000000..ae63a5026 --- /dev/null +++ b/buildpipeline/pipeline.json @@ -0,0 +1,101 @@ +{ + "Repository": "cli", + "Definitions": { + "Path": ".", + "Type": "VSTS", + "BaseUrl": "https://devdiv.visualstudio.com/DefaultCollection" + }, + "Pipelines": [ + { + "Name": "Trusted-All-Release", + "Parameters": { + "TreatWarningsAsErrors": "false" + }, + "BuildParameters": { + "BuildConfiguration": "Release" + }, + "Definitions": [ + { + "Name": "DotNet-CLI-CentOS-x64", + "ReportingParameters": { + "OperatingSystem": "CentOS 7.1", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-Debian8-x64", + "ReportingParameters": { + "OperatingSystem": "Debian 8.2", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-Fedora23-x64", + "ReportingParameters": { + "OperatingSystem": "Fedora 23", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-opensuse13.2-x64", + "ReportingParameters": { + "OperatingSystem": "OpenSuse 13.2", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-OSX-x64", + "ReportingParameters": { + "OperatingSystem": "OSX", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-RHEL7-x64", + "ReportingParameters": { + "OperatingSystem": "RedHat 7", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-Signing-Windows-x64", + "ReportingParameters": { + "OperatingSystem": "Windows", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-Signing-Windows-x86", + "ReportingParameters": { + "OperatingSystem": "Windows", + "Type": "build/product/", + "Platform": "x86" + } + }, + { + "Name": "DotNet-CLI-Ubuntu14.04-x64", + "ReportingParameters": { + "OperatingSystem": "Ubuntu 14.04", + "Type": "build/product/", + "Platform": "x64" + } + }, + { + "Name": "DotNet-CLI-Ubuntu16.04-x64", + "ReportingParameters": { + "OperatingSystem": "Ubuntu 16.04", + "Type": "build/product/", + "Platform": "x64" + } + } + ] + } + ] +} diff --git a/scripts/dockerrun-as-current-user.sh b/scripts/dockerrun-as-current-user.sh new file mode 100644 index 000000000..70344cc3c --- /dev/null +++ b/scripts/dockerrun-as-current-user.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# +# 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. +# + +set -e + +docker run -u="$(id -u):$(id -g)" "$@" diff --git a/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs index 7756f77e7..265edd05e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs @@ -7,6 +7,13 @@ namespace Microsoft.DotNet.Cli.Utils { internal static class ExceptionExtensions { + public static TException DisplayAsError(this TException exception) + where TException : Exception + { + exception.Data.Add(CLI_User_Displayed_Exception, true); + return exception; + } + public static void ReportAsWarning(this Exception e) { Reporter.Verbose.WriteLine($"Warning: Ignoring exception: {e.ToString().Yellow()}"); diff --git a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs index 95238ecc0..9ffb204b9 100644 --- a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs +++ b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs @@ -10,9 +10,10 @@ namespace Microsoft.DotNet.Configurer { public class NuGetCachePrimer : INuGetCachePrimer { - private static string[] s_TemplatesUsedToPrimeCache = new string[] + private static IReadOnlyList> _templatesUsedToPrimeCache = new List>() { - "Console", + new List() { "mvc", "-f", "netcoreapp1.0", "-au", "Individual", "--debug:ephemeral-hive" }, + new List() { "mvc", "-f", "netcoreapp1.1", "-au", "Individual", "--debug:ephemeral-hive" } }; private readonly ICommandFactory _commandFactory; @@ -76,7 +77,7 @@ namespace Microsoft.DotNet.Configurer { bool succeeded = true; - foreach (string template in s_TemplatesUsedToPrimeCache) + foreach (IReadOnlyList templateInfo in _templatesUsedToPrimeCache) { if (succeeded) { @@ -84,7 +85,7 @@ namespace Microsoft.DotNet.Configurer { var workingDirectory = temporaryDotnetNewDirectory.DirectoryPath; - succeeded &= CreateTemporaryProject(workingDirectory, template); + succeeded &= CreateTemporaryProject(workingDirectory, templateInfo); if (succeeded) { @@ -100,11 +101,11 @@ namespace Microsoft.DotNet.Configurer } } - private bool CreateTemporaryProject(string workingDirectory, string templateName) + private bool CreateTemporaryProject(string workingDirectory, IReadOnlyList templateInfo) { return RunCommand( "new", - new[] { "-t", templateName }, + templateInfo, workingDirectory); } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/Files/IncludeContext.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/Files/IncludeContext.cs index bc90d63b0..7dbf25099 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/Files/IncludeContext.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/Files/IncludeContext.cs @@ -35,6 +35,8 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files throw new ArgumentNullException(nameof(rawObject)); } + CustomIncludePatterns = new List(); + CustomRemovePatterns = new List(); SourceBasePath = sourceBasePath; Option = option; var token = rawObject.Value(option); @@ -111,6 +113,10 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files public string Option { get; } + public List CustomIncludePatterns { get; } + + public List CustomRemovePatterns { get; } + public List IncludePatterns { get; } public List ExcludePatterns { get; } @@ -131,6 +137,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files return other != null && SourceBasePath == other.SourceBasePath && Option == other.Option && + EnumerableEquals(CustomIncludePatterns, other.CustomIncludePatterns) && EnumerableEquals(IncludePatterns, other.IncludePatterns) && EnumerableEquals(ExcludePatterns, other.ExcludePatterns) && EnumerableEquals(IncludeFiles, other.IncludeFiles) && diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs index d8332258a..976cc8502 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs @@ -230,10 +230,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration projectSearchPaths.Add(projectRootDirectory); var globalPaths = GetGlobalPaths(projectRootDirectory); - projectSearchPaths = projectSearchPaths.Union(globalPaths).ToList(); + projectSearchPaths = globalPaths.Union(projectSearchPaths).ToList(); var solutionPaths = GetSolutionPaths(slnFile); - projectSearchPaths = projectSearchPaths.Union(solutionPaths).ToList(); + projectSearchPaths = solutionPaths.Union(projectSearchPaths).ToList(); var projects = new Dictionary(StringComparer.Ordinal); @@ -328,11 +328,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration var projectJSONFilePath = Path.Combine(projectDirectory.FullName, "project.json"); var csProjFilePath = Path.Combine(projectDirectory.FullName, $"{projectDirectory.Name}.csproj"); - if (File.Exists(projectJSONFilePath) || File.Exists(csProjFilePath)) + if (File.Exists(projectJSONFilePath)) { var project = new ProjectDependency(projectDirectory.Name, projectJSONFilePath); projects.Add(project); } + else if (File.Exists(csProjFilePath)) + { + var project = new ProjectDependency(projectDirectory.Name, csProjFilePath); + projects.Add(project); + } } internal static List GetGlobalPaths(string rootPath) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index ef2183979..daa54aaf8 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -15,6 +15,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules { internal class MigrateBuildOptionsRule : IMigrationRule { + private const string BuiltInCompilerResourcesPattern = "compiler/resources/*"; + private AddPropertyTransform[] EmitEntryPointTransforms => new [] { @@ -171,15 +173,15 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules private Func> RemoveCompileFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => - RemoveCompileFilesTransform.Transform(compilerOptions.CompileInclude); + RemoveCompileFilesTransform.Transform(GetCompileRemoveContext(compilerOptions, projectDirectory)); private Func> EmbedFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => - EmbedFilesTransform.Transform(GetEmbedIncludeContext(compilerOptions)); + EmbedFilesTransform.Transform(GetEmbedIncludeContext(compilerOptions, projectDirectory)); private Func> RemoveEmbedFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => - RemoveEmbedFilesTransform.Transform(GetEmbedIncludeContext(compilerOptions)); + RemoveEmbedFilesTransform.Transform(GetEmbedRemoveContext(compilerOptions)); private Func> CopyToOutputFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => @@ -224,6 +226,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules ConstructTransformLists(); } + private bool ContainsCompilerResources(string projectDirectory) + { + return Directory.Exists(Path.Combine(projectDirectory, "compiler", "resources")); + } + private void ConstructTransformLists() { _propertyTransforms = new List>() @@ -342,7 +349,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules var configurationOutput = removeContextTransformExecutes(configurationCompilerOptions, projectDirectory, projectType); - if (configurationOutput != null) + if (configurationOutput != null && + !ItemRemovesAreEqual(nonConfigurationOutput, configurationOutput)) { transformApplicator.Execute(configurationOutput, itemGroup, mergeExisting: true); } @@ -372,6 +380,38 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules return configurationOutput == nonConfigurationOutput; } + private bool ItemRemovesAreEqual( + IEnumerable nonConfigurationOutput, + IEnumerable configurationOutput) + { + return Enumerable.SequenceEqual( + nonConfigurationOutput ?? EmptyArray.Value, + configurationOutput ?? EmptyArray.Value, + new ItemRemoveAttributeComparer()); + } + + private class ItemRemoveAttributeComparer : EqualityComparer + { + public override bool Equals(ProjectItemElement item1, ProjectItemElement item2) + { + if (item1 == null && item2 == null) + { + return true; + } + else if (item1 == null || item2 == null) + { + return false; + } + + return string.Equals(item1.Remove, item2.Remove, StringComparison.Ordinal); + } + + public override int GetHashCode(ProjectItemElement item) + { + return item.GetHashCode(); + } + } + private void PerformPropertyAndItemMappings( CommonCompilerOptions compilerOptions, ProjectPropertyGroupElement propertyGroup, @@ -428,7 +468,46 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules } } - private IncludeContext GetEmbedIncludeContext(CommonCompilerOptions compilerOptions) + private IncludeContext GetCompileRemoveContext( + CommonCompilerOptions compilerOptions, + string projectDirectory) + { + var includeContext = compilerOptions.CompileInclude; + if (includeContext == null && ContainsCompilerResources(projectDirectory)) + { + includeContext = new IncludeContext( + projectDirectory, + "compile", + new JObject(), + null, + null); + includeContext.CustomRemovePatterns.Add(BuiltInCompilerResourcesPattern); + } + return includeContext; + } + + private IncludeContext GetEmbedIncludeContext( + CommonCompilerOptions compilerOptions, + string projectDirectory) + { + var embedIncludeContext = compilerOptions.EmbedInclude; + embedIncludeContext?.BuiltInsExclude.Add("@(EmbeddedResource)"); + + if (embedIncludeContext == null && ContainsCompilerResources(projectDirectory)) + { + embedIncludeContext = new IncludeContext( + projectDirectory, + "embed", + new JObject(), + null, + null); + embedIncludeContext.CustomIncludePatterns.Add(BuiltInCompilerResourcesPattern); + } + + return embedIncludeContext; + } + + private IncludeContext GetEmbedRemoveContext(CommonCompilerOptions compilerOptions) { var embedIncludeContext = compilerOptions.EmbedInclude; diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateRuntimeOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateRuntimeOptionsRule.cs index 3b808dd6a..5f7d63e3b 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateRuntimeOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateRuntimeOptionsRule.cs @@ -1,6 +1,8 @@ // 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 Microsoft.DotNet.ProjectJsonMigration.Transforms; +using Newtonsoft.Json.Linq; using System; using System.IO; @@ -8,8 +10,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules { internal class MigrateRuntimeOptionsRule : IMigrationRule { + private const string ConfigPropertiesTokenName = "configProperties"; + private const string SystemGCServerTokenName = "System.GC.Server"; + private readonly ITransformApplicator _transformApplicator; private static readonly string s_runtimeOptionsFileName = "runtimeconfig.template.json"; + public MigrateRuntimeOptionsRule(ITransformApplicator transformApplicator = null) + { + _transformApplicator = transformApplicator ?? new TransformApplicator(); + } + public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs) { var projectContext = migrationRuleInputs.DefaultProjectContext; @@ -24,8 +34,69 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules String.Format(LocalizableStrings.ProjAlreadyExistsError, outputRuntimeOptionsFile)).Throw(); } - File.WriteAllText(outputRuntimeOptionsFile, raw); + var runtimeOptions = JObject.Parse(raw); + if (HasServerGCProperty(runtimeOptions)) + { + bool serverGCValue = GetServerGCValue(runtimeOptions); + + if (!IsServerGCValueInjectedBySdk(serverGCValue, projectContext.ProjectFile.GetProjectType())) + { + var propertyTransform = new AddPropertyTransform( + "ServerGarbageCollection", + gcValue => gcValue.ToString().ToLower(), + gcValue => true); + + _transformApplicator.Execute( + propertyTransform.Transform(serverGCValue), + migrationRuleInputs.CommonPropertyGroup, + true); + } + + RemoveServerGCProperty(runtimeOptions); + } + + if (runtimeOptions.HasValues) + { + File.WriteAllText(outputRuntimeOptionsFile, runtimeOptions.ToString()); + } } - } + } + + private bool IsServerGCValueInjectedBySdk(bool serverGCValue, ProjectType projectType) + { + return (projectType == ProjectType.Web && serverGCValue); + } + + private bool HasServerGCProperty(JObject runtimeOptions) + { + bool hasServerGCProperty = false; + + var configProperties = runtimeOptions.Value(ConfigPropertiesTokenName); + if (configProperties != null) + { + hasServerGCProperty = configProperties[SystemGCServerTokenName] != null; + } + + return hasServerGCProperty; + } + + private bool GetServerGCValue(JObject runtimeOptions) + { + var configProperties = runtimeOptions[ConfigPropertiesTokenName]; + return configProperties.Value(SystemGCServerTokenName); + } + + private void RemoveServerGCProperty(JObject runtimeOptions) + { + var configProperties = runtimeOptions.Value(ConfigPropertiesTokenName); + if (configProperties != null) + { + configProperties.Remove(SystemGCServerTokenName); + if (!configProperties.HasValues) + { + runtimeOptions.Remove(ConfigPropertiesTokenName); + } + } + } } } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Transforms/UpdateContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Transforms/UpdateContextTransform.cs index 72c6f3b68..4e3080f52 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Transforms/UpdateContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Transforms/UpdateContextTransform.cs @@ -36,7 +36,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms includeContext => { var fullIncludeSet = includeContext.IncludePatterns.OrEmptyIfNull() - .Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); + .Union(includeContext.BuiltInsInclude.OrEmptyIfNull()) + .Union(includeContext.CustomIncludePatterns.OrEmptyIfNull()); return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); }, @@ -47,6 +48,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Count > 0) || (includeContext.BuiltInsInclude != null && includeContext.BuiltInsInclude.Count > 0) + || + (includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Count > 0) ); }); diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs index e71bcf923..e8ff641e3 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs @@ -23,16 +23,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms .Where((pattern) => !_excludePatternRule(pattern)), includeContext.SourceBasePath), includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath), - includeContext => includeContext != null - && includeContext.IncludeFiles != null + includeContext => includeContext != null + && includeContext.IncludeFiles != null && includeContext.IncludeFiles.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0); protected virtual Func> IncludeExcludeTransformGetter => (itemName) => new AddItemTransform( itemName, - includeContext => + includeContext => { - var fullIncludeSet = includeContext.IncludePatterns.OrEmptyIfNull(); + var fullIncludeSet = includeContext.IncludePatterns.OrEmptyIfNull() + .Union(includeContext.CustomIncludePatterns.OrEmptyIfNull()); if (_emitBuiltInIncludes) { fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); @@ -50,12 +51,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms return FormatGlobPatternsForMsbuild(fullExcludeSet, includeContext.SourceBasePath); }, - includeContext => + includeContext => { return includeContext != null && - ( + ( (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0) || + (includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0) + || (_emitBuiltInIncludes && includeContext.BuiltInsInclude != null && includeContext.BuiltInsInclude.Count > 0) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs index 1dae3a581..6da010c8e 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs @@ -21,7 +21,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms includeContext => { var fullRemoveSet = includeContext.ExcludePatterns.OrEmptyIfNull() - .Union(includeContext.ExcludeFiles.OrEmptyIfNull()); + .Union(includeContext.ExcludeFiles.OrEmptyIfNull()) + .Union(includeContext.CustomRemovePatterns.OrEmptyIfNull()); return FormatGlobPatternsForMsbuild(fullRemoveSet, includeContext.SourceBasePath); }, @@ -32,6 +33,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms (includeContext.ExcludePatterns != null && includeContext.ExcludePatterns.Count > 0) || (includeContext.ExcludeFiles != null && includeContext.ExcludeFiles.Count > 0) + || + (includeContext.CustomRemovePatterns != null && includeContext.CustomRemovePatterns.Count > 0) ); }); diff --git a/src/dotnet/CommandLine/CommandLineApplication.cs b/src/dotnet/CommandLine/CommandLineApplication.cs index a7db54bce..087d89dda 100644 --- a/src/dotnet/CommandLine/CommandLineApplication.cs +++ b/src/dotnet/CommandLine/CommandLineApplication.cs @@ -136,7 +136,7 @@ namespace Microsoft.DotNet.Cli.CommandLine public int Execute(params string[] args) { CommandLineApplication command = this; - IEnumerator arguments = null; + CommandArgumentEnumerator arguments = null; if (HandleResponseFiles) { @@ -156,7 +156,10 @@ namespace Microsoft.DotNet.Cli.CommandLine else if (isLongOption || arg.StartsWith("-")) { CommandOption option; + var result = ParseOption(isLongOption, command, args, ref index, out option); + + if (result == ParseOptionResult.ShowHelp) { command.ShowHelp(); @@ -181,9 +184,9 @@ namespace Microsoft.DotNet.Cli.CommandLine } else { - if (arguments == null) + if (arguments == null || arguments.CommandName != command.Name) { - arguments = new CommandArgumentEnumerator(command.Arguments.GetEnumerator()); + arguments = new CommandArgumentEnumerator(command.Arguments.GetEnumerator(), command.Name); } if (arguments.MoveNext()) @@ -285,14 +288,24 @@ namespace Microsoft.DotNet.Cli.CommandLine else { index++; - arg = args[index]; - if (!option.TryParse(arg)) + + if (index < args.Length) + { + arg = args[index]; + if (!option.TryParse(arg)) + { + command.ShowHint(); + throw new CommandParsingException( + command, + String.Format(LocalizableStrings.UnexpectedValueForOptionError, arg, optionName)); + } + } + else { command.ShowHint(); throw new CommandParsingException( command, - String.Format(LocalizableStrings.UnexpectedValueForOptionError, arg, optionName)); - + String.Format(LocalizableStrings.OptionRequiresSingleValueWhichIsMissing, arg, optionName)); } } } @@ -629,11 +642,16 @@ namespace Microsoft.DotNet.Cli.CommandLine { private readonly IEnumerator _enumerator; - public CommandArgumentEnumerator(IEnumerator enumerator) + public CommandArgumentEnumerator( + IEnumerator enumerator, + string commandName) { + CommandName = commandName; _enumerator = enumerator; } + public string CommandName { get; } + public CommandArgument Current { get diff --git a/src/dotnet/CommandLine/LocalizableStrings.cs b/src/dotnet/CommandLine/LocalizableStrings.cs index 117be72fc..5458291a6 100644 --- a/src/dotnet/CommandLine/LocalizableStrings.cs +++ b/src/dotnet/CommandLine/LocalizableStrings.cs @@ -4,6 +4,8 @@ namespace Microsoft.DotNet.Cli.CommandLine { public const string LastArgumentMultiValueError = "The last argument '{0}' accepts multiple values. No more argument can be added."; + public const string OptionRequiresSingleValueWhichIsMissing = "Required value for option '{0}' was not provided."; + public const string UnexpectedValueForOptionError = "Unexpected value '{0}' for option '{1}'"; public const string UnexpectedArgumentError = "Unrecognized {0} '{1}'"; diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 47f8cc897..63119cdba 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -17,7 +17,6 @@ using Microsoft.DotNet.Tools.List; using Microsoft.DotNet.Tools.Migrate; using Microsoft.DotNet.Tools.MSBuild; using Microsoft.DotNet.Tools.New; -using Microsoft.DotNet.Tools.New3; using Microsoft.DotNet.Tools.NuGet; using Microsoft.DotNet.Tools.Pack; using Microsoft.DotNet.Tools.Publish; @@ -43,8 +42,7 @@ namespace Microsoft.DotNet.Cli ["list"] = ListCommand.Run, ["migrate"] = MigrateCommand.Run, ["msbuild"] = MSBuildCommand.Run, - ["new"] = NewCommand.Run, - ["new3"] = New3CommandShim.Run, + ["new"] = NewCommandShim.Run, ["nuget"] = NuGetCommand.Run, ["pack"] = PackCommand.Run, ["publish"] = PublishCommand.Run, diff --git a/src/dotnet/commands/dotnet-migrate/TemporaryDotnetNewTemplateProject.cs b/src/dotnet/commands/dotnet-migrate/TemporaryDotnetNewTemplateProject.cs index 12fcbda25..41a008e1d 100644 --- a/src/dotnet/commands/dotnet-migrate/TemporaryDotnetNewTemplateProject.cs +++ b/src/dotnet/commands/dotnet-migrate/TemporaryDotnetNewTemplateProject.cs @@ -50,7 +50,7 @@ namespace Microsoft.DotNet.Tools.Migrate } Directory.CreateDirectory(tempDir); - RunCommand("new", new string[] {}, tempDir); + RunCommand("new", new string[] { "console", "-o", tempDir, "--debug:ephemeral-hive" }, tempDir); return tempDir; } @@ -77,8 +77,9 @@ namespace Microsoft.DotNet.Tools.Migrate { MigrationTrace.Instance.WriteLine(commandResult.StdOut); MigrationTrace.Instance.WriteLine(commandResult.StdErr); - - throw new GracefulException($"Failed to run {commandToExecute} in directory: {workingDirectory}"); + + string argList = string.Join(", ", args); + throw new GracefulException($"Failed to run {commandToExecute} with args: {argList} ... workingDirectory = {workingDirectory}"); } } } diff --git a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs index 5b5e68232..6b2b0f47f 100644 --- a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs +++ b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs @@ -41,10 +41,11 @@ namespace Microsoft.DotNet.Tools.MSBuild { Type loggerType = typeof(MSBuildLogger); - argsToForward = argsToForward.Concat(new[] - { - $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" - }); + argsToForward = argsToForward + .Concat(new[] + { + $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" + }); } catch (Exception) { @@ -54,7 +55,7 @@ namespace Microsoft.DotNet.Tools.MSBuild _forwardingApp = new ForwardingApp( GetMSBuildExePath(), - _msbuildRequiredParameters.Concat(argsToForward), + _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)), environmentVariables: _msbuildRequiredEnvironmentVariables); } @@ -77,6 +78,13 @@ namespace Microsoft.DotNet.Tools.MSBuild return app.Option("-v|--verbosity", LocalizableStrings.VerbosityOptionDescription, CommandOptionType.SingleValue); } + private static string Escape(string arg) => + // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 + (arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ? + arg.Replace(";", "%3B") + .Replace("://", ":%2F%2F") : + arg; + private static string GetMSBuildExePath() { return Path.Combine( diff --git a/src/dotnet/commands/dotnet-new/NewCommandShim.cs b/src/dotnet/commands/dotnet-new/NewCommandShim.cs new file mode 100644 index 000000000..e979ecb74 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/NewCommandShim.cs @@ -0,0 +1,73 @@ +// 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.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.TemplateEngine.Abstractions; +using Microsoft.TemplateEngine.Cli; +using Microsoft.TemplateEngine.Edge; +using Microsoft.TemplateEngine.Orchestrator.RunnableProjects; +using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Config; +using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Macros; +using Microsoft.TemplateEngine.Utils; + +namespace Microsoft.DotNet.Tools.New +{ + internal class NewCommandShim + { + private const string HostIdentifier = "dotnetcli"; + private const string CommandName = "new"; + + public static int Run(string[] args) + { + return New3Command.Run(CommandName, CreateHost(), FirstRun, args); + } + + private static ITemplateEngineHost CreateHost() + { + var builtIns = new Dictionary> + { + { new Guid("0C434DF7-E2CB-4DEE-B216-D7C58C8EB4B3"), () => typeof(RunnableProjectGenerator) }, + { new Guid("3147965A-08E5-4523-B869-02C8E9A8AAA1"), () => typeof(BalancedNestingConfig) }, + { new Guid("3E8BCBF0-D631-45BA-A12D-FBF1DE03AA38"), () => typeof(ConditionalConfig) }, + { new Guid("A1E27A4B-9608-47F1-B3B8-F70DF62DC521"), () => typeof(FlagsConfig) }, + { new Guid("3FAE1942-7257-4247-B44D-2DDE07CB4A4A"), () => typeof(IncludeConfig) }, + { new Guid("3D33B3BF-F40E-43EB-A14D-F40516F880CD"), () => typeof(RegionConfig) }, + { new Guid("62DB7F1F-A10E-46F0-953F-A28A03A81CD1"), () => typeof(ReplacementConfig) }, + { new Guid("370996FE-2943-4AED-B2F6-EC03F0B75B4A"), () => typeof(ConstantMacro) }, + { new Guid("BB625F71-6404-4550-98AF-B2E546F46C5F"), () => typeof(EvaluateMacro) }, + { new Guid("10919008-4E13-4FA8-825C-3B4DA855578E"), () => typeof(GuidMacro) }, + { new Guid("F2B423D7-3C23-4489-816A-41D8D2A98596"), () => typeof(NowMacro) }, + { new Guid("011E8DC1-8544-4360-9B40-65FD916049B7"), () => typeof(RandomMacro) }, + { new Guid("8A4D4937-E23F-426D-8398-3BDBD1873ADB"), () => typeof(RegexMacro) }, + { new Guid("B57D64E0-9B4F-4ABE-9366-711170FD5294"), () => typeof(SwitchMacro) }, + { new Guid("10919118-4E13-4FA9-825C-3B4DA855578E"), () => typeof(CaseChangeMacro) } + }.ToList(); + + var preferences = new Dictionary + { + { "prefs:language", "C#" }, + { "dotnet-cli-version", Product.Version } + }; + + return new DefaultTemplateEngineHost(HostIdentifier, "v" + Product.Version, CultureInfo.CurrentCulture.Name, preferences, builtIns); + } + + private static void FirstRun(IEngineEnvironmentSettings environmentSettings, IInstaller installer) + { + Paths paths = new Paths(environmentSettings); + var templatesDir = Path.Combine(paths.Global.BaseDir, "Templates"); + + if (paths.Exists(templatesDir)) + { + var layoutIncludedPackages = environmentSettings.Host.FileSystem.EnumerateFiles(templatesDir, "*.nupkg", SearchOption.TopDirectoryOnly); + installer.InstallPackages(layoutIncludedPackages); + } + } + } +} diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index 2de00e3da..8f88817f1 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -121,12 +121,14 @@ namespace Microsoft.DotNet.Tools.Run { throw new InvalidOperationException( $"{LocalizableStrings.RunCommandInvalidOperationException1} {directory}." + Environment.NewLine + - LocalizableStrings.RunCommandInvalidOperationException2); + LocalizableStrings.RunCommandInvalidOperationException2) + .DisplayAsError(); } else if (projectFiles.Length > 1) { throw new InvalidOperationException( - $"{LocalizableStrings.RunCommandInvalidOperationException3}'{directory}'{LocalizableStrings.RunCommandInvalidOperationException4}"); + $"{LocalizableStrings.RunCommandInvalidOperationException3}'{directory}'{LocalizableStrings.RunCommandInvalidOperationException4}") + .DisplayAsError(); } Project = projectFiles[0]; diff --git a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs index c965723b4..3e8920d03 100644 --- a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs @@ -55,8 +55,5 @@ public const string RunSettingsArgsHelpText = @"Any extra command-line runsettings arguments that should be passed to vstest. See 'dotnet vstest --help' for available options. Example: -- RunConfiguration.ResultsDirectory=""C:\users\user\desktop\Results Directory"" MSTest.DeploymentEnabled=false"; - - public const string CmdResultsDirectoryDescription = @"The test results directory will be created in the specified path if it does not exist. - Example: --results-directory "; } } diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index 26a57f494..89d0c3595 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -83,11 +83,6 @@ namespace Microsoft.DotNet.Tools.Test LocalizableStrings.CmdNoBuildDescription, CommandOptionType.NoValue); - var resultsDirectoryOption = cmd.Option( - "-r|--results-directory", - LocalizableStrings.CmdResultsDirectoryDescription, - CommandOptionType.SingleValue); - CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(cmd); cmd.OnExecute(() => @@ -134,11 +129,6 @@ namespace Microsoft.DotNet.Tools.Test msbuildArgs.Add($"/p:TargetFramework={frameworkOption.Value()}"); } - if (resultsDirectoryOption.HasValue()) - { - msbuildArgs.Add($"/p:VSTestResultsDirectory={resultsDirectoryOption.Value()}"); - } - if (outputOption.HasValue()) { msbuildArgs.Add($"/p:OutputPath={outputOption.Value()}"); diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index aa1c84896..2e08f9891 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -6,6 +6,8 @@ using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; +[assembly: CollectionBehavior(DisableTestParallelization = true)] + namespace Microsoft.DotNet.Tests.EndToEnd { public class GivenDotNetUsesMSBuild : TestBase @@ -17,9 +19,10 @@ namespace Microsoft.DotNet.Tests.EndToEnd { string projectDirectory = directory.Path; - new NewCommand() + string newArgs = "console --debug:ephemeral-hive"; + new NewCommandShim() .WithWorkingDirectory(projectDirectory) - .Execute("") + .Execute(newArgs) .Should().Pass(); new RestoreCommand() diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs index 413897165..c30b510b5 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs @@ -61,8 +61,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests _dotnetNewCommandMock = new Mock(); SetupCommandMock(_dotnetNewCommandMock); + commandFactoryMock - .Setup(c => c.Create("new", new[] { "-t", "Console" }, null, Constants.DefaultConfiguration)) + .Setup(c => c.Create("new", new[] { "mvc", "-f", "netcoreapp1.0", "-au", "Individual", "--debug:ephemeral-hive" }, null, Constants.DefaultConfiguration)) + .Returns(_dotnetNewCommandMock.Object); + commandFactoryMock + .Setup(c => c.Create("new", new[] { "mvc", "-f", "netcoreapp1.1", "-au", "Individual", "--debug:ephemeral-hive" }, null, Constants.DefaultConfiguration)) .Returns(_dotnetNewCommandMock.Object); _dotnetRestoreCommandMock = new Mock(); @@ -151,7 +155,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests _commandFactoryMock.Verify( c => c.Create( "restore", - new [] {"-s", $"{PACKAGES_ARCHIVE_PATH}"}, + new[] { "-s", $"{PACKAGES_ARCHIVE_PATH}" }, null, Constants.DefaultConfiguration), Times.Exactly(1)); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index 521618155..03405bb14 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -618,6 +618,61 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.Count(i => i.ItemType.Equals("Compile", StringComparison.Ordinal)).Should().Be(0); } + [Fact] + public void MigratingProjectWithCompileResourcesPopulatesAppropriateProjectItemElements() + { + var testDirectory = Temp.CreateDirectory().Path; + WriteCompileResourceFiles(testDirectory); + + var pj = @" + { + ""version"": ""1.0.0-*"", + ""dependencies"": { + ""NETStandard.Library"": ""1.6.0"" + }, + ""frameworks"": { + ""netstandard1.5"": {} + } + }"; + + var mockProj = RunBuildOptionsRuleOnPj(pj, testDirectory); + + var compileItems = mockProj.Items.Where(i => i.ItemType.Equals("Compile", StringComparison.Ordinal)); + compileItems.Count().Should().Be(1); + var compileItem = compileItems.Single(); + compileItem.Include.Should().BeEmpty(); + compileItem.Exclude.Should().BeEmpty(); + compileItem.Remove.Should().Be(@"compiler\resources\*"); + + var embeddedResourceItems = mockProj.Items.Where( + i => i.ItemType.Equals("EmbeddedResource", StringComparison.Ordinal)); + embeddedResourceItems.Count().Should().Be(1); + var embeddedResourceItem = embeddedResourceItems.Single(); + embeddedResourceItem.Include.Should().Be(@"compiler\resources\*"); + embeddedResourceItem.Exclude.Should().BeEmpty(); + embeddedResourceItem.Remove.Should().BeEmpty(); + } + + [Fact] + public void MigratingProjectWithoutCompileResourcesDoesNotAddProjectItemElements() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""version"": ""1.0.0-*"", + ""dependencies"": { + ""NETStandard.Library"": ""1.6.0"" + }, + ""frameworks"": { + ""netstandard1.5"": {} + } + }"; + + var mockProj = RunBuildOptionsRuleOnPj(pj, testDirectory); + mockProj.Items.Count.Should().Be(0); + } + private static IEnumerable GetDefaultExcludePatterns(string group) { var defaultExcludePatterns = new List(group == "copyToOutput" ? @@ -658,6 +713,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests File.WriteAllText(Path.Combine(directory, "rootfile.cs"), "content"); } + private void WriteCompileResourceFiles(string directory) + { + Directory.CreateDirectory(Path.Combine(directory, "compiler")); + Directory.CreateDirectory(Path.Combine(directory, "compiler", "resources")); + File.WriteAllText(Path.Combine(directory, "compiler", "resources", "file.cs"), "content"); + } + private ProjectRootElement RunBuildOptionsRuleOnPj(string s, string testDirectory = null) { testDirectory = testDirectory ?? Temp.CreateDirectory().Path; diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs index 028bda3a8..cbfb015a4 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs @@ -302,6 +302,27 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests item => item.ItemType == "ProjectReference" && item.Include == projectReferenceInclude); } + [Fact] + public void ItDoesNotReferenceTheProjectUnderBackupWhenMigratingAPartiallyMigratedStructure() + { + var testAssetsManager = GetTestGroupTestAssetsManager("NonRestoredTestProjects"); + var solutionDirectory = testAssetsManager.CreateTestInstance("PJHalfMigrated").Path; + + var appDirectory = Path.Combine(solutionDirectory, "ProjectB"); + + var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10); + var mockProj = ProjectRootElement.Create(); + var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(appDirectory, appDirectory, mockProj, null); + var testInputs = new MigrationRuleInputs(new[] {projectContext}, mockProj, mockProj.AddItemGroup(), + mockProj.AddPropertyGroup()); + new MigrateProjectDependenciesRule().Apply(testSettings, testInputs); + + var projectReferences = mockProj.Items.Where( + item => item.ItemType.Equals("ProjectReference", StringComparison.Ordinal)); + projectReferences.Should().ContainSingle(); + projectReferences.Single().Include.Should().Be(Path.Combine("..", "src", "ProjectA", "ProjectA.csproj")); + } + private ProjectRootElement MigrateProject(string solution, string project) { return MigrateProject(solution, project, FrameworkConstants.CommonFrameworks.NetCoreApp10); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs index 7dfad829a..6619b436c 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs @@ -23,7 +23,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests private static readonly string s_runtimeConfigFileName = "runtimeconfig.template.json"; [Fact] - public void RuntimeOptions_are_copied_from_projectJson_to_runtimeconfig_template_json_file() + public void RuntimeOptionsAreCopiedFromProjectJsonToRuntimeConfigTemplateJsonFile() { var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithRuntimeOptions"); var projectDir = testInstance.Path; @@ -47,7 +47,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } [Fact] - public void Migrating_ProjectJson_with_no_RuntimeOptions_produces_no_runtimeconfig_template_json_file() + public void MigratingProjectJsonWithNoRuntimeOptionsProducesNoRuntimeConfigTemplateJsonFile() { var testInstance = TestAssetsManager.CreateTestInstance("PJTestAppSimple"); var projectDir = testInstance.Path; @@ -62,5 +62,173 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests File.Exists(migratedRuntimeOptionsPath).Should().BeFalse(); } + + [Fact] + public void MigratingProjectJsonWithOnlyServerGCRuntimeOptionsProducesNoRuntimeConfigTemplateJsonFile() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": true + } + } + }"; + + RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var migratedRuntimeOptionsPath = Path.Combine(testDirectory, s_runtimeConfigFileName); + File.Exists(migratedRuntimeOptionsPath).Should().BeFalse(); + } + + [Fact] + public void MigratingProjectJsonWithServerGCAndOtherConfigPropertiesProducesRuntimeConfigTemplateJsonFile() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": false, + ""Other"": false + } + } + }"; + + RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var migratedRuntimeOptionsPath = Path.Combine(testDirectory, s_runtimeConfigFileName); + File.Exists(migratedRuntimeOptionsPath).Should().BeTrue(); + + var root = JObject.Parse(File.ReadAllText(migratedRuntimeOptionsPath)); + var configProperties = root.Value("configProperties"); + configProperties.Should().NotBeNull(); + configProperties["System.GC.Server"].Should().BeNull(); + configProperties["Other"].Should().NotBeNull(); + } + + [Fact] + public void MigratingProjectJsonWithServerGCAndOtherRuntimeOptionsProducesRuntimeConfigTemplateJsonFile() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": false + }, + ""Other"": false + } + }"; + + RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var migratedRuntimeOptionsPath = Path.Combine(testDirectory, s_runtimeConfigFileName); + File.Exists(migratedRuntimeOptionsPath).Should().BeTrue(); + + var root = JObject.Parse(File.ReadAllText(migratedRuntimeOptionsPath)); + root.Value("configProperties").Should().BeNull(); + } + + [Fact] + public void MigratingProjectJsonWithServerGCTrueProducesServerGarbageCollectionProperty() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": true + } + } + }"; + + var mockProj = RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var props = mockProj.Properties.Where(p => p.Name.Equals("ServerGarbageCollection", StringComparison.Ordinal)); + props.Count().Should().Be(1); + props.First().Value.Should().Be("true"); + } + + [Fact] + public void MigratingProjectJsonWithServerGCFalseProducesServerGarbageCollectionProperty() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": false + } + } + }"; + + var mockProj = RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var props = mockProj.Properties.Where(p => p.Name.Equals("ServerGarbageCollection", StringComparison.Ordinal)); + props.Count().Should().Be(1); + props.First().Value.Should().Be("false"); + } + + [Fact] + public void MigratingWebProjectJsonWithServerGCTrueDoesNotProduceServerGarbageCollectionProperty() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""buildOptions"": { + ""emitEntryPoint"": true + }, + ""dependencies"": { + ""Microsoft.AspNetCore.Mvc"": ""1.0.0"" + }, + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": true + } + } + }"; + + var mockProj = RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var props = mockProj.Properties.Where(p => p.Name.Equals("ServerGarbageCollection", StringComparison.Ordinal)); + props.Count().Should().Be(0); + } + + [Fact] + public void MigratingWebProjectJsonWithServerGCFalseProducesServerGarbageCollectionProperty() + { + var testDirectory = Temp.CreateDirectory().Path; + + var pj = @" + { + ""buildOptions"": { + ""emitEntryPoint"": true + }, + ""dependencies"": { + ""Microsoft.AspNetCore.Mvc"": ""1.0.0"" + }, + ""runtimeOptions"": { + ""configProperties"": { + ""System.GC.Server"": false + } + } + }"; + + var mockProj = RunMigrateRuntimeOptionsRulePj(pj, testDirectory); + var props = mockProj.Properties.Where(p => p.Name.Equals("ServerGarbageCollection", StringComparison.Ordinal)); + props.Count().Should().Be(1); + props.First().Value.Should().Be("false"); + } + + private ProjectRootElement RunMigrateRuntimeOptionsRulePj(string s, string testDirectory = null) + { + testDirectory = testDirectory ?? Temp.CreateDirectory().Path; + return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[] + { + new MigrateRuntimeOptionsRule() + }, s, testDirectory); + } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs new file mode 100644 index 000000000..ff7b0bc15 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs @@ -0,0 +1,29 @@ +// 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 Microsoft.DotNet.Cli.Utils; +using Xunit; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public sealed class NewCommandShim : TestCommand + { + public NewCommandShim() + : base("dotnet") + { + + } + + public override CommandResult Execute(string args = "") + { + args = $"new {args} --debug:ephemeral-hive"; + return base.Execute(args); + } + + public override CommandResult ExecuteWithCapturedOutput(string args = "") + { + args = $"new {args} --debug:ephemeral-hive"; + return base.ExecuteWithCapturedOutput(args); + } + } +} diff --git a/test/dotnet-add-package.Tests/GivenDotnetPackageAdd.cs b/test/dotnet-add-package.Tests/GivenDotnetPackageAdd.cs index def951aec..3cf2cd76c 100644 --- a/test/dotnet-add-package.Tests/GivenDotnetPackageAdd.cs +++ b/test/dotnet-add-package.Tests/GivenDotnetPackageAdd.cs @@ -2,18 +2,23 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; -using Microsoft.Build.Construction; -using Microsoft.DotNet.Cli.Sln.Internal; using Microsoft.DotNet.Tools.Test.Utilities; using System; using System.IO; using System.Linq; using Xunit; +using Xunit.Abstractions; namespace Microsoft.DotNet.Cli.Package.Add.Tests { public class GivenDotnetPackageAdd : TestBase { + private readonly ITestOutputHelper _output; + + public GivenDotnetPackageAdd(ITestOutputHelper output) + { + _output = output; + } [Fact] public void WhenValidPackageIsPassedBeforeVersionItGetsAdded() @@ -37,6 +42,35 @@ namespace Microsoft.DotNet.Cli.Package.Add.Tests cmd.StdErr.Should().BeEmpty(); } + [Fact] + public void + WhenValidProjectAndPackageArePassedItGetsAdded() + { + var testAsset = "TestAppSimple"; + var projectDirectory = TestAssets + .Get(testAsset) + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + var csproj = $"{projectDirectory + Path.DirectorySeparatorChar + testAsset}.csproj"; + var packageName = "Newtonsoft.Json"; + var packageVersion = "9.0.1"; + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput($"add {csproj} package {packageName} --version {packageVersion}"); + + _output.WriteLine($"[STDOUT] {cmd.StdOut}\n[STDERR]{cmd.StdErr}\n"); + + cmd.Should().Pass(); + + cmd.StdOut.Should() + .Contain($"PackageReference for package \'{packageName}\' version \'{packageVersion}\' added to file '{csproj}'."); + + cmd.StdErr.Should().BeEmpty(); + } + [Fact] public void WhenValidPackageIsPassedAfterVersionItGetsAdded() { diff --git a/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs b/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs index 9d60d27f9..2c2087934 100644 --- a/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs +++ b/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs @@ -58,9 +58,10 @@ Additional Arguments: try { - new NewCommand() + string args = $"classlib -o \"{dir.Path}\" --debug:ephemeral-hive"; + new NewCommandShim() .WithWorkingDirectory(dir.Path) - .ExecuteWithCapturedOutput("-t Lib") + .ExecuteWithCapturedOutput(args) .Should().Pass(); } catch (System.ComponentModel.Win32Exception e) diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs index 1bb59fc4d..781f7c985 100644 --- a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs +++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs @@ -46,9 +46,10 @@ namespace Microsoft.DotNet.Cli.Build.Tests string dir = "pkgs"; string args = $"--packages {dir}"; - new NewCommand() + string newArgs = $"console -o \"{rootPath}\" --debug:ephemeral-hive"; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute() + .Execute(newArgs) .Should() .Pass(); diff --git a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs index 6d82863b2..4dfc6dbeb 100644 --- a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs +++ b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs @@ -193,9 +193,10 @@ Options: try { - new NewCommand() + string newArgs = $"classlib -o \"{dir.Path}\" --debug:ephemeral-hive"; + new NewCommandShim() .WithWorkingDirectory(dir.Path) - .ExecuteWithCapturedOutput("-t Lib") + .ExecuteWithCapturedOutput(newArgs) .Should().Pass(); } catch (System.ComponentModel.Win32Exception e) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 0559cfedb..45aa52e7b 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -19,6 +19,8 @@ using Newtonsoft.Json.Linq; using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand; +[assembly: CollectionBehavior(DisableTestParallelization = true)] + namespace Microsoft.DotNet.Migration.Tests { public class GivenThatIWantToMigrateTestApps : TestBase diff --git a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs index dde27668c..117f34bae 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs @@ -5,18 +5,27 @@ using System; using System.Linq; using System.Linq.Expressions; using System.Reflection; +using System.Runtime.InteropServices; using FluentAssertions; using Microsoft.DotNet.Configurer; using Microsoft.DotNet.Tools.MSBuild; using Microsoft.DotNet.Tools.Test.Utilities; using NuGet.Protocol; using Xunit; +using Xunit.Abstractions; using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand; namespace Microsoft.DotNet.Cli.MSBuild.Tests { public class GivenDotnetMSBuildBuildsProjects : TestBase { + private readonly ITestOutputHelper _output; + + public GivenDotnetMSBuildBuildsProjects(ITestOutputHelper output) + { + _output = output; + } + [Fact] public void ItRunsSpecifiedTargetsWithPropertiesCorrectly() { @@ -76,6 +85,37 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests } } + [Fact] + public void WhenRestoreSourcesStartsWithUnixPathThenHttpsSourceIsParsedCorrectly() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return; + } + + // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 + var testInstance = TestAssets.Get("LibraryWithUnresolvablePackageReference") + .CreateInstance() + .WithSourceFiles(); + + var root = testInstance.Root; + var somePathThatExists = "/usr/local/bin"; + + var result = new DotnetCommand() + .WithWorkingDirectory(root) + .Execute($"msbuild /p:RestoreSources={somePathThatExists};https://api.nuget.org/v3/index.json /t:restore LibraryWithUnresolvablePackageReference.csproj"); + + _output.WriteLine($"[STDOUT]\n{result.StdOut}\n[STDERR]\n{result.StdErr}"); + + result.Should().Fail(); + + result.StdOut.Should() + .ContainVisuallySameFragment( +@"Feeds used: + /usr/local/bin + https://api.nuget.org/v3/index.json"); + } + [Fact] public void WhenDotnetRunHelpIsInvokedAppArgumentsTextIsIncludedInOutput() { @@ -85,7 +125,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests var result = new TestCommand("dotnet") .WithWorkingDirectory(projectDirectory.Path) .ExecuteWithCapturedOutput("run --help"); - + result.ExitCode.Should().Be(0); result.StdOut.Should().Contain(AppArgumentsText); } diff --git a/test/dotnet-new.Tests/GivenThatIWantANewApp.cs b/test/dotnet-new.Tests/GivenThatIWantANewApp.cs index 2d38f2c53..c1700b239 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewApp.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewApp.cs @@ -1,9 +1,9 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// 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 Microsoft.DotNet.Tools.Test.Utilities; using System; using System.IO; -using Microsoft.DotNet.Tools.Test.Utilities; using FluentAssertions; using Xunit; @@ -17,53 +17,52 @@ namespace Microsoft.DotNet.New.Tests var rootPath = TestAssetsManager.CreateTestDirectory().Path; new TestCommand("dotnet") { WorkingDirectory = rootPath } - .Execute("new"); + .Execute($"new console --debug:ephemeral-hive"); DateTime expectedState = Directory.GetLastWriteTime(rootPath); var result = new TestCommand("dotnet") { WorkingDirectory = rootPath } - .ExecuteWithCapturedOutput("new"); + .ExecuteWithCapturedOutput($"new console --debug:ephemeral-hive"); DateTime actualState = Directory.GetLastWriteTime(rootPath); Assert.Equal(expectedState, actualState); - result.Should().Fail() - .And.HaveStdErr(); + result.Should().Fail(); + } + + [Fact] + public void RestoreDoesNotUseAnyCliProducedPackagesOnItsTemplates() + { + string[] cSharpTemplates = new[] { "console", "classlib", "mstest", "xunit", "web", "mvc", "webapi" }; + + var rootPath = TestAssetsManager.CreateTestDirectory().Path; + var packagesDirectory = Path.Combine(rootPath, "packages"); + + foreach (string cSharpTemplate in cSharpTemplates) + { + var projectFolder = Path.Combine(rootPath, cSharpTemplate + "1"); + Directory.CreateDirectory(projectFolder); + CreateAndRestoreNewProject(cSharpTemplate, projectFolder, packagesDirectory); + } + + Directory.EnumerateFiles(packagesDirectory, $"*.nupkg", SearchOption.AllDirectories) + .Should().NotContain(p => p.Contains("Microsoft.DotNet.Cli.Utils")); + } + + private void CreateAndRestoreNewProject( + string projectType, + string projectFolder, + string packagesDirectory) + { + new TestCommand("dotnet") { WorkingDirectory = projectFolder } + .Execute($"new {projectType} --debug:ephemeral-hive") + .Should().Pass(); + + new RestoreCommand() + .WithWorkingDirectory(projectFolder) + .Execute($"--packages {packagesDirectory} /p:SkipInvalidConfigurations=true") + .Should().Pass(); } - - [Fact] - public void RestoreDoesNotUseAnyCliProducedPackagesOnItsTemplates() - { - var cSharpTemplates = new [] { "Console", "Lib", "Web", "Mstest", "XUnittest" }; - - var rootPath = TestAssetsManager.CreateTestDirectory().Path; - var packagesDirectory = Path.Combine(rootPath, "packages"); - - foreach (var cSharpTemplate in cSharpTemplates) - { - var projectFolder = Path.Combine(rootPath, cSharpTemplate); - Directory.CreateDirectory(projectFolder); - CreateAndRestoreNewProject(cSharpTemplate, projectFolder, packagesDirectory); - } - - Directory.EnumerateFiles(packagesDirectory, $"*.nupkg", SearchOption.AllDirectories) - .Should().NotContain(p => p.Contains("Microsoft.DotNet.Cli.Utils")); - } - - private void CreateAndRestoreNewProject( - string projectType, - string projectFolder, - string packagesDirectory) - { - new TestCommand("dotnet") { WorkingDirectory = projectFolder } - .Execute($"new --type {projectType}") - .Should().Pass(); - - new RestoreCommand() - .WithWorkingDirectory(projectFolder) - .Execute($"--packages {packagesDirectory} /p:SkipInvalidConfigurations=true") - .Should().Pass(); - } } } diff --git a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs index 00621c34a..3588bc3fc 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs @@ -1,13 +1,9 @@ -// 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; using System.Collections.Generic; using System.IO; -using System.Linq; +using System.Text; +using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Xunit; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; @@ -17,26 +13,27 @@ namespace Microsoft.DotNet.New.Tests public class GivenThatIWantANewAppWithSpecifiedType : TestBase { [Theory] - [InlineData("C#", "Console", false)] - [InlineData("C#", "Lib", false)] - [InlineData("C#", "Web", true)] - [InlineData("C#", "Mstest", false)] - [InlineData("C#", "XUnittest", false)] - [InlineData("F#", "Console", false)] - [InlineData("F#", "Lib", false)] - [InlineData("F#", "Web", true)] - [InlineData("F#", "Mstest", false)] - [InlineData("F#", "XUnittest", false)] + [InlineData("C#", "console", false)] + [InlineData("C#", "classlib", false)] + [InlineData("C#", "mstest", false)] + [InlineData("C#", "xunit", false)] + [InlineData("C#", "web", true)] + [InlineData("C#", "mvc", true)] + [InlineData("C#", "webapi", true)] + [InlineData("F#", "console", false)] + [InlineData("F#", "classlib", false)] + [InlineData("F#", "mstest", false)] + [InlineData("F#", "xunit", false)] + [InlineData("F#", "mvc", true)] public void TemplateRestoresAndBuildsWithoutWarnings( string language, string projectType, bool useNuGetConfigForAspNet) { - var rootPath = TestAssetsManager.CreateTestDirectory(identifier: $"{language}_{projectType}").Path; + string rootPath = TestAssetsManager.CreateTestDirectory(identifier: $"{language}_{projectType}").Path; - new TestCommand("dotnet") - .WithWorkingDirectory(rootPath) - .Execute($"new --type {projectType} --lang {language}") + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute($"new {projectType} -lang {language} -o {rootPath} --debug:ephemeral-hive") .Should().Pass(); if (useNuGetConfigForAspNet) diff --git a/test/dotnet-new.Tests/NewCommandTests.cs b/test/dotnet-new.Tests/NewCommandTests.cs index 2ab41b0a6..4a9c7d115 100644 --- a/test/dotnet-new.Tests/NewCommandTests.cs +++ b/test/dotnet-new.Tests/NewCommandTests.cs @@ -3,10 +3,7 @@ using FluentAssertions; using Microsoft.DotNet.Tools.Test.Utilities; -using System; -using System.Linq; using Xunit; -using Xunit.Abstractions; namespace Microsoft.DotNet.New.Tests { @@ -18,9 +15,18 @@ namespace Microsoft.DotNet.New.Tests var cmd = new DotnetCommand().Execute("new Web1.1"); cmd.ExitCode.Should().NotBe(0); - - cmd.StdErr.Should().Be("Unrecognized command or argument 'Web1.1'"); - cmd.StdOut.Should().Be("Specify --help for a list of available options and commands."); - } - } + + cmd.StdErr.Should().StartWith("No templates matched the input template name: [Web1.1]"); + } + + [Fact] + public void WhenTemplateNameIsNotUniquelyMatchedThenItIndicatesProblemToUser() + { + var cmd = new DotnetCommand().Execute("new c"); + + cmd.ExitCode.Should().NotBe(0); + + cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: [c]"); + } + } } diff --git a/test/dotnet-pack.Tests/PackTests.cs b/test/dotnet-pack.Tests/PackTests.cs index 661ce5fd8..d2c4eeb1c 100644 --- a/test/dotnet-pack.Tests/PackTests.cs +++ b/test/dotnet-pack.Tests/PackTests.cs @@ -216,9 +216,10 @@ namespace Microsoft.DotNet.Tools.Pack.Tests string dir = "pkgs"; string args = $"--packages {dir}"; - new NewCommand() + string newArgs = $"console -o \"{rootPath}\""; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute() + .Execute(newArgs) .Should() .Pass(); diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 18f1c2a79..8db62ef97 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -93,9 +93,10 @@ namespace Microsoft.DotNet.Cli.Publish.Tests string dir = "pkgs"; string args = $"--packages {dir}"; - new NewCommand() + string newArgs = $"console -o \"{rootPath}\""; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute() + .Execute(newArgs) .Should() .Pass(); diff --git a/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs b/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs index 4e8717b3e..0826feeb9 100644 --- a/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs +++ b/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs @@ -55,9 +55,10 @@ Additional Arguments: try { - new NewCommand() + string newArgs = $"classlib -o \"{dir.Path}\""; + new NewCommandShim() .WithWorkingDirectory(dir.Path) - .ExecuteWithCapturedOutput("-t Lib") + .ExecuteWithCapturedOutput(newArgs) .Should().Pass(); } catch (System.ComponentModel.Win32Exception e) diff --git a/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs b/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs index 6113b1485..cbe226760 100644 --- a/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs +++ b/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs @@ -22,9 +22,10 @@ namespace Microsoft.DotNet.Restore.Tests string dir = "pkgs"; string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir)); - new NewCommand() + string newArgs = $"console -o \"{rootPath}\""; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute() + .Execute(newArgs) .Should() .Pass(); @@ -48,9 +49,10 @@ namespace Microsoft.DotNet.Restore.Tests string dir = "pkgs"; string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir)); - new NewCommand() + string newArgs = $"classlib -o \"{rootPath}\""; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute("-t lib") + .Execute(newArgs) .Should() .Pass(); diff --git a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs index 3070f4cb5..2ef0f627f 100644 --- a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs +++ b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs @@ -123,9 +123,10 @@ namespace Microsoft.DotNet.Cli.Run.Tests string dir = "pkgs"; string args = $"--packages {dir}"; - new NewCommand() + string newArgs = $"console -o \"{rootPath}\""; + new NewCommandShim() .WithWorkingDirectory(rootPath) - .Execute() + .Execute(newArgs) .Should() .Pass(); diff --git a/test/dotnet.Tests/CommandLineApplicationTests.cs b/test/dotnet.Tests/CommandLineApplicationTests.cs new file mode 100644 index 000000000..8a7237dd3 --- /dev/null +++ b/test/dotnet.Tests/CommandLineApplicationTests.cs @@ -0,0 +1,26 @@ +using System; +using FluentAssertions; +using Microsoft.DotNet.Cli.CommandLine; +using Xunit; + +namespace Microsoft.DotNet.Tests +{ + public class CommandLineApplicationTests + { + [Fact] + public void WhenAnOptionRequiresASingleValueThatIsNotSuppliedItThrowsCommandParsingException() + { + var app = new CommandLineApplication(); + + app.Option("-v|--verbosity", "be verbose", CommandOptionType.SingleValue); + + Action execute = () => app.Execute("-v"); + + execute.ShouldThrow() + .Which + .Message + .Should() + .Be("Required value for option '-v' was not provided."); + } + } +} diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 4a4d90a63..331604d89 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -11,9 +11,11 @@ using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; using FluentAssertions; +[assembly: CollectionBehavior(DisableTestParallelization = true)] + namespace Microsoft.DotNet.Tests { - public class GivenThatTheUserIsRunningDotNetForTheFirstTime : TestBase + public class GivenThatTheUserIsRunningDotNetForTheFirstTime : TestBase { private static CommandResult _firstDotnetNonVerbUseCommandResult; private static CommandResult _firstDotnetVerbUseCommandResult; @@ -31,7 +33,7 @@ namespace Microsoft.DotNet.Tests command.Environment["SkipInvalidConfigurations"] = "true"; _firstDotnetNonVerbUseCommandResult = command.ExecuteWithCapturedOutput("--info"); - _firstDotnetVerbUseCommandResult = command.ExecuteWithCapturedOutput("new"); + _firstDotnetVerbUseCommandResult = command.ExecuteWithCapturedOutput("new --debug:ephemeral-hive"); _nugetCacheFolder = new DirectoryInfo(testNugetCache); } @@ -77,9 +79,9 @@ A command is running to initially populate your local package cache, to improve .And.NotContain("Restore completed in"); } - [Fact] - public void ItCreatesASentinelFileUnderTheNuGetCacheFolder() - { + [Fact] + public void ItCreatesASentinelFileUnderTheNuGetCacheFolder() + { _nugetCacheFolder .Should() .HaveFile($"{GetDotnetVersion()}.dotnetSentinel"); @@ -123,10 +125,10 @@ A command is running to initially populate your local package cache, to improve } private string GetDotnetVersion() - { - return new DotnetCommand().ExecuteWithCapturedOutput("--version").StdOut - .TrimEnd(Environment.NewLine.ToCharArray()); - } + { + return new DotnetCommand().ExecuteWithCapturedOutput("--version").StdOut + .TrimEnd(Environment.NewLine.ToCharArray()); + } private static string NormalizeLineEndings(string s) { diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index e4a0a3cc1..8f425466d 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -41,7 +41,6 @@ namespace Microsoft.DotNet.Tests }; } } - public static IEnumerable LibraryDependencyToolArguments { get