Skip to content

[WIP]Fix nightly upload nuget package order #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Bb]uild/
msbuild.binlog

# Visual Studio 2015 cache/options directory
Expand Down Expand Up @@ -297,4 +296,4 @@ __pycache__/
.vscode

# OSX
.DS_Store
.DS_Store
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<PackageOutputPath>$(MSBuildThisFileDirectory)build\$(Configuration)\</PackageOutputPath>
</PropertyGroup>

Expand Down
14 changes: 1 addition & 13 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@
<Exec Command="dotnet build &quot;$(MSBuildThisFileDirectory)src\coverlet.collector\coverlet.collector.csproj&quot; -c $(Configuration)" />
</Target>

<Target Name="PublishMSBuildTaskProject" AfterTargets="BuildAllProjects">
<Exec Command="dotnet publish &quot;$(MSBuildThisFileDirectory)src\coverlet.msbuild.tasks\coverlet.msbuild.tasks.csproj&quot; -c $(Configuration) -o &quot;$(OutputPath)&quot;" />
</Target>

<Target Name="CopyMSBuildScripts" AfterTargets="PublishMSBuildTaskProject">
<ItemGroup>
<BuildScript Include="$(MSBuildThisFileDirectory)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />
<BuildScript Include="$(MSBuildThisFileDirectory)src\coverlet.msbuild.tasks\coverlet.msbuild.targets" />
</ItemGroup>
<Copy SourceFiles="@(BuildScript)" DestinationFolder="$(OutputPath)" />
</Target>

<Target Name="RunTests" AfterTargets="CopyMSBuildScripts">
<Target Name="RunTests" AfterTargets="BuildAllProjects">
<Exec Command="dotnet test &quot;$(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj&quot; -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]*"/>
<Exec Command="dotnet test &quot;$(MSBuildThisFileDirectory)test\coverlet.collector.tests\coverlet.collector.tests.csproj&quot; -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]*"/>
</Target>
Expand Down
2 changes: 1 addition & 1 deletion eng/nightly.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Write-Host -ForegroundColor Blue Publish with .NET CLI
& dotnet --info

Write-Host -ForegroundColor Green Create Packages
& dotnet msbuild "$PSScriptRoot\..\build.proj" /t:CreateNuGetPackage /p:Configuration=Release /p:PublicRelease=false # amend build.proj path if changes
& dotnet msbuild "$PSScriptRoot\..\build.proj" /t:BuildAllProjects /p:Configuration=Release /p:PublicRelease=false # amend build.proj path if changes

Write-Host -ForegroundColor Green Upload Packages
& dotnet nuget push "$PSScriptRoot\..\build\Release\*.nupkg" -k $apiKey -s $source
19 changes: 10 additions & 9 deletions src/coverlet.collector/coverlet.collector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/tonerdo/coverlet</RepositoryUrl>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NuspecFile>coverlet.collector.nuspec</NuspecFile>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.1.0" />
</ItemGroup>

<ItemGroup>
<Content Include="coverlet.collector.targets" />
<None Update="build\**" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -61,12 +63,11 @@
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\coverlet.core\coverlet.core.csproj" PrivateAssets="All" />
</ItemGroup>

<Target Name="SetNuspecPackageVersion" DependsOnTargets="GetBuildVersion" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<NuspecProperties>$(NuspecProperties);version=$(NuGetPackageVersion);configuration=$(Configuration)
</NuspecProperties>
</PropertyGroup>
</Target>

<Target Name="PackBuildOutputs">
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetDir)\*.dll" PackagePath="build\netstandard1.0\" />
<TfmSpecificPackageFile Include="$(TargetDir)\*.deps.json" PackagePath="build\netstandard1.0\" />
</ItemGroup>
</Target>
</Project>
21 changes: 0 additions & 21 deletions src/coverlet.collector/coverlet.collector.nuspec

This file was deleted.

2 changes: 1 addition & 1 deletion src/coverlet.collector/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0.0",
"version": "1.0.0-preview.{height}",
"publicReleaseRefSpec": [
"^refs/heads/master$"
]
Expand Down
2 changes: 1 addition & 1 deletion src/coverlet.console/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.5.1",
"version": "1.5.1-preview.{height}",
"publicReleaseRefSpec": [
"^refs/heads/master$"
]
Expand Down
14 changes: 11 additions & 3 deletions src/coverlet.core/Coverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,18 @@ private string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments,
string key = sourceLinkDocument.Key;
if (Path.GetFileName(key) != "*") continue;

