Skip to content

Commit

Permalink
[maint] Removes the old implementation of sourcelink and uses the new…
Browse files Browse the repository at this point in the history
…er one present in the .net SDK (octokit#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 <[email protected]>

---------

Co-authored-by: Keegan Campbell <[email protected]>
  • Loading branch information
nickfloyd and kfcampbell authored Feb 7, 2023
1 parent e3e27bb commit 00b89da
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 87 deletions.
6 changes: 0 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"isRoot": true,
"tools": {
"sourcelink": {
"version": "3.1.1",
"commands": [
"sourcelink"
]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Octokit - GitHub API Client Library for .NET

![Build status](https://github.com/octokit/octokit.net/workflows/CI%20Build/badge.svg)
[![Build status](https://ci.appveyor.com/api/projects/status/cego2g42yw26th26/branch/main?svg=true)](https://ci.appveyor.com/project/github-windows/octokit-net/branch/main)
[![codecov](https://codecov.io/gh/octokit/octokit.net/branch/main/graph/badge.svg)](https://codecov.io/gh/octokit/octokit.net)
[![Join the chat at https://gitter.im/octokit/octokit.net](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/octokit/octokit.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![NuGet](https://img.shields.io/nuget/v/Octokit.svg)](https://www.nuget.org/packages/Octokit)
Expand Down Expand Up @@ -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/.
Expand Down
2 changes: 0 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 };
Expand Down
4 changes: 0 additions & 4 deletions build/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ 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; }

public DirectoryPath Artifacts { get; set; }
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; }
Expand Down
19 changes: 1 addition & 18 deletions build/Lifetime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public override void Setup(Context 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/";
Expand All @@ -22,16 +21,8 @@ public override void Setup(Context 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);
Expand Down Expand Up @@ -62,18 +53,10 @@ public override void Setup(Context 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);
Expand Down
3 changes: 1 addition & 2 deletions build/Tasks/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public override void Run(Context 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()),
});
}
}
3 changes: 1 addition & 2 deletions build/Tasks/Default.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Cake.Frosting;

[IsDependentOn(typeof(TestSourceLink))]
[IsDependentOn(typeof(Package))]
public sealed class Default : FrostingTask<Context>
{
}
36 changes: 0 additions & 36 deletions build/Tasks/TestSourceLink.cs

This file was deleted.

6 changes: 2 additions & 4 deletions docs/debugging-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ with a specific type, and cache it in your local symbols cache.

![F11 step into symbol](https://cloud.githubusercontent.com/assets/359239/5389259/74600502-8149-11e4-94f7-10dc79a0573f.gif)

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.
2 changes: 1 addition & 1 deletion docs/shipping-releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 00b89da

Please sign in to comment.