@@ -36,20 +36,20 @@ static String readVersion() {
3636 }
3737
3838
39- static void build (AppArguments arguments ) throws IOException {
39+ static boolean build (AppArguments arguments ) throws IOException {
4040 var sourceDirectory = arguments .sourcesDirectory ();
4141 var classesDirectory = arguments .classesDirectory ();
42-
42+
4343 var javaFiles = JavaFiles .findFrom (sourceDirectory );
4444 var configuredMainClass = Optional .ofNullable (Configuration .MAIN_CLASS .get (null ));
4545 var mainClass = JavaFiles .findMainClass (javaFiles , configuredMainClass );
46-
46+
4747 UserHint .showHint (sourceDirectory , javaFiles , mainClass );
4848 Directories .createIfNotExists (classesDirectory );
4949 var compilationSuccess = Compiler .compile (javaFiles , classesDirectory );
5050 if (!compilationSuccess ) {
5151 Log .warning ("⚠️ compilation failed" );
52- return ;
52+ return false ;
5353 }
5454 Log .user ("🔍 compiled %d files" .formatted (javaFiles .size ()));
5555
@@ -62,15 +62,18 @@ static void build(AppArguments arguments) throws IOException {
6262 if (arguments .isClassesDirTemporary ()) {
6363 Cleaner .cleanClasses (classesDirectory );
6464 }
65- PostBuildHook . runIfConfigured ( sourceDirectory , jarDirectory , jarFileName ) ;
65+ return true ;
6666 }
6767
6868 static void main (String ... args ) throws IOException {
6969 Log .user ("🚀 " + VERSION + " - fast and pure Java 🛠️" );
7070 var arguments = AppArguments .from (args );
7171 arguments .userInfo ();
7272 var stopWatch = StopWatch .start ();
73- build (arguments );
73+ var success = build (arguments );
7474 stopWatch .stop ();
75+ if (success ) {
76+ PostBuildHook .runIfConfigured (arguments .sourcesDirectory (), arguments .jarDirectory (), arguments .jarFileName ());
77+ }
7578 }
7679}
0 commit comments