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

Update nuke build to include unsigned and non-merged client nuget targets for local builds #782

Merged
merged 10 commits into from
Oct 17, 2023

Conversation

scme0
Copy link
Contributor

@scme0 scme0 commented Oct 16, 2023

The Nuke build fails in a few places for MacOS which meant I had to manually comment things out to get it to play ball.

The two problematic areas are:

  1. Signing
  2. Merging/Packing

I've added a build target to create unsigned and non-merged Client Nuget packages for a Local builds so they can be used for testing purposes locally.

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the file encoding to UTF8 with no BOM so that when we do inline edits of the file and then revert it, it doesn't leave a pending change in git.

@scme0 scme0 marked this pull request as ready for review October 16, 2023 23:01
@scme0 scme0 closed this Oct 17, 2023
@scme0 scme0 deleted the scme/update-nuke-for-macos branch October 17, 2023 00:17
@scme0 scme0 restored the scme/update-nuke-for-macos branch October 17, 2023 01:09
@scme0 scme0 reopened this Oct 17, 2023
build/Build.cs Outdated
@@ -189,6 +189,33 @@ class Build : NukeBuild
});
});

Target PackMergedClientNugetForMacOs => _ => _
.OnlyWhenStatic(() => IsLocalBuild)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the indenting a bit funny here or is it just github displaying it?

I'd expect this, in keeping with the rest of the file

    Target PackMergedClientNugetForMacOs => _ => _
         .OnlyWhenStatic(() => IsLocalBuild) // note tabbed in by 4 spaces here
         .OnlyWhenStatic(() => OperatingSystem.IsMacOS())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think my Rider is not doing this right. Let me fix that up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fixed now.

build/Build.cs Outdated
@@ -189,6 +189,33 @@ class Build : NukeBuild
});
});

Target PackMergedClientNugetForMacOs => _ => _
.OnlyWhenStatic(() => IsLocalBuild)
.OnlyWhenStatic(() => OperatingSystem.IsMacOS())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could merge .OnlyWhenStatic(() => IsLocalBuild && !OperatingSystem.IsWindows())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per your comments below, I've remove the operating system check altogether 👍

build/Build.cs Outdated
@@ -189,6 +189,33 @@ class Build : NukeBuild
});
});

Target PackMergedClientNugetForMacOs => _ => _
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've happened to hit the issue on macOS, but neither the problem nor solution are macOS specific.

Other developers on linux will have the same problem, and if a windows dev is in your situation they may be able to run ILRepack, but the Azure code signing keys most likely won't be accessible and they also may want an unsigned nuget package.

Suggestion: Remove the 'macOS' and call this something more generic like PackUnsignedClient

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: This target is called PackMergedClient but it doesn't seem to be doing any ILMerging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the naming of targets to make it clearer and I've removed the MacOS specific naming to make it more generically creating "Unsigned" nuget packages 👍

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, this is not mac specific - perhaps call it "Local" or "Unsigned" instead of "MacOs.nuspec"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

<projectUrl>https://github.com/OctopusDeploy/OctopusClients</projectUrl>
<icon>images\icon.png</icon>
<description>Octopus Deploy is an automated release management tool for modern developers and DevOps teams.
This package contains the ILmerged client library for the HTTP API in Octopus.</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description is copied from the release nuspec which is probably wrong. This one doesn't contain an ILMerged client library for example.

Suggestion: Put a developer-specific description in here e.g. "This package contains an unsigned, non-ILMerged, locally built client library for the HTTP API in Octopus"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, good catch!

build/Build.cs Outdated
});

void PackNormalClientNugetPackage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be it's own Nuke target rather than a function, so other targets can DependsOn it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can in this case because of the order of execution. For the Signed Client we need to sign the binaries before packing which means the packing target would need to depend on the signing target but then we can't use the packing target for anything else because you can't have a conditional dependency which is a shame.

@@ -115,63 +115,63 @@ class Build : NukeBuild
Target Merge => _ => _
.DependsOn(Compile)
.Executes(() =>
{
foreach (var target in new[] { "net462", "net48", "netstandard2.0" })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole target has not changed - It's just less indented to match other formatting... I can revert it if it's annoying.

Copy link
Contributor

@APErebus APErebus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@scme0 scme0 changed the title Update nuke build for macos Update nuke build to include unsigned and non-merged client nuget targets for local builds Oct 17, 2023
@scme0 scme0 merged commit b691bed into master Oct 17, 2023
@scme0 scme0 deleted the scme/update-nuke-for-macos branch October 17, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants