diff --git a/Documentation/dotnet-test-protocol.md b/Documentation/dotnet-test-protocol.md index 14c96dee0..50af88a51 100644 --- a/Documentation/dotnet-test-protocol.md +++ b/Documentation/dotnet-test-protocol.md @@ -23,7 +23,7 @@ All messages have the format described here: The payload formats for each message is described in links to the classes used to serialize/deseralize the information in the description of the protocol. #### Test Execution -![alt tag](../../../images/DotnetTestExecuteTests.png) +![alt tag](./images/DotnetTestExecuteTests.png) 1. After the optional version check, the adapter sends a TestExecution.GetTestRunnerProcessStartInfo, with the [tests](https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.Extensions.Testing.Abstractions/Messages/RunTestsMessage.cs) it wants to execute inside of it. Dotnet test sends back a FileName and Arguments inside a [TestStartInfo](https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-test/TestStartInfo.cs) payload that the adapter can use to start the runner. In the past, we would send the list of tests to run as part of that argument, but we were actually going over the command line size limit for some test projects. @@ -36,7 +36,7 @@ The payload formats for each message is described in links to the classes used t 7. Once the adapter is done, it sends dotnet test a TestSession.Terminate which will cause dotnet test to shutdown. #### Test discovery -![alt tag](../../../images/DotnetTestDiscoverTests.png) +![alt tag](./images/DotnetTestDiscoverTests.png) 1. After the optional version check, the adapter sends a TestDiscovery.Start message. Because in this case, the adapter does not need to attach to the process, dotnet test will start the runner itself. Also, since there is no long list of arguments to be passed to the runner, no --wait-command flag is needed to be passed to the runner. dotnet test only passes a --list argument to the runner, which means the runner should not run the tests, just list them. 2. The runner then sends dotnet test (and it passes forward to the adapter) a TestDiscovery.TestFound for each [test](https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.Extensions.Testing.Abstractions/Test.cs) found. diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 319430b98..b4769861a 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -84,6 +84,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-dependency-tool-invo EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Compiler.Common.Tests", "test\Microsoft.DotNet.Compiler.Common.Tests\Microsoft.DotNet.Compiler.Common.Tests.xproj", "{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-nuget.UnitTests", "test\dotnet-nuget.UnitTests\dotnet-nuget.UnitTests.xproj", "{2EC08501-CFC6-412F-9345-8D31D258A60E}" +EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-pack.Tests", "test\dotnet-pack.Tests\dotnet-pack.Tests.xproj", "{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-run.Tests", "test\dotnet-run.Tests\dotnet-run.Tests.xproj", "{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F}" @@ -110,6 +112,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Archive", "src\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.xproj", "{35B19F22-B8C0-4849-9C35-3F809B7588B8}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-new.Tests", "test\dotnet-new.Tests\dotnet-new.Tests.xproj", "{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}" +EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-build3.Tests", "test\dotnet-build3.Tests\dotnet-build3.Tests.xproj", "{49D7318E-D198-4E2B-BBEA-3A24D805F88D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4-BC0F-443B-8ADF-691321F10108}" @@ -620,6 +624,22 @@ Global {44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Debug|x64.ActiveCfg = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Debug|x64.Build.0 = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Release|Any CPU.Build.0 = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Release|x64.ActiveCfg = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.Release|x64.Build.0 = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {2EC08501-CFC6-412F-9345-8D31D258A60E}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -828,6 +848,22 @@ Global {35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|Any CPU.Build.0 = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|x64.ActiveCfg = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|x64.Build.0 = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|Any CPU.ActiveCfg = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|Any CPU.Build.0 = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|x64.ActiveCfg = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|x64.Build.0 = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|Any CPU.Build.0 = Debug|Any CPU {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -963,6 +999,7 @@ Global {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} = {ADA7052B-884B-4776-8B8D-D04191D0AA70} {C26A48BB-193F-450C-AB09-4D3324C78188} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} {44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} + {2EC08501-CFC6-412F-9345-8D31D258A60E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {35E3C2DC-9B38-4EC5-8DD7-C32458DC485F} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {6A3095FF-A7C5-4300-85A9-C025C384401D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} @@ -976,6 +1013,7 @@ Global {E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} + {712A4AFF-D758-49B0-AB46-B6DD2FFC9D26} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {49D7318E-D198-4E2B-BBEA-3A24D805F88D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {FD7D515A-D10F-4F49-B8AE-21CF7ED071AE} = {89905EC4-BC0F-443B-8ADF-691321F10108} {8E3354BD-827F-41B7-9EE6-6BE1F1EDD8E9} = {89905EC4-BC0F-443B-8ADF-691321F10108} diff --git a/build/Microsoft.DotNet.Cli.Package.targets b/build/Microsoft.DotNet.Cli.Package.targets index 0ca7a1758..d930228db 100644 --- a/build/Microsoft.DotNet.Cli.Package.targets +++ b/build/Microsoft.DotNet.Cli.Package.targets @@ -3,7 +3,7 @@ - + diff --git a/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj b/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj new file mode 100644 index 000000000..0c13f7029 --- /dev/null +++ b/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + true + + + + + + diff --git a/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets b/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets index 8dad18c11..c6b64a6d2 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets @@ -1,114 +1,113 @@ - - - - + + + + dotnet-deb-tool + 1.0.0-* + dotnet-deb-tool-consumer + $(IntermediateDirectory)/$(DotnetDebToolConsumerProjectName) + + - - + + + + + + + + - - false - true + + + /usr/share/dotnet - $(RepoRoot)/scripts/package/package-debian.sh - $(RepoRoot)/Documentation/manpages + package_root + $ + samples + docs + debian + - $(PackagesDirectory) - $(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension) + + + $(SdkVersion) + dotnet-dev-$(SdkDebianPackageVersion) + $(SharedFrameworkVersion) + dotnet-sharedframework-$(SharedFrameworkName)-$(SharedFxDebianPackageVersion) + $(SharedFxDebianPackageName.ToLower()) + $(HostFxrVersion) + dotnet-hostfxr-$(HostFxrDebianPackageVersion) + $(HostFxrDebianPackageName.ToLower()) + dotnet-host + - dotnet-dev-$(SdkVersion) - dotnet-sharedframework-$(SharedFrameworkName)-$(SharedFrameworkVersion) - $(SharedFrameworkDebianPackageName.ToLower()) - dotnet-hostfxr-$(HostFxrVersion) - $(HostFxrDebianPackageName.ToLower()) - dotnet-host + + + $(RepoRoot)/Documentation/manpages + $(RepoRoot)/test/EndToEnd + $(Stage2Directory)/sdk + - $(IntermediateDirectory)/debian/sdk + + + + - $(SdkDebianIntermediateDirectory)/debian-testResults.xml - /usr/share/dotnet - $(RepoRoot)/test/EndToEnd - + + + $(PackagesDirectory) + $(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension) - - - + $(IntermediateDirectory)/debian/sdk + $(SdkDebianIntermediateDirectory)/deb-tool-output + $(SdkDebianIntermediateDirectory)/debian-testResults.xml + - - - - + + + $(SdkDebianIntermediateDirectory)/debianLayoutDirectory + $(LayoutDirectory)/$(LayoutPackageRootDirName) + $(LayoutDirectory)/$(LayoutAbsolutePlacementDirName) + $(LayoutDirectory)/$(LayoutSamplesDirName) + $(LayoutDirectory)/$(LayoutDocsDirName) + $(LayoutDirectory)/$(LayoutDebianFilesDirName) + - - - - + + + $(RepoRoot)/packaging/deb/dotnet-debian_config.json + $(LayoutDirectory)/debian_config.json + - + + + $(SharedFxDebianPackageName) + + + $(SharedFrameworkName) + + + $(SharedFrameworkVersion) + + + $(SharedFrameworkBrandName) + + + $(SdkVersion) + + + $(SdkBrandName) + + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/build_projects/dotnet-cli-build/DotNetDebTool.cs b/build_projects/dotnet-cli-build/DotNetDebTool.cs new file mode 100644 index 000000000..82036e60c --- /dev/null +++ b/build_projects/dotnet-cli-build/DotNetDebTool.cs @@ -0,0 +1,53 @@ +// 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.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Microsoft.DotNet.Cli.Build +{ + public class DotNetDebTool : DotNetTool + { + protected override string Command + { + get { return "deb-tool"; } + } + + protected override string Args + { + get { return $"{GetInputDir()} {GetOutputFile()} {GetPackageName()} {GetPackageVersion()}"; } + } + + [Required] + public string InputDirectory { get; set; } + + [Required] + public string OutputDirectory { get; set; } + + [Required] + public string PackageName { get; set; } + + [Required] + public string PackageVersion { get; set; } + + private string GetInputDir() + { + return $"-i {InputDirectory}"; + } + + private string GetOutputFile() + { + return $"-o {OutputDirectory}"; + } + + private string GetPackageName() + { + return $"-n {PackageName}"; + } + + private string GetPackageVersion() + { + return $"-v {PackageVersion}"; + } + } +} diff --git a/packaging/debian/dotnet-debian_config.json b/packaging/deb/dotnet-debian_config.json similarity index 100% rename from packaging/debian/dotnet-debian_config.json rename to packaging/deb/dotnet-debian_config.json diff --git a/packaging/debian/postinst b/packaging/deb/postinst old mode 100755 new mode 100644 similarity index 100% rename from packaging/debian/postinst rename to packaging/deb/postinst diff --git a/scripts/obtain/dotnet-install.ps1 b/scripts/obtain/dotnet-install.ps1 index 448b7d502..3351ac652 100644 --- a/scripts/obtain/dotnet-install.ps1 +++ b/scripts/obtain/dotnet-install.ps1 @@ -116,6 +116,46 @@ function Get-Version-Info-From-Version-Text([string]$VersionText) { return $VersionInfo } +function Load-Assembly([string] $Assembly) { + try { + Add-Type -Assembly $Assembly | Out-Null + } + catch { + # On Nano Server, Powershell Core Edition is used. Add-Type is unable to resolve base class assemblies because they are not GAC'd. + # Loading the base class assemblies is not unnecessary as the types will automatically get resolved. + } +} + +function GetHTTPResponse([Uri] $Uri) +{ + $HttpClient = $null + + try { + # HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet. + Load-Assembly -Assembly System.Net.Http + $HttpClient = New-Object System.Net.Http.HttpClient + $Response = $HttpClient.GetAsync($Uri).Result + if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode))) + { + $ErrorMsg = "Failed to download $Uri." + if ($Response -ne $null) + { + $ErrorMsg += " $Response" + } + + throw $ErrorMsg + } + + return $Response + } + finally { + if ($HttpClient -ne $null) { + $HttpClient.Dispose() + } + } +} + + function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) { Say-Invocation $MyInvocation @@ -127,14 +167,14 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str $VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version" } - $Response = Invoke-WebRequest -UseBasicParsing $VersionFileUrl + $Response = GetHTTPResponse -Uri $VersionFileUrl + $StringContent = $Response.Content.ReadAsStringAsync().Result - switch ($Response.Headers.'Content-Type'){ - { ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($Response.Content) } - { ($_ -eq "text/plain") } { $VersionText = $Response.Content } - default { throw "``$Response.Headers.'Content-Type'`` is an unknown .version file content type." } + switch ($Response.Content.Headers.ContentType) { + { ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) } + { ($_ -eq "text/plain") } { $VersionText = $StringContent } + default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." } } - $VersionInfo = Get-Version-Info-From-Version-Text $VersionText @@ -282,7 +322,7 @@ function Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package([Sys function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { Say-Invocation $MyInvocation - Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null + Load-Assembly -Assembly System.IO.Compression.FileSystem Set-Variable -Name Zip try { $Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipPath) @@ -309,6 +349,23 @@ function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { } } +function DownloadFile([Uri]$Uri, [string]$OutPath) { + $Stream = $null + + try { + $Response = GetHTTPResponse -Uri $Uri + $Stream = $Response.Content.ReadAsStreamAsync().Result + $File = [System.IO.File]::Create($OutPath) + $Stream.CopyTo($File) + $File.Close() + } + finally { + if ($Stream -ne $null) { + $Stream.Dispose() + } + } +} + $AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel $CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture $SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version @@ -338,7 +395,7 @@ New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null foreach ($DownloadLink in $DownloadLinks) { $ZipPath = [System.IO.Path]::GetTempFileName() Say "Downloading $DownloadLink" - $resp = Invoke-WebRequest -UseBasicParsing $DownloadLink -OutFile $ZipPath + DownloadFile -Uri $DownloadLink -OutPath $ZipPath Say "Extracting zip from $DownloadLink" Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot diff --git a/scripts/package/package-debian.sh b/scripts/package/package-debian.sh deleted file mode 100755 index 0a93146ec..000000000 --- a/scripts/package/package-debian.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/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. - -# Debian Packaging Script -# Currently Intended to build on ubuntu14.04 - -set -e - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -source "$DIR/../common/_common.sh" -REPOROOT="$DIR/../.." - -help(){ - echo "Usage: $0" - echo "" - echo "Options:" - echo " --version Specify a version for the package." - echo " --input Package the entire contents of the directory tree." - echo " --manpages Directory containing man pages for the package (Optional)." - echo " --output The full path to which the package will be written." - echo " --package-name Package to identify during installation. Example - 'dotnet-nightly', 'dotnet'" - echo " --brand-name Brand name of the package, used for 'short_description' of the deb file. Example - '.NET CLI SDK'" - echo " --framework-nuget-name The name of the nuget package that produced this shared framework." - echo " --framework-nuget-version The versionf of the nuget package that produced this shared framework." - echo " --previous-version-url Url to the previous version of the debian packge against which to run the upgrade tests." - echo " --obj-root Root folder for intermediate objects." - exit 1 -} - -parseargs(){ - - while [[ $# > 0 ]]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -m|--manpages) - MANPAGE_DIR=$2 - shift - ;; - -o|--output) - OUTPUT_DEBIAN_FILE=$2 - shift - ;; - -i|--input) - REPO_BINARIES_DIR=$2 - shift - ;; - -p|--package-name) - DOTNET_DEB_PACKAGE_NAME=$2 - shift - ;; - -b|--brand-name) - DOTNET_CLI_BRAND_NAME=$2 - shift - ;; - -v|--version) - DOTNET_CLI_VERSION=$2 - shift - ;; - --previous-version-url) - PREVIOUS_VERSION_URL=$2 - shift - ;; - --framework-debian-package-name) - SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME=$2 - shift - ;; - --framework-nuget-name) - SHARED_FRAMEWORK_NUGET_NAME=$2 - shift - ;; - --framework-nuget-version) - SHARED_FRAMEWORK_NUGET_VERSION=$2 - shift - ;; - --obj-root) - OBJECT_DIR=$2 - shift - ;; - --help) - help - ;; - *) - break - ;; - esac - shift - done - - if [ -z "$DOTNET_CLI_VERSION" ]; then - echo "Provide a version number. Missing option '--version'" && help - fi - - if [ -z "$OUTPUT_DEBIAN_FILE" ]; then - echo "Provide an output deb. Missing option '--output'" && help - fi - - if [ -z "$REPO_BINARIES_DIR" ]; then - echo "Provide an input directory. Missing option '--input'" && help - fi - - if [ -z "$DOTNET_DEB_PACKAGE_NAME" ]; then - echo "Provide an the name for the debian package. Missing option '--package-name'" && help - fi - - if [ -z "$SHARED_FRAMEWORK_NUGET_NAME" ]; then - echo "Provide the NuGet name of the targetted Shared Framework. Missing option '--framework-nuget-name'" && help - fi - - if [ -z "$SHARED_FRAMEWORK_NUGET_VERSION" ]; then - echo "Provide the NuGet version of the targetted Shared Framework. Missing option '--framework-nuget-version'" && help - fi - - if [ ! -d "$REPO_BINARIES_DIR" ]; then - echo "'$REPO_BINARIES_DIR' - is either missing or not a directory" 1>&2 - exit 1 - fi - -} - -parseargs "$@" - -PACKAGING_ROOT="$REPOROOT/packaging/debian" -PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" - -PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" -PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" -TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" - -# remove any residual deb files from earlier builds -rm -f "$PACKAGE_OUTPUT_DIR/*.deb" - -execute_build(){ - create_empty_debian_layout - copy_files_to_debian_layout - update_debian_json - create_debian_package -} - -execute_test(){ - test_debian_package -} - -create_empty_debian_layout(){ - header "Creating empty debian package layout" - - rm -rf "$PACKAGE_LAYOUT_DIR" - mkdir -p "$PACKAGE_LAYOUT_DIR" - - mkdir "$PACKAGE_LAYOUT_DIR/\$" - mkdir "$PACKAGE_LAYOUT_DIR/package_root" - mkdir "$PACKAGE_LAYOUT_DIR/samples" - mkdir "$PACKAGE_LAYOUT_DIR/docs" - mkdir "$PACKAGE_LAYOUT_DIR/debian" -} - -copy_files_to_debian_layout(){ - header "Copying files to debian layout" - - # Copy Built Binaries - cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root" - - # Copy config file - cp "$PACKAGING_ROOT/dotnet-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json" - - # Copy Manpages - cp -a "$MANPAGE_DIR/sdk/." "$PACKAGE_LAYOUT_DIR/docs" - - # Append Version to all manpage files - for manpage in "$PACKAGE_LAYOUT_DIR/docs/"*.1; do mv "$manpage" "${manpage%.1}"; done - for manpage in "$PACKAGE_LAYOUT_DIR/docs/"*; do mv "$manpage" "${manpage}-${DOTNET_CLI_VERSION}.1"; done - - # Copy postinstall - cp "$PACKAGING_ROOT/postinst" "$PACKAGE_LAYOUT_DIR/debian/postinst" -} - -create_debian_package(){ - header "Packing .deb" - - mkdir -p "$PACKAGE_OUTPUT_DIR" - - "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -v $DOTNET_CLI_VERSION -n "$DOTNET_DEB_PACKAGE_NAME" -} - -update_debian_json() -{ - header "Updating debian.json file" - sed -i "s/%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%/$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SHARED_FRAMEWORK_NUGET_NAME%/$SHARED_FRAMEWORK_NUGET_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SHARED_FRAMEWORK_NUGET_VERSION%/$SHARED_FRAMEWORK_NUGET_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SDK_NUGET_VERSION%/$DOTNET_CLI_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%CLI_SDK_BRAND_NAME%/$DOTNET_CLI_BRAND_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json -} - -test_debian_package(){ - header "Testing debian package" - - install_bats - run_package_integrity_tests -} - -install_bats() { - rm -rf $TEST_STAGE_DIR - git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR -} - -run_package_integrity_tests() { - $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats -} - -execute_build - -DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") - -execute_test - -mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/src/Microsoft.DotNet.Compiler.Common/Microsoft.Dotnet.Compiler.Common.xproj b/src/Microsoft.DotNet.Compiler.Common/Microsoft.DotNet.Compiler.Common.xproj similarity index 100% rename from src/Microsoft.DotNet.Compiler.Common/Microsoft.Dotnet.Compiler.Common.xproj rename to src/Microsoft.DotNet.Compiler.Common/Microsoft.DotNet.Compiler.Common.xproj diff --git a/src/dotnet/ICommandRunner.cs b/src/dotnet/ICommandRunner.cs new file mode 100644 index 000000000..376d13fba --- /dev/null +++ b/src/dotnet/ICommandRunner.cs @@ -0,0 +1,13 @@ +// 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; + +namespace Microsoft.DotNet.Cli +{ + public interface ICommandRunner + { + int Run(string[] commandArgs); + } +} diff --git a/src/dotnet/commands/dotnet-restore/NuGetForwardingApp.cs b/src/dotnet/NuGetForwardingApp.cs similarity index 96% rename from src/dotnet/commands/dotnet-restore/NuGetForwardingApp.cs rename to src/dotnet/NuGetForwardingApp.cs index e12bb2b8a..04e86623a 100644 --- a/src/dotnet/commands/dotnet-restore/NuGetForwardingApp.cs +++ b/src/dotnet/NuGetForwardingApp.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using Microsoft.DotNet.Cli; -namespace Microsoft.DotNet.Tools.Restore +namespace Microsoft.DotNet.Tools { public class NuGetForwardingApp { diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 60ee18d42..26f6c1008 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -15,6 +15,7 @@ using Microsoft.DotNet.Tools.Compiler; using Microsoft.DotNet.Tools.Compiler.Csc; using Microsoft.DotNet.Tools.Help; using Microsoft.DotNet.Tools.New; +using Microsoft.DotNet.Tools.NuGet; using Microsoft.DotNet.Tools.Pack3; using Microsoft.DotNet.Tools.Publish; using Microsoft.DotNet.Tools.Restore; @@ -34,6 +35,7 @@ namespace Microsoft.DotNet.Cli ["compile-csc"] = CompileCscCommand.Run, ["help"] = HelpCommand.Run, ["new"] = NewCommand.Run, + ["nuget"] = NuGetCommand.Run, ["pack"] = PackCommand.Run, ["publish"] = PublishCommand.Run, ["restore"] = RestoreCommand.Run, diff --git a/src/dotnet/commands/dotnet-compile-csc/Program.cs b/src/dotnet/commands/dotnet-compile-csc/Program.cs index 5f6c24784..b369241a8 100644 --- a/src/dotnet/commands/dotnet-compile-csc/Program.cs +++ b/src/dotnet/commands/dotnet-compile-csc/Program.cs @@ -198,19 +198,17 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc commonArgs.Add("-t:library"); } + string debugType; if (string.IsNullOrEmpty(options.DebugType)) { - commonArgs.Add(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? "-debug:full" - : "-debug:portable"); + debugType = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "full" : "portable"; } else { - commonArgs.Add(options.DebugType == "portable" - ? "-debug:portable" - : "-debug:full"); + debugType = options.DebugType; } + commonArgs.Add("-debug:" + debugType); return commonArgs; } diff --git a/src/dotnet/commands/dotnet-help/HelpCommand.cs b/src/dotnet/commands/dotnet-help/HelpCommand.cs index ecc9bb030..740111f5f 100644 --- a/src/dotnet/commands/dotnet-help/HelpCommand.cs +++ b/src/dotnet/commands/dotnet-help/HelpCommand.cs @@ -25,7 +25,7 @@ Host options (passed before the command): --version Display .NET CLI Version Number --info Display .NET CLI Info -Common Commands: +Commands: new Initialize a basic .NET project restore Restore dependencies specified in the .NET project build Builds a .NET project diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs b/src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs index 51233cffa..f095a9f74 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs @@ -1,12 +1,9 @@ using System; -namespace ConsoleApplication +class Program { - public class Program + static void Main(string[] args) { - public static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } + Console.WriteLine("Hello World!"); } } diff --git a/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs b/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs new file mode 100644 index 000000000..ab4cf8ec5 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; + +namespace Tests +{ + public class Tests + { + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template new file mode 100644 index 000000000..bb414fa52 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template @@ -0,0 +1,22 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NUnit": "3.4.1", + "dotnet-test-nunit": "3.4.0-beta-1" + }, + + "testRunner": "nunit", + + "frameworks": { + "netcoreapp1.0": { + "imports": "portable-net45+win8", + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/CSharp_xunittest/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_xunittest/project.json.template index 6b9d82e88..710740dd1 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_xunittest/project.json.template +++ b/src/dotnet/commands/dotnet-new/CSharp_xunittest/project.json.template @@ -5,9 +5,8 @@ }, "dependencies": { "System.Runtime.Serialization.Primitives": "4.1.1", - "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-rc2-330423-54", - "Microsoft.DotNet.InternalAbstractions": "1.0.0" + "xunit": "2.2.0-beta2-build3300", + "dotnet-test-xunit": "2.2.0-preview2-build1029" }, "testRunner": "xunit", "frameworks": { diff --git a/src/dotnet/commands/dotnet-new/Program.cs b/src/dotnet/commands/dotnet-new/Program.cs index b527dc332..cd0adaaad 100644 --- a/src/dotnet/commands/dotnet-new/Program.cs +++ b/src/dotnet/commands/dotnet-new/Program.cs @@ -126,7 +126,7 @@ namespace Microsoft.DotNet.Tools.New app.Description = "Initializes empty project for .NET Platform"; app.HelpOption("-h|--help"); - var csharp = new { Name = "C#", Alias = new[] { "c#", "cs", "csharp" }, TemplatePrefix = "CSharp", Templates = new[] { "Console", "Web", "Lib", "xunittest", "MSBuild" } }; + var csharp = new { Name = "C#", Alias = new[] { "c#", "cs", "csharp" }, TemplatePrefix = "CSharp", Templates = new[] { "Console", "Web", "Lib", "xunittest", "nunittest", "MSBuild" } }; var fsharp = new { Name = "F#", Alias = new[] { "f#", "fs", "fsharp" }, TemplatePrefix = "FSharp", Templates = new[] { "Console", "Lib" } }; var languages = new[] { csharp, fsharp }; diff --git a/src/dotnet/commands/dotnet-new/README.md b/src/dotnet/commands/dotnet-new/README.md index 117edacb7..f795cb6c0 100644 --- a/src/dotnet/commands/dotnet-new/README.md +++ b/src/dotnet/commands/dotnet-new/README.md @@ -32,6 +32,7 @@ Type of the project. Valid values for C# are: * `web` * `lib` * `xunittest` +* `nunittest` Valid values for F# are: diff --git a/src/dotnet/commands/dotnet-nuget/Program.cs b/src/dotnet/commands/dotnet-nuget/Program.cs new file mode 100644 index 000000000..b22588c0d --- /dev/null +++ b/src/dotnet/commands/dotnet-nuget/Program.cs @@ -0,0 +1,43 @@ +// 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.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.InternalAbstractions; +using Microsoft.DotNet.Tools; + +namespace Microsoft.DotNet.Tools.NuGet +{ + public class NuGetCommand + { + public static int Run(string[] args) + { + return Run(args, new NuGetCommandRunner()); + } + + public static int Run(string[] args, ICommandRunner nugetCommandRunner) + { + DebugHelper.HandleDebugSwitch(ref args); + + if (nugetCommandRunner == null) + { + throw new ArgumentNullException(nameof(nugetCommandRunner)); + } + + return nugetCommandRunner.Run(args); + } + + private class NuGetCommandRunner : ICommandRunner + { + public int Run(string [] args) + { + var nugetApp = new NuGetForwardingApp(args); + + return nugetApp.Execute(); + } + } + } +} diff --git a/src/dotnet/commands/dotnet-pack/NuGet/Constants.cs b/src/dotnet/commands/dotnet-pack/NuGet/Constants.cs index a6896c346..323cb6122 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/Constants.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/Constants.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace NuGet +namespace NuGet.Legacy { public static class Constants { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/EmptyFrameworkFolderFile.cs b/src/dotnet/commands/dotnet-pack/NuGet/EmptyFrameworkFolderFile.cs index eeabe193b..9036c4ea1 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/EmptyFrameworkFolderFile.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/EmptyFrameworkFolderFile.cs @@ -4,7 +4,7 @@ using System; using System.IO; -namespace NuGet +namespace NuGet.Legacy { /// /// Represents an empty framework folder in NuGet 2.0+ packages. diff --git a/src/dotnet/commands/dotnet-pack/NuGet/FrameworkAssemblyReference.cs b/src/dotnet/commands/dotnet-pack/NuGet/FrameworkAssemblyReference.cs index 9e25bc080..7d0c7e2fc 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/FrameworkAssemblyReference.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/FrameworkAssemblyReference.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using NuGet.Frameworks; -namespace NuGet +namespace NuGet.Legacy { public class FrameworkAssemblyReference { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/IPackageFile.cs b/src/dotnet/commands/dotnet-pack/NuGet/IPackageFile.cs index 1c96bcf8c..1e32fe8b6 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/IPackageFile.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/IPackageFile.cs @@ -3,7 +3,7 @@ using System.IO; -namespace NuGet +namespace NuGet.Legacy { public interface IPackageFile { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/Manifest.cs b/src/dotnet/commands/dotnet-pack/NuGet/Manifest.cs index e400f5c55..25394c7c4 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/Manifest.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/Manifest.cs @@ -8,7 +8,7 @@ using System.IO; using System.Linq; using System.Xml.Linq; -namespace NuGet +namespace NuGet.Legacy { public class Manifest { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestContentFiles.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestContentFiles.cs index 8321a3e5f..dac2dfaae 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestContentFiles.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestContentFiles.cs @@ -1,7 +1,7 @@ // 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. -namespace NuGet +namespace NuGet.Legacy { public class ManifestContentFiles { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestFile.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestFile.cs index bcb484aea..50bfe1180 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestFile.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestFile.cs @@ -1,7 +1,7 @@ // 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. -namespace NuGet +namespace NuGet.Legacy { public class ManifestFile { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestMetadata.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestMetadata.cs index 1010c8140..54199a1a6 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestMetadata.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestMetadata.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using NuGet.Versioning; -namespace NuGet +namespace NuGet.Legacy { public class ManifestMetadata { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestReader.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestReader.cs index d3a81b680..68f06996e 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestReader.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestReader.cs @@ -14,7 +14,7 @@ using System.Xml; using System.Xml.Linq; // TODO: Resources using NuGet.Resources; -namespace NuGet +namespace NuGet.Legacy { internal static class ManifestReader { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestSchemaUtility.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestSchemaUtility.cs index defcd12cc..c62eeb454 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestSchemaUtility.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestSchemaUtility.cs @@ -5,7 +5,7 @@ using System; using System.Globalization; using System.Linq; -namespace NuGet +namespace NuGet.Legacy { internal static class ManifestSchemaUtility { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionAttribute.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionAttribute.cs index 7758c0e03..eaaaf0e6f 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionAttribute.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionAttribute.cs @@ -3,7 +3,7 @@ using System; -namespace NuGet +namespace NuGet.Legacy { [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] internal sealed class ManifestVersionAttribute : Attribute diff --git a/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionUtility.cs b/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionUtility.cs index 0220dcc43..9a2510403 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionUtility.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/ManifestVersionUtility.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Linq; using System.Reflection; -namespace NuGet +namespace NuGet.Legacy { internal static class ManifestVersionUtility { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PackageBuilder.cs b/src/dotnet/commands/dotnet-pack/NuGet/PackageBuilder.cs index f6596df79..fc45583c8 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PackageBuilder.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PackageBuilder.cs @@ -13,7 +13,7 @@ using NuGet.Packaging; using NuGet.Packaging.Core; using NuGet.Versioning; -namespace NuGet +namespace NuGet.Legacy { public class PackageBuilder { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PackageDependencySet.cs b/src/dotnet/commands/dotnet-pack/NuGet/PackageDependencySet.cs index 5d171c414..1c6fb8244 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PackageDependencySet.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PackageDependencySet.cs @@ -7,7 +7,7 @@ using System.Linq; using NuGet.Frameworks; using NuGet.Packaging.Core; -namespace NuGet +namespace NuGet.Legacy { public class PackageDependencySet { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PackageIdValidator.cs b/src/dotnet/commands/dotnet-pack/NuGet/PackageIdValidator.cs index efc20acea..60a1819d1 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PackageIdValidator.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PackageIdValidator.cs @@ -5,7 +5,7 @@ using System; using System.Globalization; using System.Text.RegularExpressions; -namespace NuGet +namespace NuGet.Legacy { public static class PackageIdValidator { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PackageMetadataXmlExtensions.cs b/src/dotnet/commands/dotnet-pack/NuGet/PackageMetadataXmlExtensions.cs index c654dd5ec..14e09d5c8 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PackageMetadataXmlExtensions.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PackageMetadataXmlExtensions.cs @@ -9,7 +9,7 @@ using NuGet.Frameworks; using NuGet.Packaging.Core; using NuGet.Versioning; -namespace NuGet +namespace NuGet.Legacy { internal static class PackageMetadataXmlExtensions { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PackageReferenceSet.cs b/src/dotnet/commands/dotnet-pack/NuGet/PackageReferenceSet.cs index 6c2d228b9..31de42634 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PackageReferenceSet.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PackageReferenceSet.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using NuGet.Frameworks; -namespace NuGet +namespace NuGet.Legacy { public class PackageReferenceSet { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PathResolver.cs b/src/dotnet/commands/dotnet-pack/NuGet/PathResolver.cs index af430dff3..79e845ae2 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PathResolver.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PathResolver.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; -namespace NuGet +namespace NuGet.Legacy { public static class PathResolver { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PathUtility.cs b/src/dotnet/commands/dotnet-pack/NuGet/PathUtility.cs index 2bf29df88..adfb51f98 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PathUtility.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PathUtility.cs @@ -4,7 +4,7 @@ using System; using System.IO; -namespace NuGet +namespace NuGet.Legacy { internal static class PathUtility { diff --git a/src/dotnet/commands/dotnet-pack/NuGet/PhysicalPackageFile.cs b/src/dotnet/commands/dotnet-pack/NuGet/PhysicalPackageFile.cs index d7e8e10af..a6e100c6d 100644 --- a/src/dotnet/commands/dotnet-pack/NuGet/PhysicalPackageFile.cs +++ b/src/dotnet/commands/dotnet-pack/NuGet/PhysicalPackageFile.cs @@ -4,7 +4,7 @@ using System; using System.IO; -namespace NuGet +namespace NuGet.Legacy { public class PhysicalPackageFile : IPackageFile { diff --git a/src/dotnet/commands/dotnet-pack/PackageGenerator.cs b/src/dotnet/commands/dotnet-pack/PackageGenerator.cs index 0ecfb3102..1edf880ea 100644 --- a/src/dotnet/commands/dotnet-pack/PackageGenerator.cs +++ b/src/dotnet/commands/dotnet-pack/PackageGenerator.cs @@ -14,12 +14,12 @@ using Microsoft.DotNet.ProjectModel.Graph; using Microsoft.DotNet.ProjectModel.Resources; using Microsoft.DotNet.ProjectModel.Utilities; using Microsoft.DotNet.Tools.Pack; -using NuGet; +using NuGet.Legacy; using NuGet.Frameworks; using NuGet.Packaging.Core; using NuGet.Versioning; -using PackageBuilder = NuGet.PackageBuilder; -using NuGetConstants = NuGet.Constants; +using PackageBuilder = NuGet.Legacy.PackageBuilder; +using NuGetConstants = NuGet.Legacy.Constants; namespace Microsoft.DotNet.Tools.Compiler { diff --git a/src/dotnet/commands/dotnet-pack/SymbolPackageGenerator.cs b/src/dotnet/commands/dotnet-pack/SymbolPackageGenerator.cs index 97619ac04..306f21ef1 100644 --- a/src/dotnet/commands/dotnet-pack/SymbolPackageGenerator.cs +++ b/src/dotnet/commands/dotnet-pack/SymbolPackageGenerator.cs @@ -6,7 +6,7 @@ using System.IO; using Microsoft.DotNet.ProjectModel; using Microsoft.DotNet.ProjectModel.Files; using Microsoft.DotNet.Tools.Pack; -using NuGet; +using NuGet.Legacy; namespace Microsoft.DotNet.Tools.Compiler { diff --git a/src/dotnet/commands/dotnet-restore/NuGet3.cs b/src/dotnet/commands/dotnet-restore/NuGet3.cs index 0ccc4018a..17cb4a70f 100644 --- a/src/dotnet/commands/dotnet-restore/NuGet3.cs +++ b/src/dotnet/commands/dotnet-restore/NuGet3.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.DotNet.Tools; namespace Microsoft.DotNet.Tools.Restore { diff --git a/src/dotnet/commands/dotnet-restore/Program.cs b/src/dotnet/commands/dotnet-restore/Program.cs index c2ecf5205..d55e781ed 100644 --- a/src/dotnet/commands/dotnet-restore/Program.cs +++ b/src/dotnet/commands/dotnet-restore/Program.cs @@ -11,8 +11,6 @@ namespace Microsoft.DotNet.Tools.Restore { public partial class RestoreCommand { - private static readonly string DefaultRid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(); - public static int Run(string[] args) { DebugHelper.HandleDebugSwitch(ref args); diff --git a/src/dotnet/project.json b/src/dotnet/project.json index e6dfb8432..b087d2324 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -9,6 +9,7 @@ "commands/dotnet-new/CSharp_MSBuild.zip", "commands/dotnet-new/CSharp_xunittest.zip", "commands/dotnet-new/CSharp_Web.zip", + "commands/dotnet-new/CSharp_nunittest.zip", "commands/dotnet-new/FSharp_Console.zip", "commands/dotnet-new/FSharp_Lib.zip" ] @@ -21,7 +22,8 @@ "commands/dotnet-new/CSharp_Lib/**", "commands/dotnet-new/CSharp_MSBuild/**", "commands/dotnet-new/FSharp_Lib/**", - "commands/dotnet-new/CSharp_xunittest/**" + "commands/dotnet-new/CSharp_xunittest/**", + "commands/dotnet-new/CSharp_nunittest/**" ] } }, diff --git a/test/Microsoft.DotNet.ProjectModel.Loader.Tests/Microsoft.DotNet.ProjectModel.Loader.Tests.xproj b/test/Microsoft.DotNet.ProjectModel.Loader.Tests/Microsoft.DotNet.ProjectModel.Loader.Tests.xproj index c0cd383ea..c8663e6e3 100644 --- a/test/Microsoft.DotNet.ProjectModel.Loader.Tests/Microsoft.DotNet.ProjectModel.Loader.Tests.xproj +++ b/test/Microsoft.DotNet.ProjectModel.Loader.Tests/Microsoft.DotNet.ProjectModel.Loader.Tests.xproj @@ -18,4 +18,4 @@ 2.0 - + \ No newline at end of file diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs new file mode 100644 index 000000000..e03168e26 --- /dev/null +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs @@ -0,0 +1,49 @@ +// 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 Xunit; +using FluentAssertions; + +namespace Microsoft.DotNet.Tests +{ + [Collection("'dotnet test' collection")] + public class GivenThatIWantANewCSnUnitProject : TestBase + { + + [Fact] + public void When_nUnit_project_created_Then_project_restores() + { + var rootPath = Temp.CreateDirectory().Path; + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("new --type nunittest") + .Should() + .Pass(); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore") + .Should().Pass(); + } + + [Fact] + public void When_dotnet_test_is_invoked_Then_tests_run_without_errors() + { + var rootPath = Temp.CreateDirectory().Path; + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("new --type nunittest"); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore"); + + var buildResult = new TestCommand("dotnet") + .WithWorkingDirectory(rootPath) + .ExecuteWithCapturedOutput("test") + .Should() + .Pass() + .And + .NotHaveStdErr(); + } + } +} diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs index 6a9c9e568..566e00e38 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs @@ -1,18 +1,14 @@ // 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.IO; -using System.Linq; using Microsoft.DotNet.Tools.Test.Utilities; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Xunit; using FluentAssertions; +using System.IO; namespace Microsoft.DotNet.Tests { + [Collection("'dotnet test' collection")] public class GivenThatIWantANewCSxUnitProject : TestBase { @@ -20,12 +16,10 @@ namespace Microsoft.DotNet.Tests public void When_xUnit_project_created_Then_project_restores() { var rootPath = Temp.CreateDirectory().Path; - var projectJsonFile = Path.Combine(rootPath, "project.json"); new TestCommand("dotnet") { WorkingDirectory = rootPath } .Execute("new --type xunittest") - .Should() - .Pass(); + .Should().Pass(); new TestCommand("dotnet") { WorkingDirectory = rootPath } .Execute("restore") @@ -56,7 +50,5 @@ namespace Microsoft.DotNet.Tests .And .NotHaveStdErr(); } - - } } diff --git a/test/dotnet-new.Tests/dotnet-new.Tests.xproj b/test/dotnet-new.Tests/dotnet-new.Tests.xproj new file mode 100644 index 000000000..eddc88c4a --- /dev/null +++ b/test/dotnet-new.Tests/dotnet-new.Tests.xproj @@ -0,0 +1,21 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 712a4aff-d758-49b0-ab46-b6dd2ffc9d26 + dotnet-new.Tests + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/dotnet-nuget.UnitTests/GivenANuGetCommand.cs b/test/dotnet-nuget.UnitTests/GivenANuGetCommand.cs new file mode 100644 index 000000000..8a903ec38 --- /dev/null +++ b/test/dotnet-nuget.UnitTests/GivenANuGetCommand.cs @@ -0,0 +1,60 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.DotNet.Tools.NuGet; +using Moq; +using NuGet.Frameworks; +using Xunit; + +namespace Microsoft.DotNet.Tools.Run.Tests +{ + public class GivenANuGetCommand : TestBase + { + [Theory] + [InlineData(new[] { "push", "foo.1.0.0.nupkg" }, 0)] + [InlineData(new[] { "push", "foo.1.0.0.nupkg", "-k", "12345678-1234-1234-1234-123456789012" }, 0)] + [InlineData(new[] { "push", "foo.1.0.0.nupkg", + "--api-key", "12345678-1234-1234-1234-123456789012", + "--source", "http://www.myget.org/foofeed" }, 0)] + [InlineData(new[] { "push", "foo.1.0.0.nupkg", + "--api-key", "12345678-1234-1234-1234-123456789012", + "--source", "http://www.nuget.org/foofeed", + "--symbol-api-key", "12345678-1234-1234-1234-123456789012", + "--symbol-source", "https://nuget.smbsrc.net/foo", + "--timeout", "1000", + "--disable-buffering", + "--no-symbols" }, 0)] // Unlikely option given others, but testing max options edge case + [InlineData(new[] { "delete", "foo.1.0.0.nupkg" }, 0)] + [InlineData(new[] { "delete", "foo.1.0.0.nupkg", + "--non-interactive" }, 0)] + [InlineData(new[] { "delete", "foo.1.0.0.nupkg", + "--api-key", "12345678-1234-1234-1234-123456789012", + "--source", "http://www.nuget.org/foofeed", + "--non-interactive" }, 0)] + [InlineData(new[] { "locals" }, 0)] + [InlineData(new[] { "locals", "http-cache", "packages-cache", "global-packages", "temp" }, 0)] + public void ItPassesCommandIfSupported(string[] inputArgs, int result) + { + // Arrange + string[] receivedArgs = null; + var testCommandRunner = new Mock(); + testCommandRunner + .Setup(x => x.Run(It.IsAny())) + .Callback(s => receivedArgs = s) + .Returns(0); + + // Act + var returned = NuGetCommand.Run(inputArgs, testCommandRunner.Object); + + // Assert + receivedArgs.Should().BeEquivalentTo(inputArgs); + returned.Should().Be(result); + } + } +} diff --git a/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.xproj b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.xproj new file mode 100644 index 000000000..8ab83bd82 --- /dev/null +++ b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.xproj @@ -0,0 +1,21 @@ + + + + 14.0.24720 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 2EC08501-CFC6-412F-9345-8D31D258A60E + Microsoft.DotNet.Tools.NuGet.UnitTests + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/dotnet-nuget.UnitTests/project.json b/test/dotnet-nuget.UnitTests/project.json new file mode 100644 index 000000000..e9d507a3d --- /dev/null +++ b/test/dotnet-nuget.UnitTests/project.json @@ -0,0 +1,28 @@ +{ + "version": "1.0.0-*", + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + }, + "System.Runtime.Serialization.Primitives": "4.1.1", + "dotnet": { + "target": "project" + }, + "Microsoft.DotNet.Tools.Tests.Utilities": { + "target": "project" + }, + "xunit": "2.2.0-beta3-build3330", + "dotnet-test-xunit": "1.0.0-rc2-330423-54", + "moq.netcore": "4.4.0-beta8" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dotnet5.4", + "portable-net451+win8" + ] + } + }, + "testRunner": "xunit" +} diff --git a/tools/DebianPackageTool/README.md b/tools/DebianPackageTool/README.md deleted file mode 100644 index e5f515de7..000000000 --- a/tools/DebianPackageTool/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Debian Package Tool - -This is a tool which simplifies the creation process of a debian package. -Use of this tool requires creating a json configuration, and appropriate -directory structure with your desired files to be included. - - -## Usage - -``` - Usage: package_tool [-i ] [-o ] - [-n ] [-v ] [-h] - - REQUIRED: - -i : Input directory conforming to package_tool conventions and debian_config.json - -o : Output directory for debian package and other artifacts - - OPTIONAL: - -n : name of created package, will override value in debian_config.json - -v : version of created package, will override value in debian_config.json - -h: Show this message - - NOTES: - See Below for more information on package_tool conventions and debian_config.json format -``` - -## Input Directory Spec - -``` - package/ - $/ (Contents in this directory will be placed absolutely according to their relative path) - usr/lib/somelib.so (ex. This file gets placed at /usr/lib/somelib.so at install) - package_root/ (Contents placed in install root) - samples/ (Contents here will be installed as samples) - docs/ (Contents will be installed as manpages) - debian_config.json (See example below) - docs.json (For manpage generation) - (ex. dotnet-commands-test.sh) -``` - - -Note: The default install root is `/usr/share/{package_name}` where package_name is replaced with the name of the created package - -## full example debian_config.json -Note: Use the commentless version [here](example_config.json). - -```json - { - "maintainer_name":"Microsoft", // [required] - "maintainer_email": "optimus@service.microsoft.com", // [required] - - "package_name": "Packagify_Test", // [required] - - "short_description": "This is a test package", // [required] Max. 60 chars - "long_description": "This is a longer description of the test package", // [required] - "homepage": "http://testpackage.com", // (optional no default) - - "release":{ - "package_version":"0.1", // [required] - "package_revision":"1", // [required] - "urgency" : "low", // (optional default="low") https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Urgency - "changelog_message" : "some stuff here" // [required] - }, - - "control": { // (optional) - "priority":"standard", // (optional default="standard") https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities - "section":"devel", // (optional default="misc") https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections - "architecture":"all" // (optional default="all" ) - }, - - "copyright": "2015 Microsoft", // [required] - "license": { // [required] - "type": "some_license", // [required] - "full_text": "full license text here" // [required] - }, - - "debian_dependencies" : { // (optional no default) - "package_name": { - "package_version" : "1.0.0" // (optional within package_name no default) - } - }, - - "symlinks": { // (optional no defaults) - "path_relative_to_package_root/test_exe.sh" : "usr/bin/test_exe.sh" - } - } -``` diff --git a/tools/DebianPackageTool/example_config.json b/tools/DebianPackageTool/example_config.json deleted file mode 100644 index 74e8012dc..000000000 --- a/tools/DebianPackageTool/example_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "maintainer_name":"Microsoft", - "maintainer_email": "optimus@service.microsoft.com", - - "package_name": "Packagify_Test", - - "short_description": "This is a test package", - "long_description": "This is a longer description of the test package", - "homepage": "http://testpackage.com", - - "release":{ - "package_version":"0.1", - "package_revision":"1", - "urgency" : "low", - "changelog_message" : "some stuff here" - }, - - "control": { - "priority":"standard", - "section":"devel", - "architecture":"all" - }, - - "copyright": "2015 Microsoft", - "license": { - "type": "some_license", - "full_text": "full license text here" - }, - - "debian_dependencies" : { - "package_name": { - "package_version" : "1.0.0" - } - }, - - "symlinks": { - "path_relative_to_package_root/test_exe.sh" : "usr/bin/test_exe.sh" - } -} \ No newline at end of file diff --git a/tools/DebianPackageTool/package_files/debian/compat b/tools/DebianPackageTool/package_files/debian/compat deleted file mode 100644 index ec635144f..000000000 --- a/tools/DebianPackageTool/package_files/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/tools/DebianPackageTool/package_files/debian/rules b/tools/DebianPackageTool/package_files/debian/rules deleted file mode 100644 index 50efe07ec..000000000 --- a/tools/DebianPackageTool/package_files/debian/rules +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/make -f -# -# 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. -# - -%: - dh $@ diff --git a/tools/DebianPackageTool/package_files/debian/source/format b/tools/DebianPackageTool/package_files/debian/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/tools/DebianPackageTool/package_files/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/tools/DebianPackageTool/package_tool b/tools/DebianPackageTool/package_tool deleted file mode 100755 index 6bd678c8e..000000000 --- a/tools/DebianPackageTool/package_tool +++ /dev/null @@ -1,272 +0,0 @@ -#!/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 - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -## Load Functions ## -source $SCRIPT_DIR/scripts/debian_build_lib.sh - -## Debian Package Creation Functions ## -execute(){ - if ! parse_args_and_set_env_vars "$@"; then - exit 1 - fi - - # Exit if required validation fails - if ! validate_inputs; then - exit 1 - fi - - parse_config_and_set_env_vars - clean_or_create_build_dirs - package_all - generate_all - create_source_tarball - - # Actually Build Package Files - (cd ${PACKAGE_SOURCE_DIR}; debuild -us -uc) - - copy_files_to_output -} - -parse_args_and_set_env_vars(){ - OPTIND=1 # Reset in case getopts has been used previously in the shell. - - while getopts ":n:v:i:o:h" opt; do - case $opt in - n) - export PACKAGE_NAME="$OPTARG" - ;; - v) - export PACKAGE_VERSION="$OPTARG" - ;; - i) - export INPUT_DIR="$OPTARG" - ;; - o) - export OUTPUT_DIR="$OPTARG" - ;; - h) - print_help - return 1 - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - return 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - return 1 - ;; - esac - done - - # Special Input Directories + Paths - ABSOLUTE_PLACEMENT_DIR="${INPUT_DIR}/\$" - PACKAGE_ROOT_PLACEMENT_DIR="${INPUT_DIR}/package_root" - CONFIG="$INPUT_DIR/debian_config.json" - - return 0 -} - -print_help(){ - echo "Usage: package_tool [-i ] [-o ] - [-n ] [-v ] [-h] - - REQUIRED: - -i : Input directory conforming to package_tool conventions and debian_config.json - -o : Output directory for debian package and other artifacts - - OPTIONAL: - -n : name of created package, will override value in debian_config.json - -v : version of created package, will override value in debian_config.json - -h: Show this message - - NOTES: - See Readme for more information on package_tool conventions and debian_config.json format - https://github.com/dotnet/cli/tree/master/packaging/debian/package_tool - " -} - -validate_inputs(){ - local ret=0 - if [[ -z "$INPUT_DIR" ]]; then - echo "ERROR: -i Not Specified" - ret=1 - fi - - if [[ -z "$OUTPUT_DIR" ]]; then - echo "ERROR: -o Not Specified." - ret=1 - fi - - if [[ ! -d "$PACKAGE_ROOT_PLACEMENT_DIR" ]]; then - echo "ERROR: package_root directory does not exist" - echo $PACKAGE_ROOT_PLACEMENT_DIR - ret=1 - fi - - if [[ ! -f "$CONFIG" ]]; then - echo "ERROR: debian_config.json file does not exist" - echo $CONFIG - ret=1 - fi - - return $ret -} - -parse_config_and_set_env_vars(){ - extract_base_cmd="python $SCRIPT_DIR/scripts/extract_json_value.py" - - # Arguments Take Precedence over Config - [ -z "$PACKAGE_VERSION" ] && PACKAGE_VERSION="$($extract_base_cmd $CONFIG "release.package_version")" - [ -z "$PACKAGE_NAME" ] && PACKAGE_NAME="$($extract_base_cmd $CONFIG "package_name")" - - # Inputs - INPUT_SAMPLES_DIR="$INPUT_DIR/samples" - INPUT_DOCS_DIR="$INPUT_DIR/docs" - DOCS_JSON_PATH="$INPUT_DIR/docs.json" - - PACKAGE_SOURCE_DIR="${OUTPUT_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}" - - if ! INSTALL_ROOT="$($extract_base_cmd $CONFIG "install_root")"; then - INSTALL_ROOT="/usr/share/$PACKAGE_NAME" - fi - - DEBIAN_DIR="${PACKAGE_SOURCE_DIR}/debian" - DOCS_DIR="${PACKAGE_SOURCE_DIR}/docs" -} - -clean_or_create_build_dirs(){ - rm -rf ${PACKAGE_SOURCE_DIR} - mkdir -p $DEBIAN_DIR -} - -package_all(){ - package_static_files - package_package_root_placement - package_absolute_placement - package_samples - package_docs - package_install_scripts -} - -generate_all(){ - generate_config_templates - generate_manpages - generate_manpage_manifest - generate_sample_manifest - write_debian_install_file -} - -create_source_tarball(){ - rm -f ${OUTPUT_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}.orig.tar.gz - tar -cvzf ${OUTPUT_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}.orig.tar.gz -C $PACKAGE_SOURCE_DIR . -} - -copy_files_to_output(){ - # .deb, .dsc, etc.. Already in output dir - # Copy Test files - - cp $SCRIPT_DIR/test/integration_tests/test_package.bats $OUTPUT_DIR -} - -## Packaging Functions ## -package_static_files(){ - cp -a $SCRIPT_DIR/package_files/debian/* ${PACKAGE_SOURCE_DIR}/debian -} - -package_package_root_placement(){ - add_dir_to_install ${PACKAGE_ROOT_PLACEMENT_DIR} "" -} - -package_absolute_placement(){ - if [[ -d "$ABSOLUTE_PLACEMENT_DIR" ]]; then - abs_in_package_dir="\$" - - add_dir_to_install ${ABSOLUTE_PLACEMENT_DIR} $abs_in_package_dir - - # Get List of all files in directory tree, relative to ABSOLUTE_PLACEMENT_DIR - abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) ) - - # For each file add a a system placement - for abs_file in ${abs_files[@]} - do - parent_dir=$(dirname $abs_file) - filename=$(basename $abs_file) - - add_system_file_placement "$abs_in_package_dir/$abs_file" "/$parent_dir" - done - fi -} - -package_samples(){ - if [[ -d "$INPUT_SAMPLES_DIR" ]]; then - cp -a $INPUT_SAMPLES_DIR/. $PACKAGE_SOURCE_DIR - fi -} - -package_docs(){ - if [[ -d "$INPUT_DOCS_DIR" ]]; then - mkdir -p $DOCS_DIR - cp -a $INPUT_DOCS_DIR/. $DOCS_DIR - fi -} - -package_install_scripts(){ - # copy scripts for the package's control section like preinst, postint, etc - if [[ -d "$INPUT_DIR/debian" ]]; then - cp -a "$INPUT_DIR/debian/." $DEBIAN_DIR - fi -} - -## Generation Functions ## -generate_config_templates(){ - python ${SCRIPT_DIR}/scripts/config_template_generator.py $CONFIG $SCRIPT_DIR/templates/debian $DEBIAN_DIR $PACKAGE_NAME $PACKAGE_VERSION -} - -generate_manpages(){ - if [[ -f "$DOCS_JSON_PATH" ]]; then - mkdir -p $DOCS_DIR - - # Generate the manpages from json spec - python ${SCRIPT_DIR}/scripts/manpage_generator.py ${DOCS_JSON_PATH} ${DOCS_DIR} - fi -} - -generate_manpage_manifest(){ - # Get a list of files generated relative to $DOCS_DIR - generated_manpages=( $(_get_files_in_dir_tree $DOCS_DIR) ) - - # Get path relative to $PACKAGE_SOURCE_DIR to prepend to each filename - # This syntax is bash substring removal - docs_rel_path=${DOCS_DIR#${PACKAGE_SOURCE_DIR}/} - - # Remove any existing manifest - rm -f ${DEBIAN_DIR}/${PACKAGE_NAME}.manpages - - for manpage in ${generated_manpages[@]} - do - echo "${docs_rel_path}/${manpage}" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.manpages" - done -} - -generate_sample_manifest(){ - if [[ -d "$INPUT_SAMPLES_DIR" ]]; then - generated_manpages=( $(_get_files_in_dir_tree $INPUT_SAMPLES_DIR) ) - - rm -f sample_manifest - for sample in ${samples[@]} - do - echo "$sample" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.examples" - done - else - echo "Provide a 'samples' directory in INPUT_DIR to package samples" - fi -} - -execute "$@" diff --git a/tools/DebianPackageTool/scripts/config_template_generator.py b/tools/DebianPackageTool/scripts/config_template_generator.py deleted file mode 100755 index ad6a303c8..000000000 --- a/tools/DebianPackageTool/scripts/config_template_generator.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/python -# -# 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. -# - -# Parses debian_config.json and generates appropriate templates -# Where optional defaults exist, they are defined in the template_dict -# of the appropriate generation function - -import os -import sys -import json -import datetime - -FILE_CHANGELOG = 'changelog' -FILE_CONTROL = 'control' -FILE_COPYRIGHT = 'copyright' -FILE_SYMLINK_FORMAT = '{package_name}.links' - -PACKAGE_ROOT_FORMAT = "usr/share/{package_name}" -CHANGELOG_DATE_FORMAT = "%a, %d %b %Y %H:%M:%S %z" - -# UTC Timezone for Changelog date -class UTC(datetime.tzinfo): - def utcoffset(self, dt): - return datetime.timedelta(0) - - def tzname(self, dt): - return "UTC" - - def dst(self, dt): - return datetime.timedelta(0) - -# Generation Functions -def generate_and_write_all(config_data, template_dir, output_dir, package_name=None, package_version=None): - try: - changelog_contents = generate_changelog( - config_data, - template_dir, - package_name=package_name, - package_version=package_version) - - control_contents = generate_control(config_data, template_dir, package_name=package_name) - copyright_contents = generate_copyright(config_data, template_dir) - symlink_contents = generate_symlinks(config_data, package_name=package_name) - except Exception as exc: - print exc - help_and_exit("Error: Generation Failed, check your config file.") - - write_file(changelog_contents, output_dir, FILE_CHANGELOG) - write_file(control_contents, output_dir, FILE_CONTROL) - write_file(copyright_contents, output_dir, FILE_COPYRIGHT) - - # Symlink File is optional - if symlink_contents: - symlink_filename = get_symlink_filename(config_data, package_name=package_name) - write_file(symlink_contents, output_dir, symlink_filename) - - return - -def generate_changelog(config_data, template_dir, package_version=None, package_name=None): - template = get_template(template_dir, FILE_CHANGELOG) - - release_data = config_data["release"] - - # Allow for Version Override - config_package_version = release_data["package_version"] - package_version = package_version or config_package_version - - template_dict = dict(\ - PACKAGE_VERSION=package_version, - PACKAGE_REVISION=release_data["package_revision"], - CHANGELOG_MESSAGE=release_data["changelog_message"], - URGENCY=release_data.get("urgency", "low"), - - PACKAGE_NAME=package_name or config_data["package_name"], - MAINTAINER_NAME=config_data["maintainer_name"], - MAINTAINER_EMAIL=config_data["maintainer_email"], - DATE=datetime.datetime.now(UTC()).strftime(CHANGELOG_DATE_FORMAT) - ) - - contents = template.format(**template_dict) - - return contents - -def generate_control(config_data, template_dir, package_name=None): - template = get_template(template_dir, FILE_CONTROL) - - dependency_data = config_data.get("debian_dependencies", None) - dependency_str = get_dependendent_packages_string(dependency_data) - - conflict_data = config_data.get("package_conflicts", []) - conflict_str = ', '.join(conflict_data) - - # Default to empty dict, so we don't explode on nested optional values - control_data = config_data.get("control", dict()) - - template_dict = dict(\ - SHORT_DESCRIPTION=config_data["short_description"], - LONG_DESCRIPTION=config_data["long_description"], - HOMEPAGE=config_data.get("homepage", ""), - - SECTION=control_data.get("section", "misc"), - PRIORITY=control_data.get("priority", "low"), - ARCH=control_data.get("architecture", "all"), - - DEPENDENT_PACKAGES=dependency_str, - CONFLICT_PACKAGES=conflict_str, - - PACKAGE_NAME=package_name or config_data["package_name"], - MAINTAINER_NAME=config_data["maintainer_name"], - MAINTAINER_EMAIL=config_data["maintainer_email"] - ) - - contents = template.format(**template_dict) - - return contents - -def generate_copyright(config_data, template_dir): - template = get_template(template_dir, FILE_COPYRIGHT) - - license_data = config_data["license"] - - template_dict = dict(\ - COPYRIGHT_TEXT=config_data["copyright"], - LICENSE_NAME=license_data["type"], - LICENSE_TEXT=license_data["full_text"] - ) - - contents = template.format(**template_dict) - - return contents - -def generate_symlinks(config_data, package_name=None): - symlink_entries = [] - package_root_path = get_package_root(config_data, package_name=package_name) - - symlink_data = config_data.get("symlinks", dict()) - - for package_rel_path, symlink_path in symlink_data.iteritems(): - - package_abs_path = os.path.join(package_root_path, package_rel_path) - - symlink_entries.append( '%s %s' % (package_abs_path, symlink_path) ) - - return '\n'.join(symlink_entries) - -# Helper Functions -def get_package_root(config_data, package_name=None): - config_install_root = config_data.get("install_root", None) - package_name = package_name or config_data["package_name"] - - return config_install_root or PACKAGE_ROOT_FORMAT.format(package_name=package_name) - -def get_symlink_filename(config_data, package_name=None): - package_name = package_name or config_data["package_name"] - return FILE_SYMLINK_FORMAT.format(package_name=package_name) - -def get_dependendent_packages_string(debian_dependency_data): - if debian_dependency_data is None: - return "" - - dependencies = [] - - for debian_package_name in debian_dependency_data: - dep_str = debian_package_name - - if debian_dependency_data[debian_package_name].get("package_version", None): - debian_package_version = debian_dependency_data[debian_package_name].get("package_version") - - dep_str += " (>= %s)" % debian_package_version - - dependencies.append(dep_str) - - # Leading Comma is important here - return ', ' + ', '.join(dependencies) - - -def load_json(json_path): - json_data = None - with open(json_path, 'r') as json_file: - json_data = json.load(json_file) - - return json_data - -def get_template(template_dir, name): - path = os.path.join(template_dir, name) - template_contents = None - - with open(path, 'r') as template_file: - template_contents = template_file.read() - - return template_contents - -def write_file(contents, output_dir, name): - path = os.path.join(output_dir, name) - - with open(path, 'w') as out_file: - out_file.write(contents) - - return - -# Tool Functions -def help_and_exit(msg): - print msg - sys.exit(1) - -def print_usage(): - print "Usage: config_template_generator.py [config file path] [template directory path] [output directory] (package name) (package version)" - -def parse_and_validate_args(): - if len(sys.argv) < 4: - print_usage() - help_and_exit("Error: Invalid Arguments") - - config_path = sys.argv[1] - template_dir = sys.argv[2] - output_dir = sys.argv[3] - name_override = None - version_override = None - - if len(sys.argv) >= 5: - name_override = sys.argv[4] - - if len(sys.argv) >= 6: - version_override = sys.argv[5] - - if not os.path.isfile(config_path): - help_and_exit("Error: Invalid config file path") - - if not os.path.isdir(template_dir): - help_and_exit("Error: Invalid template directory path") - - if not os.path.isdir(output_dir): - help_and_exit("Error: Invalid output directory path") - - return (config_path, template_dir, output_dir, name_override, version_override) - -def execute(): - config_path, template_dir, output_dir, name_override, version_override = parse_and_validate_args() - - config_data = load_json(config_path) - - generate_and_write_all(config_data, template_dir, output_dir, package_name = name_override, package_version=version_override) - -if __name__ == "__main__": - execute() \ No newline at end of file diff --git a/tools/DebianPackageTool/scripts/debian_build_lib.sh b/tools/DebianPackageTool/scripts/debian_build_lib.sh deleted file mode 100755 index 8aa53420f..000000000 --- a/tools/DebianPackageTool/scripts/debian_build_lib.sh +++ /dev/null @@ -1,170 +0,0 @@ -# -# 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. -# - -# This file is not intended to be executed directly -# Import these functions using source -# -# Relies on these environment variables: -# PACKAGE_SOURCE_DIR :: Package Source Staging Directory -# INSTALL_ROOT :: Absolute path of package installation root - -# write_debian_install_file -# Summary: Writes the contents of the "install_placement" array to the debian/install -# This array is populated by calls to the "add_system_file_placement" function -# Usage: write_debian_install_file -write_debian_install_file(){ - # Remove any existing install file, we need to overwrite it - rm -f ${PACKAGE_SOURCE_DIR}/debian/install - - for i in "${install_placement[@]}" - do - echo "${i}" >> "${PACKAGE_SOURCE_DIR}/debian/install" - done -} - -# add_system_file_placement -# Summary: Registers a file placement on the filesystem from the package by populating the "install_placement" array -# Usage: add_system_file_placement {local path of file in package} {absolute path of directory to place file in} -add_system_file_placement(){ - #Initialize placement_index variable - if [[ -z "$placement_index" ]]; then - placement_index=0 - fi - - install_placement[${placement_index}]="${1} ${2}" - placement_index=$((${placement_index}+1)) -} - -# add_system_dir_placement -# Summary: Registers a directory placement on the post-installation package from an in-package path -add_system_dir_placement(){ - - in_package_dir=$1 - abs_installation_dir=$2 - - dir_files=( $(_get_files_in_dir_tree $PACKAGE_SOURCE_DIR/$in_package_dir) ) - - # If in_package_dir isn't empty include a slash - if [ ! -z "$in_package_dir" ]; then - in_package_dir="${in_package_dir}/" - fi - - for rel_filepath in ${dir_files[@]} - do - local parent_path=$(dirname $rel_filepath) - - # If there is no parent, parent_path = "." - if [[ "$parent_path" == "." ]]; then - add_system_file_placement "${in_package_dir}${rel_filepath}" "${abs_installation_dir}" - else - add_system_file_placement "${in_package_dir}${rel_filepath}" "${abs_installation_dir}/${parent_path}" - fi - - done -} - -# add_file_to_install -# Summary: Adds a file from the local filesystem to the package and installs it rooted at INSTALL_ROOT -# Usage: add_install_file {relative path to local file} {relative path to INSTALL_ROOT to place file} -add_file_to_install(){ - copy_from_file=$1 - rel_install_path=$2 - - local filename=$(basename $copy_from_file) - local parent_dir=$(dirname $copy_from_file) - - # Create Relative Copy From Path - rel_copy_from_file=${copy_from_file#$parent_dir/} - - # Delete any existing file and ensure path exists - rm -f ./${PACKAGE_SOURCE_DIR}/${rel_install_path}/${filename} - mkdir -p ./${PACKAGE_SOURCE_DIR}/${rel_install_path} - - dir_files=( "$rel_copy_from_file" ) - - _copy_files_to_package $parent_dir $rel_install_path "${dir_files[@]}" - - add_system_file_placement "${rel_install_path}/${filename}" "${INSTALL_ROOT}/$rel_install_path" -} - -# add_dir_to_install -# Summary: Adds contents of a directory on the local filesystem to the package and installs them rooted at INSTALL_ROOT -# Note: Does not install the directory passed, only its contents -# Usage: add_dir_to_install {relative path of directory to copy} {relative path to INSTALL_ROOT to place directory tree} -add_dir_to_install(){ - - copy_from_dir=$1 - rel_install_path=$2 - - # Delete and Create any existing directory - mkdir -p ${PACKAGE_SOURCE_DIR}/${rel_install_path} - - dir_files=( $(_get_files_in_dir_tree $copy_from_dir) ) - - _copy_files_to_package "$copy_from_dir" "$rel_install_path" "${dir_files[@]}" - - for file in "${dir_files[@]}" - do - file_rel_dir="$(dirname $file)" - add_system_file_placement "${rel_install_path}/${file}" "${INSTALL_ROOT}/$rel_install_path/${file_rel_dir}" - done -} - -# Usage: _copy_files_to_package {local files root directory} {relative directory in package to copy to} "${filepath_array[@]}" -# Note: The specific syntax on the parameter shows how to pass an array -_copy_files_to_package(){ - local_root_dir=$1 - package_dest_dir=$2 - - # Consume the remaining input as an array - shift; shift; - rel_filepath_list=( $@ ) - - for rel_filepath in ${rel_filepath_list[@]} - do - local parent_dir=$(dirname $rel_filepath) - local filename=$(basename $rel_filepath) - - mkdir -p ${PACKAGE_SOURCE_DIR}/${package_dest_dir}/${parent_dir} - - # Ignore $parent_dir if it there isn't one - if [[ "$parent_dir" == "." ]]; then - cp "${local_root_dir}/${rel_filepath}" "${PACKAGE_SOURCE_DIR}/${package_dest_dir}" - else - cp "${local_root_dir}/${rel_filepath}" "${PACKAGE_SOURCE_DIR}/${package_dest_dir}/${parent_dir}" - fi - - done -} - -# Usage: _get_files_in_dir_tree {path of directory} -_get_files_in_dir_tree(){ - - root_dir=$1 - - # Use Globstar expansion to enumerate all directories and files in the tree - shopt -s globstar - shopt -s dotglob - dir_tree_list=( "${root_dir}/"** ) - - # Build a new array with only the Files contained in $dir_tree_list - local index=0 - for file_path in "${dir_tree_list[@]}" - do - if [ -f $file_path ]; then - dir_tree_file_list[${index}]=$file_path - index=$(($index+1)) - fi - done - - # Remove $root_dir prefix from each path in dir_tree_file_list - # This is confusing syntax, so here's a reference link (Substring Removal) - # http://wiki.bash-hackers.org/syntax/pe - dir_tree_file_list=( "${dir_tree_file_list[@]#${root_dir}/}" ) - - # Echo is the return mechanism - echo "${dir_tree_file_list[@]}" -} - diff --git a/tools/DebianPackageTool/scripts/extract_json_value.py b/tools/DebianPackageTool/scripts/extract_json_value.py deleted file mode 100755 index c7d290bf1..000000000 --- a/tools/DebianPackageTool/scripts/extract_json_value.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python -# -# 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. -# - -# Extract Json Value -# -# Very simple tool to ease extracting json values from the cmd line. -import os -import sys -import json - -def print_usage(): - print """ - Usage: extract_json_value.py [json file path] [key of value to extract] - For nested keys, use . separator - """ - -def help_and_exit(msg=None): - print msg - print_usage() - sys.exit(1) - -def parse_and_validate_args(): - - if len(sys.argv) < 3: - help_and_exit(msg="Error: Invalid Args") - - json_path = sys.argv[1] - json_key = sys.argv[2] - - if not os.path.isfile(json_path): - help_and_exit("Error: Invalid json file path") - - return json_path, json_key - -def extract_key(json_path, json_key): - json_data = None - - with open(json_path, 'r') as json_file: - json_data = json.load(json_file) - - nested_keys = json_key.split('.') - json_context = json_data - - for key in nested_keys: - json_context = json_context.get(key, None) - - if json_context is None: - help_and_exit("Error: Invalid json key") - - return str(json_context) - -def execute(): - json_path, json_key = parse_and_validate_args() - - value = extract_key(json_path, json_key) - - return value - -if __name__ == "__main__": - print execute() - diff --git a/tools/DebianPackageTool/scripts/manpage_generator.py b/tools/DebianPackageTool/scripts/manpage_generator.py deleted file mode 100755 index 3ba7afb8a..000000000 --- a/tools/DebianPackageTool/scripts/manpage_generator.py +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/python -# -# 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. -# - -# manpage_generator -# Converts top level docs.json format command info to -# nroff manpage format. Done in python for easy json parsing. -# -# Usage: argv[1] = path to docs.json; argv[2] = output path - -import sys -import os -import json -import datetime - -SECTION_SEPARATOR = "\n.P \n" -MANPAGE_EXTENSION = ".1" - -# For now this is a magic number -# See https://www.debian.org/doc/manuals/maint-guide/dother.en.html#manpage -SECTION_NUMBER = 1 - -def generate_man_pages(doc_path, output_dir): - - with open(doc_path) as doc_file: - doc_json = None - try: - doc_json = json.load(doc_file) - except: - raise Exception("Failed to load json file. Check formatting.") - - tools = doc_json.get("tools", None) - - if tools is None: - raise Exception("No tool sections in doc.json") - - for tool_name in tools: - tool_data = tools[tool_name] - - man_page_content = generate_man_page(tool_name, tool_data) - man_page_path = get_output_path(tool_name, output_dir) - - write_man_page(man_page_path, man_page_content) - -def get_output_path(toolname, output_dir): - out_filename = toolname + MANPAGE_EXTENSION - - return os.path.join(output_dir, out_filename) - -def write_man_page(path, content): - with open(path, 'w') as man_file: - man_file.write(content) - - #Build Fails without a final newline - man_file.write('\n') - -def generate_man_page(tool_name, tool_data): - - sections = [ - generate_header_section(tool_name, tool_data), - generate_name_section(tool_name, tool_data), - generate_synopsis_section(tool_name, tool_data), - generate_description_section(tool_name, tool_data), - generate_options_section(tool_name, tool_data), - generate_author_section(tool_name, tool_data), - generate_copyright_section(tool_name, tool_data) - ] - - return SECTION_SEPARATOR.join(sections) - -def generate_header_section(tool_name, tool_data):# - roff_text_builder = [] - - header_format = ".TH {program_name} {section_number} {center_footer} {left_footer} {center_header}" - - today = datetime.date.today() - today_string = today.strftime("%B %d, %Y") - - format_args = { - "program_name" : tool_name, - "section_number" : SECTION_NUMBER, - "center_footer" : "", # Omitted - "left_footer" : "", # Omitted - "center_header" : "" # Omitted - } - - roff_text_builder.append(header_format.format(**format_args)) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_name_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH NAME") - - tool_short_description = tool_data.get("short_description", "") - name_format = ".B {program_name} - {short_description}" - - name_format_args = { - "program_name": tool_name, - "short_description" : tool_short_description - } - - roff_text_builder.append(name_format.format(**name_format_args)) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_synopsis_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH SYNOPSIS") - - synopsis_format = '.B {program_name} {command_name} \n.RI {options} " "\n.I "{argument_list_name}"' - - tool_commands = tool_data.get("commands", []) - for command_name in tool_commands: - command_data = tool_commands[command_name] - - # Default options to empty list so the loop doesn't blow up - options = command_data.get("options", []) - argument_list = command_data.get("argumentlist", None) - - # Construct Option Strings - option_string_list = [] - argument_list_name = "" - - for option_name in options: - option_data = options[option_name] - - specifier_short = option_data.get("short", None) - specifier_long = option_data.get("long", None) - parameter = option_data.get("parameter", None) - - option_string = _option_string_helper(specifier_short, specifier_long, parameter) - - option_string_list.append(option_string) - - # Populate Argument List Name - if argument_list: - argument_list_name = argument_list.get("name", "") - - cmd_format_args = { - 'program_name' : tool_name, - 'command_name' : command_name, - 'options' : '" "'.join(option_string_list), - 'argument_list_name' : argument_list_name - } - - cmd_string = synopsis_format.format(**cmd_format_args) - - roff_text_builder.append(cmd_string) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_description_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH DESCRIPTION") - - # Tool Description - long_description = tool_data.get("long_description", "") - roff_text_builder.append(".PP {0}".format(long_description)) - - # Command Descriptions - cmd_description_format = ".B {program_name} {command_name}\n{command_description}" - - tool_commands = tool_data.get("commands", []) - for command_name in tool_commands: - command_data = tool_commands[command_name] - - command_description = command_data.get("description", "") - - format_args = { - "program_name" : tool_name, - "command_name" : command_name, - "command_description" : command_description - } - - cmd_string = cmd_description_format.format(**format_args) - - roff_text_builder.append(cmd_string) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_options_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH OPTIONS") - - options_format = '.TP\n.B {option_specifiers}\n{option_description}' - - tool_commands = tool_data.get("commands", []) - for command_name in tool_commands: - command_data = tool_commands[command_name] - - # Default to empty list so the loop doesn't blow up - options = command_data.get("options", []) - - for option_name in options: - option_data = options[option_name] - - specifier_short = option_data.get("short", None) - specifier_long = option_data.get("long", None) - parameter = option_data.get("parameter", None) - description = option_data.get("description", "") - - option_specifiers_string = _option_string_helper(specifier_short, - specifier_long, - parameter, - include_brackets = False, - delimiter=' ", " ') - - format_args = { - "option_specifiers": option_specifiers_string, - "option_description" : description - } - - roff_text_builder.append(options_format.format(**format_args)) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_author_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH AUTHOR") - - author_format = '.B "{author_name}" " " \n.RI ( "{author_email}" )' - - author_name = tool_data.get("author", "") - author_email = tool_data.get("author_email", "") - - format_args = { - "author_name" : author_name, - "author_email" : author_email - } - - roff_text_builder.append(author_format.format(**format_args)) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def generate_copyright_section(tool_name, tool_data):# - roff_text_builder = [] - roff_text_builder.append(".SH COPYRIGHT") - - copyright_data = tool_data.get("copyright") - - roff_text_builder.append('.B "{0}"'.format(copyright_data)) - - return SECTION_SEPARATOR.join(roff_text_builder) - -def _option_string_helper(specifier_short, specifier_long, parameter, include_brackets = True, delimiter = " | "): - option_string = "" - - if include_brackets: - option_string = " [ " - - if specifier_short: - option_string += ' "{0}" '.format(specifier_short) - - if specifier_short and specifier_long: - option_string += delimiter - - if specifier_long: - option_string += ' "{0}" '.format(specifier_long) - - if parameter: - option_string += ' " " ' - option_string += ' "{0}" '.format(parameter) - - if include_brackets: - option_string += " ] " - - return option_string - - -def print_usage(): - print "Usage: argv[1] = path to docs.json; argv[2] = output path" - print "Example: manpage_generator.py ../docs.json ./dotnet-1.0/debian" - -def parse_args(): - doc_path = sys.argv[1] - output_dir = sys.argv[2] - - return (doc_path, output_dir) - -def validate_args(doc_path, output_dir): - if not os.path.isfile(doc_path): - raise Exception("Docs.json path is not valid.") - - if not os.path.isdir(output_dir): - raise Exception("Output Directory Path is not valid.") - -def execute_command_line(): - try: - doc_path, output_dir = parse_args() - - validate_args(doc_path, output_dir) - - generate_man_pages(doc_path, output_dir) - - except Exception as exc: - print "Error: ", exc - print_usage() - -if __name__ == "__main__": - execute_command_line() diff --git a/tools/DebianPackageTool/setup/build_setup.sh b/tools/DebianPackageTool/setup/build_setup.sh deleted file mode 100755 index 269aff50e..000000000 --- a/tools/DebianPackageTool/setup/build_setup.sh +++ /dev/null @@ -1,20 +0,0 @@ -# -# 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. -# - -install_dependencies(){ - # Add LLdb 3.6 package source - echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - - - #Install Deps - apt-get update - apt-get install -y debhelper build-essential devscripts git liblttng-ust-dev lldb-3.6-dev -} - -setup(){ - install_dependencies -} - -setup \ No newline at end of file diff --git a/tools/DebianPackageTool/setup/test_setup.sh b/tools/DebianPackageTool/setup/test_setup.sh deleted file mode 100755 index 47442fd60..000000000 --- a/tools/DebianPackageTool/setup/test_setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -# -# 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. -# - -install_dependencies(){ - # Add LLdb 3.6 package source - echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - - - #Install Deps - apt-get update - apt-get install -y debhelper build-essential devscripts git liblttng-ust-dev lldb-3.6-dev -} - -install_bats(){ - git clone https://github.com/sstephenson/bats.git - cd bats - ./install.sh /usr/local -} - -setup(){ - install_dependencies - install_bats -} - -setup \ No newline at end of file diff --git a/tools/DebianPackageTool/templates/debian/changelog b/tools/DebianPackageTool/templates/debian/changelog deleted file mode 100644 index 8eccaab39..000000000 --- a/tools/DebianPackageTool/templates/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -{PACKAGE_NAME} ({PACKAGE_VERSION}-{PACKAGE_REVISION}) unstable; urgency={URGENCY} - - * {CHANGELOG_MESSAGE} - - -- {MAINTAINER_NAME} <{MAINTAINER_EMAIL}> {DATE} diff --git a/tools/DebianPackageTool/templates/debian/control b/tools/DebianPackageTool/templates/debian/control deleted file mode 100644 index 49fb2b994..000000000 --- a/tools/DebianPackageTool/templates/debian/control +++ /dev/null @@ -1,19 +0,0 @@ -# -# 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. -# - -Source: {PACKAGE_NAME} -Maintainer: {MAINTAINER_NAME} <{MAINTAINER_EMAIL}> -Section: {SECTION} -Priority: {PRIORITY} -Standards-Version: 3.9.2 -Build-Depends: debhelper (>=9) -Homepage: {HOMEPAGE} - -Package: {PACKAGE_NAME} -Architecture: {ARCH} -Depends: ${{shlibs:Depends}}, ${{misc:Depends}}{DEPENDENT_PACKAGES} -Conflicts: {CONFLICT_PACKAGES} -Description: {SHORT_DESCRIPTION} - {LONG_DESCRIPTION} diff --git a/tools/DebianPackageTool/templates/debian/copyright b/tools/DebianPackageTool/templates/debian/copyright deleted file mode 100644 index 1fe22df1b..000000000 --- a/tools/DebianPackageTool/templates/debian/copyright +++ /dev/null @@ -1,10 +0,0 @@ -Comment: 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. - -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ - -Files: * -Copyright: {COPYRIGHT_TEXT} -License: {LICENSE_NAME} - -License: {LICENSE_NAME} - {LICENSE_TEXT} \ No newline at end of file diff --git a/tools/DebianPackageTool/test.sh b/tools/DebianPackageTool/test.sh deleted file mode 100755 index 9adde436f..000000000 --- a/tools/DebianPackageTool/test.sh +++ /dev/null @@ -1,41 +0,0 @@ -# -# 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. -# - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -current_user=$(whoami) -if [ $current_user != "root" ]; then - echo "test.sh requires superuser privileges to run" - exit 1 -fi - -run_unit_tests(){ - bats $DIR/test/unit_tests/test_debian_build_lib.bats - bats $DIR/test/unit_tests/test_scripts.bats -} - -run_integration_tests(){ - input_dir=$DIR/test/test_assets/test_package_layout - output_dir=$DIR/bin - - # Create output dir - mkdir -p $output_dir - - # Build the actual package - $DIR/package_tool -i $input_dir -o $output_dir - - # Integration Test Entrypoint placed by package_tool - bats $output_dir/test_package.bats - - # Cleanup output dir - rm -rf $DIR/test/test_assets/test_package_output -} - -run_all(){ - run_unit_tests - run_integration_tests -} - -run_all diff --git a/tools/DebianPackageTool/test/integration_tests/test_package.bats b/tools/DebianPackageTool/test/integration_tests/test_package.bats deleted file mode 100755 index 8f4c75053..000000000 --- a/tools/DebianPackageTool/test/integration_tests/test_package.bats +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/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. -# -# This script is used to test the debian package after it's creation. -# The package tool will drop it next to the .deb file it creates. -# Environment Variables: -# LAST_VERSION_URL: Url for last version .deb (to test upgrades) [required for upgrade test] - -#Ensure running with superuser privileges -current_user=$(whoami) -if [ $current_user != "root" ]; then - echo "WARNING: test_package.bats requires superuser privileges to run, trying sudo..." - SUDO_PREFIX="sudo" -fi - -setup(){ - DIR="$BATS_TEST_DIRNAME" - - PACKAGE_FILENAME="$(ls $DIR | grep .deb -m 1)" - PACKAGE_PATH="$DIR/*.deb" - - # Get Package name from package path, - PACKAGE_NAME=${PACKAGE_FILENAME%%_*} -} - -install_package(){ - $SUDO_PREFIX dpkg -i $PACKAGE_PATH -} - -remove_package(){ - $SUDO_PREFIX dpkg -r $PACKAGE_NAME -} - -purge_package(){ - $SUDO_PREFIX dpkg -P $PACKAGE_NAME -} - -install_last_version(){ - $SUDO_PREFIX dpkg -i "$DIR/last_version.deb" -} - -download_and_install_last_version(){ - curl "$LAST_VERSION_URL" -o "$DIR/last_version.deb" - - install_last_version -} - -delete_last_version(){ - rm -f "$DIR/last_version.deb" -} - -teardown(){ - delete_last_version -} - -@test "package install + removal test" { - install_package - remove_package -} - -@test "package install + purge test" { - install_package - purge_package -} - -# Ultimate Package Test -# https://www.debian.org/doc/manuals/maint-guide/checkit.en.html#pmaintscripts -@test "package install + upgrade + purge + install + remove + install + purge test" { - if [ ! -z "$LAST_VERSION_URL" ]; then - download_and_install_last_version - install_package - purge_package - install_package - remove_package - install_package - purge_package - fi -} diff --git a/tools/DebianPackageTool/test/test_assets/lkgtestman.1 b/tools/DebianPackageTool/test/test_assets/lkgtestman.1 deleted file mode 100644 index 57915b0a6..000000000 --- a/tools/DebianPackageTool/test/test_assets/lkgtestman.1 +++ /dev/null @@ -1,99 +0,0 @@ -.TH tool1 1 -.P -.SH NAME -.P -.B tool1 - A tool to Vestibulum lacinia arcu eget nulla. -.P -.SH SYNOPSIS -.P -.B tool1 noOptionsCommand -.RI " " -.I "argument list stuff" -.P -.B tool1 noArgumentListFullOptions -.RI [ "-t" | "--target" " " "TARGET" ] " " [ "--noshortparam" ] " " [ "-l" ] " " [ "-p" | "--noparam" ] " " [ "-n" " " "NOLONG" ] " " [ "--noshort" " " "NOSHORT" ] " " [ "-a" | "--another" " " "ANOTHER" ] " " -.I "" -.P -.B tool1 fullcommand1 -.RI [ "-t" | "--target" " " "TARGET" ] " " [ "--noshortparam" ] " " [ "-l" ] " " [ "-p" | "--noparam" ] " " [ "-n" " " "NOLONG" ] " " [ "--noshort" " " "NOSHORT" ] " " [ "-a" | "--another" " " "ANOTHER" ] " " -.I "argument list stuff" -.P -.SH DESCRIPTION -.P -.PP Tool1 is a really great Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. -.P -.B tool1 noOptionsCommand -builds a native executable from specified source files -.P -.B tool1 noArgumentListFullOptions -builds a native executable from specified source files -.P -.B tool1 fullcommand1 -builds a native executable from specified source files -.P -.SH OPTIONS -.P -.TP -.B "-t" ", " "--target" " " "TARGET" -Specifies target binary output type. EXE or DLL -.P -.TP -.B "--noshortparam" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-l" -Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet -.P -.TP -.B "-p" ", " "--noparam" -Specifies noparam metus vitae pharetra auctor, sem -.P -.TP -.B "-n" " " "NOLONG" -Specifies nolong Nunc feugiat mi a tellus consequat -.P -.TP -.B "--noshort" " " "NOSHORT" -Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt -.P -.TP -.B "-a" ", " "--another" " " "ANOTHER" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-t" ", " "--target" " " "TARGET" -Specifies target binary output type. EXE or DLL -.P -.TP -.B "--noshortparam" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-l" -Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet -.P -.TP -.B "-p" ", " "--noparam" -Specifies noparam metus vitae pharetra auctor, sem -.P -.TP -.B "-n" " " "NOLONG" -Specifies nolong Nunc feugiat mi a tellus consequat -.P -.TP -.B "--noshort" " " "NOSHORT" -Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt -.P -.TP -.B "-a" ", " "--another" " " "ANOTHER" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.SH AUTHOR -.P -.B "Test Author" " " -.RI ( "testing@testing.com" ) -.P -.SH COPYRIGHT -.P -.B "This is the copyright of tool1." diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/debian_config.json b/tools/DebianPackageTool/test/test_assets/test_package_layout/debian_config.json deleted file mode 100644 index db873c716..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/debian_config.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "maintainer_name":"Microsoft", - "maintainer_email": "optimus@service.microsoft.com", - - "package_name": "packagetooltest", - - "short_description": "This is a test package", - "long_description": "This is a longer description of the test package", - "homepage": "http://testpackage.com", - - "release":{ - "package_version":"0.1", - "package_revision":"1", - "urgency" : "low", - "changelog_message" : "some stuff here" - }, - - "control": { - "priority":"standard", - "section":"devel", - "architecture":"any" - }, - - "copyright": "2015 Microsoft", - "license": { - "type": "some_license", - "full_text": "full license text here" - }, - - "debian_dependencies" : { - "curl": { - "package_version" : "0.5.3" - }, - "python":{} - }, - - "symlinks": { - "path_relative_to_package_root/test_exe.sh" : "usr/bin/test_exe.sh" - } -} \ No newline at end of file diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/docs.json b/tools/DebianPackageTool/test/test_assets/test_package_layout/docs.json deleted file mode 100644 index e35fdb3bf..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/docs.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "tools": { - "tool1": { - "copyright": "This is the copyright of tool1.", - "license" : "This is the license of tool1", - "author":"Test Author", - "author_email":"testing@testing.com", - "short_description":"A tool to Vestibulum lacinia arcu eget nulla.", - "long_description":"Tool1 is a really great Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. ", - "commands": { - "fullcommand1":{ - "description":"builds a native executable from specified source files", - "options" : { - "target": { - "short": "-t", - "long":"--target", - "description":"Specifies target binary output type. EXE or DLL", - "parameter":"TARGET" - }, - "target2": { - "short": "-a", - "long":"--another", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra", - "parameter":"ANOTHER" - }, - "noshort": { - "long":"--noshort", - "description":"Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt", - "parameter":"NOSHORT" - }, - "nolong": { - "short": "-n", - "description":"Specifies nolong Nunc feugiat mi a tellus consequat ", - "parameter":"NOLONG" - }, - "noparam": { - "short": "-p", - "long":"--noparam", - "description":"Specifies noparam metus vitae pharetra auctor, sem" - }, - "noParamNoShort": { - "long":"--noshortparam", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra" - }, - "noParamNoLong": { - "short": "-l", - "description":"Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet" - } - }, - "argumentlist" : { - "name":"argument list stuff", - "description":"ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" - } - - }, - "noOptionsCommand":{ - "description":"builds a native executable from specified source files", - "argumentlist" : { - "name":"argument list stuff", - "description":"ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" - } - - }, - "noArgumentListFullOptions":{ - "description":"builds a native executable from specified source files", - "options" : { - "target": { - "short": "-t", - "long":"--target", - "description":"Specifies target binary output type. EXE or DLL", - "parameter":"TARGET" - }, - "target2": { - "short": "-a", - "long":"--another", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra", - "parameter":"ANOTHER" - }, - "noshort": { - "long":"--noshort", - "description":"Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt", - "parameter":"NOSHORT" - }, - "nolong": { - "short": "-n", - "description":"Specifies nolong Nunc feugiat mi a tellus consequat ", - "parameter":"NOLONG" - }, - "noparam": { - "short": "-p", - "long":"--noparam", - "description":"Specifies noparam metus vitae pharetra auctor, sem" - }, - "noParamNoShort": { - "long":"--noshortparam", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra" - }, - "noParamNoLong": { - "short": "-l", - "description":"Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet" - } - } - } - } - - } - } -} diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/docs/testdocs.1 b/tools/DebianPackageTool/test/test_assets/test_package_layout/docs/testdocs.1 deleted file mode 100644 index 57915b0a6..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/docs/testdocs.1 +++ /dev/null @@ -1,99 +0,0 @@ -.TH tool1 1 -.P -.SH NAME -.P -.B tool1 - A tool to Vestibulum lacinia arcu eget nulla. -.P -.SH SYNOPSIS -.P -.B tool1 noOptionsCommand -.RI " " -.I "argument list stuff" -.P -.B tool1 noArgumentListFullOptions -.RI [ "-t" | "--target" " " "TARGET" ] " " [ "--noshortparam" ] " " [ "-l" ] " " [ "-p" | "--noparam" ] " " [ "-n" " " "NOLONG" ] " " [ "--noshort" " " "NOSHORT" ] " " [ "-a" | "--another" " " "ANOTHER" ] " " -.I "" -.P -.B tool1 fullcommand1 -.RI [ "-t" | "--target" " " "TARGET" ] " " [ "--noshortparam" ] " " [ "-l" ] " " [ "-p" | "--noparam" ] " " [ "-n" " " "NOLONG" ] " " [ "--noshort" " " "NOSHORT" ] " " [ "-a" | "--another" " " "ANOTHER" ] " " -.I "argument list stuff" -.P -.SH DESCRIPTION -.P -.PP Tool1 is a really great Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. -.P -.B tool1 noOptionsCommand -builds a native executable from specified source files -.P -.B tool1 noArgumentListFullOptions -builds a native executable from specified source files -.P -.B tool1 fullcommand1 -builds a native executable from specified source files -.P -.SH OPTIONS -.P -.TP -.B "-t" ", " "--target" " " "TARGET" -Specifies target binary output type. EXE or DLL -.P -.TP -.B "--noshortparam" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-l" -Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet -.P -.TP -.B "-p" ", " "--noparam" -Specifies noparam metus vitae pharetra auctor, sem -.P -.TP -.B "-n" " " "NOLONG" -Specifies nolong Nunc feugiat mi a tellus consequat -.P -.TP -.B "--noshort" " " "NOSHORT" -Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt -.P -.TP -.B "-a" ", " "--another" " " "ANOTHER" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-t" ", " "--target" " " "TARGET" -Specifies target binary output type. EXE or DLL -.P -.TP -.B "--noshortparam" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.TP -.B "-l" -Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet -.P -.TP -.B "-p" ", " "--noparam" -Specifies noparam metus vitae pharetra auctor, sem -.P -.TP -.B "-n" " " "NOLONG" -Specifies nolong Nunc feugiat mi a tellus consequat -.P -.TP -.B "--noshort" " " "NOSHORT" -Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt -.P -.TP -.B "-a" ", " "--another" " " "ANOTHER" -Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra -.P -.SH AUTHOR -.P -.B "Test Author" " " -.RI ( "testing@testing.com" ) -.P -.SH COPYRIGHT -.P -.B "This is the copyright of tool1." diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/path_relative_to_package_root/test_exe.sh b/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/path_relative_to_package_root/test_exe.sh deleted file mode 100755 index 370bc40f3..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/path_relative_to_package_root/test_exe.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/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. -# - -# Resolve symlinks until we have the parent dir of the actual file -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -# This is how tools should be called -exec bash $DIR/../test_called.sh diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/test_called.sh b/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/test_called.sh deleted file mode 100755 index e14e427cf..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/package_root/test_called.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/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. -# - -echo "script called" diff --git a/tools/DebianPackageTool/test/test_assets/test_package_layout/samples/testsample.cs b/tools/DebianPackageTool/test/test_assets/test_package_layout/samples/testsample.cs deleted file mode 100644 index 4f7432b48..000000000 --- a/tools/DebianPackageTool/test/test_assets/test_package_layout/samples/testsample.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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; - -public class Program { - - public static void Main(){ - System.Console.WriteLine("Hello World"); - } - -} \ No newline at end of file diff --git a/tools/DebianPackageTool/test/test_assets/testdocs.json b/tools/DebianPackageTool/test/test_assets/testdocs.json deleted file mode 100644 index e35fdb3bf..000000000 --- a/tools/DebianPackageTool/test/test_assets/testdocs.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "tools": { - "tool1": { - "copyright": "This is the copyright of tool1.", - "license" : "This is the license of tool1", - "author":"Test Author", - "author_email":"testing@testing.com", - "short_description":"A tool to Vestibulum lacinia arcu eget nulla.", - "long_description":"Tool1 is a really great Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. ", - "commands": { - "fullcommand1":{ - "description":"builds a native executable from specified source files", - "options" : { - "target": { - "short": "-t", - "long":"--target", - "description":"Specifies target binary output type. EXE or DLL", - "parameter":"TARGET" - }, - "target2": { - "short": "-a", - "long":"--another", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra", - "parameter":"ANOTHER" - }, - "noshort": { - "long":"--noshort", - "description":"Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt", - "parameter":"NOSHORT" - }, - "nolong": { - "short": "-n", - "description":"Specifies nolong Nunc feugiat mi a tellus consequat ", - "parameter":"NOLONG" - }, - "noparam": { - "short": "-p", - "long":"--noparam", - "description":"Specifies noparam metus vitae pharetra auctor, sem" - }, - "noParamNoShort": { - "long":"--noshortparam", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra" - }, - "noParamNoLong": { - "short": "-l", - "description":"Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet" - } - }, - "argumentlist" : { - "name":"argument list stuff", - "description":"ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" - } - - }, - "noOptionsCommand":{ - "description":"builds a native executable from specified source files", - "argumentlist" : { - "name":"argument list stuff", - "description":"ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" - } - - }, - "noArgumentListFullOptions":{ - "description":"builds a native executable from specified source files", - "options" : { - "target": { - "short": "-t", - "long":"--target", - "description":"Specifies target binary output type. EXE or DLL", - "parameter":"TARGET" - }, - "target2": { - "short": "-a", - "long":"--another", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra", - "parameter":"ANOTHER" - }, - "noshort": { - "long":"--noshort", - "description":"Specifies noshortNam nec ante. Sed lacinia, urna non tincidunt", - "parameter":"NOSHORT" - }, - "nolong": { - "short": "-n", - "description":"Specifies nolong Nunc feugiat mi a tellus consequat ", - "parameter":"NOLONG" - }, - "noparam": { - "short": "-p", - "long":"--noparam", - "description":"Specifies noparam metus vitae pharetra auctor, sem" - }, - "noParamNoShort": { - "long":"--noshortparam", - "description":"Specifies another aptent taciti sociosqu ad litora torquent per conubia nostra" - }, - "noParamNoLong": { - "short": "-l", - "description":"Specifies noparam nolong congue elementum. Morbi in ipsum sit amet pede facilisis laoreet" - } - } - } - } - - } - } -} diff --git a/tools/DebianPackageTool/test/unit_tests/test_debian_build_lib.bats b/tools/DebianPackageTool/test/unit_tests/test_debian_build_lib.bats deleted file mode 100755 index 193868f83..000000000 --- a/tools/DebianPackageTool/test/unit_tests/test_debian_build_lib.bats +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/bin/env bats -# -# 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. -# - -# Tests for debian_build_lib.sh - -setup(){ - DIR="$BATS_TEST_DIRNAME" - PACKAGIFY_DIR="$(readlink -f $DIR/../../)" - - PACKAGE_DIR="$BATS_TMPDIR/test-package" - PACKAGE_SOURCE_DIR="$BATS_TMPDIR/test-source-package" - INSTALL_ROOT="test-install-root" - - # # Create Mock Package Directory - mkdir -p $PACKAGE_SOURCE_DIR/debian - mkdir $PACKAGE_DIR - - source $PACKAGIFY_DIR/scripts/debian_build_lib.sh - -} - -teardown(){ - # Remove Mock Package Directory - rm -r $PACKAGE_DIR - rm -r $PACKAGE_SOURCE_DIR -} - -@test "add_system_file_placement populates placement array" { - - add_system_file_placement "testfile0" "testdir0" - add_system_file_placement "testfile1" "testdir1" - - [ $placement_index -eq "2" ] - [ "${install_placement[0]}" = "testfile0 testdir0" ] - [ "${install_placement[1]}" = "testfile1 testdir1" ] -} - -@test "add_system_dir_placement adds files in dir to placement array" { - test_package_rel_dir="test-dir" - abs_test_path="/abs/test/path" - - mkdir $PACKAGE_SOURCE_DIR/$test_package_rel_dir - echo "file0 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file0 - echo "file1 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file1 - echo "file2 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file2 - - add_system_dir_placement $test_package_rel_dir $abs_test_path - - rm -r $PACKAGE_SOURCE_DIR/$test_package_rel_dir - - [ "$placement_index" -eq 3 ] - [ "${install_placement[0]}" = "$test_package_rel_dir/file0 $abs_test_path" ] - [ "${install_placement[1]}" = "$test_package_rel_dir/file1 $abs_test_path" ] - [ "${install_placement[2]}" = "$test_package_rel_dir/file2 $abs_test_path" ] -} - -@test "add_system_dir_placement adds all files in subdir to placement array" { - test_package_rel_dir="test-dir" - test_package_rel_subdir="test-subdir" - abs_test_path="/abs/test/path" - - mkdir -p $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir - echo "file0 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file0 - echo "file1 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file1 - echo "file2 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file2 - - add_system_dir_placement $test_package_rel_dir $abs_test_path - - rm -r $PACKAGE_SOURCE_DIR/$test_package_rel_dir - - [ "$placement_index" -eq "3" ] - [ "${install_placement[0]}" = "$test_package_rel_dir/$test_package_rel_subdir/file0 $abs_test_path/$test_package_rel_subdir" ] - [ "${install_placement[1]}" = "$test_package_rel_dir/$test_package_rel_subdir/file1 $abs_test_path/$test_package_rel_subdir" ] - [ "${install_placement[2]}" = "$test_package_rel_dir/$test_package_rel_subdir/file2 $abs_test_path/$test_package_rel_subdir" ] -} - -@test "add_system_dir_placement adds all files in subdir and dir to placement array" { - test_package_rel_dir="test-dir" - test_package_rel_subdir="test-subdir" - abs_test_path="/abs/test/path" - - mkdir -p $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir - echo "file0 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file0 - echo "file1 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file1 - echo "file2 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/file2 - echo "file3 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file3 - echo "file4 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file4 - echo "file5 contents" > $PACKAGE_SOURCE_DIR/$test_package_rel_dir/$test_package_rel_subdir/file5 - - add_system_dir_placement $test_package_rel_dir $abs_test_path - - rm -r $PACKAGE_SOURCE_DIR/$test_package_rel_dir - - [ "$placement_index" -eq "6" ] - [ "${install_placement[0]}" = "$test_package_rel_dir/file0 $abs_test_path" ] - [ "${install_placement[1]}" = "$test_package_rel_dir/file1 $abs_test_path" ] - [ "${install_placement[2]}" = "$test_package_rel_dir/file2 $abs_test_path" ] - [ "${install_placement[3]}" = "$test_package_rel_dir/$test_package_rel_subdir/file3 $abs_test_path/$test_package_rel_subdir" ] - [ "${install_placement[4]}" = "$test_package_rel_dir/$test_package_rel_subdir/file4 $abs_test_path/$test_package_rel_subdir" ] - [ "${install_placement[5]}" = "$test_package_rel_dir/$test_package_rel_subdir/file5 $abs_test_path/$test_package_rel_subdir" ] -} - -@test "write_debian_install_file writes to debian/install" { - add_system_file_placement "somefile" "/some/abs/path" - write_debian_install_file - - [ -f "$PACKAGE_SOURCE_DIR/debian/install" ] - [ "$(cat $PACKAGE_SOURCE_DIR/debian/install)" = "somefile /some/abs/path" ] -} - -@test "add_file_to_install adds file to package_dest_dir" { - local_test_dir="$BATS_TMPDIR/local-dir" - local_subdir="the/path/should/not/matter" - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir -p $local_test_dir/$local_subdir - echo "file0 contents" > $local_test_dir/$local_subdir/file0 - echo "file1 contents" > $local_test_dir/$local_subdir/file1 - echo "file2 contents" > $local_test_dir/$local_subdir/file2 - - add_file_to_install "$local_test_dir/$local_subdir/file0" "$package_test_dir" - add_file_to_install "$local_test_dir/$local_subdir/file1" "$package_test_dir" - add_file_to_install "$local_test_dir/$local_subdir/file2" "$package_test_dir" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file0" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file1" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file2" ] -} - -@test "add_file_to_install added files written to install file after write_debian_install_file" { - local_test_dir="$BATS_TMPDIR/local-dir" - local_subdir="the/path/should/not/matter" - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir -p $local_test_dir/$local_subdir - echo "file0 contents" > $local_test_dir/$local_subdir/file0 - - add_file_to_install "$local_test_dir/$local_subdir/file0" "$package_test_dir" - - rm -r $local_test_dir - - [ ! -e $PACKAGE_SOURCE_DIR/debian/install ] - write_debian_install_file - [ -f $PACKAGE_SOURCE_DIR/debian/install ] - [ "$(cat $PACKAGE_SOURCE_DIR/debian/install)" = "$package_test_dir/file0 $INSTALL_ROOT/$package_test_dir" ] -} - -@test "add_dir_to_install adds files in dir to package_dest_dir" { - local_test_dir="$BATS_TMPDIR/local-dir" - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir $local_test_dir - echo "file0 contents" > $local_test_dir/file0 - echo "file1 contents" > $local_test_dir/file1 - echo "file2 contents" > $local_test_dir/file2 - - add_dir_to_install "$local_test_dir" "$package_test_dir" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file0" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file1" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file2" ] -} - -@test "add_dir_to_install adds files in subdirectory tree to package_dest_dir" { - local_test_dir="$BATS_TMPDIR/local-dir" - local_test_subdir="local-subdir" - - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir -p $local_test_dir/$local_test_subdir - echo "file0 contents" > $local_test_dir/$local_test_subdir/file0 - echo "file1 contents" > $local_test_dir/$local_test_subdir/file1 - echo "file2 contents" > $local_test_dir/$local_test_subdir/file2 - - add_dir_to_install "$local_test_dir" "$package_test_dir" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file0" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file1" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file2" ] -} - -@test "add_dir_to_install adds files in directory and subdirectory tree to package_dest_dir" { - local_test_dir="$BATS_TMPDIR/local-dir" - local_test_subdir="local-subdir" - - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir -p $local_test_dir/$local_test_subdir - - echo "file0 contents" > $local_test_dir/file0 - echo "file1 contents" > $local_test_dir/file1 - echo "file2 contents" > $local_test_dir/file2 - echo "file3 contents" > $local_test_dir/$local_test_subdir/file3 - echo "file4 contents" > $local_test_dir/$local_test_subdir/file4 - echo "file5 contents" > $local_test_dir/$local_test_subdir/file5 - - add_dir_to_install "$local_test_dir" "$package_test_dir" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file0" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file1" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/file2" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file3" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file4" ] - [ -f "$PACKAGE_SOURCE_DIR/$package_test_dir/$local_test_subdir/file5" ] -} - -@test "add_dir_to_install added files written to install file after write_debian_install_file" { - local_test_dir="$BATS_TMPDIR/local-dir" - package_test_dir="package-dir" - - mkdir $PACKAGE_SOURCE_DIR/$package_test_dir - mkdir -p $local_test_dir - - echo "file0 contents" > $local_test_dir/file0 - - add_dir_to_install "$local_test_dir" "$package_test_dir" - - rm -r $local_test_dir - - [ ! -e $PACKAGE_SOURCE_DIR/debian/install ] - write_debian_install_file - [ -f $PACKAGE_SOURCE_DIR/debian/install ] - [ "$(cat $PACKAGE_SOURCE_DIR/debian/install)" = "$package_test_dir/file0 $INSTALL_ROOT/$package_test_dir" ] -} - -@test "add_dir_to_install with empty dest dir outputs to PACKAGE_SOURCE_DIR" { - local_test_dir="$BATS_TMPDIR/local-dir" - mkdir -p $local_test_dir - - echo "file0 contents" > $local_test_dir/file0 - - add_dir_to_install "$local_test_dir" "" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/file0" ] -} - - -@test "add_dir_to_install with empty dest dir adds files in directory and subdirectory tree to $PACKAGE_SOURCE_DIR" { - local_test_dir="$BATS_TMPDIR/local-dir" - local_test_subdir="local-subdir" - - mkdir -p $local_test_dir/$local_test_subdir - - echo "file0 contents" > $local_test_dir/file0 - echo "file1 contents" > $local_test_dir/file1 - echo "file2 contents" > $local_test_dir/file2 - echo "file3 contents" > $local_test_dir/$local_test_subdir/file3 - echo "file4 contents" > $local_test_dir/$local_test_subdir/file4 - echo "file5 contents" > $local_test_dir/$local_test_subdir/file5 - - add_dir_to_install "$local_test_dir" "" - - rm -r $local_test_dir - - [ -f "$PACKAGE_SOURCE_DIR/file0" ] - [ -f "$PACKAGE_SOURCE_DIR/file1" ] - [ -f "$PACKAGE_SOURCE_DIR/file2" ] - [ -f "$PACKAGE_SOURCE_DIR/$local_test_subdir/file3" ] - [ -f "$PACKAGE_SOURCE_DIR/$local_test_subdir/file4" ] - [ -f "$PACKAGE_SOURCE_DIR/$local_test_subdir/file5" ] -} diff --git a/tools/DebianPackageTool/test/unit_tests/test_scripts.bats b/tools/DebianPackageTool/test/unit_tests/test_scripts.bats deleted file mode 100755 index 9d23b0b12..000000000 --- a/tools/DebianPackageTool/test/unit_tests/test_scripts.bats +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bats -# -# 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. -# - -# Tests for debian_build_lib.sh - -setup(){ - DIR="$BATS_TEST_DIRNAME" - PACKAGIFY_DIR="$(readlink -f $DIR/../../)" -} - -@test "manpage generation is identical to lkg file" { - # Output is file "tool1.1" - # LKG file is "lkgtestman.1" - python $PACKAGIFY_DIR/scripts/manpage_generator.py $PACKAGIFY_DIR/test/test_assets/testdocs.json $PACKAGIFY_DIR/test/test_assets - - # Test Output existence - [ -f $PACKAGIFY_DIR/test/test_assets/tool1.1 ] - - # Test Output matches LKG - # If this is failing double check line ending style - [ -z "$(diff "$PACKAGIFY_DIR/test/test_assets/tool1.1" "$PACKAGIFY_DIR/test/test_assets/lkgtestman.1")" ] - - # Cleanup - rm $PACKAGIFY_DIR/test/test_assets/tool1.1 -} \ No newline at end of file