|
81 | 81 | :target-path :target-exe :classpath :native-image-xmx
|
82 | 82 | :entry-class]}]
|
83 | 83 | (status/line :head "Graal native-image compile AOT")
|
84 |
| - (when (fs/exists? target-exe) |
85 |
| - (fs/delete target-exe)) |
86 |
| - (let [native-image-cmd (->> [graal-native-image |
87 |
| - (str "-H:Path=" target-path) |
88 |
| - (str "-H:Name=" target-exe) |
89 |
| - "--features=clj_easy.graal_build_time.InitClojureClasses" |
90 |
| - "-H:+ReportExceptionStackTraces" |
91 |
| - "-J-Dclojure.spec.skip-macros=true" |
92 |
| - "-J-Dclojure.compiler.direct-linking=true" |
93 |
| - (when graal-reflection-fname |
94 |
| - (str "-H:ReflectionConfigurationFiles=" graal-reflection-fname)) |
95 |
| - "-H:Log=registerResource:" |
96 |
| - "-H:EnableURLProtocols=http,https,jar" |
97 |
| - "--verbose" |
98 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileReader" |
99 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileReader" |
100 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.MixerProvider" |
101 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.FormatConversionProvider" |
102 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileWriter" |
103 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiDeviceProvider" |
104 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.SoundbankReader" |
105 |
| - "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileWriter" |
106 |
| - "--no-fallback" |
107 |
| - "--no-server" |
108 |
| - "--report-unsupported-elements-at-runtime" |
109 |
| - "-cp" (str classpath java.io.File/pathSeparator "classes") |
110 |
| - (str "-J-Xmx" native-image-xmx) |
111 |
| - entry-class] |
112 |
| - (remove nil?))] |
113 |
| - (apply shell/command native-image-cmd))) |
| 84 | + (let [full-path-target-exe (str (fs/file target-path target-exe))] |
| 85 | + (when-let [exe (fs/which full-path-target-exe)] |
| 86 | + (status/line :detail "Deleting existing %s" exe) |
| 87 | + (fs/delete exe)) |
| 88 | + (let [native-image-cmd (->> [graal-native-image |
| 89 | + "-o" full-path-target-exe |
| 90 | + "--enable-http" |
| 91 | + "--enable-https" |
| 92 | + "--features=clj_easy.graal_build_time.InitClojureClasses" |
| 93 | + "-H:+ReportExceptionStackTraces" |
| 94 | + "-J-Dclojure.spec.skip-macros=true" |
| 95 | + "-J-Dclojure.compiler.direct-linking=true" |
| 96 | + (when graal-reflection-fname |
| 97 | + (str "-H:ReflectionConfigurationFiles=" graal-reflection-fname)) |
| 98 | + "--verbose" |
| 99 | + "--no-fallback" |
| 100 | + "--report-unsupported-elements-at-runtime" |
| 101 | + "-cp" (str classpath java.io.File/pathSeparator "classes") |
| 102 | + (str "-J-Xmx" native-image-xmx) |
| 103 | + entry-class] |
| 104 | + (remove nil?))] |
| 105 | + (apply shell/command native-image-cmd)))) |
0 commit comments