@@ -17,6 +17,7 @@ import Synchronization
17
17
import JavaKitConfigurationShared
18
18
import Dispatch
19
19
import _Subprocess
20
+ import System
20
21
21
22
@available ( macOS 15 . 0 , * )
22
23
@main
@@ -67,45 +68,48 @@ final class SwiftJavaBootstrapJavaTool {
67
68
" --rerun-tasks " ,
68
69
// "--debug",
69
70
// "\(localGradleProjectDependencyName):jar",
70
- " \( localGradleProjectDependencyName) : \( printRuntimeClasspathTaskName) "
71
- ]
71
+ " \( localGradleProjectDependencyName) : \( printRuntimeClasspathTaskName) " ,
72
+ ] ,
73
+ output: . writeTo( . open( " /tmp/out.txt " , . writeOnly) , closeAfterSpawningProcess: true ) ,
74
+ error: . writeTo( . open( " /tmp/err.txt " , . writeOnly) , closeAfterSpawningProcess: true )
72
75
)
73
76
74
- let outString = String (
75
- data: process. standardOutput,
76
- encoding: . utf8
77
- )
78
- let errString = String (
79
- data: process. standardError,
80
- encoding: . utf8
81
- )
82
-
83
- print ( " OUT ==== \( outString? . count) ::: \( outString ?? " " ) " )
84
- print ( " ERR ==== \( errString? . count) ::: \( errString ?? " " ) " )
85
-
86
- let classpathOutput : String
87
- if let found = outString? . split ( separator: " \n " ) . first ( where: { $0. hasPrefix ( self . SwiftJavaClasspathPrefix) } ) {
88
- classpathOutput = String ( found)
89
- } else if let found = errString? . split ( separator: " \n " ) . first ( where: { $0. hasPrefix ( self . SwiftJavaClasspathPrefix) } ) {
90
- classpathOutput = String ( found)
91
- } else {
92
- let suggestDisablingSandbox = " It may be that the Sandbox has prevented dependency fetching, please re-run with '--disable-sandbox'. "
93
- fatalError ( " Gradle output had no SWIFT_JAVA_CLASSPATH! \( suggestDisablingSandbox) . \n " +
94
- " Output was:<<< \( outString ?? " <empty> " ) >>>; Err was:<<< \( errString ?? " <empty> " ) >>> " )
95
- }
96
-
97
- let classpathString = String ( classpathOutput. dropFirst ( self . SwiftJavaClasspathPrefix. count) )
98
-
99
- _ = try ? FileManager . default. createDirectory (
100
- at: URL ( fileURLWithPath: outputDirectoryPath) ,
101
- withIntermediateDirectories: true ,
102
- attributes: nil
103
- )
104
-
77
+ // let outString = String(
78
+ // data: process.standardOutput,
79
+ // encoding: .utf8
80
+ // )
81
+ // let errString = String(
82
+ // data: process.standardError,
83
+ // encoding: .utf8
84
+ // )
85
+ //
86
+ // print("OUT ==== \(outString?.count) ::: \(outString ?? "")")
87
+ // print("ERR ==== \(errString?.count) ::: \(errString ?? "")")
88
+ //
89
+ // let classpathOutput: String
90
+ // if let found = outString?.split(separator: "\n").first(where: { $0.hasPrefix(self.SwiftJavaClasspathPrefix) }) {
91
+ // classpathOutput = String(found)
92
+ // } else if let found = errString?.split(separator: "\n").first(where: { $0.hasPrefix(self.SwiftJavaClasspathPrefix) }) {
93
+ // classpathOutput = String(found)
94
+ // } else {
95
+ // let suggestDisablingSandbox = "It may be that the Sandbox has prevented dependency fetching, please re-run with '--disable-sandbox'."
96
+ // fatalError("Gradle output had no SWIFT_JAVA_CLASSPATH! \(suggestDisablingSandbox). \n" +
97
+ // "Output was:<<<\(outString ?? "<empty>")>>>; Err was:<<<\(errString ?? "<empty>")>>>")
98
+ // }
99
+ //
100
+ // let classpathString = String(classpathOutput.dropFirst(self.SwiftJavaClasspathPrefix.count))
101
+ //
102
+ // _ = try? FileManager.default.createDirectory(
103
+ // at: URL(fileURLWithPath: outputDirectoryPath),
104
+ // withIntermediateDirectories: true,
105
+ // attributes: nil
106
+ // )
107
+ //
105
108
let classpathOutputURL =
106
109
URL ( fileURLWithPath: outputDirectoryPath)
107
110
. appendingPathComponent ( " \( moduleName) .swift-java.classpath " , isDirectory: false )
108
111
112
+ let classpathString = " MOCK "
109
113
try ! classpathString. write ( to: classpathOutputURL, atomically: true , encoding: . utf8)
110
114
111
115
print ( " [swift-java-bootstrap] Done, written classpath to: \( classpathOutputURL) " )
0 commit comments