Skip to content
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

enable source linking #1555

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions Build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
$msbuildVerbosity = 'minimal'
$treatWarningsAsErrors = $false
$workingName = if ($workingName) {$workingName} else {"Working"}
$netCliChannel = "2.0"
$netCliVersion = "2.0.0"
$nugetUrl = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe"

$baseDir = resolve-path ..
Expand All @@ -24,6 +22,7 @@
$releaseDir = "$baseDir\Release"
$workingDir = "$baseDir\$workingName"
$workingSourceDir = "$workingDir\Src"
if ($env:ci){ $workingSourceDir = $sourceDir } # for source linking

$nugetPath = "$buildDir\Temp\nuget.exe"
$vswhereVersion = "2.1.4"
Expand Down Expand Up @@ -53,16 +52,22 @@ task Clean {
Write-Host "Setting location to $baseDir"
Set-Location $baseDir

if (Test-Path -path $workingDir)
if($env:ci)
{
Write-Host "Deleting existing working directory $workingDir"

Execute-Command -command { del $workingDir -Recurse -Force }
# for testing CI behavior locally
Execute-Command -command { git clean -xfd }
}
else
{
if (Test-Path -path $workingDir)
{
Write-Host "Deleting existing working directory $workingDir"
Execute-Command -command { del $workingDir -Recurse -Force }
}
}

Write-Host "Creating working directory $workingDir"
New-Item -Path $workingDir -ItemType Directory

}

# Build each solution, optionally signed
Expand All @@ -78,8 +83,11 @@ task Build -depends Clean {
$script:msBuildPath = GetMsBuildPath
Write-Host "MSBuild path $script:msBuildPath"

Write-Host "Copying source to working source directory $workingSourceDir"
robocopy $sourceDir $workingSourceDir /MIR /NFL /NDL /NP /XD bin obj TestResults AppPackages $packageDirs .vs artifacts /XF *.suo *.user *.lock.json | Out-Default
if (-not $env:ci)
{
Write-Host "Copying source to working source directory $workingSourceDir"
robocopy $sourceDir $workingSourceDir /MIR /NFL /NDL /NP /XD bin obj TestResults AppPackages $packageDirs .vs artifacts /XF *.suo *.user *.lock.json | Out-Default
}
Copy-Item -Path $baseDir\LICENSE.md -Destination $workingDir\
mkdir "$workingDir\Build" -Force
Copy-Item -Path $buildDir\install.ps1 -Destination $workingDir\Build\
Expand Down Expand Up @@ -213,8 +221,6 @@ function NetCliTests($build)
$location = "$workingSourceDir\Newtonsoft.Json.Tests"
$testDir = if ($build.TestFramework -ne $null) { $build.TestFramework } else { $build.Framework }

exec { .\Tools\Dotnet\dotnet-install.ps1 -Channel $netCliChannel -Version $netCliVersion | Out-Default }

try
{
Set-Location $location
Expand Down
3 changes: 3 additions & 0 deletions Src/Newtonsoft.Json/Newtonsoft.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@
<NugetTargetMoniker>.NETPortable,Version=v0.0,Profile=Profile259</NugetTargetMoniker>
<LanguageTargets>$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets</LanguageTargets>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.7.3" PrivateAssets="All" />
</ItemGroup>
</Project>