Skip to content

Commit

Permalink
OpenTK Deprecation
Browse files Browse the repository at this point in the history
We are going to stop shipping OpenTK-1.0 in a future update. In order to give users who are using
that assembly a chance to migrate we will deprecate it first.
We will raise a `XA4313` warning if we detect that OpenTK-1.0 is in the `@(Refereces)` item group.

A replacement Nuget Package has already been created at https://www.nuget.org/packages/Xamarin.Legacy.OpenTK/
Users seeing this warning should remove the reference to `OpenTK-1.0` and replace it will the following

```
<PackageReference Include="Xamarin.Legacy.OpenTK" Version="0.0.1-alpha" />
```

The version number will change in the future.

The vast majority of changes in this commit are to stop the OpenTK java types being included in `mono-android.jar`.
From this point on `OpenTK` will be treated like all other Android Class Libraries, the generated java code will be
written to the `$(IntermediateOutputPath)\lp` directory along with all the other references.
  • Loading branch information
dellis1972 committed Apr 20, 2021
1 parent 97b3cc0 commit c98e9c7
Show file tree
Hide file tree
Showing 26 changed files with 238 additions and 21 deletions.
1 change: 1 addition & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Please disable fast deployment in the Visual Studio project property pages or ed
+ [XA4310](xa4310.md): \`$(AndroidSigningKeyStore)\` file \`{keystore}\` could not be found.
+ XA4311: The application won't contain the paired Wear package because the Wear application package APK is not created yet. If building on the command line, be sure to build the "SignAndroidPackage" target.
+ [XA4312](xa4312.md): Referencing an Android Wear application project from an Android application project is deprecated.
+ [XA4313](xa4313.md): Framework assembly has been deprecated.

## XA5xxx: GCC and toolchain

Expand Down
20 changes: 20 additions & 0 deletions Documentation/guides/messages/xa4313.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Xamarin.Android error/warning XA4313
description: XA4313 error/warning code
ms.date: 03/19/2021
---
# Xamarin.Android error/warning XA4313

The specified Framework assembly has been deprecated.
You need up upgrade to use the specified NuGet Package.

For example, to upgade `OpenTK-1.0` remove

'<Reference Include="OpenTK-1.0" />'

from your csproj then add

'<PackageReference Include="Xamarin.Legacy.OpenTK" Version="1.0.0" />'

to your project to upgrade.

11 changes: 2 additions & 9 deletions build-tools/scripts/BuildEverything.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: leeroy jenkins leeroy-all opentk-jcw
.PHONY: leeroy jenkins leeroy-all
.PHONY: create-vsix

#
Expand All @@ -24,15 +24,8 @@ ifneq ("$(wildcard $(topdir)/external/monodroid/Makefile)","")
endif
$(MAKE) leeroy $(ZIP_OUTPUT)

leeroy: leeroy-all framework-assemblies opentk-jcw
leeroy: leeroy-all framework-assemblies

leeroy-all:
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore $(SOLUTION) /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore tools/xabuild/xabuild.csproj /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)

opentk-jcw:
$(foreach api_level, $(API_LEVELS), \
touch bin/$(CONFIGURATION)/lib/xamarin.android/xbuild-frameworks/MonoAndroid/*/OpenTK-1.0.dll; \
$(call MSBUILD_BINLOG,OpenTK-JCW,$(_SLN_BUILD)) $(MSBUILD_FLAGS) src/OpenTK-1.0/OpenTK.csproj \
/t:GenerateJavaCallableWrappers /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS) \
/p:AndroidApiLevel=$(api_level) /p:AndroidPlatformId=$(word $(api_level), $(ALL_PLATFORM_IDS)) /p:AndroidFrameworkVersion=$(word $(api_level), $(ALL_FRAMEWORKS)) || exit 1; )
5 changes: 0 additions & 5 deletions src/OpenTK-1.0/OpenTK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,5 @@
<Import Project="..\..\build-tools\scripts\MonoAndroidFramework.targets" />
<PropertyGroup>
<DefineConstants>MONODROID;MINIMAL;MOBILE;OPENTK_1;OPENTK_1_0</DefineConstants>
<JavacSourceVersion Condition=" '$(JavacSourceVersion)' == '' And '$(AndroidApiLevel)' != '' And $(AndroidApiLevel) &gt; 23 ">1.8</JavacSourceVersion>
<JavacSourceVersion Condition=" '$(JavacSourceVersion)' == '' ">1.6</JavacSourceVersion>
<JavaCallableWrapperAbsAssembly>$(JavaCallableWrapperOutputPathAbs)$(AssemblyName).dll</JavaCallableWrapperAbsAssembly>
<JavaCallableWrapperAbsAssembly Condition="!Exists('$(JavaCallableWrapperAbsAssembly)')">$(MSBuildProjectDirectory)\$(IntermediateOutputPath)\$(AssemblyName).dll</JavaCallableWrapperAbsAssembly>
</PropertyGroup>
<Import Project="..\..\build-tools\scripts\JavaCallableWrappers.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public abstract class MobileProfile : Profile {
"Mono.Data.Sqlite",
"Mono.Posix",
"Mono.Security",
"OpenTK",
"OpenTK-1.0",
// Facades assemblies (PCL)
"Microsoft.Win32.Primitives",
"Microsoft.Win32.Registry.AccessControl",
Expand Down
9 changes: 9 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,15 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<value>Referencing the Android Wear application project '{0}' from an Android application project is deprecated and will no longer be supported in a future version of Xamarin.Android. Remove the Android Wear application project reference from the Android application project and distribute the Wear application as a standalone application instead.</value>
<comment>The following are literal names and should not be translated: Android Wear, Android, Wear.
{0} - The referenced Android Wear project.</comment>
</data>
<data name="XA4313" xml:space="preserve">
<value>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</value>
<comment>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</comment>
</data>
<data name="XA5101" xml:space="preserve">
<value>Missing Android NDK toolchains directory '{0}'. Please install the Android NDK.</value>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ The following are literal names and should not be translated: ABI, 'libs/armeabi
<note>The following are literal names and should not be translated: ABI, NuGet
{0} - The native library file path
{1} - Either the name of the NuGet package or a path to the native library</note>
</trans-unit>
<trans-unit id="XA4313">
<source>The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</source>
<target state="new">The built-in '{0}' reference has been deprecated.
Remove the '{0}' reference from your project and add the '{1}' NuGet package instead.
</target>
<note>The following are literal names and should not be translated:
{0} - The Assembly name which is deprecated
{1} - A Nuget package name.
</note>
</trans-unit>
<trans-unit id="XA_Manifest_AutoGenerated_Header">
<source>
Expand Down
7 changes: 5 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ void Run (DirectoryAssemblyResolver res)
Log.LogDebugMessage ($"Skipping Java Stub Generation for {asm.ItemSpec}");
continue;
}
allTypemapAssemblies.Add (asm.ItemSpec);
userAssemblies.Add (Path.GetFileNameWithoutExtension (asm.ItemSpec), asm.ItemSpec);
if (!allTypemapAssemblies.Contains (asm.ItemSpec))
allTypemapAssemblies.Add (asm.ItemSpec);
string name = Path.GetFileNameWithoutExtension (asm.ItemSpec);
if (!userAssemblies.ContainsKey (name))
userAssemblies.Add (name, asm.ItemSpec);
}

// Step 1 - Find all the JLO types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3986,6 +3986,35 @@ public void XA1018 ()
}
}

[Test]
public void XA4313 ()
{
var proj = new XamarinAndroidApplicationProject () {
References = {
new BuildItem.Reference ("OpenTK-1.0")
},
};
using (var builder = CreateApkBuilder ()) {
builder.ThrowOnBuildFailure = false;
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
string error = builder.LastBuildOutput
.SkipWhile (x => !x.StartsWith ("Build succeeded."))
.FirstOrDefault (x => x.Contains ("warning XA4313"));
Assert.IsNotNull (error, "Build should have failed with XA4313.");
}
}

[Test]
public void OpenTKNugetWorks ()
{
var proj = new XamarinAndroidApplicationProject ();
proj.PackageReferences.Add (KnownPackages.Xamarin_Legacy_OpenTK);
using (var builder = CreateApkBuilder ()) {
builder.ThrowOnBuildFailure = false;
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
}
}

static readonly object [] XA1027XA1028Source = new object [] {
new object [] {
/* linkTool */ "r8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ public static class KnownPackages
Version = "2.4.1",
TargetFramework = "MonoAndroid10",
};
public static Package Xamarin_Legacy_OpenTK = new Package {
Id = "Xamarin.Legacy.OpenTK",
Version = "0.0.1-alpha",
TargetFramework = "MonoAndroid10",
};
}
}

Loading

0 comments on commit c98e9c7

Please sign in to comment.