if (!Path.GetDirectoryName(document).StartsWith(Path.GetDirectoryName(key) + Path.DirectorySeparatorChar))
continue;
string directoryDocument = Path.GetDirectoryName(document);
string sourceLinkRoot = Path.GetDirectoryName(key);
string relativePath = "";

// if document is on repo root we skip relative path calculation
if (directoryDocument != sourceLinkRoot)
{
if (!directoryDocument.StartsWith(sourceLinkRoot + Path.DirectorySeparatorChar))
continue;

var relativePath = Path.GetDirectoryName(document).Substring(Path.GetDirectoryName(key).Length + 1);
relativePath = directoryDocument.Substring(sourceLinkRoot.Length + 1);
}

if (relativePathOfBestMatch.Length == 0)
{
Expand Down
3 changes: 3 additions & 0 deletions src/coverlet.msbuild.tasks/coverlet.msbuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
<ThresholdType Condition="$(ThresholdType) == ''">line,branch,method</ThresholdType>
<ThresholdStat Condition="$(ThresholdStat) == ''">minimum</ThresholdStat>
</PropertyGroup>
<PropertyGroup>
<CoverletToolsPath Condition=" '$(CoverletToolsPath)' == '' ">$(MSBuildThisFileDirectory)</CoverletToolsPath>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/coverlet.msbuild.tasks/coverlet.msbuild.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<UsingTask TaskName="Coverlet.MSbuild.Tasks.InstrumentationTask" AssemblyFile="$(MSBuildThisFileDirectory)coverlet.msbuild.tasks.dll"/>
<UsingTask TaskName="Coverlet.MSbuild.Tasks.CoverageResultTask" AssemblyFile="$(MSBuildThisFileDirectory)coverlet.msbuild.tasks.dll"/>
<UsingTask TaskName="Coverlet.MSbuild.Tasks.InstrumentationTask" AssemblyFile="$(CoverletToolsPath)coverlet.msbuild.tasks.dll"/>
<UsingTask TaskName="Coverlet.MSbuild.Tasks.CoverageResultTask" AssemblyFile="$(CoverletToolsPath)coverlet.msbuild.tasks.dll"/>

<Target Name="InstrumentModulesNoBuild" BeforeTargets="VSTest">
<Coverlet.MSbuild.Tasks.InstrumentationTask
Expand Down
2 changes: 1 addition & 1 deletion src/coverlet.msbuild.tasks/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.6.1",
"version": "2.6.1-preview.{height}",
"publicReleaseRefSpec": [
"^refs/heads/master$"
]
Expand Down
20 changes: 20 additions & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<Choose>
<!-- This condition tests whether coverlet.msbuild.props has been imported by the project -->
<When Condition=" '$(ThresholdType)' != '' ">
<ItemGroup>
<!-- Arrange for the project that builds the build tools has built first. -->
<ProjectReference Include="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.tasks.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<!-- Ensure that the built tools can be found at build time.
This is required when the coverlet.msbuild imports are made in their src directory
(so that msbuild eval works even before they are built)
so that they can still find the tooling that will be built by the build. -->
<CoverletToolsPath>$(RepoRoot)src\coverlet.msbuild.tasks\bin\$(Configuration)\netstandard2.0\</CoverletToolsPath>
</PropertyGroup>
</When>
</Choose>
</Project>
4 changes: 2 additions & 2 deletions test/coverlet.collector.tests/coverlet.collector.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\coverlet.core\coverlet.core.csproj" />
<ProjectReference Include="..\..\src\coverlet.collector\coverlet.collector.csproj" />
<ProjectReference Include="$(RepoRoot)src\coverlet.core\coverlet.core.csproj" />
<ProjectReference Include="$(RepoRoot)src\coverlet.collector\coverlet.collector.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(MSBuildThisFileDirectory)\..\..\build\$(Configuration)\coverlet.msbuild.props" />
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
Expand All @@ -15,5 +15,5 @@
<ProjectReference Include="..\coverlet.testsubject\coverlet.testsubject.csproj" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)\..\..\build\$(Configuration)\coverlet.msbuild.targets" />
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.targets" />
</Project>
6 changes: 3 additions & 3 deletions test/coverlet.core.tests/coverlet.core.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(MSBuildThisFileDirectory)\..\..\build\$(Configuration)\coverlet.msbuild.props" />
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
Expand All @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\coverlet.core\coverlet.core.csproj" />
<ProjectReference Include="$(RepoRoot)src\coverlet.core\coverlet.core.csproj" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)\..\..\build\$(Configuration)\coverlet.msbuild.targets" />
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.targets" />
</Project>