Skip to content

Commit 592c918

Browse files
committed
Update facebook to net9.0, cut NativeLibraryInterop.BuildTasks
1 parent ab58d1d commit 592c918

26 files changed

+65
-927
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v3
1717

18-
- name: Use .NET 8.x
18+
- name: Use .NET 9.x
1919
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: '8.x'
21+
dotnet-version: '9.x'
22+
dotnet-quality: 'preview'
23+
24+
# Temporarily install newer runtime for iOS binding projects
25+
- name: Install .NET 9 RTM runtime
26+
run: >
27+
DOTNET_ROOT=~/.dotnet/ &&
28+
curl -L https://dot.net/v1/dotnet-install.sh --retry 5 --retry-max-time 300 > dotnet-install.sh &&
29+
chmod +x dotnet-install.sh &&
30+
./dotnet-install.sh -c 9.0 -q daily --runtime dotnet
2231

2332
- name: Install JDK 17
2433
uses: actions/setup-java@v4
@@ -44,26 +53,6 @@ jobs:
4453
- name: Create logs dir
4554
run: mkdir -p ${{ runner.temp }}/logs/
4655

47-
- name: Create local nupkg dir
48-
run: mkdir -p ./src/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks/bin/Release
49-
50-
- name: Build and test build tasks
51-
working-directory: ./src
52-
run: >-
53-
dotnet test CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks.sln
54-
--logger trx --results-directory ${{ runner.temp }}/logs/TestResults-build-tasks
55-
-bl:${{ runner.temp }}/logs/build-tasks.binlog
56-
57-
- name: Pack build tasks
58-
working-directory: ./src/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks
59-
run: dotnet pack CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks.csproj -bl:${{ runner.temp }}/logs/build-tasks-pack.binlog
60-
61-
- name: Upload nupkg
62-
uses: actions/upload-artifact@v4
63-
with:
64-
name: nupkg
65-
path: ./src/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks/bin/Release/*.nupkg
66-
6756
- name: Build template
6857
working-directory: ./template
6958
run: dotnet build -bl:${{ runner.temp }}/logs/template.binlog

Directory.Build.props

Lines changed: 0 additions & 10 deletions
This file was deleted.

facebook/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ This folder contains a slim binding for the Facebook SDK which demonstrates simp
33

44
### Build and Run
55
```shell
6-
dotnet build sample -t:Run -f net8.0-android
7-
dotnet build sample -t:Run -f net8.0-ios
6+
dotnet build sample -t:Run -f net9.0-android
7+
dotnet build sample -t:Run -f net9.0-ios
88
```
99

1010
### Configure
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0-android</TargetFramework>
3+
<TargetFramework>net9.0-android</TargetFramework>
44
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
7+
<!--
8+
Enable trim analyzers for Android class libraries.
9+
To learn more, see: https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming
10+
-->
11+
<IsTrimmable>true</IsTrimmable>
712
<RootNamespace>Facebook</RootNamespace>
8-
<AndroidGenerateResourceDesigner>false</AndroidGenerateResourceDesigner>
913
</PropertyGroup>
1014

1115
<ItemGroup>
12-
<PackageReference Include="CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks" Version="$(NLIPackageVersion)" PrivateAssets="all" />
13-
</ItemGroup>
14-
15-
<ItemGroup>
16-
<NLIGradleProjectReference Include="../native" >
16+
<AndroidGradleProject Include="../native/build.gradle.kts" >
1717
<ModuleName>mauifacebook</ModuleName>
1818
<!-- Metadata applicable to @(AndroidLibrary) will be used if set, otherwise the following defaults will be used:
1919
<Bind>true</Bind>
2020
<Pack>true</Pack>
2121
-->
22-
</NLIGradleProjectReference>
22+
</AndroidGradleProject>
2323
</ItemGroup>
2424

2525
</Project>

facebook/android/native/mauifacebook/build.gradle.kts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,9 @@ android {
2525
}
2626
}
2727

28-
configurations {
29-
create("copyDependencies")
30-
}
31-
3228
dependencies {
3329
implementation("androidx.appcompat:appcompat:1.6.1")
3430
implementation("com.google.android.material:material:1.11.0")
35-
implementation("com.facebook.android:facebook-android-sdk:latest.release")
36-
"copyDependencies"("com.facebook.android:facebook-android-sdk:latest.release")
31+
implementation("com.facebook.android:facebook-android-sdk:17.0.2")
3732
}
3833

39-
project.afterEvaluate {
40-
tasks.register<Copy>("copyDeps") {
41-
from(configurations["copyDependencies"])
42-
into("${buildDir}/outputs/deps")
43-
}
44-
tasks.named("preBuild") { finalizedBy("copyDeps") }
45-
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0-ios</TargetFramework>
3+
<TargetFramework>net9.0-ios</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>true</ImplicitUsings>
66
<IsBindingProject>true</IsBindingProject>
7-
</PropertyGroup>
87

9-
<ItemGroup>
10-
<PackageReference Include="CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks" Version="$(NLIPackageVersion)" PrivateAssets="all" />
11-
</ItemGroup>
8+
<!--
9+
Enable trim analyzers for class libraries.
10+
To learn more, see: https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming
11+
-->
12+
<IsTrimmable>true</IsTrimmable>
13+
</PropertyGroup>
1214

1315
<ItemGroup>
1416
<ObjcBindingApiDefinition Include="ApiDefinitions.cs"/>
15-
<NLIXcodeProjectReference Include="../native/MauiFacebook.xcodeproj">
17+
<XcodeProject Include="../native/MauiFacebook.xcodeproj">
1618
<SchemeName>MauiFacebook</SchemeName>
17-
<SharpieNamespace>Facebook</SharpieNamespace>
18-
<SharpieBind>true</SharpieBind>
1919
<!-- Metadata applicable to @(NativeReference) will be used if set, otherwise the following defaults will be used:
2020
<Kind>Framework</Kind>
2121
<SmartLink>true</SmartLink>
2222
-->
23-
</NLIXcodeProjectReference>
23+
</XcodeProject>
2424
</ItemGroup>
2525

2626
</Project>

facebook/sample/App.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ public partial class App : Application
55
public App()
66
{
77
InitializeComponent();
8+
}
89

9-
MainPage = new AppShell();
10+
protected override Window CreateWindow(IActivationState? activationState)
11+
{
12+
return new Window(new AppShell());
1013
}
1114
}

facebook/sample/Sample.csproj

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0-ios;net8.0-android</TargetFrameworks>
4+
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
55
<!-- Note for MacCatalyst:
66
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
77
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
@@ -26,8 +26,11 @@
2626
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
2727
<ApplicationVersion>1</ApplicationVersion>
2828

29-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
30-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
29+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
30+
<WindowsPackageType>None</WindowsPackageType>
31+
32+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
33+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
3134
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
3235
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
3336
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
@@ -36,25 +39,25 @@
3639

3740
<ItemGroup>
3841
<!-- App Icon -->
39-
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4"/>
42+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
4043

4144
<!-- Splash Screen -->
42-
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128"/>
45+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
4346

4447
<!-- Images -->
45-
<MauiImage Include="Resources\Images\*"/>
46-
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185"/>
48+
<MauiImage Include="Resources\Images\*" />
49+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
4750

4851
<!-- Custom Fonts -->
49-
<MauiFont Include="Resources\Fonts\*"/>
52+
<MauiFont Include="Resources\Fonts\*" />
5053

5154
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
52-
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
55+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
5356
</ItemGroup>
5457

5558
<ItemGroup>
56-
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)"/>
57-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)"/>
59+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
60+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-rc.2.24473.5" />
5861
</ItemGroup>
5962

6063
<ItemGroup Condition="$(TargetFramework.Contains('ios')) Or $(TargetFramework.Contains('maccatalyst'))">
@@ -63,19 +66,15 @@
6366

6467
<ItemGroup Condition="$(TargetFramework.Contains('android'))">
6568
<ProjectReference Include="..\android\Facebook.Android.Binding\Facebook.Android.Binding.csproj" />
66-
<!-- Include core facebook dependencies. Starting in .NET 9 these can potentially be replaced with @(AndroidMavenPackage) -->
67-
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-android-sdk-17.0.0.aar">
68-
<Bind>false</Bind>
69-
<Visible>false</Visible>
70-
</AndroidLibrary>
71-
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-common-17.0.0.aar">
72-
<Bind>false</Bind>
73-
<Visible>false</Visible>
74-
</AndroidLibrary>
75-
<AndroidLibrary Include="..\android\native\mauifacebook\bin\Release\$(TargetFramework)\outputs\deps\facebook-core-17.0.0.aar">
76-
<Bind>false</Bind>
77-
<Visible>false</Visible>
78-
</AndroidLibrary>
69+
<!-- Add maven dependencies used in Facebook.Android.Binding.csproj to be resolved at runtime.
70+
See https://learn.microsoft.com/en-us/dotnet/android/binding-libs/advanced-concepts/android-maven-library -->
71+
<AndroidMavenLibrary Include="com.facebook.android:facebook-core" Version="17.0.2" Bind="false" />
72+
<AndroidMavenLibrary Include="com.facebook.android:facebook-bolts" Version="17.0.2" Bind="false" />
73+
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.8.2.1" />
74+
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.Utils" Version="1.0.0.29" />
75+
<PackageReference Include="Xamarin.Google.Android.InstallReferrer" Version="1.1.2.6" />
76+
<PackageReference Include="Xamarin.AndroidX.Core.Core.Ktx" Version="1.13.1.5" />
77+
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.0.21" />
7978
</ItemGroup>
8079

8180
</Project>

nuget.config

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks.Tests/BindingToolTaskTests.cs

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks.Tests/CommunityToolkit.Maui.NativeLibraryInterop.BuildTasks.Tests.csproj

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)