@@ -32,6 +32,14 @@ impl AntPlugin {
3232 Ok ( Self { jvm } )
3333 }
3434
35+ fn get_ant_executable ( & self ) -> & ' static str {
36+ if cfg ! ( windows) {
37+ "ant.bat"
38+ } else {
39+ "ant"
40+ }
41+ }
42+
3543 fn copy_tmc_junit_runner ( & self , path : & Path ) -> Result < ( ) , JavaError > {
3644 log:: debug!( "Copying TMC Junit runner" ) ;
3745
@@ -106,13 +114,14 @@ impl LanguagePlugin for AntPlugin {
106114 let stderr =
107115 File :: create ( & stderr_path) . map_err ( |e| JavaError :: File ( stderr_path. clone ( ) , e) ) ?;
108116
109- let output = Command :: new ( "ant" )
117+ let ant_exec = self . get_ant_executable ( ) ;
118+ let output = Command :: new ( ant_exec)
110119 . arg ( "clean" )
111120 . stdout ( stdout)
112121 . stderr ( stderr)
113122 . current_dir ( path)
114123 . output ( )
115- . map_err ( |e| JavaError :: FailedToRun ( "ant" . to_string ( ) , e) ) ?;
124+ . map_err ( |e| JavaError :: FailedToRun ( ant_exec . to_string ( ) , e) ) ?;
116125
117126 if output. status . success ( ) {
118127 fs:: remove_file ( stdout_path) ?;
@@ -175,13 +184,14 @@ impl JavaPlugin for AntPlugin {
175184 File :: create ( & stderr_path) . map_err ( |e| JavaError :: File ( stderr_path. clone ( ) , e) ) ?;
176185
177186 // TODO: don't require ant in path?
178- let output = Command :: new ( "ant" )
187+ let ant_exec = self . get_ant_executable ( ) ;
188+ let output = Command :: new ( ant_exec)
179189 . arg ( "compile-test" )
180190 . current_dir ( project_root_path)
181191 . output ( )
182- . map_err ( |e| JavaError :: FailedToRun ( "ant" . to_string ( ) , e) ) ?;
192+ . map_err ( |e| JavaError :: FailedToRun ( ant_exec . to_string ( ) , e) ) ?;
183193
184- log:: trace !( "stdout: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
194+ log:: debug !( "stdout: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
185195 log:: debug!( "stderr: {}" , String :: from_utf8_lossy( & output. stderr) ) ;
186196 stdout
187197 . write_all ( & output. stdout )
0 commit comments