Review Request: 6911737: Module build: generate modules with native libraries and any other files

Mandy Chung Mandy.Chung at Sun.COM
Thu Dec 17 23:32:11 PST 2009


This is the next step toward modularizing the jdk:
    6911737: Module build: generate modules with native libraries and 
any other files

Webrev at:
    http://cr.openjdk.java.net/~mchung/6911737/webrev.00/

For classes and other resource files in jar files, we use simple 
patterns to match what classes/resources in which module (most cases can 
simply use the package name as the pattern).  The module definitions are 
defined in make/modules/modules.config.

For native libraries and any other files, pattern matching approach 
won't work well and keeping the mapping of native libs and other files 
to which module is hard to maintain and also error-prone.  Instead, I 
add a new MODULE variable and modify install-file macro in Defs.gmk so 
that for any file is installed in the build image, the file will be 
installed in its corresponding module in the module image.   I also add 
a few new macros in Defs.gmk such as install-non-module-file, 
chmod-file, etc to handle different cases.

This change modifies > 120 makefiles and most of them are added one line 
to define its module.  The main change is in Defs.gmk.

 > cd make/modules; gnumake all

This command will generate one directory per module, 
$OUTPUTDIR/modules/<module>.  It will consist of the jar file containing 
its classes and resource files as well as any native libraries, 
binaries, executables, etc.

For example, the base module is under $OUTPUTDIR/modules/base

 > find base -print
base
base/bin
base/bin/java
base/lib
base/lib/base.jar
base/lib/i386
base/lib/i386/native_threads
base/lib/i386/native_threads/libhpi.so
base/lib/i386/jvm.cfg
base/lib/i386/server
base/lib/i386/server/libjvm.so
base/lib/i386/server/Xusage.txt
base/lib/i386/server/libjsig.so
base/lib/i386/server/libjvm_db.so
base/lib/i386/client
base/lib/i386/client/libjvm.so
base/lib/i386/client/Xusage.txt
base/lib/i386/client/libjsig.so
base/lib/i386/client/libjvm_db.so
base/lib/i386/libjsig.so
base/lib/i386/libverify.so
base/lib/i386/libjava.so
base/lib/i386/jli
base/lib/i386/jli/libjli.so
base/lib/i386/libzip.so
base/lib/i386/libnpt.so
base/lib/i386/libnet.so
base/lib/i386/libnio.so
base/lib/security
base/lib/security/US_export_policy.jar
base/lib/security/local_policy.jar
base/lib/security/java.security
base/lib/security/java.policy
base/lib/security/cacerts
base/lib/content-types.properties
base/lib/calendars.properties
base/lib/currency.data
base/lib/net.properties
base/lib/zi/....

 > find nio -print
nio
nio/lib
nio/lib/nio.jar

The base module itself can be used to run applications that don't depend 
on other modules.
 > base/bin/java helloworld

To add the nio module on the top of the base module, you can do:
 >  cp -rf base  myJRE
 >  cp -rf nio/* myJRE

Mandy



More information about the jigsaw-dev mailing list