1
- // swift-tools-version: 6.0
2
- // The swift-tools-version declares the minimum version of Swift required to build this package.
3
-
1
+ // swift-tools-version: 6.1
4
2
import CompilerPluginSupport
5
3
import PackageDescription
6
4
7
5
import class Foundation. FileManager
8
6
import class Foundation. ProcessInfo
9
7
10
- // Note: the JAVA_HOME environment variable must be set to point to where
11
- // Java is installed, e.g.,
12
- // Library/Java/JavaVirtualMachines/openjdk-21.jdk/Contents/Home.
13
- func findJavaHome( ) -> String {
14
- if let home = ProcessInfo . processInfo. environment [ " JAVA_HOME " ] {
15
- return home
16
- }
17
-
18
- // This is a workaround for envs (some IDEs) which have trouble with
19
- // picking up env variables during the build process
20
- let path = " \( FileManager . default. homeDirectoryForCurrentUser. path ( ) ) .java_home "
21
- if let home = try ? String ( contentsOfFile: path, encoding: . utf8) {
22
- if let lastChar = home. last, lastChar. isNewline {
23
- return String ( home. dropLast ( ) )
24
- }
25
-
26
- return home
27
- }
28
-
29
- fatalError ( " Please set the JAVA_HOME environment variable to point to where Java is installed. " )
30
- }
31
- let javaHome = findJavaHome ( )
32
-
33
- let javaIncludePath = " \( javaHome) /include "
34
- #if os(Linux)
35
- let javaPlatformIncludePath = " \( javaIncludePath) /linux "
36
- #elseif os(macOS)
37
- let javaPlatformIncludePath = " \( javaIncludePath) /darwin "
38
- #elseif os(Windows)
39
- let javaPlatformIncludePath = " \( javaIncludePath) /win32 "
40
- #endif
41
-
42
8
// Get NDK version from command line
43
9
let ndkVersion = ProcessInfo . processInfo. environment [ " ANDROID_NDK_VERSION " ] . flatMap { UInt ( $0) } ?? 27
44
10
let ndkVersionDefine = SwiftSetting . define ( " ANDROID_NDK_VERSION_ " + ndkVersion. description)
@@ -118,10 +84,6 @@ var package = Package(
118
84
name: " JavaKitReflection " ,
119
85
package : " swift-java "
120
86
) ,
121
- . product(
122
- name: " Binder " ,
123
- package : " Binder "
124
- ) ,
125
87
" AndroidNDK " ,
126
88
" AndroidJava " ,
127
89
" AndroidManifest " ,
@@ -140,7 +102,6 @@ var package = Package(
140
102
] ,
141
103
swiftSettings: [
142
104
. swiftLanguageMode( . v5) ,
143
- . unsafeFlags( [ " -I \( javaIncludePath) " , " -I \( javaPlatformIncludePath) " ] ) ,
144
105
ndkVersionDefine,
145
106
sdkVersionDefine
146
107
]
0 commit comments