diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-02-10 17:34:25 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-02-10 17:34:25 +0000 |
commit | 0bb42730e8fc9c8e571f12e3189c6c6f8d532c24 (patch) | |
tree | cba6032fbed30be2b0764494607c3ec9dda0c18a /eclass/dotnet-pkg.eclass | |
parent | cc901a8ce7c6bfe97e3b4f048619693d360ae348 (diff) |
gentoo auto-resync : 10:02:2024 - 17:34:25
Diffstat (limited to 'eclass/dotnet-pkg.eclass')
-rw-r--r-- | eclass/dotnet-pkg.eclass | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 9d78f463be77..59a8ae799f86 100644 --- a/eclass/dotnet-pkg.eclass +++ b/eclass/dotnet-pkg.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: dotnet-pkg.eclass @@ -48,6 +48,24 @@ inherit dotnet-pkg-base RDEPEND+=" ${DOTNET_PKG_RDEPS} " BDEPEND+=" ${DOTNET_PKG_BDEPS} " +# @ECLASS_VARIABLE: DOTNET_PKG_BAD_PROJECTS +# @DESCRIPTION: +# List of projects to remove from all found solution (".sln") files. +# The projects are removed in the "dotnet-pkg_src_prepare" function. +# +# This variable should be set after inheriting "dotnet-pkg.eclass". +# +# Default value is an empty array. +# +# Example: +# @CODE +# DOTNET_PKG_BAD_PROJECTS=( "${S}/BrokenTests" ) +# DOTNET_PKG_PROJECTS=( "${S}/DotnetProject" ) +# @CODE +# +# For more info see: "dotnet-pkg_remove-bad" function. +DOTNET_PKG_BAD_PROJECTS=() + # @ECLASS_VARIABLE: DOTNET_PKG_PROJECTS # @DEFAULT_UNSET # @DESCRIPTION: @@ -138,6 +156,29 @@ DOTNET_PKG_BUILD_EXTRA_ARGS=() # For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_test". DOTNET_PKG_TEST_EXTRA_ARGS=() +# @FUNCTION: dotnet-pkg_force-compat +# @DESCRIPTION: +# This function appends special options to all "DOTNET_PKG_*_EXTRA_ARGS" +# variables in an attempt to force compatibility to the picked +# "DOTNET_PKG_COMPAT" .NET SDK version. +# +# Call this function post-inherit. +dotnet-pkg_force-compat() { + if [[ -z ${DOTNET_PKG_COMPAT} ]] ; then + die "DOTNET_PKG_COMPAT is not set" + fi + + local -a force_extra_args=( + -p:RollForward=Major + -p:TargetFramework="net${DOTNET_PKG_COMPAT}" + -p:TargetFrameworks="net${DOTNET_PKG_COMPAT}" + ) + + DOTNET_PKG_RESTORE_EXTRA_ARGS+=( "${force_extra_args[@]}" ) + DOTNET_PKG_BUILD_EXTRA_ARGS+=( "${force_extra_args[@]}" ) + DOTNET_PKG_TEST_EXTRA_ARGS+=( "${force_extra_args[@]}" ) +} + # @FUNCTION: dotnet-pkg_pkg_setup # @DESCRIPTION: # Default "pkg_setup" for the "dotnet-pkg" eclass. @@ -161,14 +202,38 @@ dotnet-pkg_src_unpack() { nuget_unpack-non-nuget-archives } +# @FUNCTION: dotnet-pkg_remove-bad +# @USAGE: <solution> +# @DESCRIPTION: +# Remove all projects specified by "DOTNET_PKG_BAD_PROJECTS" from a given +# solution file. +# +# Used by "dotnet-pkg_src_prepare". +dotnet-pkg_remove-bad() { + debug-print-function "${FUNCNAME[0]}" "${@}" + + [[ -z ${1} ]] && die "${FUNCNAME[0]}: no solution file specified" + + local bad_project + for bad_project in "${DOTNET_PKG_BAD_PROJECTS[@]}" ; do + nonfatal dotnet-pkg-base_sln-remove "${1}" "${bad_project}" + done +} + # @FUNCTION: dotnet-pkg_src_prepare # @DESCRIPTION: # Default "src_prepare" for the "dotnet-pkg" eclass. # Prepare the package sources. # -# Run "dotnet-pkg-base_remove-global-json". +# Run "dotnet-pkg-base_remove-global-json", "dotnet-pkg-base_remove-bad" +# for each found solution file and prepare for using Nuget. dotnet-pkg_src_prepare() { dotnet-pkg-base_remove-global-json + dotnet-pkg-base_foreach-solution "$(pwd)" dotnet-pkg_remove-bad + + find "$(pwd)" -maxdepth 1 -iname "nuget.config" -delete || + die "${FUNCNAME[0]}: failed to remove unwanted \"NuGet.config\" config files" + nuget_writeconfig "$(pwd)/" default } |