From da3a495a29d408232302c085c0ea1f58a184cfd9 Mon Sep 17 00:00:00 2001 From: kapusch Date: Wed, 15 Jul 2026 23:51:26 +0200 Subject: [PATCH] fix(packaging): evaluate Facebook features after project properties --- .github/workflows/ci.yml | 3 +++ .github/workflows/publish.yml | 3 +++ .../Kapusch.Facebook.Android.props | 3 --- .../Kapusch.Facebook.Android.targets | 5 +++++ tests/FeatureSelection.proj | 21 +++++++++++++++++++ tests/validate-feature-selection.sh | 11 ++++++++++ 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 tests/FeatureSelection.proj create mode 100644 tests/validate-feature-selection.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1bc6a4..f97f0b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: with: dotnet-version: "10.0.x" + - name: Validate feature selection + run: bash tests/validate-feature-selection.sh + - uses: actions/setup-java@v4 with: distribution: "microsoft" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1b45c52..b9c92ce 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -71,6 +71,9 @@ jobs: with: dotnet-version: "10.0.x" + - name: Validate feature selection + run: bash tests/validate-feature-selection.sh + - uses: actions/setup-java@v4 with: distribution: "microsoft" diff --git a/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.props b/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.props index efcab06..771742b 100644 --- a/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.props +++ b/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.props @@ -1,9 +1,6 @@ Login - <_KapuschFacebookFeaturesDelimited>;$([System.String]::Copy('$(KapuschFacebookFeatures)').Replace(' ', '')); - <_KapuschFacebookLoginEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Login;')) - <_KapuschFacebookShareEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Share;')) false false diff --git a/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.targets b/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.targets index 0ec3d5c..dea5123 100644 --- a/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.targets +++ b/src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.targets @@ -1,5 +1,10 @@ + + <_KapuschFacebookFeaturesDelimited>;$([System.String]::Copy('$(KapuschFacebookFeatures)').Replace(' ', '')); + <_KapuschFacebookLoginEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Login;')) + <_KapuschFacebookShareEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Share;')) <_KapuschFacebookAndroidPackageRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..')) diff --git a/tests/FeatureSelection.proj b/tests/FeatureSelection.proj new file mode 100644 index 0000000..a0ffea8 --- /dev/null +++ b/tests/FeatureSelection.proj @@ -0,0 +1,21 @@ + + + + + + $(RequestedFacebookFeatures) + + + + + + + + + diff --git a/tests/validate-feature-selection.sh b/tests/validate-feature-selection.sh new file mode 100644 index 0000000..6f3bc49 --- /dev/null +++ b/tests/validate-feature-selection.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +project="tests/FeatureSelection.proj" + +dotnet msbuild "$project" -t:ValidateFeatureSelection -p:ExpectedLoginEnabled=True -p:ExpectedShareEnabled=False + +dotnet msbuild "$project" -t:ValidateFeatureSelection -p:RequestedFacebookFeatures=Share -p:ExpectedLoginEnabled=False -p:ExpectedShareEnabled=True + +dotnet msbuild "$project" -t:ValidateFeatureSelection -p:RequestedFacebookFeatures=Login%3BShare -p:ExpectedLoginEnabled=True -p:ExpectedShareEnabled=True