Skip to content

Commit b53fa70

Browse files
authored
Merge pull request #5 from rssdev10/fix/utilities_updates
Fix/utilities updates
2 parents 22812f7 + 587481d commit b53fa70

36 files changed

+2038
-509
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,15 @@ engine.eval("println(x);", newContext);
6969

7070
For running: julia should be installed.
7171

72-
For building with binaries: julia, julia-devel, Java 8, swig, gcc, make.
72+
For building with binaries: julia, julia-devel, Java >21, swig, gcc, make.
7373

7474
### How to build
75-
These sources doesn't include native binary libraries. But you can build them manually by [`swig/build.sh`](swig/build.sh) script.
75+
These sources doesn't include native binary libraries. But you can build them manually by [`swig/build.sh`](swig/build.sh) script.
76+
```bash
77+
cd swig
78+
./build.sh
79+
```
80+
7681
Also see [swig/lib_src/Makefile](swig/lib_src/Makefile)
7782

7883
Next run `./gradlew build`

build.gradle

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,78 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
mavenLocal()
5-
}
6-
}
7-
81
plugins {
92
id 'java'
103
id 'maven-publish'
114
}
125

13-
group 'org.julia'
14-
version '0.0.2-SNAPSHOT'
6+
group = 'org.julia'
7+
version = '0.0.3.SNAPSHOT'
158

16-
sourceCompatibility = 1.11
9+
java {
10+
sourceCompatibility = JavaVersion.VERSION_21
11+
targetCompatibility = JavaVersion.VERSION_21
12+
}
1713

1814
repositories {
1915
mavenCentral()
16+
mavenLocal()
2017
}
2118

2219
publishing {
2320
publications {
2421
maven(MavenPublication) {
25-
groupId = group
22+
groupId = project.group
2623
artifactId = rootProject.name
27-
version = version
24+
version = project.version
2825

2926
from components.java
3027
}
3128
}
3229
}
3330

31+
// Helper function to get Julia's lib directory
32+
def getJuliaLibPath() {
33+
def juliaCmd = [
34+
'julia',
35+
'-e',
36+
'print(abspath(joinpath(Sys.BINDIR, "..", "lib")))'
37+
]
38+
def process = juliaCmd.execute()
39+
process.waitFor()
40+
if (process.exitValue() != 0) {
41+
throw new GradleException("Failed to find Julia lib path: ${process.err.text}")
42+
}
43+
return process.text.trim()
44+
}
45+
3446
test {
3547
useJUnitPlatform()
48+
49+
// Set library paths for all platforms
50+
def juliaLibPath = getJuliaLibPath()
51+
52+
// macOS specific configuration
53+
if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem.isMacOsX()) {
54+
environment "DYLD_LIBRARY_PATH", juliaLibPath + (
55+
System.getenv('DYLD_LIBRARY_PATH')
56+
? ":" + System.getenv('DYLD_LIBRARY_PATH')
57+
: ""
58+
)
59+
}
60+
// Linux specific configuration
61+
else if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem.isLinux()) {
62+
environment "LD_LIBRARY_PATH", juliaLibPath + (
63+
System.getenv('LD_LIBRARY_PATH')
64+
? ":" + System.getenv('LD_LIBRARY_PATH')
65+
: ""
66+
)
67+
}
68+
// Windows specific configuration
69+
else if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem.isWindows()) {
70+
def currentPath = System.getenv('PATH') ?: ""
71+
environment "PATH", juliaLibPath + File.pathSeparator + currentPath
72+
}
3673
}
3774

