diff --git a/doc/panama_jextract.html b/doc/panama_jextract.html index c0752e48ac1..385089f8788 100644 --- a/doc/panama_jextract.html +++ b/doc/panama_jextract.html @@ -134,6 +134,14 @@
+jextract -t com.github -lgit2 \
+ -I /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/ \
+ -I ${LIBGIT2_HOME}/include/ \
+ -I ${LIBGIT2_HOME}/include/git2 \
+ ${LIBGIT2_HOME}/include/git2.h
+import static com.github.git2_h.*;
+import static jdk.incubator.foreign.CSupport.*;
+import static jdk.incubator.foreign.MemoryAddress.NULL;
+import static jdk.incubator.foreign.NativeAllocationScope.*;
+import static com.github.Cstring.*;
+
+public class GitClone {
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.err.println("java GitClone <url> <path>");
+ System.exit(1);
+ }
+ git_libgit2_init();
+ try (var scope = unboundedScope()) {
+ var repo = scope.allocate(C_POINTER, NULL);
+ var url = toCString(args[0], scope);
+ var path = toCString(args[1], scope);
+ System.out.println(git_clone(repo, url, path, NULL));
+ }
+ git_libgit2_shutdown();
+ }
+}
+# file run.sh
+
+java -Dforeign.restricted=permit --add-modules jdk.incubator.foreign \
+ -Djava.library.path=${LIBGIT2_HOME}/build/ \
+ GitClone.java $*