Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Commit

Permalink
msbuild full framework support (#166)
Browse files Browse the repository at this point in the history
* add net461 for msbuild full framework #164

* fixed index out of bounds with print-json when missing

* this will be 2.0.2

* IntermediateOutputPath

* IntermediateOutputPath
  • Loading branch information
ctaggart authored Mar 11, 2017
1 parent 86aa84b commit b7f32eb
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 142 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Install by adding this `DotNetCliToolReference` to the project file:
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.0.0" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.0.2" />
</ItemGroup>
</Project>
```
Expand All @@ -51,7 +51,7 @@ From the project folder, you can then test the Portable PDB by running `dotnet s

If you wish to have `dotnet sourcelink test` run on your build server for each build, you can add the MSBuild targets by adding this to your project file too:
``` xml
<PackageReference Include="SourceLink.Test" Version="2.0.0" PrivateAssets="all" />
<PackageReference Include="SourceLink.Test" Version="2.0.2" PrivateAssets="all" />
```
You can control when it runs by setting the `SourceLinkTest` property. It defaults to running when CI is true, so it will run automatically on continuous integration servers like AppVeyor and Travis CI which have that environment variable set. In general these tools are meant to be run only on your build server, but it is simple to test locally with:
```
Expand All @@ -65,11 +65,11 @@ The debugger will download the source file and verify that its checksum matches
By default, sourcelink-git will verify that all of the source files are in the repository and that their checksums match. If the checksums do not match due to line endings, it will automatically fix them to match the git repository like endings of `lf`. If the file checksums still don't match, it will tell the compiler to embed it in the Portable PDB. If the file is not in the git repository, it will tell the compiler to embed it in the Portable PDB. All of these settings are configurable.

``` xml
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.0.0" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.0.2" />
```

The tool can be run automatically by installing MSBuild targets. This tool automatically figures out the `SourceLinkUrl` based on a git remote origin for GitHub. That property can be set manually for other providers. Contributions for other MSBuild targets for other providers are welcome.

``` xml
<PackageReference Include="SourceLink.Create.GitHub" Version="2.0.0" PrivateAssets="all" />
<PackageReference Include="SourceLink.Create.GitHub" Version="2.0.2" PrivateAssets="all" />
```
35 changes: 0 additions & 35 deletions SourceLink.Create.GitHub/SourceLink.Create.GitHub.Core.targets

This file was deleted.

31 changes: 11 additions & 20 deletions SourceLink.Create.GitHub/SourceLink.Create.GitHub.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../build/common.props" />
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<DebugType>embedded</DebugType>
<TargetFrameworks>netstandard1.4;net461</TargetFrameworks>
<!-- https://github.com/NuGet/Home/wiki/Adding-nuget-pack-as-a-msbuild-target -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<!--<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>-->

<Authors>Cameron Taggart</Authors>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://ctaggart.github.io/SourceLink/SourceLink128.jpg</PackageIconUrl>
<PackageProjectUrl>https://github.com/ctaggart/SourceLink</PackageProjectUrl>
<PackageTags>sourcelink pdb symbols git sourceindexing debugging sourceserver build</PackageTags>
<Description>
SourceLink: Source Code On Demand
Source Link your Portable PDB files to allow source code to be downloaded on demand
</Description>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,19 +17,21 @@
<Pack>true</Pack>
<PackagePath>build</PackagePath>
</Content>
<Content Include="SourceLink.Create.GitHub.Core.targets">

<Content Include="$(OutputPath)netstandard1.4/SourceLink.Create.GitHub.dll">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/netstandard1.4</PackagePath>
</Content>
<Content Include="$(OutputPath)SourceLink.Create.GitHub.dll">
<Content Include="$(OutputPath)netstandard1.4/SourceLink.Create.GitHub.deps.json">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/netstandard1.4</PackagePath>
</Content>
<Content Include="$(OutputPath)SourceLink.Create.GitHub.deps.json">

<Content Include="$(OutputPath)net461/SourceLink.Create.GitHub.dll">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/net461</PackagePath>
</Content>
</ItemGroup>

<!--<Import Project="../SourceLink.props" />-->
<!--<Import Project="../build/sourcelink.props" />-->
</Project>
38 changes: 37 additions & 1 deletion SourceLink.Create.GitHub/SourceLink.Create.GitHub.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
<Project>
<Import Condition="'$(MSBuildRuntimeType)' == 'Core'" Project="SourceLink.Create.GitHub.Core.targets" />
<PropertyGroup>
<SourceLinkCreateGitHubDll Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard1.4\SourceLink.Create.GitHub.dll</SourceLinkCreateGitHubDll>
<SourceLinkCreateGitHubDll Condition="'$(MSBuildRuntimeType)' != 'Core'">net461\SourceLink.Create.GitHub.dll</SourceLinkCreateGitHubDll>
</PropertyGroup>
<UsingTask TaskName="SourceLink.Create.GitHub.CreateTask" AssemblyFile="$(SourceLinkCreateGitHubDll)" />

<PropertyGroup>
<!-- enable only in CI environments by default -->
<!-- enable on AppVeyor and Travis CI, detect CI environment variable -->
<SourceLinkCreate Condition="'$(SourceLinkCreate)' == ''">$(CI)</SourceLinkCreate>
<!-- enable on Jenkins and TeamCity, detect BUILD_NUMBER environment variable -->
<SourceLinkCreate Condition="'$(SourceLinkCreate)' == '' and '$(BUILD_NUMBER)' != ''">true</SourceLinkCreate>
<CompileDependsOn Condition="'$(SourceLinkCreate)' == 'true' and ($(DebugType) == 'portable' or $(DebugType) == 'embedded')">SourceLinkCreate;$(CompileDependsOn)</CompileDependsOn>
<SourceLinkRepo Condition="'$(SourceLinkRepo)' == ''">$(MSBuildProjectDirectory)</SourceLinkRepo>
<SourceLinkFile Condition="'$(SourceLinkFile)' == ''">$(SourceLink)</SourceLinkFile>
<SourceLinkFile Condition="'$(SourceLinkFile)' == ''">$(IntermediateOutputPath)sourcelink.json</SourceLinkFile>
<SourceLinkNotInGit Condition="'$(SourceLinkNotInGit)' == ''">embed</SourceLinkNotInGit>
<SourceLinkHashMismatch Condition="'$(SourceLinkHashMismatch)' == ''">embed</SourceLinkHashMismatch>
</PropertyGroup>

<ItemGroup>
<SourceLinkSources Condition="'@(SourceLinkSources)' == ''" Include="@(Compile)" Exclude="@(EmbeddedFiles)" />
</ItemGroup>

<Target Name="SourceLinkCreate">
<SourceLink.Create.GitHub.CreateTask
GitDirectory="$(SourceLinkGitDirectory)"
Url="$(SourceLinkUrl)"
File="$(SourceLinkFile)"
Sources="@(SourceLinkSources)"
NoAutoLF="$(SourceLinkNoAutoLF)"
EmbeddedFilesIn="@(EmbeddedFiles)">
<Output PropertyName="SourceLink" TaskParameter="SourceLink" />
<Output ItemName="EmbeddedFiles" TaskParameter="EmbeddedFiles" />
</SourceLink.Create.GitHub.CreateTask>
</Target>

</Project>
19 changes: 0 additions & 19 deletions SourceLink.Test/SourceLink.Test.Core.targets

This file was deleted.

36 changes: 14 additions & 22 deletions SourceLink.Test/SourceLink.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../build/common.props" />
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<DebugType>embedded</DebugType>
<TargetFrameworks>netstandard1.4;net461</TargetFrameworks>
<!-- https://github.com/NuGet/Home/wiki/Adding-nuget-pack-as-a-msbuild-target -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<!--<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>-->

<Authors>Cameron Taggart</Authors>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://ctaggart.github.io/SourceLink/SourceLink128.jpg</PackageIconUrl>
<PackageProjectUrl>https://github.com/ctaggart/SourceLink</PackageProjectUrl>
<PackageTags>sourcelink pdb symbols git sourceindexing debugging sourceserver build</PackageTags>
<Description>
SourceLink: Source Code On Demand
Source Link your Portable PDB files to allow source code to be downloaded on demand
</Description>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="14.3.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.548" />
</ItemGroup>

<!-- https://docs.microsoft.com/en-us/dotnet/articles/core/preview3/tools/extensibility -->
Expand All @@ -28,22 +17,25 @@
<Pack>true</Pack>
<PackagePath>build</PackagePath>
</Content>
<Content Include="SourceLink.Test.Core.targets">

<Content Include="$(OutputPath)netstandard1.4/SourceLink.Test.dll">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/netstandard1.4</PackagePath>
</Content>
<Content Include="$(OutputPath)SourceLink.Test.dll">
<Content Include="$(OutputPath)netstandard1.4/SourceLink.Test.deps.json">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/netstandard1.4</PackagePath>
</Content>
<Content Include="$(OutputPath)SourceLink.Test.deps.json">

<Content Include="$(OutputPath)net461/SourceLink.Test.dll">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<PackagePath>build/net461</PackagePath>
</Content>
</ItemGroup>

<ItemGroup>
<Compile Include="..\SourceLink.Create.GitHub\Process.cs" Link="Process.cs" />
</ItemGroup>

<!--<Import Project="../SourceLink.props" />-->
<!--<Import Project="../build/sourcelink.props" />-->
</Project>
22 changes: 21 additions & 1 deletion SourceLink.Test/SourceLink.Test.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<Project>
<Import Condition="'$(MSBuildRuntimeType)' == 'Core'" Project="SourceLink.Test.Core.targets" />
<PropertyGroup>
<SourceLinkTestDll Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard1.4\SourceLink.Test.dll</SourceLinkTestDll>
<SourceLinkTestDll Condition="'$(MSBuildRuntimeType)' != 'Core'">net461\SourceLink.Test.dll</SourceLinkTestDll>
</PropertyGroup>
<UsingTask TaskName="SourceLink.Test.TestTask" AssemblyFile="$(SourceLinkTestDll)" />

<PropertyGroup>
<!-- enable only in CI environments by default -->
<!-- enable on AppVeyor and Travis CI, detect CI environment variable -->
<SourceLinkTest Condition="'$(SourceLinkTest)' == ''">$(CI)</SourceLinkTest>
<!-- enable on Jenkins and TeamCity, detect BUILD_NUMBER environment variable -->
<SourceLinkTest Condition="'$(SourceLinkTest)' == '' and '$(BUILD_NUMBER)' != ''">true</SourceLinkTest>
<CompileDependsOn Condition="'$(SourceLinkTest)' == 'true' and ($(DebugType) == 'portable' or $(DebugType) == 'embedded')">$(CompileDependsOn);SourceLinkTest</CompileDependsOn>
<SourceLinkPdb Condition="'$(SourceLinkPdb)' == ''">$(PdbFile)</SourceLinkPdb>
<SourceLinkPdb Condition="'$(SourceLinkPdb)' == '' and $(DebugType) == 'portable'">$(IntermediateOutputPath)$(TargetName).pdb</SourceLinkPdb>
<SourceLinkPdb Condition="'$(SourceLinkPdb)' == '' and $(DebugType) == 'embedded'">$(IntermediateOutputPath)$(TargetName).dll</SourceLinkPdb>
</PropertyGroup>

<Target Name="SourceLinkTest">
<SourceLink.Test.TestTask Pdb="$(SourceLinkPdb)" />
</Target>
</Project>
6 changes: 3 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version = '2.0.1' # the version under development, update after a release
$versionSuffix = '-a107' # manually incremented for local builds
$version = '2.0.2' # the version under development, update after a release
$versionSuffix = '-a115' # manually incremented for local builds

function isVersionTag($tag){
$v = New-Object Version
Expand All @@ -15,7 +15,7 @@ if ($env:appveyor){
Update-AppveyorBuild -Version "$version$versionSuffix"
}

$pack = "pack", "-c", "release", "-o", "../bin", "/p:Version=$version$versionSuffix", "/v:n"
$pack = "pack", "-c", "release", "-o", "../bin", "/p:Version=$version$versionSuffix", "/v:m"

Set-Location $psscriptroot\dotnet-sourcelink
dotnet restore
Expand Down
17 changes: 17 additions & 0 deletions build/common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>

<Authors>Cameron Taggart</Authors>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://ctaggart.github.io/SourceLink/SourceLink128.jpg</PackageIconUrl>
<PackageProjectUrl>https://github.com/ctaggart/SourceLink</PackageProjectUrl>
<PackageTags>sourcelink pdb symbols git sourceindexing debugging sourceserver build</PackageTags>
<Description>
SourceLink: Source Code On Demand
Source Link your Portable PDB files to allow source code to be downloaded on demand
</Description>

<DebugType>embedded</DebugType>

</PropertyGroup>
</Project>
8 changes: 4 additions & 4 deletions SourceLink.props → build/sourcelink.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<SourceLinkTest>true</SourceLinkTest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SourceLink.Create.GitHub" Version="[2.0.1-b408]" PrivateAssets="all" />
<PackageReference Include="SourceLink.Test" Version="[2.0.1-b408]" PrivateAssets="all" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="[2.0.1-b408]" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="[2.0.1-b408]" />
<PackageReference Include="SourceLink.Create.GitHub" Version="[2.0.1]" PrivateAssets="all" />
<PackageReference Include="SourceLink.Test" Version="[2.0.1]" PrivateAssets="all" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="[2.0.1]" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="[2.0.1]" />
</ItemGroup>
</Project>
14 changes: 2 additions & 12 deletions dotnet-sourcelink-git/dotnet-sourcelink-git.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../build/common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<DebugType>embedded</DebugType>
<PackageType>DotnetCliTool</PackageType>

<Authors>Cameron Taggart</Authors>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://ctaggart.github.io/SourceLink/SourceLink128.jpg</PackageIconUrl>
<PackageProjectUrl>https://github.com/ctaggart/SourceLink</PackageProjectUrl>
<PackageTags>sourcelink pdb symbols git sourceindexing debugging sourceserver build</PackageTags>
<Description>
SourceLink: Source Code On Demand
Source Link your Portable PDB files to allow source code to be downloaded on demand
</Description>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\dotnet-sourcelink\SourceLinkJson.cs" Link="SourceLinkJson.cs" />
Expand All @@ -25,5 +15,5 @@
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<Import Project="../SourceLink.props" />
<Import Project="../build/sourcelink.props" />
</Project>
Loading

0 comments on commit b7f32eb

Please sign in to comment.