Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
</PropertyGroup>

<!--
When building on a bot w/ VS2019:

warning CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from

however, with `$(TreatWarningsAsErrors)`=True, this becomes an error,
meaning we can't build on VS2019.

Ignore CS8032 so that we can build on VS2019.
-->
<PropertyGroup>
<NoWarn>$(NoWarn);CS8032</NoWarn>
</PropertyGroup>

<!-- The net6.0 versions of these are stricter and require overloads not available in .NET Framework, so start with just .NET Framework -->
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand Down
2 changes: 1 addition & 1 deletion src/Java.Base/Java.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<NoWarn>8764</NoWarn>
<NoWarn>$(NoWarn);8764</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Java.Base/Java.Base.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<GeneratorPath>$(ToolOutputFullPath)generator.dll</GeneratorPath>
<GeneratorPath>$(UtilityOutputFullPath)generator.dll</GeneratorPath>
</PropertyGroup>

<Target Name="_GetJavaBaseJmodPath">
Expand All @@ -17,7 +17,7 @@
Outputs="$(IntermediateOutputPath)\mcw\api.xml">
<MakeDir Directories="$(IntermediateOutputPath)mcw" />
<PropertyGroup>
<_ClassParse>"$(ToolOutputFullPath)class-parse.dll"</_ClassParse>
<_ClassParse>"$(UtilityOutputFullPath)class-parse.dll"</_ClassParse>
<_Input>"$(_JavaBaseJmod)"</_Input>
<_Output>"-o=$(IntermediateOutputPath)/mcw/api.xml"</_Output>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Java.Interop/Java.Interop-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RootNamespace>Java.Interop</RootNamespace>
<AssemblyName>Java.Interop</AssemblyName>
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v4.5</TargetFrameworkVersion>
<NoWarn>1591</NoWarn>
<NoWarn>$(NoWarn);1591</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<LangVersion>8.0</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Java.Interop/Java.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1591</NoWarn>
<NoWarn>$(NoWarn);1591</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<DefineConstants>INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)</DefineConstants>
Expand Down
4 changes: 4 additions & 0 deletions src/Java.Interop/Java.Interop/JavaTypeParametersAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;

#if NET

namespace Java.Interop
{
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Method,
Expand All @@ -14,3 +16,5 @@ public JavaTypeParametersAttribute (string [] typeParameters)
public string [] TypeParameters { get; }
}
}

#endif // NET
3 changes: 3 additions & 0 deletions tests/generator-Tests/Integration-Tests/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static Assembly Compile (Xamarin.Android.Binder.CodeGeneratorOptions opti
if (options.CodeGenerationTarget == CodeGenerationTarget.JavaInterop1) {
preprocessorSymbols.Add ("JAVA_INTEROP1");
}
#if NET
preprocessorSymbols.Add ("NET");
#endif // NET

var parseOptions = new CSharpParseOptions (preprocessorSymbols:preprocessorSymbols);

Expand Down
18 changes: 18 additions & 0 deletions tests/generator-Tests/SupportFiles/JavaTypeParametersAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if !NET

using System;

namespace Java.Interop
{
public class JavaTypeParametersAttribute : Attribute
{
public JavaTypeParametersAttribute (string [] typeParameters)
{
TypeParameters = typeParameters;
}

public string [] TypeParameters { get; set; }
}
}

#endif // !NET