Skip to content

[Hello-NativeAOTFromJNI] Add NativeAOT sample #1153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
007317b
[Hello-NativeAOTFromJNI] Add NativeAOT sample
jonpryor Oct 24, 2023
db84cc3
Try to create a JreRuntime
jonpryor Oct 25, 2023
a32e244
icanhaz blittable method registration?
jonpryor Oct 25, 2023
4c30ab5
Linux builds require -Wl,-soname to be set properly.
jonpryor Oct 25, 2023
a08dce8
Fix build break.
jonpryor Oct 25, 2023
da9f188
Use [UnmanagedFunctionPointer]
jonpryor Oct 25, 2023
69c90ba
"Full(er)" sample
jonpryor Nov 1, 2023
1fc0af5
Use JniTransition.
jonpryor Nov 2, 2023
a499a1d
Allow init from JNIEnv*, not just JavaVM*
jonpryor Nov 2, 2023
e1822f0
Make it (mostly) work!
jonpryor Nov 2, 2023
9027591
Fix Java.Interop.Export-Tests
jonpryor Nov 7, 2023
1d422da
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Nov 7, 2023
902fe28
Remove more `n_`s?!
jonpryor Nov 7, 2023
0392169
Enable activation
jonpryor Nov 7, 2023
93a901a
Allow marking constructors as callable from Java.
jonpryor Nov 7, 2023
a50457b
Partially revert 9027591c41232c82a582f8ab16ddaa783795582c
jonpryor Nov 8, 2023
ce850ca
Rethink `Type.GetType()` alternatives
jonpryor Nov 9, 2023
6920e6c
Remove need for NativeAotValueManager.
jonpryor Nov 9, 2023
4ceaa34
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Nov 13, 2023
cf73d77
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Nov 14, 2023
986f0c4
Reduce patch size.
jonpryor Nov 14, 2023
17a4403
Work with .NET 8 GA (…?)
jonpryor Nov 15, 2023
1b86f9a
Use `net.dot.jni` package prefix
jonpryor Nov 16, 2023
f71cadb
Forgot to fix up a header path…
jonpryor Nov 16, 2023
b5fc4cf
Don't add new public API
jonpryor Nov 16, 2023
4741dc9
Reduce patch size.
jonpryor Nov 16, 2023
8eb2850
Remove more unneeded bits.
jonpryor Nov 16, 2023
c3e4870
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Nov 23, 2023
aeed449
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Nov 24, 2023
1e71988
Remove GetTypeFromAssemblyQualifiedName()
jonpryor Nov 23, 2023
1b7be6c
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Dec 2, 2023
14f6713
Cleanup.
jonpryor Dec 3, 2023
508dcde
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Feb 9, 2024
74248fb
Merge remote-tracking branch 'origin/main' into dev/jonp/jonp-hello-f…
jonpryor Feb 16, 2024
12e187e
Fix spelling of JNI_OnUnload
jonpryor Feb 16, 2024
cfdfeaf
Reduce unnecessary changes.
jonpryor Feb 16, 2024
0803048
Integrate Hello-NativeAOTFromJNI.csproj into Java.Interop.sln
jonpryor Feb 16, 2024
f8bb97f
Cleanup.
jonpryor Feb 16, 2024
12cda04
Run the sample on CI!
jonpryor Feb 16, 2024
3861773
Reduce manual string duplication.
jonpryor Feb 16, 2024
adf5773
Remove unnecessary line.
jonpryor Feb 16, 2024
65f7d90
Set publishWebProjects: false.
jonpryor Feb 16, 2024
429bb4d
Try setting workingDirectory.
jonpryor Feb 16, 2024
b4cddb7
Setting workingDirectory didn't fix things.
jonpryor Feb 16, 2024
42c7251
$CWD isn't what I expect, so use a rooted WorkingDirectory.
jonpryor Feb 16, 2024
f656870
MOAR PRINTFS
jonpryor Feb 16, 2024
1b8b1af
Avoid DotNetCoreCLI@2
jonpryor Feb 16, 2024
59314fc
Cleanup.
jonpryor Feb 16, 2024
2a012c7
Fix some `dotnet publish` linker warnings.
jonpryor Feb 16, 2024
f79d3e1
Quote `$(DotnetToolPath)`, as it will contain spaces on Windows.
jonpryor Feb 16, 2024
213a57b
$(Standalone) by default, and prefer `native-library` loader in JreRu…
jonpryor Feb 16, 2024
cf240f9
Run the Hello-NativeAOT tests on Windows, too
jonpryor Feb 16, 2024
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
Prev Previous commit
Next Next commit
Cleanup.
  • Loading branch information
jonpryor committed Feb 16, 2024
commit 59314fc389c607efd8cb2358c24083e3a396f9d0
4 changes: 2 additions & 2 deletions samples/Hello-NativeAOTFromJNI/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Hello_NativeAOTFromJNI;

static class App {

// symbol name from `$(IntermediateOutputPath)obj/Release/osx-arm64/h-classes/net_dot_jni_hello_App.h`
// symbol name from `$(IntermediateOutputPath)obj/Release/osx-x64/h-classes/net_dot_jni_hello_App.h`
[UnmanagedCallersOnly (EntryPoint="Java_net_dot_jni_hello_App_sayHello")]
static IntPtr sayHello (IntPtr jnienv, IntPtr klass)
{
Expand All @@ -28,4 +28,4 @@ static IntPtr sayHello (IntPtr jnienv, IntPtr klass)
}
return nint.Zero;
}
}
}
22 changes: 0 additions & 22 deletions samples/Hello-NativeAOTFromJNI/Hello-NativeAOTFromJNI.targets
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,11 @@
<Copy SourceFiles="$(OutputPath)hello-from-java.jar" DestinationFolder="$(PublishDir)" />
</Target>

<Target Name="_DumpDirContents"
AfterTargets="Publish">
<ItemGroup>
<_TD Include="$(MSBuildThisFileDirectory)**\*" />
</ItemGroup>
<Message Text="# jonp: $(MSBuildThisFileDirectory) Contents:" Importance="high" />
<Message Text=" @(_TD, '
')" Importance="high" />
</Target>

<Target Name="RunJavaSample">
<PropertyGroup>
<_HavePD Condition=" Exists('$(MSBuildThisFileDirectory)$(PublishDir)') ">true</_HavePD>
</PropertyGroup>
<Message Text="# jonp: PublishDir='$(PublishDir)'; exists? $(_HavePD)" Importance="high" />
<ItemGroup>
<_Classpath Include="hello-from-java.jar" />
<_Classpath Include="java-interop.jar" />
<_TD Include="$(MSBuildThisFileDirectory)**\*" />
<_PD Include="$(MSBuildThisFileDirectory)$(PublishDir)**\*" />
</ItemGroup>
<Message Text="# jonp: $(MSBuildThisFileDirectory)$(PublishDir) Contents:" />
<Message Text=" @(_PD, '
')" Importance="high" />
<Message Text="# jonp: $(MSBuildThisFileDirectory) Contents:" />
<Message Text=" @(_TD, '
')" Importance="high" />
<PropertyGroup>
<_CPSep Condition=" '$(OS)' == 'Windows_NT' ">;</_CPSep>
<_CPSep Condition=" '$(_CPSep)' == '' ">:</_CPSep>
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy