Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Commit d5afa0a

Browse files
authored
[invocation-overhead] Add generated source files (#1175)
Building the `Java.Interop.sln` solution always produces some generated files that `git` wants to try to commit: Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: tests/invocation-overhead/jni.cs Untracked files: (use "git add <file>..." to include in what will be committed) tests/invocation-overhead/jni-api.h tests/invocation-overhead/jni.c Commit these generated files, and update the generator for `jni.cs` to always use native platform new lines so it does not show up as modified on Windows.
1 parent 473ef74 commit d5afa0a

3 files changed

Lines changed: 1687 additions & 5 deletions

File tree

‎build-tools/jnienv-gen/Generator.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static int Main (string [] args)
4040

4141
try{
4242
using(TextWriterw=newStringWriter()){
43-
w.NewLine="\n";
43+
w.NewLine=Environment.NewLine;
4444
GenerateFile(w);
4545
stringcontent=w.ToString();
4646
if(jnienv_g_cs=="-")
@@ -50,7 +50,7 @@ public static int Main (string [] args)
5050
}
5151
using(TextWritersw=newStringWriter()){
5252
using(TextWriterhw=newStringWriter()){
53-
sw.NewLine="\n";
53+
sw.NewLine=Environment.NewLine;
5454
GenerateNativeLibSource(sw,hw,jnienv_g_h);
5555
stringsourceContent=sw.ToString();
5656
stringheaderContent=hw.ToString();
@@ -254,13 +254,13 @@ static void GenerateJniNativeInterfaceInvoker (TextWriter o, HandleStyle style)
254254
continue;
255255
o.WriteLine();
256256
if(e.Prebind)
257-
o.WriteLine("\t\tpublic readonly {0} {1};\n",d,e.Name);
257+
o.WriteLine("\t\tpublic readonly {0} {1};{2}",d,e.Name,Environment.NewLine);
258258
else{
259259
o.WriteLine("\t\t{0}? _{1};",d,e.Name);
260260
o.WriteLine("\t\tpublic {0} {1} {{",d,e.Name);
261261
o.WriteLine("\t\t\tget {");
262-
o.WriteLine("\t\t\t\tif (_{0} == null)\n\t\t\t\t\t{1}",e.Name,Initialize(e,"_",d));
263-
o.WriteLine("\t\t\t\treturn _{0};\n\t\t\t}}",e.Name);
262+
o.WriteLine("\t\t\t\tif (_{0} == null){2}\t\t\t\t\t{1}",e.Name,Initialize(e,"_",d),Environment.NewLine);
263+
o.WriteLine("\t\t\t\treturn _{0};{1}\t\t\t}}",e.Name,Environment.NewLine);
264264
o.WriteLine("\t\t}");
265265
}
266266
}

0 commit comments

Comments
 (0)