mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
[maint] Removes the old implementation of sourcelink and uses the newer one present in the .net SDK (#2666)
* reoves the old implemetnation of sourcelink and uses the newer one present in the .net SDK * cleans up appveyor * updates proj with sourcelink props * adds deterministic build check as well. * Update docs/debugging-source.md Co-authored-by: Keegan Campbell <me@kfcampbell.com> --------- Co-authored-by: Keegan Campbell <me@kfcampbell.com>
This commit is contained in:
@@ -2,12 +2,6 @@
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"sourcelink": {
|
||||
"version": "3.1.1",
|
||||
"commands": [
|
||||
"sourcelink"
|
||||
]
|
||||
},
|
||||
"dotnet-format": {
|
||||
"version": "5.1.250801",
|
||||
"commands": [
|
||||
|
||||
2
.github/workflows/netcore.yml
vendored
2
.github/workflows/netcore.yml
vendored
@@ -28,5 +28,5 @@ jobs:
|
||||
with:
|
||||
dotnet-version: 6.0.*
|
||||
- name: Build with dotnet
|
||||
run: ./build.sh --linksources=true --verbosity=verbose
|
||||
run: ./build.sh --verbosity=verbose
|
||||
shell: bash
|
||||
|
||||
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
with:
|
||||
dotnet-version: 6.0.*
|
||||
- name: Build with dotnet
|
||||
run: ./build.sh --linksources=true --verbosity=verbose
|
||||
run: ./build.sh --verbosity=verbose
|
||||
shell: bash
|
||||
|
||||
- name: Publish to NuGet
|
||||
|
||||
@@ -72,11 +72,11 @@ To install dependencies and run the CAKE build script use the following wrapper
|
||||
|
||||
- Windows (Powershell)
|
||||
|
||||
`.\build.ps1 -Target <target> -Configuration Release -LinkSources [Additional Parameters]`
|
||||
`.\build.ps1 -Target <target> -Configuration Release [Additional Parameters]`
|
||||
|
||||
- Linux/OSX (bash)
|
||||
|
||||
`./build.sh --target=<target> --configuration==Release --linksources=true [Additional Parameters]`
|
||||
`./build.sh --target=<target> --configuration==Release [Additional Parameters]`
|
||||
|
||||
### Running Tests
|
||||
|
||||
|
||||
@@ -22,6 +22,16 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);1591;1701;1702;1705</NoWarn>
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Source Link">
|
||||
<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<!-- Optional: Include PDB in the built .nupkg -->
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -22,6 +22,16 @@
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);SIMPLE_JSON_INTERNAL;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_READONLY_COLLECTIONS;SIMPLE_JSON_TYPEINFO</DefineConstants>
|
||||
<NoWarn>$(NoWarn);1591;1701;1702;1705</NoWarn>
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Source Link">
|
||||
<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<!-- Optional: Include PDB in the built .nupkg -->
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Octokit - GitHub API Client Library for .NET
|
||||
|
||||

|
||||
[](https://ci.appveyor.com/project/github-windows/octokit-net/branch/main)
|
||||
[](https://codecov.io/gh/octokit/octokit.net)
|
||||
[](https://gitter.im/octokit/octokit.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://www.nuget.org/packages/Octokit)
|
||||
@@ -42,13 +41,6 @@ There is also an IObservable based GitHub API client library for .NET using Reac
|
||||
dotnet add package Octokit.Reactive
|
||||
```
|
||||
|
||||
|
||||
### Beta packages ###
|
||||
Unstable NuGet packages that track the `main` branch of this repository are available at
|
||||
[https://ci.appveyor.com/nuget/octokit-net](https://ci.appveyor.com/nuget/octokit-net)
|
||||
|
||||
In Xamarin Studio you can find this option under the project's context menu: **Add | Add Packages...***.
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is available at http://octokitnet.readthedocs.io/en/latest/.
|
||||
|
||||
@@ -24,7 +24,6 @@ Param(
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[switch]$LinkSources,
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Normal",
|
||||
[switch]$WhatIf,
|
||||
@@ -98,7 +97,6 @@ if (!(Test-Path $NugetPath)) {
|
||||
$Arguments = @{
|
||||
target=$Target;
|
||||
configuration=$Configuration;
|
||||
linkSources=$LinkSources;
|
||||
verbosity=$Verbosity;
|
||||
dryrun=$WhatIf;
|
||||
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
|
||||
|
||||
@@ -9,7 +9,6 @@ public class Context : FrostingContext
|
||||
{
|
||||
public string Target { get; set; }
|
||||
public new string Configuration { get; set; }
|
||||
public bool LinkSources { get; set; }
|
||||
public bool FormatCode { get; set; }
|
||||
public BuildVersion Version { get; set; }
|
||||
|
||||
@@ -17,11 +16,8 @@ public class Context : FrostingContext
|
||||
public bool IsLocalBuild { get; set; }
|
||||
public bool IsPullRequest { get; set; }
|
||||
public bool IsOriginalRepo { get; set; }
|
||||
public bool IsTagged { get; set; }
|
||||
public bool IsMainBranch { get; set; }
|
||||
public bool ForcePublish { get; set; }
|
||||
|
||||
public bool AppVeyor { get; set; }
|
||||
public bool GitHubActions { get; set; }
|
||||
|
||||
public Project[] Projects { get; set; }
|
||||
|
||||
@@ -12,7 +12,6 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
{
|
||||
context.Target = context.Argument("target", "Default");
|
||||
context.Configuration = context.Argument("configuration", "Release");
|
||||
context.LinkSources = context.Argument("linkSources", false);
|
||||
context.FormatCode = context.Argument("formatCode", false);
|
||||
|
||||
context.Artifacts = "./packaging/";
|
||||
@@ -22,16 +21,8 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
context.IsLocalBuild = buildSystem.IsLocalBuild;
|
||||
|
||||
context.GitHubActions = buildSystem.GitHubActions.IsRunningOnGitHubActions;
|
||||
context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor;
|
||||
context.IsTagged = IsBuildTagged(buildSystem);
|
||||
|
||||
if (context.AppVeyor)
|
||||
{
|
||||
context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
|
||||
context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.AppVeyor.Environment.Repository.Name);
|
||||
context.IsMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildSystem.AppVeyor.Environment.Repository.Branch);
|
||||
}
|
||||
else if (context.GitHubActions)
|
||||
if (context.GitHubActions)
|
||||
{
|
||||
context.IsPullRequest = buildSystem.GitHubActions.Environment.PullRequest.IsPullRequest;
|
||||
context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.GitHubActions.Environment.Workflow.Repository);
|
||||
@@ -62,18 +53,10 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
context.Information("Version: {0}", context.Version.Prefix);
|
||||
context.Information("Version suffix: {0}", context.Version.Suffix);
|
||||
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("GitHub Actions: {0}", context.GitHubActions);
|
||||
}
|
||||
|
||||
private static bool IsBuildTagged(BuildSystem buildSystem)
|
||||
{
|
||||
return buildSystem.AppVeyor.Environment.Repository.Tag.IsTag
|
||||
&& !string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name);
|
||||
}
|
||||
|
||||
private static string GetEnvironmentValueOrArgument(Context context, string environmentVariable, string argumentName)
|
||||
{
|
||||
var arg = context.EnvironmentVariable(environmentVariable);
|
||||
|
||||
@@ -13,8 +13,7 @@ public class Build : FrostingTask<Context>
|
||||
{
|
||||
Configuration = context.Configuration,
|
||||
ArgumentCustomization = args => args
|
||||
.Append("/p:Version={0}", context.Version.GetSemanticVersion())
|
||||
.Append("/p:SourceLinkCreate={0}", context.LinkSources.ToString().ToLower()),
|
||||
.Append("/p:Version={0}", context.Version.GetSemanticVersion()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Cake.Frosting;
|
||||
|
||||
[IsDependentOn(typeof(TestSourceLink))]
|
||||
[IsDependentOn(typeof(Package))]
|
||||
public sealed class Default : FrostingTask<Context>
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using Cake.Common;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Common.IO;
|
||||
using Cake.Core;
|
||||
using Cake.Core.IO;
|
||||
using Cake.Frosting;
|
||||
|
||||
[IsDependentOn(typeof(Package))]
|
||||
public class TestSourceLink : FrostingTask<Context>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,9 @@ with a specific type, and cache it in your local symbols cache.
|
||||
|
||||

|
||||
|
||||
You can then set subsequent breakpoints inside the source code, to return to
|
||||
You can then set subsequent breakpoints inside the source code, to return to
|
||||
in the debugging session.
|
||||
|
||||
### Acknowledgements
|
||||
|
||||
Thanks to [Cameron Taggart](http://blog.ctaggart.com/) for building the
|
||||
[SourceLink](https://github.com/ctaggart/SourceLink) framework which we use
|
||||
to support this behaviour.
|
||||
Thanks to Cameron Taggart for the initial implementation and the .NET foundation for ongoing support of [SourceLink](https://github.com/dotnet/sourcelink) which we use to provide source debugging.
|
||||
|
||||
@@ -26,7 +26,7 @@ Or can be run individually:
|
||||
|
||||
### Create NuGet Packages
|
||||
|
||||
NuGet packages are automatically generated (and SourceLinked) by the CAKE build script.
|
||||
NuGet packages are automatically generated (and SourceLinked) by the csproj configration.
|
||||
> `.\build.ps1`
|
||||
|
||||
The output .nupkg files will be located in the `packaging` directory.
|
||||
|
||||
Reference in New Issue
Block a user