Menu

Getting haiku.bat to do incremental builds

2015-06-08
2015-06-11
  • Chinmay Nagarkar

    How do I get Haiku.bat to do incremental builds? If a java file hasn't changed, don't recompile it; if a class file hasn't changed, don't recreate it's C equivalent, etc. Haiku.bat seems to regenerate all the files each time, and I don't see any switches for incremental build.

    Thanks!

     
    • genom2

      genom2 - 2015-06-08

      This question has three sides, because we have
      a compilation from java to class (javac) and
      a compilation from class to c (haikulink) and
      a compilation from c to o (gcc with make)

      First: java to class (javac)
      As far as I know javac (the core of haikuc) does a good job on incremental translations.
      (I'm not sure how Gradle can further improve this.)

      Second: class to c (haikulink)
      Until now, I found no way to do this incremental. Because haikufying has the need to do a global search to eliminate unused classes, methods etc.. Mainly all Java class C equivalents a generated in
      HaikuVM/utility/haikuJava.[ch]
      it's not file by file.
      Moving to incremental haikufying would have the need to read a last incremental analyses file, use and augment it and re-read on the next run.
      Until now, I decided, that this is to much effort. Nowadays computer are fast and a typical HaikuVM project is small.
      On the upside, haikulink only affects files in HaikuVM/utility (at least this was the plan).

      Third: c to o (gcc with make)
      If you use the Arduino IDE, it's up to them. And they do a good job on incremental compilation (as far as I can see) because they leave it to make.
      If you stay with HaikuVM (not using the Arduino IDE) then HaikuVM uses make as well but (sadly) cleans up before starting the compilation phase.
      On the downside, make will analyse dependencies and might decide to compile everything (even in the Arduino IDE). Even if only a file in HaikuVM/utility had a change.

      Do you have an example where you are missing an incremental behavior?

      But anyway, how can we make HaikuVM a little more incremental? Any ideas?

       

      Last edit: genom2 2015-06-08
  • TimReset

    TimReset - 2015-06-08

    Hello!
    I tried create Gradle script for HaikuVM - https://github.com/TimReset/HaikuVMGradle
    Gradle support saving state of source file - if source file not change, it's not rerun.
    I recommend use Gradle - it's support all IDE (e.g. Eclipse, IDEA), support dependency (I create example with dependency), easy using Java tools - FindBug, ProGuard and etc.

     
  • Chinmay Nagarkar

    "As far as I know javac (the core of haikuc) does a good job on incremental translations."

    I'm not sure about this. According to the oracle docs, javac recompiles all the java files each time; it doesn't track what changed and only recompile that.

    Eclipse on the other hand, does track changes and only recompile changed files. I suggest the following incremental changes:

    1. In my eclipse plugin, when constructing a classpath for haiku.bat, I'll point to the bin/ directories containing class files instead of source directories containing java files. This way I can piggyback on eclipse incremental builds.
    2. Haiku distribution should provide compiled jar files instead of passing all the source folders to the Haikuc.bat command. Right now, haikuc/javac is recompiling all those java files each time.
      So instead of this:
      D:\software\haikuvm132\bin..\gallerie\src\main\java
      pass in:
      D:\software\haikuvm132\bin..\lib\gallerie.jar
    3. In Eclipse, to avoid taking up CPU constantly with builds if the user is editing and saving quickly (like once every second), I will implement a delayed build process that batches up changes.

    Put together this should give pretty good result even without any improvements to linking or make.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.