Workaround for partial builds
Erik Joelsson
erik.joelsson at oracle.com
Fri Dec 21 09:39:53 UTC 2012
There have been some concerns raised about partial builds going away
when switching to the new build. Sjavac is supposed to solve this
problem once and for all, but since it most probably won't be there from
day one, I'm going to describe the workaround that has been implemented
to alleviate this problem.
There are two levels of partial here, only recompile certain
repositories and only recompile certain source files. I will start with
limiting repositories. This is done using the *-only targets. Using
these targets bypasses the dependencies between repositories and hits
only the one called for. The new build is pretty fast in determining
that nothing needs to be rebuilt, but there are still seconds to save
using this if you need to. Especially on slow platforms (windows/cygwin)
this is a big help.
The other level of partial is to limit the number of source files that
are recompiled. This is only a problem for java files since for the rest
of the build, dependencies work quite well. The typical case is not
wanting to recompile all 10000 java files in the jdk repo every time you
change one of those files. This can be done using the variable
JDK_FILTER. By setting it on the command line you can filter the
packages being recompiled and save a lot of time. The format is:
JDK_FILTER=package/one[,package/two]...
I will illustrate this with an example (on my linux workstation):
After a full build, I edit
jdk/src/share/classes/java/awt/Transparency.java and add a static final
int to it. Typing make again, it rebuilds all java classes and the build
takes 4 minutes. Now to improve rebuild speed, I do like this (after
changing the value of the new field first):
make jdk-only JDK_FILTER=java/awt
I note that a lot less classes get recompiled:
"Compiling 370 files for BUILD_JDK"
Also, if I added LOG=info, I see that the following native compilations
take place, since I triggered a header file change:
Compiling awt_ImagingLib.c (for libawt.so)
Compiling awt_parseImage.c (for libawt.so)
Compiling img_globals.c (for libawt.so)
Compiling X11Color.c (for libawt_xawt.so)
Compiling gtk2_interface.c (for libawt_xawt.so)
Compiling X11Color.c (for libawt_headless.so)
Linking libawt.so
Linking libawt_xawt.so
Linking libfontmanager.so
Linking libawt_headless.so
Linking libt2k.so
Linking libjawt.so
Finally the total build times were:
----- Build times -------
Start 2012-12-21 10:13:45
End 2012-12-21 10:13:57
00:00:12 jdk
00:00:12 TOTAL
Note that the native recompile would have been the same without the
filter. Those dependencies are correct. I hope this will be good enough
for people to survive. The build times will be a bit longer on windows.
/Erik
More information about the build-dev
mailing list