File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 15
15
.PHONY : run clean all
16
16
17
17
ARCH := $(shell arch)
18
+ UNAME := $(shell uname)
19
+
20
+ ifeq ($(UNAME ) , Linux)
21
+ ifeq ($(ARCH ) , 'i386')
22
+ ARCH_SUBDIR := x86_64
23
+ else
24
+ ARCH_SUBDIR := aarch64
25
+ endif
26
+ BUILD_DIR := .build/$(ARCH_SUBDIR ) -unknown-linux-gnu
27
+ LIB_SUFFIX := so
28
+ endif
29
+
30
+ ifeq ($(UNAME ) , Darwin)
18
31
ifeq ($(ARCH ) , 'i386')
19
32
ARCH_SUBDIR := x86_64
20
33
else
21
34
ARCH_SUBDIR := arm64
22
35
endif
36
+ BUILD_DIR := .build/$(ARCH_SUBDIR ) -apple-macosx
37
+ LIB_SUFFIX := dylib
38
+ endif
23
39
24
- BUILD_DIR =".build/$(ARCH_SUBDIR ) -apple-macosx"
25
40
26
41
all : generate-all
27
42
28
- $(BUILD_DIR ) /debug/libJavaKit.dylib $(BUILD_DIR ) /debug/libJavaKitExample.dylib $(BUILD_DIR ) /debug/Java2Swift :
43
+ $(BUILD_DIR ) /debug/libJavaKit.$( LIB_SUFFIX ) $(BUILD_DIR ) /debug/libJavaKitExample.$( LIB_SUFFIX ) $(BUILD_DIR ) /debug/Java2Swift :
29
44
swift build
30
45
31
46
./JavaSwiftKitDemo/build/classes/java/main/com/example/swift/HelloSubclass.class : JavaSwiftKitDemo/src/main/java/com/example/swift
32
47
./gradlew build
33
48
34
- run : $(BUILD_DIR ) /debug/libJavaKit.dylib $(BUILD_DIR ) /debug/libJavaKitExample.dylib JavaSwiftKitDemo/src/main/java/com/example/swift
49
+ run : $(BUILD_DIR ) /debug/libJavaKit.$( LIB_SUFFIX ) $(BUILD_DIR ) /debug/libJavaKitExample.$( LIB_SUFFIX ) JavaSwiftKitDemo/src/main/java/com/example/swift
35
50
java -cp JavaSwiftKitDemo/build/classes/java/main -Djava.library.path=$(BUILD_DIR ) /debug/ com.example.swift.HelloSwift
36
51
37
52
Java2Swift : $(BUILD_DIR ) /debug/Java2Swift
82
97
jextract-swift : generate-JExtract-interface-files
83
98
swift build
84
99
85
- generate-JExtract-interface-files : $(BUILD_DIR ) /debug/libJavaKit.dylib
100
+ generate-JExtract-interface-files : $(BUILD_DIR ) /debug/libJavaKit.$( LIB_SUFFIX )
86
101
echo " Generate .swiftinterface files..."
87
102
@$(call make_swiftinterface, "JavaKitExample", "MySwiftLibrary")
88
103
@$(call make_swiftinterface, "JavaKitExample", "SwiftKit")
Original file line number Diff line number Diff line change @@ -32,11 +32,11 @@ let javaHome = findJavaHome()
32
32
33
33
let javaIncludePath = " \( javaHome) /include "
34
34
#if os(Linux)
35
- let javaPlatformIncludePath = " \( javaIncludePath) /linux "
35
+ let javaPlatformIncludePath = " \( javaIncludePath) /linux "
36
36
#elseif os(macOS)
37
- let javaPlatformIncludePath = " \( javaIncludePath) /darwin "
37
+ let javaPlatformIncludePath = " \( javaIncludePath) /darwin "
38
38
#else
39
- #error("Currently only macOS and Linux platforms are supported, this may change in the future.")
39
+ #error("Currently only macOS and Linux platforms are supported, this may change in the future.")
40
40
// TODO: Handle windows as well
41
41
#endif
42
42
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ ENV LANGUAGE=en_US.UTF-8
17
17
18
18
# JDK dependency
19
19
COPY install_jdk.sh .
20
- RUN bash -x ./install_jdk.sh
20
+ RUN bash -xc 'JDK_VENDOR=Corretto ./install_jdk.sh'
21
21
ENV JAVA_HOME="/usr/lib/jvm/default-jdk"
22
22
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"
You can’t perform that action at this time.
0 commit comments