Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<Project>
<PropertyGroup>
<KapuschFacebookFeatures Condition="'$(KapuschFacebookFeatures)' == ''">Login</KapuschFacebookFeatures>
<_KapuschFacebookFeaturesDelimited>;$([System.String]::Copy('$(KapuschFacebookFeatures)').Replace(' ', ''));</_KapuschFacebookFeaturesDelimited>
<_KapuschFacebookLoginEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Login;'))</_KapuschFacebookLoginEnabled>
<_KapuschFacebookShareEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Share;'))</_KapuschFacebookShareEnabled>
<DisableKapuschFacebookAndroidNativeAssets Condition="'$(DisableKapuschFacebookAndroidNativeAssets)' == ''">false</DisableKapuschFacebookAndroidNativeAssets>
<UseKapuschFacebookAndroidInteropFromSource Condition="'$(UseKapuschFacebookAndroidInteropFromSource)' == ''">false</UseKapuschFacebookAndroidInteropFromSource>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project>
<PropertyGroup>
<!-- Package .props are imported before the consuming project body. Resolve the
selected features here, after the consumer had a chance to override them. -->
<_KapuschFacebookFeaturesDelimited>;$([System.String]::Copy('$(KapuschFacebookFeatures)').Replace(' ', ''));</_KapuschFacebookFeaturesDelimited>
<_KapuschFacebookLoginEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Login;'))</_KapuschFacebookLoginEnabled>
<_KapuschFacebookShareEnabled>$([System.String]::Copy('$(_KapuschFacebookFeaturesDelimited)').Contains(';Share;'))</_KapuschFacebookShareEnabled>
<_KapuschFacebookAndroidPackageRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..'))</_KapuschFacebookAndroidPackageRoot>
</PropertyGroup>

Expand Down
21 changes: 21 additions & 0 deletions tests/FeatureSelection.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project>
<!-- Reproduce NuGet's import order: .props, consumer project body, .targets. -->
<Import Project="../src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.props" />

<PropertyGroup Condition="'$(RequestedFacebookFeatures)' != ''">
<KapuschFacebookFeatures>$(RequestedFacebookFeatures)</KapuschFacebookFeatures>
</PropertyGroup>

<Import Project="../src/Kapusch.FacebookApisForAndroidComponents/buildTransitive/Kapusch.Facebook.Android.targets" />

<Target Name="ValidateFeatureSelection">
<Error
Condition="'$(_KapuschFacebookLoginEnabled)' != '$(ExpectedLoginEnabled)'"
Text="Expected Login=$(ExpectedLoginEnabled), got $(_KapuschFacebookLoginEnabled) for '$(KapuschFacebookFeatures)'."
/>
<Error
Condition="'$(_KapuschFacebookShareEnabled)' != '$(ExpectedShareEnabled)'"
Text="Expected Share=$(ExpectedShareEnabled), got $(_KapuschFacebookShareEnabled) for '$(KapuschFacebookFeatures)'."
/>
</Target>
</Project>
11 changes: 11 additions & 0 deletions tests/validate-feature-selection.sh
Original file line number Diff line number Diff line change
@@ -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
Loading