File tree Expand file tree Collapse file tree 3 files changed +29
-9
lines changed Expand file tree Collapse file tree 3 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,14 @@ def swiftProductsWithJExtractPlugin() {
78
78
}
79
79
}
80
80
81
+ def swiftCheckValid = tasks. register(" swift-check-valid" , Exec ) {
82
+ commandLine " swift"
83
+ args(" -version" )
84
+ }
85
+
81
86
def jextract = tasks. register(" jextract" , Exec ) {
82
87
description = " Generate Java wrappers for swift target"
88
+ dependsOn swiftCheckValid
83
89
// dependsOn compileSwiftJExtractPlugin
84
90
85
91
// only because we depend on "live developing" the plugin while using this project to test it
@@ -90,7 +96,8 @@ def jextract = tasks.register("jextract", Exec) {
90
96
inputs. file(new File (projectDir, " Package.swift" ))
91
97
92
98
// monitor all targets/products which depend on the JExtract plugin
93
- swiftProductsWithJExtractPlugin(). each {
99
+ // swiftProductsWithJExtractPlugin().each {
100
+ [" MySwiftLibrary" ]. each {
94
101
logger. info(" [swift-java:jextract (Gradle)] Swift input target: ${ it} " )
95
102
inputs. dir(new File (layout. projectDirectory. asFile, " Sources/${ it} " . toString()))
96
103
}
Original file line number Diff line number Diff line change 8
8
# check if we can compile a plain Example file that uses the generated Java bindings that should be in the generated jar
9
9
javac -cp bin/default/build/libs/* jar Example.java
10
10
11
- # Can we run the example?
12
- # - find libswiftCore.dylib
13
- SWIFT_DYLIB_PATHS=$( find " $( swiftly use --print-location) " | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
14
- # - find our library dylib
15
- SWIFT_DYLIB_PATHS=" ${SWIFT_DYLIB_PATHS} :$( find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname) "
16
- java -Djava.library.path=" ${SWIFT_DYLIB_PATHS} " -cp " .:bin/default/build/libs/*jar:../../SwiftKit/build/libs/*jar" Example
11
+
12
+ if [ " $( uname -s) " = ' Linux' ]
13
+ then
14
+ exit 1 # not implemented yet
15
+ elif [ " $( uname -s) " = ' Darwin' ]
16
+ then
17
+ # Can we run the example?
18
+ # - find libswiftCore.dylib
19
+ SWIFT_DYLIB_PATHS=$( find " $( swiftly use --print-location) " | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
20
+ # - find our library dylib
21
+ SWIFT_DYLIB_PATHS=" ${SWIFT_DYLIB_PATHS} :$( find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname) "
22
+ java -Djava.library.path=" ${SWIFT_DYLIB_PATHS} " -cp " .:bin/default/build/libs/*jar:../../SwiftKit/build/libs/*jar" Example
23
+ fi
Original file line number Diff line number Diff line change @@ -30,13 +30,19 @@ repositories {
30
30
31
31
java {
32
32
toolchain {
33
- languageVersion. set(JavaLanguageVersion . of(22 ))
33
+ languageVersion. set(JavaLanguageVersion . of(23 ))
34
34
}
35
35
}
36
36
37
+ def swiftCheckValid = tasks. register(" swift-check-valid" , Exec ) {
38
+ commandLine " swift"
39
+ args(" -version" )
40
+ }
41
+
37
42
def jextract = tasks. register(" jextract" , Exec ) {
38
43
description = " Builds swift sources, including swift-java source generation"
39
- dependsOn compileSwiftJExtractPlugin
44
+ dependsOn swiftCheckValid
45
+ // dependsOn compileSwiftJExtractPlugin
40
46
41
47
// only because we depend on "live developing" the plugin while using this project to test it
42
48
inputs. file(new File (rootDir, " Package.swift" ))
You can’t perform that action at this time.
0 commit comments