diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj
index a61c8954..5a8c0938 100644
--- a/Octokit.Reactive/Octokit.Reactive.csproj
+++ b/Octokit.Reactive/Octokit.Reactive.csproj
@@ -12,6 +12,7 @@
false
false
false
+ embedded
@@ -32,4 +33,10 @@
+
+
+
+
+
+
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index e0f2caf3..679ca4be 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -12,6 +12,7 @@
false
false
false
+ embedded
@@ -32,4 +33,10 @@
+
+
+
+
+
+
diff --git a/appveyor.yml b/appveyor.yml
index ac48e5ae..f806456d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,11 +2,11 @@ image: Visual Studio 2017
init:
- git config --global core.autocrlf input
-
+
build_script:
- dotnet --info
- - ps: .\build.ps1
-
+ - ps: .\build.ps1 -LinkSources
+
test: off
artifacts:
diff --git a/build.ps1 b/build.ps1
index e6d53d62..8bc9e183 100644
--- a/build.ps1
+++ b/build.ps1
@@ -24,6 +24,7 @@ Param(
[string]$Target = "Default",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
+ [switch]$LinkSources,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity = "Verbose",
[switch]$WhatIf,
@@ -83,7 +84,7 @@ if($FoundDotNetCliVersion -ne $DotNetVersion) {
###########################################################################
# Make sure nuget.exe exists.
-$NugetPath = Join-Path $ToolPath "nuget.exe"
+$NugetPath = Join-Path $ToolPath "nuget.exe"
if (!(Test-Path $NugetPath)) {
Write-Host "Downloading NuGet.exe..."
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath);
@@ -97,6 +98,7 @@ if (!(Test-Path $NugetPath)) {
$Arguments = @{
target=$Target;
configuration=$Configuration;
+ linkSources=$LinkSources;
verbosity=$Verbosity;
dryrun=$WhatIf;
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
diff --git a/build.sh b/build.sh
index f8dd8ad9..97e8166a 100755
--- a/build.sh
+++ b/build.sh
@@ -5,7 +5,7 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
ulimit -n 1024
echo "new limit: `ulimit -n`"
fi
-
+
cd build
dotnet restore
-dotnet run
\ No newline at end of file
+dotnet run -- --linkSources=true
\ No newline at end of file
diff --git a/build/Context.cs b/build/Context.cs
index 0e9919d7..87e0bf76 100644
--- a/build/Context.cs
+++ b/build/Context.cs
@@ -6,6 +6,7 @@ public class Context : FrostingContext
{
public string Target { get; set; }
public string Configuration { get; set; }
+ public bool LinkSources { get; set; }
public BuildVersion Version { get; set; }
public DirectoryPath Artifacts { get; set; }
diff --git a/build/Lifetime.cs b/build/Lifetime.cs
index 7e7c656d..e70d32d3 100644
--- a/build/Lifetime.cs
+++ b/build/Lifetime.cs
@@ -11,6 +11,7 @@ public class Lifetime : FrostingLifetime
{
context.Target = context.Argument("target", "Default");
context.Configuration = context.Argument("configuration", "Release");
+ context.LinkSources = context.Argument("linkSources", false);
context.Artifacts = "./packaging/";
@@ -58,12 +59,13 @@ public class Lifetime : FrostingLifetime
context.Version.Prefix = context.Argument("version", context.Version.Prefix);
context.Version.Suffix = context.Argument("suffix", context.Version.Suffix);
- context.Information("Version: {0}", context.Version.Prefix);
+ context.Information("Version: {0}", context.Version.Prefix);
context.Information("Version suffix: {0}", context.Version.Suffix);
- context.Information("Configuration: {0}", context.Configuration);
- context.Information("Target: {0}", context.Target);
- context.Information("AppVeyor: {0}", context.AppVeyor);
- context.Information("TravisCI: {0}", context.TravisCI);
+ context.Information("Configuration: {0}", context.Configuration);
+ context.Information("LinkSources: {0}", context.LinkSources);
+ context.Information("Target: {0}", context.Target);
+ context.Information("AppVeyor: {0}", context.AppVeyor);
+ context.Information("TravisCI: {0}", context.TravisCI);
}
private static bool IsBuildTagged(BuildSystem buildSystem)
diff --git a/build/Tasks/Build.cs b/build/Tasks/Build.cs
index 2c43e660..3d679aed 100644
--- a/build/Tasks/Build.cs
+++ b/build/Tasks/Build.cs
@@ -11,7 +11,9 @@ public class Build : FrostingTask
context.DotNetCoreBuild("./Octokit.sln", new DotNetCoreBuildSettings
{
Configuration = context.Configuration,
- ArgumentCustomization = args => args.Append("/p:Version={0}", context.Version.GetSemanticVersion())
+ ArgumentCustomization = args => args
+ .Append("/p:Version={0}", context.Version.GetSemanticVersion())
+ .AppendIfTrue(context.LinkSources, "/p:SourceLinkCreate=true")
});
}
}
\ No newline at end of file
diff --git a/build/Tasks/Default.cs b/build/Tasks/Default.cs
index 7e601c50..cca762bf 100644
--- a/build/Tasks/Default.cs
+++ b/build/Tasks/Default.cs
@@ -1,6 +1,6 @@
using Cake.Frosting;
-[Dependency(typeof(Package))]
+[Dependency(typeof(TestSourceLink))]
public sealed class Default : FrostingTask
{
}
\ No newline at end of file
diff --git a/build/Tasks/TestSourceLink.cs b/build/Tasks/TestSourceLink.cs
new file mode 100644
index 00000000..34e2f57a
--- /dev/null
+++ b/build/Tasks/TestSourceLink.cs
@@ -0,0 +1,36 @@
+using System;
+using Cake.Common;
+using Cake.Common.Diagnostics;
+using Cake.Common.IO;
+using Cake.Core;
+using Cake.Core.IO;
+using Cake.Frosting;
+
+[Dependency(typeof(Package))]
+public class TestSourceLink : FrostingTask
+{
+ public override void Run(Context context)
+ {
+ var nugetPackages = context.GetFiles($"./{context.Artifacts}/*.nupkg");
+
+ foreach (var nugetPackage in nugetPackages)
+ {
+ context.Information("Testing sourcelink info in {0}", context.Environment.WorkingDirectory.GetRelativePath(nugetPackage));
+ var exitCode = context.StartProcess("dotnet", new ProcessSettings
+ {
+ WorkingDirectory = "Octokit",
+ Arguments = $"sourcelink test {nugetPackage.FullPath}"
+ });
+
+ if (exitCode != 0)
+ {
+ throw new Exception("Sourcelink test failed!");
+ }
+ }
+ }
+
+ public override bool ShouldRun(Context context)
+ {
+ return context.LinkSources;
+ }
+}
\ No newline at end of file
diff --git a/build/Utilities/CakeExtensions.cs b/build/Utilities/CakeExtensions.cs
new file mode 100644
index 00000000..b0ef440b
--- /dev/null
+++ b/build/Utilities/CakeExtensions.cs
@@ -0,0 +1,10 @@
+using Cake.Core;
+using Cake.Core.IO;
+
+public static class CakeExtensions
+{
+ public static ProcessArgumentBuilder AppendIfTrue(this ProcessArgumentBuilder builder, bool condition, string format, params object[] args)
+ {
+ return condition ? builder.Append(format, args) : builder;
+ }
+}