Skip to content

Commit

Permalink
[tests] enable Xamarin.Android.LibraryProjectZip-LibBinding test (#8588)
Browse files Browse the repository at this point in the history
Fixes: #7794

* Port `Xamarin.Android.LibraryProjectZip-LibBinding.csproj` to .NET 9.

* Update to a more recent gradle version, I chose the one MAUI is using:

https://github.com/dotnet/maui/blob/3c7b65264d2f341a48db32263a271fd8718cfd23/src/Core/AndroidNative/build.gradle#L8

* Use `mavenCentral()` instead of `jcenter()` as the latter is deprecated.

* Fix `Outputs` by running `<Touch Files="$(OutputPath)JavaLib.aar" />`

This enables the last few tests in #7794.
  • Loading branch information
jonathanpeppers authored Dec 13, 2023
1 parent d51ffca commit 27ab3f8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public void TestTimingCreateTimingIsCorrectType ()
Assert.IsTrue (t is Com.Xamarin.Android.Timing);
}

#if TODO_7794
// This test requires that https://github.com/xamarin/xamarin-android/issues/7794
// be completed first, as it depends on Xamarin.Android.LibraryProjectZip-LibBinding projects.
[Test]
public void TestResourceId ()
{
Expand All @@ -41,7 +38,6 @@ public void TestNativeLibDllImportInEmbeddedArchive ()
{
Assert.AreEqual (TestNativeLib.Binding.SampleFunction2 (), 0xf200);
}
#endif // TODO_7794

[Test]
public void NamespaceTransforms ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<ProjectReference Include="..\..\..\src\Xamarin.Android.NUnitLite\Xamarin.Android.NUnitLite.NET.csproj" />
<ProjectReference Include="..\Xamarin.Android.FixJavaAbstractMethod-APIv2Binding\Xamarin.Android.FixJavaAbstractMethod-APIv2Binding.csproj" />
<ProjectReference Include="..\Xamarin.Android.FixJavaAbstractMethod-Library\Xamarin.Android.FixJavaAbstractMethod-Library.csproj" />
<ProjectReference Include="..\Xamarin.Android.LibraryProjectZip-LibBinding\Xamarin.Android.LibraryProjectZip-LibBinding.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,63 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9553ED9D-92EA-411B-ADFF-21C5608CCD16}</ProjectGuid>
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<RootNamespace>Xamarin.Android.LibraryProjectZip.LibBinding</RootNamespace>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<AssemblyName>AndroidLibBinding</AssemblyName>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
<Import Project="..\..\..\Configuration.props" />
<PropertyGroup>
<TargetFrameworkVersion>$(AndroidFrameworkVersion)</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>..\..\..\bin\TestDebug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>..\..\..\bin\TestRelease</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Additions\AboutAdditions.txt" />
<None Include="Jars\AboutJars.txt" />
</ItemGroup>
<ItemGroup>
<TransformFile Include="Transforms\EnumFields.xml" />
<TransformFile Include="Transforms\EnumMethods.xml" />
<TransformFile Include="Transforms\Metadata.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NativeLib.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Project="Xamarin.Android.LibraryProjectZip-LibBinding.targets" />
<PropertyGroup>
<BuildDependsOn>
Expand All @@ -68,10 +17,12 @@
</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<AndroidLibrary Remove="java\JavaLib\**" />
<AndroidJavaSource Remove="java\JavaLib\**" />
<LibraryProjectZip Include="$(OutputPath)JavaLib.aar" />
</ItemGroup>
<ItemGroup>
<InputJar Include="java\JavaLib\library\build\intermediates\packaged-classes\debug\classes.jar">
<InputJar Include="java\JavaLib\library\build\intermediates\aar_main_jar\debug\classes.jar">
<Link>Jars\classes.jar</Link>
</InputJar>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
WorkingDirectory="$(MSBuildThisFileDirectory)java\JavaLib"
/>
<MakeDir Directories="$(OutputPath)" />
<Copy SourceFiles="java\JavaLib\library\build\outputs\aar\library.aar" DestinationFiles="$(OutputPath)JavaLib.aar" />
<Copy SourceFiles="java\JavaLib\library\build\outputs\aar\library-debug.aar" DestinationFiles="$(OutputPath)JavaLib.aar" />
<Touch Files="$(OutputPath)JavaLib.aar" />
</Target>
<Target Name="CleanLocal">
<RemoveDir Directories="java\JavaLib\bin;java\JavaLib\gen;java\JavaLib\library\build;bin;obj;libs;simple2\libs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,7 +16,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down

0 comments on commit 27ab3f8

Please sign in to comment.