Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Pfister committed Feb 10, 2023
1 parent fde2bda commit d6fd785
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/mono/msbuild/apple/build/AppleApp.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'MonoAOTCompiler'))</MonoAOTCompilerDir>
<MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'MonoTargetsTasks'))</MonoTargetsTasksDir>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'AppleAppBuilder'))</AppleAppBuilderDir>
<LibraryBuilderDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'LibraryBuilder'))</AppleAppBuilderDir>
<LibraryBuilderDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'LibraryBuilder'))</LibraryBuilderDir>

<MonoAotCrossDir>$([MSBuild]::NormalizePath($(BuildBaseDir), 'cross'))</MonoAotCrossDir>
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
Expand Down
4 changes: 4 additions & 0 deletions src/tasks/AndroidAppBuilder/ApkBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ public ApkBuilder(TaskLoggingHelper logger)
File.WriteAllText(javaActivityPath,
Utils.GetEmbeddedResource("MainActivity.java")
.Replace("%EntryPointLibName%", Path.GetFileName(mainLibraryFileName)));


if (!string.IsNullOrEmpty(NativeMainSource))
File.Copy(NativeMainSource, javaActivityPath, true);

Expand All @@ -407,8 +409,10 @@ public ApkBuilder(TaskLoggingHelper logger)
envVariables += $"\t\tsetEnv(\"{name}\", \"{value}\");\n";
}

string jniLibraryName = (IsLibraryMode) ? ProjectName! : "System.Security.Cryptography.Native.Android";
string monoRunner = Utils.GetEmbeddedResource("MonoRunner.java")
.Replace("%EntryPointLibName%", Path.GetFileName(mainLibraryFileName))
.Replace("%JNI_LIBRARY_NAME%", jniLibraryName)
.Replace("%EnvVariables%", envVariables);

File.WriteAllText(monoRunnerPath, monoRunner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_library(
monodroid
SHARED
monodroid.c
%AotModulesSource%
)

%AotSources%
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/AndroidAppBuilder/Templates/MonoRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class MonoRunner extends Instrumentation
{
static {
// loadLibrary triggers JNI_OnLoad in these libs
System.loadLibrary("Android.Device_Emulator.Aot_Llvm.Test");
System.loadLibrary("%JNI_LIBRARY_NAME%");
System.loadLibrary("monodroid");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

public static class Program
{
[UnmanagedCallersOnly(EntryPoint="HelloSteve")]
public static void HelloSteve()
[UnmanagedCallersOnly(EntryPoint="SayHello")]
public static void SayHello()
{
Console.WriteLine("Called from the outside! Hello!");
Console.WriteLine("Called from native! Hello!");
}

public static int Main()
Expand Down
6 changes: 3 additions & 3 deletions src/tests/FunctionalTests/iOS/Device/AOT-LLVM/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public static class Program
[DllImport("__Internal")]
public static extern void mono_ios_set_summary (string value);

[UnmanagedCallersOnly(EntryPoint="HelloSteve")]
public static void HelloSteve()
[UnmanagedCallersOnly(EntryPoint="SayHello")]
public static void SayHello()
{
Console.WriteLine("Called from the outside! Hello!");
Console.WriteLine("Called from native! Hello!");
}

public static async Task<int> Main(string[] args)
Expand Down

0 comments on commit d6fd785

Please sign in to comment.