pulumi/sdk/dotnet/Makefile
Fraser Waters 385b5c5212 Remove use of /opt/pulumi for nuget packages
Stop using /opt/pulumi/nuget, this makes some progress towards fixing

There are three main changes here:
1) We no longer pack on build, instead requiring an explicit pack command
(which runs in relase configuration). This should be a small speed improvement
for standard builds.
2) The integration tests no longer rely on a nuget package, instead we just
reference the project directly. This removes the need for a local nuget feed
that had to be setup and installed into.
3) As we've got rid of the local nuget feed `make install` simply runs "dotnet
pack" and `make publish` picks up the .nupkg from the sdk bin folder.

The one workflow this changes is if people have pulumi programs outside
pulumi/pulumi that they we're using `make install` to get a build of the
dotnet sdk into. Anyone using that workflow instead needs to either:
1) Manually copy the .nupkg from the build folder to wherever they have
setup their local nuget feed.
2) Change that project to refer to Pulumi via a project reference.
2021-11-12 12:18:42 +00:00

68 lines
2.8 KiB
Makefile

PROJECT_NAME := Pulumi .NET Core SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v3/dotnet/cmd/pulumi-language-dotnet
PROJECT_PKGS := $(shell go list ./cmd...)
PROJECT_ROOT := $(realpath ../..)
DOTNET_VERSION := $(shell cd ../../ && pulumictl get version --language dotnet)
TESTPARALLELISM := 10
include ../../build/common.mk
# Motivation: running `make TEST_ALL_DEPS= test_all` permits running
# `test_all` without the dependencies.
TEST_ALL_DEPS = install
ensure::
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
dotnet restore dotnet.sln
build::
# From the nuget docs:
#
# Pre-release versions are then denoted by appending a hyphen and a string after the patch number.
# Technically speaking, you can use any string after the hyphen and NuGet will treat the package as
# pre-release. NuGet then displays the full version number in the applicable UI, leaving consumers
# to interpret the meaning for themselves.
#
# With this in mind, it's generally good to follow recognized naming conventions such as the
# following:
#
# -alpha: Alpha release, typically used for work-in-progress and experimentation
dotnet clean
dotnet build dotnet.sln /p:Version=${DOTNET_VERSION}
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
install_plugin::
GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
install:: build install_plugin
dotnet pack dotnet.sln --configuration Release /p:Version=${DOTNET_VERSION}
dotnet_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
auto_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
test_fast:: dotnet_test
$(GO_TEST_FAST) ${PROJECT_PKGS}
test_all:: dotnet_test auto_test
$(GO_TEST) ${PROJECT_PKGS}
dist::
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
brew:: BREW_VERSION := $(shell ../../scripts/get-version HEAD)
brew::
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${BREW_VERSION}" ${LANGHOST_PKG}
publish:: build install
echo "Publishing .nupkgs to nuget.org:"
find . -name 'Pulumi*${VERSION_PREFIX}*.nupkg' -path '*/Release/*' \
-exec dotnet nuget push -k ${NUGET_PUBLISH_KEY} -s https://api.nuget.org/v3/index.json {} ';'