Skip to content

Commit

Permalink
[buildtasks] Rework multitargeting support (#28)
Browse files Browse the repository at this point in the history
Reworks multitargeting support to ensure native build targets always run
for every target framework in the project, rather than trying to run
once at the top of a multitargeted build.

Build output directories have been updated to include $(TargetFramework)
to avoid potential conflicts with using the same output directory for
a multitargeting project.
  • Loading branch information
pjcollins authored Jun 24, 2024
1 parent 3392392 commit 046fb32
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 84 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<LangVersion>latest</LangVersion>
<MSBuildPackageVersion>17.9.5</MSBuildPackageVersion>
<BindingExtPackageVersion>0.0.1-pre3</BindingExtPackageVersion>
<BindingExtPackageVersion>0.0.1-pre7</BindingExtPackageVersion>
</PropertyGroup>

</Project>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ When packaging a native Android library (.aar) file, gradle/maven dependencies a
The `facebook/android/native/mauifacebook/build.gradle.kts` file is configured to copy facebook dependencies into a `bin/outputs/deps` folder. Some of this content is then referenced by the .NET MAUI sample project:

```xml
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-android-sdk-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-android-sdk-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-common-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-common-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-core-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-core-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
Expand Down
6 changes: 3 additions & 3 deletions facebook/sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
<ItemGroup Condition="$(TargetFramework.Contains('android'))">
<ProjectReference Include="..\android\Facebook.Android.Binding\Facebook.Android.Binding.csproj" />
<!-- Include core facebook dependencies. Starting in .NET 9 these can potentially be replaced with @(AndroidMavenPackage) -->
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-android-sdk-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-android-sdk-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-common-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-common-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
<AndroidLibrary Include="..\android\native\mauifacebook\bin\outputs\deps\facebook-core-17.0.0.aar">
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-core-17.0.0.aar">
<Bind>false</Bind>
<Visible>false</Visible>
</AndroidLibrary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
<Version>0.0.1-pre3</Version>
<Version>0.0.1-pre7</Version>
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>net,maui,netmaui,toolkit,kit,communitytoolkit,netmauitoolkit,mauicommunitytoolkit,slimbinding,binding</PackageTags>
Expand All @@ -39,8 +39,6 @@
<None Include="$(MSBuildThisFileDirectory)../../build/nuget.png" Pack="true" PackagePath="/" />
<None Include="$(MSBuildThisFileDirectory)../../README.md" Pack="true" PackagePath="/" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.targets" Pack="true" PackagePath="build" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.targets" Pack="true" PackagePath="buildMultiTargeting" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.multitargeting.props" Pack="true" PackagePath="buildMultiTargeting/CommunityToolkit.Maui.BindingExtensions.props" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.props" Pack="true" PackagePath="tools" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.android.targets" Pack="true" PackagePath="tools" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.macios.targets" Pack="true" PackagePath="tools" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup>
<GradleProjectConfiguration Condition=" '$(GradleProjectConfiguration)' == '' ">Release</GradleProjectConfiguration>
<GradleProjectBuildDirectory Condition=" '$(GradleProjectBuildDirectory)' == '' ">bin</GradleProjectBuildDirectory>
<GradleProjectBuildDirectory Condition=" '$(GradleProjectBuildDirectory)' == '' ">bin/$(GradleProjectConfiguration)/$(TargetFramework)</GradleProjectBuildDirectory>
</PropertyGroup>

<ItemDefinitionGroup>
Expand All @@ -16,15 +16,6 @@
</GradleProjectReference>
</ItemDefinitionGroup>

<PropertyGroup>
<_BuildGradleProjectsBeforeTargets Condition=" '$(IsRunningOuterBuild)' == 'true' ">
DispatchToInnerBuilds;
</_BuildGradleProjectsBeforeTargets>
<_BuildGradleProjectsDependsOn Condition=" '$(IsRunningOuterBuild)' != 'true' ">
_ResolveMonoAndroidSdks;
</_BuildGradleProjectsDependsOn>
</PropertyGroup>


<Target Name="_GetBuildGradleProjectsInputs">
<ItemGroup>
Expand All @@ -39,8 +30,8 @@
</Target>

<Target Name="_BuildGradleProjects"
Condition=" '@(GradleProjectReference->Count())' != '0' and $(OnlyBuildOuterIfMultiTargeting) "
DependsOnTargets="_GetBuildGradleProjectsInputs;$(_BuildGradleProjectsDependsOn)"
Condition=" '@(GradleProjectReference->Count())' != '0' "
DependsOnTargets="_GetBuildGradleProjectsInputs;_ResolveMonoAndroidSdks"
BeforeTargets="$(_BuildGradleProjectsBeforeTargets);$(CompileDependsOn)"
Inputs="@(_GradleInputs)"
Outputs="@(_GradleOutputs)" >
Expand Down
Loading

0 comments on commit 046fb32

Please sign in to comment.