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 1515.PHONY : run clean all
1616
1717ARCH := $(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)
1831ifeq ($(ARCH ) , 'i386')
1932 ARCH_SUBDIR := x86_64
2033else
2134 ARCH_SUBDIR := arm64
2235endif
36+ BUILD_DIR := .build/$(ARCH_SUBDIR ) -apple-macosx
37+ LIB_SUFFIX := dylib
38+ endif
2339
24- BUILD_DIR =".build/$(ARCH_SUBDIR ) -apple-macosx"
2540
2641all : generate-all
2742
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 :
2944 swift build
3045
3146./JavaSwiftKitDemo/build/classes/java/main/com/example/swift/HelloSubclass.class : JavaSwiftKitDemo/src/main/java/com/example/swift
3247 ./gradlew build
3348
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
3550 java -cp JavaSwiftKitDemo/build/classes/java/main -Djava.library.path=$(BUILD_DIR ) /debug/ com.example.swift.HelloSwift
3651
3752Java2Swift : $(BUILD_DIR ) /debug/Java2Swift
8297jextract-swift : generate-JExtract-interface-files
8398 swift build
8499
85- generate-JExtract-interface-files : $(BUILD_DIR ) /debug/libJavaKit.dylib
100+ generate-JExtract-interface-files : $(BUILD_DIR ) /debug/libJavaKit.$( LIB_SUFFIX )
86101 echo " Generate .swiftinterface files..."
87102 @$(call make_swiftinterface, "JavaKitExample", "MySwiftLibrary")
88103 @$(call make_swiftinterface, "JavaKitExample", "SwiftKit")
Original file line number Diff line number Diff line change @@ -32,11 +32,11 @@ let javaHome = findJavaHome()
3232
3333let javaIncludePath = " \( javaHome) /include "
3434#if os(Linux)
35- let javaPlatformIncludePath = " \( javaIncludePath) /linux "
35+ let javaPlatformIncludePath = " \( javaIncludePath) /linux "
3636#elseif os(macOS)
37- let javaPlatformIncludePath = " \( javaIncludePath) /darwin "
37+ let javaPlatformIncludePath = " \( javaIncludePath) /darwin "
3838#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.")
4040// TODO: Handle windows as well
4141#endif
4242
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ ENV LANGUAGE=en_US.UTF-8
1717
1818# JDK dependency
1919COPY install_jdk.sh .
20- RUN bash -x ./install_jdk.sh
20+ RUN bash -xc 'JDK_VENDOR=Corretto ./install_jdk.sh'
2121ENV JAVA_HOME="/usr/lib/jvm/default-jdk"
2222ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"
You can’t perform that action at this time.
0 commit comments