[tests] Simplify/unify code to build test NuGets. (#21472)

Also avoid the 'nuget' binary, which requires Mono.
This commit is contained in:
Rolf Bjarne Kvinge 2024-10-21 10:36:51 +02:00 коммит произвёл GitHub
Родитель d1845ee8fe
Коммит c8300a1502
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 32 добавлений и 84 удалений

Просмотреть файл

@ -1,29 +1,3 @@
TOP=../../../..
include $(TOP)/Make.config
unexport MSBUILD_EXE_PATH
.libs:
$(Q) mkdir -p $@
PACKAGE_ID=$(shell grep PackageId DynamicLibrariesInRuntimesNativeDirectory.csproj | sed 's_.*<PackageId>\(.*\)</PackageId>.*_\1_')
PACKAGE_VERSION=$(shell grep '<PackageVersion>' DynamicLibrariesInRuntimesNativeDirectory.csproj | sed 's_.*<PackageVersion>\(.*\)</PackageVersion>.*_\1_')
# Test case for dynamic libraries
.libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';')
.libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg: DynamicLibrariesInRuntimesNativeDirectory.csproj $(wildcard *.cs) | .libs
$(Q) mkdir -p $(abspath $(NUGET_TEST_FEED))
$(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $<
$(Q) $(CP) bin/Release/Xamarin.Tests.DynamicLibrariesInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg $@
INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory/$(PACKAGE_VERSION)/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg
$(INSTALLED_PACKAGE): .libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg
if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi
rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory
mkdir -p $(abspath $(NUGET_TEST_FEED))
nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive
ifdef ENABLE_DOTNET
all-local:: $(INSTALLED_PACKAGE)
endif
include ../shared.mk

Просмотреть файл

@ -1,29 +1,3 @@
TOP=../../../..
include $(TOP)/Make.config
unexport MSBUILD_EXE_PATH
.libs:
$(Q) mkdir -p $@
PACKAGE_ID=$(shell grep PackageId FrameworksInRuntimesNativeDirectory.csproj | sed 's_.*<PackageId>\(.*\)</PackageId>.*_\1_')
PACKAGE_VERSION=$(shell grep '<PackageVersion>' FrameworksInRuntimesNativeDirectory.csproj | sed 's_.*<PackageVersion>\(.*\)</PackageVersion>.*_\1_')
# Test case for https://github.com/xamarin/xamarin-macios/issues/12440
.libs/FrameworksInRuntimesNativeDirectory.nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';')
.libs/FrameworksInRuntimesNativeDirectory.nupkg: FrameworksInRuntimesNativeDirectory.csproj $(wildcard *.cs) | .libs
$(Q) mkdir -p $(abspath $(NUGET_TEST_FEED))
$(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $<
$(Q) $(CP) bin/Release/Xamarin.Tests.FrameworksInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg $@
INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.frameworksinruntimesnativedirectory/$(PACKAGE_VERSION)/xamarin.tests.frameworksinruntimesnativedirectory.$(PACKAGE_VERSION).nupkg
$(INSTALLED_PACKAGE): .libs/FrameworksInRuntimesNativeDirectory.nupkg
if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi
rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.frameworksinruntimesnativedirectory
mkdir -p $(abspath $(NUGET_TEST_FEED))
nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive
ifdef ENABLE_DOTNET
all-local:: $(INSTALLED_PACKAGE)
endif
include ../shared.mk

Просмотреть файл

@ -1,32 +1,3 @@
TOP=../../../..
include $(TOP)/Make.config
unexport MSBUILD_EXE_PATH
NAME=XCFrameworkWithStaticLibraryInRuntimesNativeDirectory
LOWERCASED_NAME:=$(shell echo $(NAME) | tr 'A-Z' 'a-z')
.libs:
$(Q) mkdir -p $@
PACKAGE_ID=$(shell grep PackageId $(NAME).csproj | sed 's_.*<PackageId>\(.*\)</PackageId>.*_\1_')
PACKAGE_VERSION=$(shell grep '<PackageVersion>' $(NAME).csproj | sed 's_.*<PackageVersion>\(.*\)</PackageVersion>.*_\1_')
# Test case for https://github.com/xamarin/xamarin-macios/issues/12440
.libs/$(NAME).nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';')
.libs/$(NAME).nupkg: $(NAME).csproj $(wildcard *.cs) | .libs
$(Q) mkdir -p $(abspath $(NUGET_TEST_FEED))
$(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $<
$(Q) $(CP) bin/Release/Xamarin.Tests.$(NAME).$(PACKAGE_VERSION).nupkg $@
INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.$(LOWERCASED_NAME)/$(PACKAGE_VERSION)/xamarin.tests.$(LOWERCASED_NAME).$(PACKAGE_VERSION).nupkg
$(INSTALLED_PACKAGE): .libs/$(NAME).nupkg
if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi
rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.$(LOWERCASED_NAME)
mkdir -p $(abspath $(NUGET_TEST_FEED))
nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive
ifdef ENABLE_DOTNET
all-local:: $(INSTALLED_PACKAGE)
endif
include ../shared.mk

Просмотреть файл

@ -0,0 +1,29 @@
TOP=../../../..
include $(TOP)/Make.config
unexport MSBUILD_EXE_PATH
NAME=$(shell basename "$(CURDIR)")
LOWERCASED_NAME:=$(shell echo $(NAME) | tr 'A-Z' 'a-z')
.libs:
$(Q) mkdir -p $@
PACKAGE_ID=$(shell grep PackageId $(NAME).csproj | sed 's_.*<PackageId>\(.*\)</PackageId>.*_\1_')
PACKAGE_VERSION=$(shell grep '<PackageVersion>' $(NAME).csproj | sed 's_.*<PackageVersion>\(.*\)</PackageVersion>.*_\1_')
NUPKG_PATH=bin/Release/$(PACKAGE_ID).$(PACKAGE_VERSION).nupkg
# Test case for dynamic libraries
$(NUPKG_PATH): export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';')
$(NUPKG_PATH): $(NAME).csproj $(wildcard *.cs) | .libs
$(Q) rm -f $(NUPKG_PATH)
$(Q) mkdir -p $(abspath $(NUGET_TEST_FEED))
$(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $<
INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/$(PACKAGE_ID).$(PACKAGE_VERSION).nupkg
$(INSTALLED_PACKAGE): $(NUPKG_PATH)
rm -rf $(NUGET_TEST_FEED)/$(PACKAGE_ID).*.nupkg
$(CP) $< $@
all-local:: $(INSTALLED_PACKAGE)