xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
173 stars 42 forks source link

Weekly stable updates 20240125 #839

Closed moljac closed 4 months ago

moljac commented 5 months ago

Support Libraries Version (eg: 23.3.0):

Does this change any of the generated binding API's?

yes

Describe your contribution

moljac commented 4 months ago

errors:

/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.509/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 1. [./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj::TargetFramework=net6.0-android]
/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "mono" exited with code 1. [./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj::TargetFramework=MonoAndroid12.0]
moljac commented 4 months ago

dotnet cake -t:ci errors:

/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.95/tools/Xamarin.Android.Bindings.ClassParse.targets(35,5): error MSB6006: "dotnet" exited with code 1. [./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj::TargetFramework=net7.0-android]
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.509/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 1. [./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj::TargetFramework=net6.0-android]
/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "mono" exited with code 1. [./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj::TargetFramework=MonoAndroid12.0]
/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "mono" exited with code 1. [./generated/androidx.compose.runtime.runtime/androidx.compose.runtime.runtime.csproj::TargetFramework=MonoAndroid12.0]
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.95/tools/Xamarin.Android.Bindings.ClassParse.targets(35,5): error MSB6006: "dotnet" exited with code 1. [./generated/androidx.compose.runtime.runtime/androidx.compose.runtime.runtime.csproj::TargetFramework=net7.0-android]
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.509/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 1. [./generated/androidx.compose.runtime.runtime/androidx.compose.runtime.runtime.csproj::TargetFramework=net6.0-android]
    32937 Warning(s)
    6 Error(s)
moljac commented 4 months ago

checking

androidx.compose.runtime:runtime:

dotnet build ./generated/androidx.compose.runtime.runtime/androidx.compose.runtime.runtime.csproj

does crash

collecting logs:

dotnet build \
    ./generated/androidx.compose.runtime.runtime/androidx.compose.runtime.runtime.csproj \
    -v:diagnostic \
    -bl:androidx.compose.runtime.runtime.csproj.binlog

binlog:

androidx.compose.runtime.runtime.csproj.binlog.zip

androidx.compose:ui.ui-util:

dotnet build ./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj

does crash.

dotnet build \
    ./generated/androidx.compose.ui.ui-util/androidx.compose.ui.ui-util.csproj \
    -v:diagnostic \
    -bl:androidx.compose.ui.ui-util.csproj.binlog

Analysis

AARs seem to be corrupt

Screenshot 2024-02-08 at 15 53 44
jpobst commented 4 months ago

Some context on why the Condition was needed:

In androidx.compose.* 1.5.4, these artifacts provided an empty .jar file, which we added to the build. It was scanned for code, none was found, so we generated an empty binding (which is fine).

In 1.6.0, they switched to providing an empty .aar file. Our logic is to extract the .aar which generally contains a classes.jar and then add the classes.jar to the build. Because the .aar doesn't contain a classes.jar we hit a "file not found" error trying to read the file.

Adding the Condition means we don't try to add the classes.jar file if it doesn't exist, preventing the "file not found" error.

Arguably we should probably create a new template for these that do not attempt to bind anything, but this is good enough for now.

Note this error is only due to AndroidX/GPS custom .aar extraction logic done in Cake. Attempting to bind these artifacts in a normal .NET Android binding library does not hit this error. I do not know why we do this custom logic. 🤷‍♂️

moljac commented 4 months ago

@jpobst Thanks for explanation. I was in a hurry. Working on other catching up with updates and some minor improvements.