From 55cdb5d0d9acf513dbfc3ccdce99f17cf55f5652 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Wed, 29 Nov 2017 01:48:15 +0100 Subject: [PATCH] Fix preprocessor definition detection Also wow, I had no idea that even .csproj files handled by msbuild support C# operations, this is freaking awesome. --- .travis.yml | 7 ++----- ArchiSteamFarm/ArchiSteamFarm.csproj | 4 ++++ appveyor.yml | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index a2907ae62..33b1b4996 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,13 +43,10 @@ script: dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -o 'out/source' --no-build --no-restore publish() { - local variantProperty="${1//-/_}" - variantProperty="ASF_VARIANT_${variantProperty^^}=1" - if [ "$1" = 'generic' ]; then - dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out/${1}" --no-restore /nologo "/p:$variantProperty" /p:LinkDuringPublish=false + dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out/${1}" --no-restore /nologo "/p:ASFVariant=$1" /p:LinkDuringPublish=false else - dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out/${1}" -r "$1" --no-restore /nologo "/p:$variantProperty" + dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out/${1}" -r "$1" --no-restore /nologo "/p:ASFVariant=$1" fi if [ -d "ArchiSteamFarm/scripts/${1}" ]; then diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 0b6927382..3eb59afca 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -30,6 +30,10 @@ + + $(DefineConstants);ASF_VARIANT_$(ASFVariant.Replace('-', '_').ToUpperInvariant()) + + diff --git a/appveyor.yml b/appveyor.yml index 8e7e85c65..25ff86e20 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -65,12 +65,10 @@ after_test: Set-Location -Path "$env:APPVEYOR_BUILD_FOLDER" - $variantProperty = 'ASF_VARIANT_' + $Variant.Replace('-', '_').ToUpperInvariant() + '=1' - if ($Variant -eq 'generic') { - dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -o "out\$Variant" --no-restore /nologo "/p:$variantProperty" /p:LinkDuringPublish=false + dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -o "out\$Variant" --no-restore /nologo "/p:ASFVariant=$Variant" /p:LinkDuringPublish=false } else { - dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -o "out\$Variant" -r "$Variant" --no-restore /nologo "/p:$variantProperty" + dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -o "out\$Variant" -r "$Variant" --no-restore /nologo "/p:ASFVariant=$Variant" } # If we include any helper scripts for this variant, copy them to output directory