3875
dependencies {
39-
testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.2')
40-
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.8.2')
76+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
77+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
4178
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Thu Jun 05 16:27:58 MSK 2025
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

src/main/java/org/julia/jni/swig/Julia4J.java

Lines changed: 225 additions & 50 deletions
Large diffs are not rendered by default.

src/main/java/org/julia/jni/swig/Julia4JJNI.java

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,88 @@
11
/* ----------------------------------------------------------------------------
2-
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 4.0.2
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
44
*
5-
* Do not make changes to this file unless you know what you are doing--modify
5+
* Do not make changes to this file unless you know what you are doing - modify
66
* the SWIG interface file instead.
77
* ----------------------------------------------------------------------------- */
88

99
package org.julia.jni.swig;
1010

1111
public class Julia4JJNI {
12+
public final static native String jl_get_libdir();
1213
public final static native void jl_init();
1314
public final static native void jl_init_with_image(String jarg1, String jarg2);
1415
public final static native String jl_get_default_sysimg_path();
1516
public final static native int jl_is_initialized();
1617
public final static native void jl_atexit_hook(int jarg1);
1718
public final static native void jl_exit(int jarg1);
1819
public final static native String jl_pathname_for_handle(long jarg1);
20+
public final static native long jl_adopt_thread();
1921
public final static native void jl_preload_sysimg_so(String jarg1);
2022
public final static native void jl_set_sysimg_so(long jarg1);
21-
public final static native long jl_create_system_image(long jarg1);
22-
public final static native void jl_save_system_image(String jarg1);
23+
public final static native void jl_create_system_image(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7);
2324
public final static native void jl_restore_system_image(String jarg1);
2425
public final static native void jl_restore_system_image_data(String jarg1, long jarg2);
25-
public final static native int jl_save_incremental(String jarg1, long jarg2);
26-
public final static native long jl_restore_incremental(String jarg1, long jarg2);
27-
public final static native long jl_restore_incremental_from_buf(String jarg1, long jarg2, long jarg3);
28-
public final static native long jl_parse_input_line(String jarg1, long jarg2, String jarg3, long jarg4);
26+
public final static native void jl_write_compiler_output();
27+
public final static native long jl_parse_all(String jarg1, long jarg2, String jarg3, long jarg4, long jarg5);
2928
public final static native long jl_parse_string(String jarg1, long jarg2, int jarg3, int jarg4);
30-
public final static native long jl_load_file_string(String jarg1, long jarg2, String jarg3, long jarg4);
3129
public final static native long jl_expand(long jarg1, long jarg2);
30+
public final static native long jl_expand_with_loc(long jarg1, long jarg2, String jarg3, int jarg4);
31+
public final static native long jl_expand_with_loc_warn(long jarg1, long jarg2, String jarg3, int jarg4);
3232
public final static native long jl_expand_stmt(long jarg1, long jarg2);
33+
public final static native long jl_expand_stmt_with_loc(long jarg1, long jarg2, String jarg3, int jarg4);
34+
public final static native long jl_load_dynamic_library(String jarg1, long jarg2, int jarg3);
35+
public final static native long jl_dlopen(String jarg1, long jarg2);
36+
public final static native int jl_dlclose(long jarg1);
37+
public final static native int jl_dlsym(long jarg1, String jarg2, long jarg3, int jarg4);
38+
public final static native long jl_toplevel_eval(long jarg1, long jarg2);
39+
public final static native long jl_toplevel_eval_in(long jarg1, long jarg2);
3340
public final static native long jl_eval_string(String jarg1);
41+
public final static native long jl_load_file_string(String jarg1, long jarg2, String jarg3, long jarg4);
42+
public final static native long jl_load(long jarg1, String jarg2);
43+
public final static native long jl_base_relative_to(long jarg1);
44+
public final static native void jl_register_newmeth_tracer(long jarg1);
45+
public final static native long jl_copy_ast(long jarg1);
46+
public final static native long jl_compress_ir(long jarg1, long jarg2);
47+
public final static native long jl_uncompress_ir(long jarg1, long jarg2, long jarg3);
48+
public final static native long jl_compress_argnames(long jarg1);
49+
public final static native long jl_uncompress_argnames(long jarg1);
50+
public final static native long jl_uncompress_argname_n(long jarg1, long jarg2);
51+
public final static native int jl_is_operator(String jarg1);
52+
public final static native int jl_is_unary_operator(String jarg1);
53+
public final static native int jl_is_unary_and_binary_operator(String jarg1);
54+
public final static native int jl_operator_precedence(String jarg1);
3455
public final static native long jl_apply_generic(long jarg1, long jarg2, long jarg3);
3556
public final static native long jl_invoke(long jarg1, long jarg2, long jarg3, long jarg4);
3657
public final static native int jl_invoke_api(long jarg1);
37-
public final static native long jl_call(long jarg1, long jarg2, int jarg3);
58+
public final static native long jl_call(long jarg1, long jarg2, long jarg3);
3859
public final static native long jl_call0(long jarg1);
3960
public final static native long jl_call1(long jarg1, long jarg2);
4061
public final static native long jl_call2(long jarg1, long jarg2, long jarg3);
4162
public final static native long jl_call3(long jarg1, long jarg2, long jarg3, long jarg4);
63+
public final static native void jl_install_sigint_handler();
64+
public final static native void jl_sigatomic_begin();
65+
public final static native void jl_sigatomic_end();
66+
public final static native long jl_new_typename_in(long jarg1, long jarg2, int jarg3, int jarg4);
67+
public final static native long jl_new_typevar(long jarg1, long jarg2, long jarg3);
68+
public final static native long jl_instantiate_unionall(long jarg1, long jarg2);
69+
public final static native long jl_apply_type(long jarg1, long jarg2, long jarg3);
70+
public final static native long jl_apply_type1(long jarg1, long jarg2);
71+
public final static native long jl_apply_type2(long jarg1, long jarg2, long jarg3);
72+
public final static native long jl_apply_cmpswap_type(long jarg1);
73+
public final static native long jl_apply_tuple_type(long jarg1, int jarg2);
74+
public final static native long jl_apply_tuple_type_v(long jarg1, long jarg2);
75+
public final static native long jl_new_datatype(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7, int jarg8, int jarg9, int jarg10);
76+
public final static native long jl_new_primitivetype(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
4277
public final static native long jl_new_bits(long jarg1, long jarg2);
78+
public final static native long jl_atomic_new_bits(long jarg1, String jarg2);
79+
public final static native void jl_atomic_store_bits(String jarg1, long jarg2, int jarg3);
80+
public final static native long jl_atomic_swap_bits(long jarg1, String jarg2, long jarg3, int jarg4);
81+
public final static native int jl_atomic_bool_cmpswap_bits(String jarg1, long jarg2, long jarg3, int jarg4);
82+
public final static native long jl_atomic_cmpswap_bits(long jarg1, long jarg2, String jarg3, long jarg4, long jarg5, int jarg6);
4383
public final static native long jl_new_struct(long jarg1);
4484
public final static native long jl_new_structv(long jarg1, long jarg2, long jarg3);
85+
public final static native long jl_new_structt(long jarg1, long jarg2);
4586
public final static native long jl_new_struct_uninit(long jarg1);
4687
public final static native long jl_new_method_instance_uninit();
4788
public final static native long jl_svec(long jarg1);
@@ -51,17 +92,14 @@ public class Julia4JJNI {
5192
public final static native long jl_alloc_svec_uninit(long jarg1);
5293
public final static native long jl_svec_copy(long jarg1);
5394
public final static native long jl_svec_fill(long jarg1, long jarg2);
54-
public final static native long jl_tupletype_fill(long jarg1, long jarg2);
5595
public final static native long jl_symbol(String jarg1);
5696
public final static native long jl_symbol_lookup(String jarg1);
5797
public final static native long jl_symbol_n(String jarg1, long jarg2);
5898
public final static native long jl_gensym();
59-
public final static native long jl_tagged_gensym(String jarg1, int jarg2);
99+
public final static native long jl_tagged_gensym(String jarg1, long jarg2);
60100
public final static native long jl_get_root_symbol();
61-
public final static native long jl_code_for_staged(long jarg1);
62-
public final static native long jl_copy_code_info(long jarg1);
101+
public final static native long jl_method_def(long jarg1, long jarg2, long jarg3, long jarg4);
63102
public final static native long jl_get_world_counter();
64-
public final static native long jl_get_kwsorter(long jarg1);
65103
public final static native long jl_box_bool(byte jarg1);
66104
public final static native long jl_box_int8(byte jarg1);
67105
public final static native long jl_box_uint8(short jarg1);

src/main/java/org/julia/jni/swig/SWIGTYPE_p_ios_t.java renamed to src/main/java/org/julia/jni/swig/SWIGTYPE_p_bool_t.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
/* ----------------------------------------------------------------------------
2-
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 4.0.2
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
44
*
5-
* Do not make changes to this file unless you know what you are doing--modify
5+
* Do not make changes to this file unless you know what you are doing - modify
66
* the SWIG interface file instead.
77
* ----------------------------------------------------------------------------- */
88

99
package org.julia.jni.swig;
1010

11-
public class SWIGTYPE_p_ios_t {
11+
public class SWIGTYPE_p_bool_t {
1212
private transient long swigCPtr;
1313

14-
protected SWIGTYPE_p_ios_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
14+
protected SWIGTYPE_p_bool_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
1515
swigCPtr = cPtr;
1616
}
1717

18-
protected SWIGTYPE_p_ios_t() {
18+
protected SWIGTYPE_p_bool_t() {
1919
swigCPtr = 0;
2020
}
2121

22-
protected static long getCPtr(SWIGTYPE_p_ios_t obj) {
22+
protected static long getCPtr(SWIGTYPE_p_bool_t obj) {
23+
return (obj == null) ? 0 : obj.swigCPtr;
24+
}
25+
26+
protected static long swigRelease(SWIGTYPE_p_bool_t obj) {
2327
return (obj == null) ? 0 : obj.swigCPtr;
2428
}
2529
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* ----------------------------------------------------------------------------
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
4+
*
5+
* Do not make changes to this file unless you know what you are doing - modify
6+
* the SWIG interface file instead.
7+
* ----------------------------------------------------------------------------- */
8+
9+
package org.julia.jni.swig;
10+
11+
public class SWIGTYPE_p_f_p_jl_method_t__void {
12+
private transient long swigCPtr;
13+
14+
protected SWIGTYPE_p_f_p_jl_method_t__void(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
15+
swigCPtr = cPtr;
16+
}
17+
18+
protected SWIGTYPE_p_f_p_jl_method_t__void() {
19+
swigCPtr = 0;
20+
}
21+
22+
protected static long getCPtr(SWIGTYPE_p_f_p_jl_method_t__void obj) {
23+
return (obj == null) ? 0 : obj.swigCPtr;
24+
}
25+
26+
protected static long swigRelease(SWIGTYPE_p_f_p_jl_method_t__void obj) {
27+
return (obj == null) ? 0 : obj.swigCPtr;
28+
}
29+
}
30+

src/main/java/org/julia/jni/swig/SWIGTYPE_p_jl_array_t.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------------
2-
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 4.0.2
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
44
*
5-
* Do not make changes to this file unless you know what you are doing--modify
5+
* Do not make changes to this file unless you know what you are doing - modify
66
* the SWIG interface file instead.
77
* ----------------------------------------------------------------------------- */
88

@@ -22,5 +22,9 @@ protected SWIGTYPE_p_jl_array_t() {
2222
protected static long getCPtr(SWIGTYPE_p_jl_array_t obj) {
2323
return (obj == null) ? 0 : obj.swigCPtr;
2424
}
25+
26+
protected static long swigRelease(SWIGTYPE_p_jl_array_t obj) {
27+
return (obj == null) ? 0 : obj.swigCPtr;
28+
}
2529
}
2630

src/main/java/org/julia/jni/swig/SWIGTYPE_p_jl_code_info_t.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------------
2-
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 4.0.2
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
44
*
5-
* Do not make changes to this file unless you know what you are doing--modify
5+
* Do not make changes to this file unless you know what you are doing - modify
66
* the SWIG interface file instead.
77
* ----------------------------------------------------------------------------- */
88

@@ -22,5 +22,9 @@ protected SWIGTYPE_p_jl_code_info_t() {
2222
protected static long getCPtr(SWIGTYPE_p_jl_code_info_t obj) {
2323
return (obj == null) ? 0 : obj.swigCPtr;
2424
}
25+
26+
protected static long swigRelease(SWIGTYPE_p_jl_code_info_t obj) {
27+
return (obj == null) ? 0 : obj.swigCPtr;
28+
}
2529
}
2630

src/main/java/org/julia/jni/swig/SWIGTYPE_p_jl_code_instance_t.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------------
2-
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 4.0.2
2+
* This file was automatically generated by SWIG (https://www.swig.org).
3+
* Version 4.3.1
44
*
5-
* Do not make changes to this file unless you know what you are doing--modify
5+
* Do not make changes to this file unless you know what you are doing - modify
66
* the SWIG interface file instead.
77
* ----------------------------------------------------------------------------- */
88

@@ -22,5 +22,9 @@ protected SWIGTYPE_p_jl_code_instance_t() {
2222
protected static long getCPtr(SWIGTYPE_p_jl_code_instance_t obj) {
2323
return (obj == null) ? 0 : obj.swigCPtr;
2424
}
25+
26+
protected static long swigRelease(SWIGTYPE_p_jl_code_instance_t obj) {
27+
return (obj == null) ? 0 : obj.swigCPtr;
28+
}
2529
}
2630

0 commit comments

Comments
 (0)