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

Add icon to dotnet tool NuGet package #905

Merged
merged 4 commits into from
Oct 14, 2022

Conversation

mjcheetham
Copy link
Collaborator

Add the GCM icon to the NuGet package used for the dotnet tool.

The image is copied to the root of the package under a new images directory (/images). The tool payload continues to be copied under the required /tool/net6.0/any directory.

Modify the pack-tool.sh script to keep all build output under the /out directory of the repository (which is in .gitignore). Output from running pack-tool.sh now looks like this:

.
└── out
    └── shared
        └── DotnetTool
            └── nupkg
                └── Debug
                    ├── git-credential-manager.$VERSION.nupkg
                    ├── images       # icon
                    ├── payload      # dotnet publish output
                    └── payload.sym  # pdbs

The contents of the NuGet package looks like this:

.
├── [Content_Types].xml
├── _rels
├── git-credential-manager.nuspec
├── images
│   └── icon.png          # copied from the output images/ dir
├── package
│   └── services
│       └── metadata/...
└── tools
    └── net6.0
        └── any/...       # copied from the output payload/ dir

Explicitly pass the version and build configuration to the dotnet tool
packaging script. Also revert to a default Debug config for local
builds; this is consistent with all other artifacts in the build for dev
(macOS pkg, Windows installers, deb, etc)
Add the GCM icon to the NuGet package used for the dotnet tool.
The image is copied to the root of the package under a new `images`
directory (/images). The tool payload continues to be copied under the
required `/tool/net6.0/any` directory.

Modify the pack-tool.sh script to keep all build output under the /out
directory of the repository (which is in .gitignore). Output from
running pack-tool.sh now looks like this:

.
└── out
    └── shared
        └── DotnetTool
            └── nupkg
                └── Debug
                    ├── git-credential-manager.$VERSION.nupkg
                    ├── images       # icon
                    ├── payload      # dotnet publish output
                    └── payload.sym  # pdbs

The contents of the NuGet package looks like this:

.
├── [Content_Types].xml
├── _rels
├── git-credential-manager.nuspec
├── images
│   └── icon.png          # copied from the output images/ dir
├── package
│   └── services
│       └── metadata/...
└── tools
    └── net6.0
        └── any/...       # copied from the output payload/ dir
@mjcheetham mjcheetham added the dotnet-tool Related to the dotnet tool installation method label Oct 14, 2022
@@ -9,6 +9,7 @@
publishDir=$(PublishDir);
</NuspecProperties>
<NoBuild>true</NoBuild>
<OutputPath>../../../out/nupkg</OutputPath>
<OutputPath>$(ProjectOutPath)nupkg\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This just prevents MSBuild from creating the empty/not used net6.0 directory under $(OutputPath)/.

@@ -5,11 +5,14 @@
<version>$version$</version>
<description>Secure, cross-platform Git credential storage with authentication to Azure Repos, GitHub, and other popular Git hosting services.</description>
<authors>git-credential-manager</authors>
<icon>images\icon.png</icon>
<iconUrl>https://raw.githubusercontent.com/GitCredentialManager/git-credential-manager/main/assets/gcm-transparent.png</iconUrl>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

iconUrl is deprecated, but icon is only supported by newer versions of NuGet and VS.. so include both, with iconUrl as a fallback.

Newer tools will only use icon.

Comment on lines +15 to +16
<file src="$publishdir$payload/" target="tools/net6.0/any" />
<file src="$publishdir$images/icon.png" target="images" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

$publishdir$ includes the trailing slash.. so this looks weird but is correct 😁

@@ -38,7 +37,7 @@ esac
done

if [ -z "$VERSION" ]; then
VERSION="$GitBuildVersionSimple"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

$GitBuildVersionSimple isn't set in dev builds, so let's just require it and have the CI pass this in. If $VERSION ends up being empty the dev builds ended up half-baked.

@@ -53,36 +52,25 @@ GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
DOTNET_TOOL="shared/DotnetTool"
PROJ_OUT="$OUT/$DOTNET_TOOL"

PACKAGE="$ROOT/nuget"
CONFIGURATION="${CONFIGURATION:=Release}"
CONFIGURATION="${CONFIGURATION:=Debug}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Switched the default back to Debug from Release.

Thinking about it again, we should make these scripts easy to call locally in dev (where we'd want debug bits) since CI doesn't care how long command line args get 😁

Comment on lines +61 to +64
OUTDIR="$PROJ_OUT/nupkg/$CONFIGURATION"
IMGOUT="$OUTDIR/images"
PAYLOAD="$OUTDIR/payload"
SYMBOLOUT="$OUTDIR/payload.sym"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Everything sits under $OUTDIR now which is /out/shared/DotnetTool/nupkg/$CONFIGURATION.

Comment on lines -133 to -135
cp -r "$SRC/$DOTNET_TOOL/DotnetToolSettings.xml" \
"$PAYLOAD/." \
"$PACKAGE/"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No need to copy the output to another directory just to pack it. Instead we're now dotnet publish-ing outputs to a payload directory, and copying associated .xml/.png files to the right dir structure in the first place.

Fix a bug that was introduced in an earlier PR to build the Core UI
helper (WPF) for Windows. We don't need to specify the TFM or RID for
these projects.
We missed the core UI helper from the dotnet tool package - include it!
@mjcheetham mjcheetham merged commit 7047f48 into git-ecosystem:main Oct 14, 2022
@mjcheetham mjcheetham deleted the pkgicon branch October 14, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-tool Related to the dotnet tool installation method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants