From 636075eb94acc15ef3a30b847cca42718778bab8 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Fri, 22 Jun 2018 16:30:57 -0500 Subject: [PATCH] sourcelink global tool (#353) * out with the old * netstandard2.0 & depdency update matching https://www.nuget.org/packages/Microsoft.Build.Utilities.Core/ * disable some tests while moving to v3 * those packages are gone * trim version, rename sourcelink to match executable * need to get them working again * Microsoft.SourceLink --- NuGet.Config | 3 +- README.md | 92 ++-- .../SourceLink.Copy.PdbFiles.csproj | 23 - .../SourceLink.Copy.PdbFiles.props | 6 - .../SourceLink.Copy.PdbFiles.targets | 9 - SourceLink.Create.BitBucket/CreateTask.cs | 10 - .../SourceLink.Create.BitBucket.csproj | 49 --- .../SourceLink.Create.BitBucket.props | 5 - .../SourceLink.Create.BitBucket.targets | 48 -- .../CreateTask.cs | 10 - .../SourceLink.Create.BitBucketServer.csproj | 49 --- .../SourceLink.Create.BitBucketServer.props | 5 - .../SourceLink.Create.BitBucketServer.targets | 48 -- .../BitBucketServerUrlConverter.cs | 0 .../BitBucketUrlConverter.cs | 0 .../FileUtil.cs | 0 .../GitHubUrlConverter.cs | 0 .../GitLabUrlConverter.cs | 0 .../SourceLink.Create.CommandLine.csproj | 24 +- .../SourceLink.Create.CommandLine.targets | 2 +- SourceLink.Create.GitHub/CreateTask.cs | 10 - .../SourceLink.Create.GitHub.csproj | 49 --- .../SourceLink.Create.GitHub.props | 5 - .../SourceLink.Create.GitHub.targets | 48 -- SourceLink.Create.GitLab/CreateTask.cs | 10 - .../SourceLink.Create.GitLab.csproj | 49 --- .../SourceLink.Create.GitLab.props | 5 - .../SourceLink.Create.GitLab.targets | 48 -- SourceLink.Create.Shared/GitCreateTask.cs | 121 ----- .../SourceLink.Create.Shared.projitems | 15 - .../SourceLink.Create.Shared.shproj | 13 - .../SourceLink.Embed.AllSourceFiles.csproj | 24 - .../SourceLink.Embed.AllSourceFiles.props | 5 - .../SourceLink.Embed.AllSourceFiles.targets | 17 - .../SourceLink.Embed.PaketFiles.csproj | 24 - .../SourceLink.Embed.PaketFiles.props | 5 - .../SourceLink.Embed.PaketFiles.targets | 19 - .../SourceLink.Embed.Shared.projitems | 13 - .../SourceLink.Embed.Shared.shproj | 13 - SourceLink.Shared/SourceLink.Shared.projitems | 14 - SourceLink.Shared/SourceLink.Shared.shproj | 13 - .../Process.cs | 0 SourceLink.Test/SourceLink.Test.csproj | 11 +- SourceLink.Test/SourceLink.Test.targets | 2 +- SourceLink.sln | 127 +----- .../When_package_without_lib_is_installed.cs | 6 - Tests/Tests.csproj | 17 +- Tests/When_parsing_links.cs | 24 +- appveyor.yml | 17 +- build.ps1 | 63 +-- build/build.proj | 3 +- build/common.props | 4 - build/sourcelink.props | 7 +- dotnet-sourcelink-git/Program.cs | 412 ------------------ dotnet-sourcelink-git/SourceFile.cs | 12 - .../dotnet-sourcelink-git.csproj | 16 - dotnet-sourcelink/Program.cs | 7 +- ...et-sourcelink.csproj => sourcelink.csproj} | 5 +- 58 files changed, 126 insertions(+), 1510 deletions(-) delete mode 100644 SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.csproj delete mode 100644 SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.props delete mode 100644 SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.targets delete mode 100644 SourceLink.Create.BitBucket/CreateTask.cs delete mode 100644 SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.csproj delete mode 100644 SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.props delete mode 100644 SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.targets delete mode 100644 SourceLink.Create.BitBucketServer/CreateTask.cs delete mode 100644 SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.csproj delete mode 100644 SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.props delete mode 100644 SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.targets rename {SourceLink.Create.BitBucketServer => SourceLink.Create.CommandLine}/BitBucketServerUrlConverter.cs (100%) rename {SourceLink.Create.BitBucket => SourceLink.Create.CommandLine}/BitBucketUrlConverter.cs (100%) rename {SourceLink.Create.Shared => SourceLink.Create.CommandLine}/FileUtil.cs (100%) rename {SourceLink.Create.GitHub => SourceLink.Create.CommandLine}/GitHubUrlConverter.cs (100%) rename {SourceLink.Create.GitLab => SourceLink.Create.CommandLine}/GitLabUrlConverter.cs (100%) delete mode 100644 SourceLink.Create.GitHub/CreateTask.cs delete mode 100644 SourceLink.Create.GitHub/SourceLink.Create.GitHub.csproj delete mode 100644 SourceLink.Create.GitHub/SourceLink.Create.GitHub.props delete mode 100644 SourceLink.Create.GitHub/SourceLink.Create.GitHub.targets delete mode 100644 SourceLink.Create.GitLab/CreateTask.cs delete mode 100644 SourceLink.Create.GitLab/SourceLink.Create.GitLab.csproj delete mode 100644 SourceLink.Create.GitLab/SourceLink.Create.GitLab.props delete mode 100644 SourceLink.Create.GitLab/SourceLink.Create.GitLab.targets delete mode 100644 SourceLink.Create.Shared/GitCreateTask.cs delete mode 100644 SourceLink.Create.Shared/SourceLink.Create.Shared.projitems delete mode 100644 SourceLink.Create.Shared/SourceLink.Create.Shared.shproj delete mode 100644 SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.csproj delete mode 100644 SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.props delete mode 100644 SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.targets delete mode 100644 SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.csproj delete mode 100644 SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.props delete mode 100644 SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.targets delete mode 100644 SourceLink.Embed.Shared/SourceLink.Embed.Shared.projitems delete mode 100644 SourceLink.Embed.Shared/SourceLink.Embed.Shared.shproj delete mode 100644 SourceLink.Shared/SourceLink.Shared.projitems delete mode 100644 SourceLink.Shared/SourceLink.Shared.shproj rename {SourceLink.Shared => SourceLink.Test}/Process.cs (100%) delete mode 100644 dotnet-sourcelink-git/Program.cs delete mode 100644 dotnet-sourcelink-git/SourceFile.cs delete mode 100644 dotnet-sourcelink-git/dotnet-sourcelink-git.csproj rename dotnet-sourcelink/{dotnet-sourcelink.csproj => sourcelink.csproj} (84%) diff --git a/NuGet.Config b/NuGet.Config index 4e1630e..8b0a086 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,6 +2,7 @@ - + + \ No newline at end of file diff --git a/README.md b/README.md index 36d7f30..f01f2be 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,57 @@ Source link support allows source code to be downloaded on demand while debugging. SourceLink is a set of build tools to help create and test for source link support. [Source link support](https://github.com/dotnet/core/blob/master/Documentation/diagnostics/source_link.md) is a developer productivity feature that allows unique information about an assembly's original source code to be embedded in its PDB during compilation. +![image](https://cloud.githubusercontent.com/assets/80104/23337630/001cedb6-fbba-11e6-9c44-68f4c826470c.png) + ## .NET Foundation -SourceLink is a [.NET Foundation](http://www.dotnetfoundation.org/projects) project. It [joined](http://www.dotnetfoundation.org/blog/2017/11/16/welcome-dnn-nunit-ironpython-mvvmcross-sourcelink-ilmerge-and-humanizer-to-the-net-foundation) in 2017-11. +SourceLink is now a [.NET Foundation](http://www.dotnetfoundation.org/) project at https://github.com/dotnet/sourcelink/. It [joined](http://www.dotnetfoundation.org/blog/2017/11/16/welcome-dnn-nunit-ironpython-mvvmcross-sourcelink-ilmerge-and-humanizer-to-the-net-foundation) in 2017-11. [Announced for .NET Core 2.1](https://blogs.msdn.microsoft.com/dotnet/2018/05/30/announcing-net-core-2-1/), much of the SourceLink support has been integrated into the SDK. -## License +New tools from https://github.com/dotnet/sourcelink/ are in beta. They are shipped in the NuGet Gallery as [Microsoft.SourceLink.*](https://www.nuget.org/packages?q=Microsoft.SourceLink.*) `1.0.0-beta*`. They currently work on Windows and Ubuntu, but will soon support the rest. -SourceLink is licensed under the [MIT license](LICENSE). +Most of the SourceLink 2 tools from this repository are made obsolete by the .NET SDK 2.1 and Microsoft.SourceLink tools. This repository will still continue to fill in gaps in tooling. SourceLink 3 tools from this repository will be tools that build on top of the .NET SDK 2.1. The first and only tool for 3.0 is a `sourcelink` command-line tool for testing for source link support. + +# Test + +For SourceLink version 3, [sourcelink](https://www.nuget.org/packages/SourceLink/3.0.0-build.732) is a [.NET Core global tool](https://natemcmaster.com/blog/2018/05/12/dotnet-global-tools/). +``` +dotnet tool install --global sourcelink --version 3.0.0-build.732 +``` + +`sourcelink` is a command you can use to test that the source link works. It makes sure all links work for every source file that is not embedded in the PDB. You can test a nupkg, a pdb, or a dll if the pdb is embedded. Run `sourcelink` without any options for a list of diagnostic commands and help: + +``` +SourceLink 3.0.0-build.732 +Source Code On Demand + +Usage: [options] [command] + +Options: + -h|--help Show help information + +Commands: + print-documents print the documents stored in the pdb or dll + print-json print the Source Link JSON stored in the pdb or dll + print-urls print the URLs for each document based on the Source Link JSON + test test each URL and verify that the checksums match + +Use " [command] --help" for more information about a command. +``` + +For SourceLink 2, it is just a [dotnet cli tool](https://docs.microsoft.com/en-us/dotnet/core/tools/extensibility), run as `dotnet sourcelink` and installed by adding: +``` xml + +``` # Quick Start -![image](https://cloud.githubusercontent.com/assets/80104/23337630/001cedb6-fbba-11e6-9c44-68f4c826470c.png) +Please use the [Microsoft.SourceLink.*](https://github.com/dotnet/sourcelink/) tools if you are able to. -The [source link support documention](https://github.com/dotnet/core/blob/master/Documentation/diagnostics/source_link.md) shows how to embed a source link file by running `git` commands. That is exactly how the [targets](SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets) file for `SourceLink.Create.CommandLine` works. Add this `PackageReference` to each project that you wish to enable source link support for. See the wiki if you are [using Paket](https://github.com/ctaggart/SourceLink/wiki/Paket). A common way to add this for multiple projects is to use a `Directory.Build.props`: +`SourceLink.Create.CommandLine` is the most successful SourceLink 2 tool. It contains a MSBuild [targets](SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets) file that runs `git` commands by default to figure out the source repository to link to. Add this `PackageReference` to each project that you wish to enable source link support for. See the wiki if you are [using Paket](https://github.com/ctaggart/SourceLink/wiki/Paket). A common way to add this for multiple projects is to use a `Directory.Build.props`: ``` xml - + ``` @@ -41,52 +75,38 @@ msbuild /t:rebuild /p:SourceLinkCreate=true /v:n ``` # Package PDB in nupkg -As of SourceLink 2.7, the pdb files will automatically be included in your nupkg if you use `dotnet pack` or `msbuild /t:pack`. This makes the MSBuild properties `/p:IncludeSymbols=true` and `/p:IncludeSource=true` obsolete and you may safely disable those options. - -# Test +Please package the pdb files in the nupkg files. It is [strongly encouraged](https://github.com/aspnet/Universe/issues/131#issuecomment-363269268) by Microsoft to do so. This obsoletes the MSBuild properties `/p:IncludeSymbols=true` and `/p:IncludeSource=true`. You do not need the [obsolete SymbolSource](https://github.com/SymbolSource/SymbolSource#deprecated-services-and-projects). -`dotnet sourcelink test` is a command you can use to test that the source link works. It makes sure all links work for every source file that is not embedded in the PDB. You can test a nupkg, a pdb, or a dll if the pdb is embedded. Run `dotnet sourcelink` for a list of other diagnostic commands and additional help. +The new project system does not copy PDBs from packages when targeting .NET Framework [#313](https://github.com/ctaggart/SourceLink/issues/313). The simplest workaround until .NET SDK 2.1.400 ships in VS 15.8 timeframe is to add this reference: -Install by adding: ``` xml - + + + + + ``` # Embedding Source Files -For source files are not committed to the repository, it is helpful to embed them, so that they are available while debugging. Source files are not committed often when generated or downloaded from elsewhere. Here is an [example of specifying files to be embedded](https://github.com/fsharp/FSharp.Compiler.Service/pull/842/files#diff-5ea2a1626f193409e8b1742db0e0c22fR669). +For source files are not committed to the repository, it is helpful to embed them, so that they are available while debugging. Source files are not committed often when generated or downloaded from elsewhere. The .NET SDK allows you to set [EmbedUntrackedSources](https://github.com/dotnet/sourcelink/blob/master/docs/README.md#embeduntrackedsources). ## All Source Files -If you just want to embed all of the source files in the pdb and not use source link support, add this package: -``` xml - -``` - -# Documentation -Additional [documentation is on the wiki](https://github.com/ctaggart/SourceLink/wiki). +If you just want to embed all of the source files in the pdb and not use source link support, the .NET SDK allows you to set [EmbedAllSources](https://github.com/dotnet/sourcelink/blob/master/docs/README.md#embedallsources). # Known Issues -- New project system does not copy PDBs from packages when targeting .NET Framework +- Visual Studio 2017 15.8 is expected to have additional [private repository support](https://github.com/ctaggart/SourceLink/issues/204) +- Visual Studio 2017 15.7 added support for source link to authenticated Github.com and VSTS repositories +- Visual Studio 2017 15.5 added support for [debugging into embedded source files]((https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/19107733-debugger-should-support-c-compiler-embed-optio)) - Add `SourceLink.Copy.PdbFiles` to your project file. See [#313](https://github.com/ctaggart/SourceLink/issues/313) for details. +# License -``` xml - - - - - -``` - -- Private repositories are not supported - - Visual Studio 2017 15.7 added support for sourlink to authenticated Github.com and VSTS repositories. Support for other repository hosts is TBD: [Uservoice request](https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/19107784-debugger-should-support-authentication-with-source). +SourceLink is licensed under the [MIT license](LICENSE). -- Visual Studio does not debug into embedded source files - - Update to Visual Studio 2017 15.5 or later. Support [was added](https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/19107733-debugger-should-support-c-compiler-embed-optio). +# Documentation +Additional [documentation is on the wiki](https://github.com/ctaggart/SourceLink/wiki). # Community This project has adopted the code of conduct defined by the [Contributor Covenant](http://contributor-covenant.org/) diff --git a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.csproj b/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.csproj deleted file mode 100644 index e7b1194..0000000 --- a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - netstandard1.4 - false - True - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - diff --git a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.props b/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.props deleted file mode 100644 index 482d1e9..0000000 --- a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.props +++ /dev/null @@ -1,6 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - $(AllowedReferenceRelatedFileExtensions);.pdb - - \ No newline at end of file diff --git a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.targets b/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.targets deleted file mode 100644 index cb82617..0000000 --- a/SourceLink.Copy.PdbFiles/SourceLink.Copy.PdbFiles.targets +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucket/CreateTask.cs b/SourceLink.Create.BitBucket/CreateTask.cs deleted file mode 100644 index 400829f..0000000 --- a/SourceLink.Create.BitBucket/CreateTask.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SourceLink.Create.BitBucket -{ - public class CreateTask : GitCreateTask - { - public override string ConvertUrl(string origin) - { - return UrlConverter.Convert(origin); - } - } -} diff --git a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.csproj b/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.csproj deleted file mode 100644 index 9fe2d9d..0000000 --- a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - netstandard1.4;net461 - - false - - True - - - - - - - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - true - build/netstandard1.4 - - - true - build/netstandard1.4 - - - - true - build/net461 - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.props b/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.targets b/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.targets deleted file mode 100644 index 234d842..0000000 --- a/SourceLink.Create.BitBucket/SourceLink.Create.BitBucket.targets +++ /dev/null @@ -1,48 +0,0 @@ - - - netstandard1.4\SourceLink.Create.BitBucket.dll - net461\SourceLink.Create.BitBucket.dll - - - - - $(CI) - true - true - SourceLinkCreate;$(CompileDependsOn) - $(MSBuildProjectDirectory) - $(SourceLink) - $(IntermediateOutputPath)sourcelink.json - embed - embed - - - - - - - - - - - - - - - - - - - - - diff --git a/SourceLink.Create.BitBucketServer/CreateTask.cs b/SourceLink.Create.BitBucketServer/CreateTask.cs deleted file mode 100644 index 4a8afea..0000000 --- a/SourceLink.Create.BitBucketServer/CreateTask.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SourceLink.Create.BitBucketServer -{ - public class CreateTask : GitCreateTask - { - public override string ConvertUrl(string origin) - { - return UrlConverter.Convert(origin); - } - } -} diff --git a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.csproj b/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.csproj deleted file mode 100644 index e0bbc98..0000000 --- a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - netstandard1.4;net461 - - false - - True - - - - - - - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - true - build/netstandard1.4 - - - true - build/netstandard1.4 - - - - true - build/net461 - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.props b/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.targets b/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.targets deleted file mode 100644 index 8aa861f..0000000 --- a/SourceLink.Create.BitBucketServer/SourceLink.Create.BitBucketServer.targets +++ /dev/null @@ -1,48 +0,0 @@ - - - netstandard1.4\SourceLink.Create.BitBucketServer.dll - net461\SourceLink.Create.BitBucketServer.dll - - - - - $(CI) - true - true - SourceLinkCreate;$(CompileDependsOn) - $(MSBuildProjectDirectory) - $(SourceLink) - $(IntermediateOutputPath)sourcelink.json - embed - embed - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.BitBucketServer/BitBucketServerUrlConverter.cs b/SourceLink.Create.CommandLine/BitBucketServerUrlConverter.cs similarity index 100% rename from SourceLink.Create.BitBucketServer/BitBucketServerUrlConverter.cs rename to SourceLink.Create.CommandLine/BitBucketServerUrlConverter.cs diff --git a/SourceLink.Create.BitBucket/BitBucketUrlConverter.cs b/SourceLink.Create.CommandLine/BitBucketUrlConverter.cs similarity index 100% rename from SourceLink.Create.BitBucket/BitBucketUrlConverter.cs rename to SourceLink.Create.CommandLine/BitBucketUrlConverter.cs diff --git a/SourceLink.Create.Shared/FileUtil.cs b/SourceLink.Create.CommandLine/FileUtil.cs similarity index 100% rename from SourceLink.Create.Shared/FileUtil.cs rename to SourceLink.Create.CommandLine/FileUtil.cs diff --git a/SourceLink.Create.GitHub/GitHubUrlConverter.cs b/SourceLink.Create.CommandLine/GitHubUrlConverter.cs similarity index 100% rename from SourceLink.Create.GitHub/GitHubUrlConverter.cs rename to SourceLink.Create.CommandLine/GitHubUrlConverter.cs diff --git a/SourceLink.Create.GitLab/GitLabUrlConverter.cs b/SourceLink.Create.CommandLine/GitLabUrlConverter.cs similarity index 100% rename from SourceLink.Create.GitLab/GitLabUrlConverter.cs rename to SourceLink.Create.CommandLine/GitLabUrlConverter.cs diff --git a/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.csproj b/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.csproj index 09dc68f..24f08d3 100644 --- a/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.csproj +++ b/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.csproj @@ -1,20 +1,12 @@  - - - netstandard1.4;net461 + netstandard2.0;net461 false True - - - - - - @@ -36,13 +28,13 @@ build - + true - build/netstandard1.4 + build/netstandard2.0 - + true - build/netstandard1.4 + build/netstandard2.0 @@ -51,9 +43,5 @@ - - - - - + \ No newline at end of file diff --git a/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets b/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets index 9680492..7e6043c 100644 --- a/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets +++ b/SourceLink.Create.CommandLine/SourceLink.Create.CommandLine.targets @@ -1,6 +1,6 @@  - netstandard1.4\SourceLink.Create.CommandLine.dll + netstandard2.0\SourceLink.Create.CommandLine.dll net461\SourceLink.Create.CommandLine.dll diff --git a/SourceLink.Create.GitHub/CreateTask.cs b/SourceLink.Create.GitHub/CreateTask.cs deleted file mode 100644 index 4903a2f..0000000 --- a/SourceLink.Create.GitHub/CreateTask.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SourceLink.Create.GitHub -{ - public class CreateTask : GitCreateTask - { - public override string ConvertUrl(string origin) - { - return UrlConverter.Convert(origin); - } - } -} diff --git a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.csproj b/SourceLink.Create.GitHub/SourceLink.Create.GitHub.csproj deleted file mode 100644 index 01ebe6f..0000000 --- a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - netstandard1.4;net461 - - false - - True - - - - - - - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - true - build/netstandard1.4 - - - true - build/netstandard1.4 - - - - true - build/net461 - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.props b/SourceLink.Create.GitHub/SourceLink.Create.GitHub.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.targets b/SourceLink.Create.GitHub/SourceLink.Create.GitHub.targets deleted file mode 100644 index aafd8aa..0000000 --- a/SourceLink.Create.GitHub/SourceLink.Create.GitHub.targets +++ /dev/null @@ -1,48 +0,0 @@ - - - netstandard1.4\SourceLink.Create.GitHub.dll - net461\SourceLink.Create.GitHub.dll - - - - - $(CI) - true - true - SourceLinkCreate;$(CompileDependsOn) - $(MSBuildProjectDirectory) - $(SourceLink) - $(IntermediateOutputPath)sourcelink.json - embed - embed - - - - - - - - - - - - - - - - - - - - - diff --git a/SourceLink.Create.GitLab/CreateTask.cs b/SourceLink.Create.GitLab/CreateTask.cs deleted file mode 100644 index d41dfc3..0000000 --- a/SourceLink.Create.GitLab/CreateTask.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SourceLink.Create.GitLab -{ - public class CreateTask : GitCreateTask - { - public override string ConvertUrl(string origin) - { - return UrlConverter.Convert(origin); - } - } -} diff --git a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.csproj b/SourceLink.Create.GitLab/SourceLink.Create.GitLab.csproj deleted file mode 100644 index 31b831e..0000000 --- a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - netstandard1.4;net461 - - false - - True - - - - - - - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - true - build/netstandard1.4 - - - true - build/netstandard1.4 - - - - true - build/net461 - - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.props b/SourceLink.Create.GitLab/SourceLink.Create.GitLab.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.targets b/SourceLink.Create.GitLab/SourceLink.Create.GitLab.targets deleted file mode 100644 index 3cc8b4b..0000000 --- a/SourceLink.Create.GitLab/SourceLink.Create.GitLab.targets +++ /dev/null @@ -1,48 +0,0 @@ - - - netstandard1.4\SourceLink.Create.GitLab.dll - net461\SourceLink.Create.GitLab.dll - - - - - $(CI) - true - true - SourceLinkCreate;$(CompileDependsOn) - $(MSBuildProjectDirectory) - $(SourceLink) - $(IntermediateOutputPath)sourcelink.json - embed - embed - - - - - - - - - - - - - - - - - - - - - diff --git a/SourceLink.Create.Shared/GitCreateTask.cs b/SourceLink.Create.Shared/GitCreateTask.cs deleted file mode 100644 index 334c11b..0000000 --- a/SourceLink.Create.Shared/GitCreateTask.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Microsoft.Build.Framework; -using MSBuildTask = Microsoft.Build.Utilities.Task; -using System; -using System.Text; -using IO = System.IO; -using System.Collections.Generic; - -namespace SourceLink.Create -{ - public abstract class GitCreateTask : MSBuildTask - { - public string GitDirectory { get; set; } - - public string Url { get; set; } - - public string[] Sources { get; set; } - - [Required] - public string File { get; set; } - - public string NotInGit { get; set; } - - public string HashMismatch { get; set; } - - public string NoAutoLF { get; set; } - - [Output] - public string SourceLink { get; set; } - - public string[] EmbeddedFilesIn { get; set; } - - [Output] - public string[] EmbeddedFiles { get; set; } - - public override bool Execute() - { - var url = Url; - var gitOption = string.IsNullOrEmpty(GitDirectory) ? "" : " -d \"" + GitDirectory + "\""; - - if (string.IsNullOrEmpty(url)) - { - var originArgs = "sourcelink-git origin" + gitOption; - var originCmd = Process.RunAndGetOutput("dotnet", originArgs); - if (originCmd.ExitCode != 0 || originCmd.OutputLines.Count != 1) - { - Log.LogError("unable to find repository origin with: dotnet " + originArgs); - return false; - } - var origin = originCmd.OutputLines[0]; - url = ConvertUrl(origin); - if (url == null) - { - Log.LogError("unable to convert origin url: " + origin); - return false; - } - } - - var compileFile = IO.Path.ChangeExtension(File, ".compile"); - using (var sw = FileUtil.OpenWrite(compileFile)) - { - if (Sources != null) - { - foreach (var source in Sources) - sw.WriteLine(source); - } - } - - var sbArgs = new StringBuilder(); - sbArgs.Append("sourcelink-git create" + gitOption); - sbArgs.Append(" -u \"" + url + "\""); - sbArgs.Append(" -f \"" + File + "\""); - - if (!string.IsNullOrEmpty(NotInGit)) - { - sbArgs.Append(" --notingit \"" + NotInGit + "\""); - } - if (!string.IsNullOrEmpty(HashMismatch)) - { - sbArgs.Append(" --hashmismatch \"" + HashMismatch + "\""); - } - if ("true".Equals(NoAutoLF, StringComparison.OrdinalIgnoreCase)) - { - sbArgs.Append(" --noautolf"); - } - var args = sbArgs.ToString(); - - var create = Process.RunAndGetOutput("dotnet", args); - if (create.ExitCode != 0) - { - Log.LogMessage(MessageImportance.High, "dotnet " + args); - foreach (var line in create.OutputLines) - Log.LogMessage(MessageImportance.High, line); - Log.LogError("exit code " + create.ExitCode + " when running: dotnet " + args); - } - else - { - Log.LogMessage(MessageImportance.Normal, "dotnet " + args); - foreach (var line in create.OutputLines) - Log.LogMessage(MessageImportance.Normal, line); - } - - if (Log.HasLoggedErrors) - return false; - - var embeddedFiles = EmbeddedFilesIn == null ? new List() : new List(EmbeddedFilesIn); - var embedFile = IO.Path.ChangeExtension(File, ".embed"); - if (IO.File.Exists(embedFile)) - { - var additionalFiles = IO.File.ReadAllLines(embedFile); - embeddedFiles.AddRange(additionalFiles); - } - EmbeddedFiles = embeddedFiles.ToArray(); - - SourceLink = File; - return true; - } - - public abstract string ConvertUrl(string origin); - - } -} diff --git a/SourceLink.Create.Shared/SourceLink.Create.Shared.projitems b/SourceLink.Create.Shared/SourceLink.Create.Shared.projitems deleted file mode 100644 index 4e3c73f..0000000 --- a/SourceLink.Create.Shared/SourceLink.Create.Shared.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 225d4dcf-82a5-49b0-8f45-7cbada058ca9 - - - SourceLink.Create - - - - - - \ No newline at end of file diff --git a/SourceLink.Create.Shared/SourceLink.Create.Shared.shproj b/SourceLink.Create.Shared/SourceLink.Create.Shared.shproj deleted file mode 100644 index dc86da2..0000000 --- a/SourceLink.Create.Shared/SourceLink.Create.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 225d4dcf-82a5-49b0-8f45-7cbada058ca9 - 14.0 - - - - - - - - diff --git a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.csproj b/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.csproj deleted file mode 100644 index 541c8a8..0000000 --- a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - netstandard1.4 - false - True - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - \ No newline at end of file diff --git a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.props b/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.targets b/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.targets deleted file mode 100644 index 3c0e530..0000000 --- a/SourceLink.Embed.AllSourceFiles/SourceLink.Embed.AllSourceFiles.targets +++ /dev/null @@ -1,17 +0,0 @@ - - - EmbedAllSourceFiles;$(BuildDependsOn) - - - - - - - - - - - - \ No newline at end of file diff --git a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.csproj b/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.csproj deleted file mode 100644 index b0bdd75..0000000 --- a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - netstandard1.4 - false - True - - - - - true - build - - - true - buildCrossTargeting - - - true - build - - - - \ No newline at end of file diff --git a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.props b/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.props deleted file mode 100644 index b3658d6..0000000 --- a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - \ No newline at end of file diff --git a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.targets b/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.targets deleted file mode 100644 index a9cbe98..0000000 --- a/SourceLink.Embed.PaketFiles/SourceLink.Embed.PaketFiles.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - EmbedPaketFiles;$(BuildDependsOn) - - - - - - - - - - - - \ No newline at end of file diff --git a/SourceLink.Embed.Shared/SourceLink.Embed.Shared.projitems b/SourceLink.Embed.Shared/SourceLink.Embed.Shared.projitems deleted file mode 100644 index 09c24d5..0000000 --- a/SourceLink.Embed.Shared/SourceLink.Embed.Shared.projitems +++ /dev/null @@ -1,13 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 083cd576-0be4-4aac-86d8-00e50c660759 - - - SourceLink.Embed - - - - \ No newline at end of file diff --git a/SourceLink.Embed.Shared/SourceLink.Embed.Shared.shproj b/SourceLink.Embed.Shared/SourceLink.Embed.Shared.shproj deleted file mode 100644 index 101a800..0000000 --- a/SourceLink.Embed.Shared/SourceLink.Embed.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 083cd576-0be4-4aac-86d8-00e50c660759 - 14.0 - - - - - - - - diff --git a/SourceLink.Shared/SourceLink.Shared.projitems b/SourceLink.Shared/SourceLink.Shared.projitems deleted file mode 100644 index 7295134..0000000 --- a/SourceLink.Shared/SourceLink.Shared.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - b1b7304a-fb72-435b-920f-b2dc53da6054 - - - SourceLink.Shared - - - - - \ No newline at end of file diff --git a/SourceLink.Shared/SourceLink.Shared.shproj b/SourceLink.Shared/SourceLink.Shared.shproj deleted file mode 100644 index 1e62369..0000000 --- a/SourceLink.Shared/SourceLink.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - b1b7304a-fb72-435b-920f-b2dc53da6054 - 14.0 - - - - - - - - diff --git a/SourceLink.Shared/Process.cs b/SourceLink.Test/Process.cs similarity index 100% rename from SourceLink.Shared/Process.cs rename to SourceLink.Test/Process.cs diff --git a/SourceLink.Test/SourceLink.Test.csproj b/SourceLink.Test/SourceLink.Test.csproj index 279a7b2..71174c9 100644 --- a/SourceLink.Test/SourceLink.Test.csproj +++ b/SourceLink.Test/SourceLink.Test.csproj @@ -1,7 +1,7 @@  - netstandard1.4;net461 + netstandard2.0;net461 false true @@ -20,13 +20,13 @@ build - + true - build/netstandard1.4 + build/netstandard2.0 - + true - build/netstandard1.4 + build/netstandard2.0 @@ -34,7 +34,6 @@ build/net461 - \ No newline at end of file diff --git a/SourceLink.Test/SourceLink.Test.targets b/SourceLink.Test/SourceLink.Test.targets index 436cb6d..3f9de2b 100644 --- a/SourceLink.Test/SourceLink.Test.targets +++ b/SourceLink.Test/SourceLink.Test.targets @@ -1,6 +1,6 @@  - netstandard1.4\SourceLink.Test.dll + netstandard2.0\SourceLink.Test.dll net461\SourceLink.Test.dll diff --git a/SourceLink.sln b/SourceLink.sln index cc46845..7639c2b 100644 --- a/SourceLink.sln +++ b/SourceLink.sln @@ -11,13 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-sourcelink", "dotnet-sourcelink\dotnet-sourcelink.csproj", "{68D40DAC-77EF-426A-979D-1CC4723CB2A1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Create.GitHub", "SourceLink.Create.GitHub\SourceLink.Create.GitHub.csproj", "{5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Create.GitLab", "SourceLink.Create.GitLab\SourceLink.Create.GitLab.csproj", "{A103EF79-CB2F-43FE-940C-491DE05756B6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-sourcelink-git", "dotnet-sourcelink-git\dotnet-sourcelink-git.csproj", "{87BCE13E-47FF-43A4-ADF4-F645FD4966AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sourcelink", "dotnet-sourcelink\sourcelink.csproj", "{68D40DAC-77EF-426A-979D-1CC4723CB2A1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{13B28F5D-43CA-4243-A932-3352BB788216}" EndProject @@ -25,41 +19,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Test", "SourceLi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Create.CommandLine", "SourceLink.Create.CommandLine\SourceLink.Create.CommandLine.csproj", "{FB0D8C0B-27DF-4D20-9F15-09794D95F744}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Create.BitBucket", "SourceLink.Create.BitBucket\SourceLink.Create.BitBucket.csproj", "{76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Create.BitBucketServer", "SourceLink.Create.BitBucketServer\SourceLink.Create.BitBucketServer.csproj", "{66682790-9305-4807-B951-C2241BF7512A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Embed.AllSourceFiles", "SourceLink.Embed.AllSourceFiles\SourceLink.Embed.AllSourceFiles.csproj", "{A791FDDC-9BAD-441B-9545-C26D2292E5C3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceLink.Embed.PaketFiles", "SourceLink.Embed.PaketFiles\SourceLink.Embed.PaketFiles.csproj", "{81801FB5-9388-43BA-B8FD-508A428C03CF}" -EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "dotnet-sourcelink-shared", "dotnet-sourcelink-shared\dotnet-sourcelink-shared.shproj", "{FD0C81CE-4FAE-47CE-B89A-20F1DB6DAD0A}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SourceLink.Embed.Shared", "SourceLink.Embed.Shared\SourceLink.Embed.Shared.shproj", "{083CD576-0BE4-4AAC-86D8-00E50C660759}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{2402E19F-C4A4-43A4-B939-F5CD198EEED3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SourceLink", "SourceLink", "{07737978-28A8-42A2-A240-A66EF5EC4C5E}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SourceLink.Create.Shared", "SourceLink.Create.Shared\SourceLink.Create.Shared.shproj", "{225D4DCF-82A5-49B0-8F45-7CBADA058CA9}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Create", "Create", "{F157756B-2442-4131-848B-CBEF39E8F706}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Embed", "Embed", "{CB177CE6-ADA8-4017-B5B3-579B72B67B2A}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SourceLink.Shared", "SourceLink.Shared\SourceLink.Shared.shproj", "{B1B7304A-FB72-435B-920F-B2DC53DA6054}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{853D5303-E7E6-48D5-A480-BB5B34BC9B06}" - ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml - build.ps1 = build.ps1 - EndProjectSection -EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution - SourceLink.Embed.Shared\SourceLink.Embed.Shared.projitems*{083cd576-0be4-4aac-86d8-00e50c660759}*SharedItemsImports = 13 - SourceLink.Create.Shared\SourceLink.Create.Shared.projitems*{225d4dcf-82a5-49b0-8f45-7cbada058ca9}*SharedItemsImports = 13 - SourceLink.Shared\SourceLink.Shared.projitems*{b1b7304a-fb72-435b-920f-b2dc53da6054}*SharedItemsImports = 13 dotnet-sourcelink-shared\dotnet-sourcelink-shared.projitems*{fd0c81ce-4fae-47ce-b89a-20f1db6dad0a}*SharedItemsImports = 13 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -83,42 +52,6 @@ Global {68D40DAC-77EF-426A-979D-1CC4723CB2A1}.Release|x64.Build.0 = Release|Any CPU {68D40DAC-77EF-426A-979D-1CC4723CB2A1}.Release|x86.ActiveCfg = Release|Any CPU {68D40DAC-77EF-426A-979D-1CC4723CB2A1}.Release|x86.Build.0 = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|x64.ActiveCfg = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|x64.Build.0 = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|x86.ActiveCfg = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Debug|x86.Build.0 = Debug|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|Any CPU.Build.0 = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|x64.ActiveCfg = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|x64.Build.0 = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|x86.ActiveCfg = Release|Any CPU - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C}.Release|x86.Build.0 = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|x64.ActiveCfg = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|x64.Build.0 = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|x86.ActiveCfg = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Debug|x86.Build.0 = Debug|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|Any CPU.Build.0 = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|x64.ActiveCfg = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|x64.Build.0 = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|x86.ActiveCfg = Release|Any CPU - {A103EF79-CB2F-43FE-940C-491DE05756B6}.Release|x86.Build.0 = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|x64.ActiveCfg = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|x64.Build.0 = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|x86.ActiveCfg = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Debug|x86.Build.0 = Debug|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|Any CPU.Build.0 = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|x64.ActiveCfg = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|x64.Build.0 = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|x86.ActiveCfg = Release|Any CPU - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD}.Release|x86.Build.0 = Release|Any CPU {13B28F5D-43CA-4243-A932-3352BB788216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13B28F5D-43CA-4243-A932-3352BB788216}.Debug|Any CPU.Build.0 = Debug|Any CPU {13B28F5D-43CA-4243-A932-3352BB788216}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -155,73 +88,15 @@ Global {FB0D8C0B-27DF-4D20-9F15-09794D95F744}.Release|x64.Build.0 = Release|Any CPU {FB0D8C0B-27DF-4D20-9F15-09794D95F744}.Release|x86.ActiveCfg = Release|Any CPU {FB0D8C0B-27DF-4D20-9F15-09794D95F744}.Release|x86.Build.0 = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|x64.ActiveCfg = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|x64.Build.0 = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|x86.ActiveCfg = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Debug|x86.Build.0 = Debug|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|Any CPU.Build.0 = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|x64.ActiveCfg = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|x64.Build.0 = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|x86.ActiveCfg = Release|Any CPU - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3}.Release|x86.Build.0 = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|x64.ActiveCfg = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|x64.Build.0 = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|x86.ActiveCfg = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Debug|x86.Build.0 = Debug|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|Any CPU.Build.0 = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|x64.ActiveCfg = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|x64.Build.0 = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|x86.ActiveCfg = Release|Any CPU - {66682790-9305-4807-B951-C2241BF7512A}.Release|x86.Build.0 = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|x64.ActiveCfg = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|x64.Build.0 = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|x86.ActiveCfg = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Debug|x86.Build.0 = Debug|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|Any CPU.Build.0 = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|x64.ActiveCfg = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|x64.Build.0 = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|x86.ActiveCfg = Release|Any CPU - {A791FDDC-9BAD-441B-9545-C26D2292E5C3}.Release|x86.Build.0 = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|x64.ActiveCfg = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|x64.Build.0 = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|x86.ActiveCfg = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Debug|x86.Build.0 = Debug|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|Any CPU.Build.0 = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|x64.ActiveCfg = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|x64.Build.0 = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|x86.ActiveCfg = Release|Any CPU - {81801FB5-9388-43BA-B8FD-508A428C03CF}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {68D40DAC-77EF-426A-979D-1CC4723CB2A1} = {2402E19F-C4A4-43A4-B939-F5CD198EEED3} - {5CEE8EC8-7A54-4860-8B5D-29F89D7F7F4C} = {F157756B-2442-4131-848B-CBEF39E8F706} - {A103EF79-CB2F-43FE-940C-491DE05756B6} = {F157756B-2442-4131-848B-CBEF39E8F706} - {87BCE13E-47FF-43A4-ADF4-F645FD4966AD} = {2402E19F-C4A4-43A4-B939-F5CD198EEED3} {FB0D8C0B-27DF-4D20-9F15-09794D95F744} = {F157756B-2442-4131-848B-CBEF39E8F706} - {76CC64F0-2D47-4B3C-ADEA-6E758953F2D3} = {F157756B-2442-4131-848B-CBEF39E8F706} - {A791FDDC-9BAD-441B-9545-C26D2292E5C3} = {CB177CE6-ADA8-4017-B5B3-579B72B67B2A} - {81801FB5-9388-43BA-B8FD-508A428C03CF} = {CB177CE6-ADA8-4017-B5B3-579B72B67B2A} {FD0C81CE-4FAE-47CE-B89A-20F1DB6DAD0A} = {2402E19F-C4A4-43A4-B939-F5CD198EEED3} - {083CD576-0BE4-4AAC-86D8-00E50C660759} = {CB177CE6-ADA8-4017-B5B3-579B72B67B2A} - {225D4DCF-82A5-49B0-8F45-7CBADA058CA9} = {F157756B-2442-4131-848B-CBEF39E8F706} {F157756B-2442-4131-848B-CBEF39E8F706} = {07737978-28A8-42A2-A240-A66EF5EC4C5E} - {CB177CE6-ADA8-4017-B5B3-579B72B67B2A} = {07737978-28A8-42A2-A240-A66EF5EC4C5E} - {B1B7304A-FB72-435B-920F-B2DC53DA6054} = {07737978-28A8-42A2-A240-A66EF5EC4C5E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7623516C-0410-449C-9EFC-84B884102D70} diff --git a/Tests/Integration/When_package_without_lib_is_installed.cs b/Tests/Integration/When_package_without_lib_is_installed.cs index ec90538..de5458f 100644 --- a/Tests/Integration/When_package_without_lib_is_installed.cs +++ b/Tests/Integration/When_package_without_lib_is_installed.cs @@ -8,13 +8,7 @@ namespace Tests.Integration public static class When_package_without_lib_is_installed { [Theory] - [InlineData("SourceLink.Create.BitBucket")] - [InlineData("SourceLink.Create.BitBucketServer")] [InlineData("SourceLink.Create.CommandLine")] - [InlineData("SourceLink.Create.GitHub")] - [InlineData("SourceLink.Create.GitLab")] - [InlineData("SourceLink.Embed.AllSourceFiles")] - [InlineData("SourceLink.Embed.PaketFiles")] [InlineData("SourceLink.Test")] public static void Should_not_reference_additional_libraries(string packageName) { diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 90db6de..633a78e 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,7 +1,6 @@  - - netcoreapp2.0 + netcoreapp2.1 @@ -15,23 +14,13 @@ - - - - - - + + - - - - - - diff --git a/Tests/When_parsing_links.cs b/Tests/When_parsing_links.cs index 689a213..df919b8 100644 --- a/Tests/When_parsing_links.cs +++ b/Tests/When_parsing_links.cs @@ -11,8 +11,8 @@ public class When_parsing_links [InlineData("https://github.com/ctaggart/sourcelink-test/")] public void Should_return_url_in_canonical_form_for_GitHub(string provided) { - var task = new SourceLink.Create.GitHub.CreateTask(); - Assert.Equal("https://raw.githubusercontent.com/ctaggart/sourcelink-test/{commit}/*", task.ConvertUrl(provided)); + Assert.Equal("https://raw.githubusercontent.com/ctaggart/sourcelink-test/{commit}/*", + SourceLink.Create.GitHub.UrlConverter.Convert(provided)); } [Theory] @@ -22,8 +22,8 @@ public void Should_return_url_in_canonical_form_for_GitHub(string provided) [InlineData("https://gitlab.com/ctaggart/sourcelink-test/")] public void Should_return_url_in_canonical_form_for_GitLab(string provided) { - var task = new SourceLink.Create.GitLab.CreateTask(); - Assert.Equal("https://gitlab.com/ctaggart/sourcelink-test/raw/{commit}/*", task.ConvertUrl(provided)); + Assert.Equal("https://gitlab.com/ctaggart/sourcelink-test/raw/{commit}/*", + SourceLink.Create.GitLab.UrlConverter.Convert(provided)); } [Theory] @@ -33,8 +33,8 @@ public void Should_return_url_in_canonical_form_for_GitLab(string provided) [InlineData("https://bitbucket.org/ctaggart/sourcelink-test/")] public void Should_return_url_in_canonical_form_for_BitBucket(string provided) { - var task = new SourceLink.Create.BitBucket.CreateTask(); - Assert.Equal("https://bitbucket.org/ctaggart/sourcelink-test/raw/{commit}/*", task.ConvertUrl(provided)); + Assert.Equal("https://bitbucket.org/ctaggart/sourcelink-test/raw/{commit}/*", + SourceLink.Create.BitBucket.UrlConverter.Convert(provided)); } [Theory] @@ -42,8 +42,8 @@ public void Should_return_url_in_canonical_form_for_BitBucket(string provided) [InlineData("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/")] public void Should_return_url_in_canonical_form_for_BitBucket_with_company_url(string provided) { - var task = new SourceLink.Create.BitBucketServer.CreateTask(); - Assert.Equal("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/raw/*?at={commit}", task.ConvertUrl(provided)); + Assert.Equal("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/raw/*?at={commit}", + SourceLink.Create.BitBucketServer.UrlConverter.Convert(provided)); } @@ -55,8 +55,8 @@ public void Should_return_url_in_canonical_form_for_BitBucket_with_company_url(s [InlineData("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/invalidPart")] public void Should_not_match_invalid_company_url(string provided) { - var task = new SourceLink.Create.BitBucketServer.CreateTask(); - Assert.NotEqual("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/raw/*?at={commit}", task.ConvertUrl(provided)); + Assert.NotEqual("https://bitbucket.company.com/projects/SMN/repos/company.innernamespace.project/raw/*?at={commit}", + SourceLink.Create.BitBucketServer.UrlConverter.Convert(provided)); } [Theory] @@ -64,8 +64,8 @@ public void Should_not_match_invalid_company_url(string provided) [InlineData("https://internal.bitbucketserver.local/scm/sol123/reallyawesomeproject.git")] public void Should_return_url_in_canonical_form_for_BitBucketServer(string provided) { - var task = new SourceLink.Create.BitBucketServer.CreateTask(); - Assert.Equal("https://internal.bitbucketserver.local/projects/sol123/repos/reallyawesomeproject/raw/*?at={commit}", task.ConvertUrl(provided)); + Assert.Equal("https://internal.bitbucketserver.local/projects/sol123/repos/reallyawesomeproject/raw/*?at={commit}", + SourceLink.Create.BitBucketServer.UrlConverter.Convert(provided)); } } } diff --git a/appveyor.yml b/appveyor.yml index 18c3486..97bb6d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ image: Visual Studio 2017 init: - git config --global core.autocrlf input - - '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"' + # - '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"' clone_depth: 10 @@ -11,18 +11,17 @@ before_build: build_script: - ps: | - dotnet --version + # dotnet --version .\build.ps1 if ($lastexitcode -ne 0){ exit $lastexitcode } -test: - assemblies: - only: - - '**\Tests.dll' +# test: +# assemblies: +# only: +# - '**\Tests.dll' - -test_script: - - ps: dotnet test .\Tests\Tests.csproj +# test_script: +# - ps: dotnet test .\Tests\Tests.csproj artifacts: - path: bin\*.nupkg \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 7396fcf..9dad6fd 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,5 +1,5 @@ -$version = '2.8.0' # the version under development, update after a release -$versionSuffix = '-a125' # manually incremented for local builds +$version = '3.0.0' # the version under development, update after a release +$versionSuffix = '-build.0' # manually incremented for local builds function isVersionTag($tag){ $v = New-Object Version @@ -7,7 +7,7 @@ function isVersionTag($tag){ } if ($env:appveyor){ - $versionSuffix = '-b' + [int]::Parse($env:appveyor_build_number).ToString('000') + $versionSuffix = '-build.' + $env:appveyor_build_number if ($env:appveyor_repo_tag -eq 'true' -and (isVersionTag($env:appveyor_repo_tag_name))){ $version = $env:appveyor_repo_tag_name $versionSuffix = '' @@ -15,59 +15,26 @@ if ($env:appveyor){ Update-AppveyorBuild -Version "$version$versionSuffix" } +# just build some, as we are not packing them yet for v3 +$build = "build", "-c", "release", "/p:Version=$version$versionSuffix", "/v:m" $pack = "pack", "-c", "release", "-o", "../bin", "/p:Version=$version$versionSuffix", "/v:m" $pack += "/p:ci=true" Set-Location $psscriptroot\dotnet-sourcelink -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\dotnet-sourcelink-git -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Create.GitHub -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Create.GitLab -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Create.BitBucket -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Create.BitBucketServer -dotnet restore dotnet $pack Set-Location $psscriptroot\SourceLink.Create.CommandLine -dotnet restore -dotnet $pack +dotnet $build Set-Location $psscriptroot\SourceLink.Test -dotnet restore -dotnet $pack +dotnet $build -Set-Location $psscriptroot\SourceLink.Embed.AllSourceFiles -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Embed.PaketFiles -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\SourceLink.Copy.PdbFiles -dotnet restore -dotnet $pack - -Set-Location $psscriptroot\build -dotnet restore -$nupkgs = ls ..\bin\*$version$versionSuffix.nupkg -foreach($nupkg in $nupkgs){ - echo "test $nupkg" - dotnet sourcelink test $nupkg -} +# Set-Location $psscriptroot\build +# dotnet restore +# $nupkgs = ls ..\bin\*$version$versionSuffix.nupkg +# foreach($nupkg in $nupkgs){ +# echo "test $nupkg" +# dotnet sourcelink test $nupkg +# } -Set-Location $psscriptroot +Set-Location $psscriptroot \ No newline at end of file diff --git a/build/build.proj b/build/build.proj index 5f7dceb..187816d 100644 --- a/build/build.proj +++ b/build/build.proj @@ -1,8 +1,7 @@ - netcoreapp2.0 + netcoreapp2.1 - diff --git a/build/common.props b/build/common.props index a989fbf..f97334d 100644 --- a/build/common.props +++ b/build/common.props @@ -1,6 +1,5 @@ - Cameron Taggart https://opensource.org/licenses/MIT https://ctaggart.github.io/SourceLink/SourceLink128.jpg @@ -10,8 +9,5 @@ SourceLink: Source Code On Demand Source Link your Portable PDB files to allow source code to be downloaded on demand - - embedded - \ No newline at end of file diff --git a/build/sourcelink.props b/build/sourcelink.props index 76cec66..e9728b5 100644 --- a/build/sourcelink.props +++ b/build/sourcelink.props @@ -1,5 +1,10 @@ + + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + true + true + - + \ No newline at end of file diff --git a/dotnet-sourcelink-git/Program.cs b/dotnet-sourcelink-git/Program.cs deleted file mode 100644 index 121f6a7..0000000 --- a/dotnet-sourcelink-git/Program.cs +++ /dev/null @@ -1,412 +0,0 @@ -using Microsoft.Extensions.CommandLineUtils; -using System; -using LibGit2Sharp; -using System.Collections.Generic; -using System.IO; -using Newtonsoft.Json; -using System.Security.Cryptography; -using System.Text; -using System.Linq; - -namespace SourceLink.Git { - public class Program - { - public static int Main(string[] args) - { - var app = new CommandLineApplication(); - app.FullName = "Source Code On Demand"; - app.HelpOption("-h|--help"); - - app.Command("repo", PrintRepo); - app.Command("origin", PrintOrigin); - app.Command("create", Create); - - if (args.Length == 0) - { - Console.WriteLine("SourceLink Git " + Version.GetAssemblyInformationalVersion()); - app.ShowHelp(); - return 0; - } - - try - { - return app.Execute(args); - } - catch(Exception ex) - { - Console.WriteLine(ex.Message); - return -1; - } - } - - public static void PrintRepo(CommandLineApplication command) - { - command.Description = "prints the repository path"; // and nothing else - var dirOption = command.Option("-d|--dir ", "the directory to look for the repository", CommandOptionType.SingleValue); - command.HelpOption("-h|--help"); - - command.OnExecute(() => - { - var dir = "."; - if (dirOption.HasValue()) - dir = dirOption.Value(); - - var repoPath = FindGitRepo(dir); - if (repoPath == null) - { - Console.Error.WriteLine("repository not found at or above " + dir); - return 1; - } - - Console.WriteLine(repoPath); - return 0; - }); - } - - public static void PrintOrigin(CommandLineApplication command) - { - command.Description = "prints the git repository url for origin"; // and nothing else - var dirOption = command.Option("-d|--dir ", "the directory to look for the repository", CommandOptionType.SingleValue); - command.HelpOption("-h|--help"); - - command.OnExecute(() => - { - var dir = "."; - if (dirOption.HasValue()) - dir = dirOption.Value(); - - var repoPath = FindGitRepo(dir); - if (repoPath == null) { - Console.Error.WriteLine("repository not found at or above " + dir); - return 1; - } - - var origin = GetOrigin(repoPath); - if(origin == null) - { - Console.Error.WriteLine("origin not found"); - return 2; // not found - } - - Console.WriteLine(origin); - return 0; - }); - } - - public static void Create(CommandLineApplication command) - { - command.Description = "creates the Source Link JSON file"; - var dirOption = command.Option("-d|--dir ", "the directory to look for the git repository", CommandOptionType.SingleValue); - var fileOption = command.Option("-f|--file ", "the sourcelink.json file to write", CommandOptionType.SingleValue); - var urlOption = command.Option("-u|--url ", "URL for downloading the source files, use {0} for commit and * for path", CommandOptionType.SingleValue); - var notInGitOption = command.Option("--notingit