@@ -36,12 +36,16 @@ export class Console extends Runner {
3636 let installDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" ) ;
3737 this . createFolder ( installDir , true ) ;
3838
39+ let downloadUrl = "https://bit.ly/2BCkFa9" ;
40+ if ( command . parameters . length > 1 && command . parameters [ 1 ] != "" ) {
41+ downloadUrl = "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.devonfw.tools.ide&a=devonfw-ide-scripts&p=tar.gz&v=" + command . parameters [ 1 ] ;
42+ }
3943 if ( this . platform == ConsolePlatform . WINDOWS ) {
40- this . executeCommandSync ( "powershell.exe Invoke-WebRequest -OutFile devonfw.tar.gz https://bit.ly/2BCkFa9 " , installDir , result ) ;
44+ this . executeCommandSync ( "powershell.exe \" Invoke-WebRequest -OutFile devonfw.tar.gz '" + downloadUrl + "'\" ", installDir , result ) ;
4145 this . executeCommandSync ( "powershell.exe tar -xvzf devonfw.tar.gz" , installDir , result ) ;
4246 this . executeCommandSync ( "powershell.exe ./setup " + path . join ( settingsDir , "settings.git" ) . replace ( / \\ / g, "/" ) , installDir , result , "yes" ) ;
4347 } else {
44- this . executeCommandSync ( "wget -c https://bit.ly/2BCkFa9 -O - | tar -xz" , installDir , result ) ;
48+ this . executeCommandSync ( "wget -c \"" + downloadUrl + "\" -O - | tar -xz", installDir , result ) ;
4549 this . executeCommandSync ( "bash setup " + path . join ( settingsDir , "settings.git" ) . replace ( / \\ / g, "/" ) , installDir , result , "yes" ) ;
4650 }
4751
@@ -75,6 +79,20 @@ export class Console extends Runner {
7579 return result ;
7680 }
7781
82+ runBuildJava ( step : Step , command : Command ) : RunResult {
83+ let result = new RunResult ( ) ;
84+ result . returnCode = 0 ;
85+
86+ let projectDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" , command . parameters [ 0 ] )
87+ if ( this . platform == ConsolePlatform . WINDOWS ) {
88+ this . executeCommandSync ( "devon mvn clean install -Dmaven.test.skip=" + ! command . parameters [ 1 ] , projectDir , result ) ;
89+ } else {
90+ this . executeCommandSync ( "~/.devon/devon mvn clean install -Dmaven.test.skip=" + ! command . parameters [ 1 ] , projectDir , result ) ;
91+ }
92+
93+ return result ;
94+ }
95+
7896 runCobiGenJava ( step : Step , command : Command ) : RunResult {
7997 return null ;
8098 }
@@ -103,6 +121,17 @@ export class Console extends Runner {
103121 . fileExits ( path . join ( this . getWorkingDirectory ( ) , "devonfw" , "software" , "cobigen-cli" , "cobigen" ) ) ;
104122 }
105123
124+ async assertBuildJava ( step : Step , command : Command , result : RunResult ) {
125+ let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" ) ;
126+
127+ new Assertions ( )
128+ . noErrorCode ( result )
129+ . noException ( result )
130+ . directoryExits ( path . join ( workspaceDir , command . parameters [ 0 ] , "api" , "target" ) )
131+ . directoryExits ( path . join ( workspaceDir , command . parameters [ 0 ] , "core" , "target" ) )
132+ . directoryExits ( path . join ( workspaceDir , command . parameters [ 0 ] , "server" , "target" ) ) ;
133+ }
134+
106135 async assertCobiGenJava ( step : Step , command : Command , result : RunResult ) {
107136 console . log ( "there is no assertion yet for the cobiGenJava command" ) ;
108137 }
@@ -121,10 +150,11 @@ export class Console extends Runner {
121150 }
122151
123152
153+
124154 private executeCommandSync ( command : string , directory : string , result : RunResult , input ?: string ) {
125155 if ( result . returnCode != 0 ) return ;
126156
127- let process = child_process . spawnSync ( command , { shell : true , cwd : directory , input : input } ) ;
157+ let process = child_process . spawnSync ( command , { shell : true , cwd : directory , input : input , maxBuffer : Infinity } ) ;
128158 if ( process . status != 0 ) {
129159 console . log ( "Error executing command: " + command + " (exit code: " + process . status + ")" ) ;
130160 console . log ( process . stderr . toString ( ) , process . stdout . toString ( ) ) ;
0 commit comments