diff options
author | Maciej Barć <xgqt@gentoo.org> | 2024-02-03 14:58:26 +0100 |
---|---|---|
committer | Maciej Barć <xgqt@gentoo.org> | 2024-02-10 17:24:45 +0100 |
commit | d08eb2ce4c8adce01a37688366f4869e273dafc2 (patch) | |
tree | 5915e0387cc23af1f5a877f64a1c589abc1b257c /eclass/dotnet-pkg.eclass | |
parent | eclass/dotnet-pkg*: add dotnet-pkg_remove-bad (diff) | |
download | gentoo-d08eb2ce4c8adce01a37688366f4869e273dafc2.tar.gz gentoo-d08eb2ce4c8adce01a37688366f4869e273dafc2.tar.bz2 gentoo-d08eb2ce4c8adce01a37688366f4869e273dafc2.zip |
eclass/dotnet-pkg.eclass: add dotnet-pkg_force-compat
add new eclass function "dotnet-pkg_force-compat" that appends special
variables to dotnet command executions to force compability with
a spefified .NET SDK version
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
Diffstat (limited to 'eclass/dotnet-pkg.eclass')
-rw-r--r-- | eclass/dotnet-pkg.eclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 94f5c5a280f7..eba46c2af2a5 100644 --- a/eclass/dotnet-pkg.eclass +++ b/eclass/dotnet-pkg.eclass @@ -156,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. |