Skip to content

Commit

Permalink
Add build-in support in NuGetizer for dotnet-nugetize
Browse files Browse the repository at this point in the history
Instead of doing so many brittle hacks, just assume the project will already be packable and have the right metadata in place. So it's mostly a tool for quickly inspecting changes to a project.

Simplify also the way the multitargeting targets are copied and used, so that there's minimal stuff in the buildMultitargeting folder. Rename NuGetizer.Common.targets to NuGetizer.Shared.targets instead, which also makes it clearer that they are shared targets across single and multi-targeting.
  • Loading branch information
kzu committed Sep 29, 2020
1 parent f8371a7 commit ff1c848
Show file tree
Hide file tree
Showing 30 changed files with 643 additions and 336 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ jobs:
with:
dotnet-version: 3.1.x
- run: dotnet tool update -g dotnet-vs
- name: set version
run: echo "::set-env name=VERSION_SUFFIX::$(git name-rev --name-only --refs=refs/heads/* HEAD).$($env:GITHUB_RUN_NUMBER)"
- run: echo "::set-env name=MSB::$(vs where preview --prop=InstallationPath)"
- run: vs install preview --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
if: env.MSB == ''
- run: echo "::add-path::$(vs where preview --prop=InstallationPath)\MSBuild\Current\Bin"
- run: msbuild -r
- run: msbuild -t:test
- run: msbuild -t:pack -p:packonbuild=true -p:nobuild=true -p:versionsuffix=$(git name-rev --name-only --refs=refs/heads/* HEAD).$($env:GITHUB_RUN_NUMBER)
- run: |
- name: build
run: msbuild -r -p:versionsuffix=$($env:VERSION_SUFFIX)
- name: test
run: msbuild -t:test
- name: pack
run: msbuild -t:pack -p:nobuild=true -p:versionsuffix=$($env:VERSION_SUFFIX)
- name: sleet
run: |
dotnet tool install -g --version 2.3.33 sleet
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure"
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ jobs:
with:
dotnet-version: 3.1.x
- run: dotnet tool update -g dotnet-vs
- name: set version
run: echo "::set-env name=VERSION::${GITHUB_REF#refs/*/v}
- run: echo "::set-env name=MSB::$(vs where preview --prop=InstallationPath)"
- run: vs install preview --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
if: env.MSB == ''
- run: echo "::add-path::$(vs where preview --prop=InstallationPath)\MSBuild\Current\Bin"
- run: msbuild -r -p:version=${GITHUB_REF#refs/*/v}
- run: msbuild -t:test
- run: msbuild -t:pack -p:packonbuild=true -p:nobuild=true -p:version=${GITHUB_REF#refs/*/v}
- name: build
run: msbuild -r -p:version=$($env:VERSION)
- name: test
run: msbuild -t:test
- name: pack
run: msbuild -t:pack -p:nobuild=true -p:version=$($env:VERSION)
- name: push
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
13 changes: 5 additions & 8 deletions NuGetizer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetizer.Tests", "src\NuGe
{57F59BF6-9272-4B66-98A1-334B3FDA5721} = {57F59BF6-9272-4B66-98A1-334B3FDA5721}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetize", "src\NuGetize\NuGetize.csproj", "{A42833EA-789D-4D8E-BDB9-3895541ABAF3}"
ProjectSection(ProjectDependencies) = postProject
{57F59BF6-9272-4B66-98A1-334B3FDA5721} = {57F59BF6-9272-4B66-98A1-334B3FDA5721}
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-nugetize", "src\dotnet-nugetize\dotnet-nugetize.csproj", "{53B47B9E-212F-420D-9E9A-68EC3B44D39E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -41,10 +38,10 @@ Global
{50032C88-1B52-4DB1-BFC5-6BADE2CC58CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50032C88-1B52-4DB1-BFC5-6BADE2CC58CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50032C88-1B52-4DB1-BFC5-6BADE2CC58CC}.Release|Any CPU.Build.0 = Release|Any CPU
{A42833EA-789D-4D8E-BDB9-3895541ABAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A42833EA-789D-4D8E-BDB9-3895541ABAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A42833EA-789D-4D8E-BDB9-3895541ABAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A42833EA-789D-4D8E-BDB9-3895541ABAF3}.Release|Any CPU.Build.0 = Release|Any CPU
{53B47B9E-212F-420D-9E9A-68EC3B44D39E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53B47B9E-212F-420D-9E9A-68EC3B44D39E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53B47B9E-212F-420D-9E9A-68EC3B44D39E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53B47B9E-212F-420D-9E9A-68EC3B44D39E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@

<Target Name="Pack" Condition="$(IsPackable)" Returns="@(PackOutput)">
<!-- Typically called in the IDE when we run Pack context menu. -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="PackOnBuild=true" Targets="Pack">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="NuGetize=true" Targets="Pack">
<Output TaskParameter="TargetOutputs" ItemName="PackOutput"/>
</MSBuild>
</Target>

<Target Name="Test" />

<Import Project="NuGetizer.Tasks\NuGetizer.props" Condition="'$(PackOnBuild)' == 'true'" />
<Import Project="NuGetizer.Tasks\NuGetizer.props" Condition="'$(NuGetize)' == 'true'" />

</Project>
8 changes: 6 additions & 2 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
<PropertyGroup Label="Pack">
<IsPackable Condition="'$(IsPackable)' == '' and '$(PackageId)' != ''">true</IsPackable>
<IsPackable Condition="'$(IsPackable)' == '' and '$(PackageId)' == ''">false</IsPackable>
<ImportNuGetBuildTasksPackTargetsFromSdk Condition="'$(PackOnBuild)' != 'true'">false</ImportNuGetBuildTasksPackTargetsFromSdk>
</PropertyGroup>

<Import Project="NuGetizer.Tasks\$(OutputPath)NuGetizer.targets" Condition="$(IsPackable) and '$(PackOnBuild)' == 'true'" />
<PropertyGroup Condition="'$(NuGetize)' != 'false'">
<!-- GeneratePackageOnBuild=false is used by VS when right-click Pack is used :) -->
<ImportNuGetBuildTasksPackTargetsFromSdk Condition="'$(NuGetize)' == 'true' or '$(GeneratePackageOnBuild)' != ''">false</ImportNuGetBuildTasksPackTargetsFromSdk>
</PropertyGroup>

<Import Project="NuGetizer.Tasks\$(OutputPath)NuGetizer.targets" Condition="$(IsPackable) and '$(NuGetize)' == 'true'" />

<PropertyGroup>
<PackageItemKindFile>$(IntermediateOutputPath)PackageItemKind.g$(DefaultLanguageSourceExtension)</PackageItemKindFile>
Expand Down
16 changes: 0 additions & 16 deletions src/NuGetize/CommandExtensions.cs

This file was deleted.

36 changes: 0 additions & 36 deletions src/NuGetize/NuGetize.Build.targets

This file was deleted.

10 changes: 0 additions & 10 deletions src/NuGetize/NuGetize.Tweaks.targets

This file was deleted.

196 changes: 0 additions & 196 deletions src/NuGetize/Program.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/NuGetize/Properties/launchSettings.json

This file was deleted.

Loading

0 comments on commit ff1c848

Please sign in to comment.