Skip to content
Open
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
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@

This can be opted into locally with $(_AndroidTreatWarningsAsErrors) = true.
-->
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'jnienv-gen.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'Mono.Android.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'Mono.Android.NET-Tests.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'MSBuildDeviceIntegration.csproj' ">true</_AllowProjectWarnings>
Expand Down
28 changes: 6 additions & 22 deletions build-tools/jnienv-gen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,32 +120,19 @@ static void GenerateJniNativeInterfaceInvoker (TextWriter o)
o.WriteLine ("\t\tpublic unsafe JniNativeInterfaceInvoker (JniNativeInterfaceStruct* p)");
o.WriteLine ("\t\t{");
o.WriteLine ("\t\t\tJniEnv = *p;");

foreach (var e in JNIEnvEntries) {
if (e.Delegate == null)
continue;
if (!e.Prebind)
continue;
o.WriteLine ("\t\t\t{0}", Initialize (e, ""));
}

o.WriteLine ("\t\t}");
o.WriteLine ();

foreach (var e in JNIEnvEntries) {
if (e.Delegate == null)
continue;
o.WriteLine ();
if (e.Prebind)
o.WriteLine ("\t\tpublic readonly {0} {1};\n", e.Delegate, e.Name);
else {
o.WriteLine ("\t\t{0} _{1};", e.Delegate, e.Name);
o.WriteLine ("\t\tpublic {0} {1} {{", e.Delegate, e.Name);
o.WriteLine ("\t\t\tget {");
o.WriteLine ("\t\t\t\tif (_{0} == null)\n\t\t\t\t\t{1}", e.Name, Initialize (e, "_"));
o.WriteLine ("\t\t\t\treturn _{0};\n\t\t\t}}", e.Name);
o.WriteLine ("\t\t}");
}
o.WriteLine ("\t\t{0} _{1};", e.Delegate, e.Name);
o.WriteLine ("\t\tpublic {0} {1} {{", e.Delegate, e.Name);
o.WriteLine ("\t\t\tget {");
o.WriteLine ("\t\t\t\tif (_{0} == null)\n\t\t\t\t\t{1}", e.Name, Initialize (e, "_"));
o.WriteLine ("\t\t\t\treturn _{0};\n\t\t\t}}", e.Name);
o.WriteLine ("\t\t}");
}

o.WriteLine ("\t}");
Expand Down Expand Up @@ -520,9 +507,6 @@ public string ApiName
public TypeInfo ReturnType;
public ParamInfo [] Parameters;

// If true, then we initialize the binding on the static ctor, we dont lazy-define it
public bool Prebind;

// If there is a custom wrapper in JNIEnv (so an automatic one shouldn't be generated)
public bool CustomWrapper;

Expand Down