RFR: Module constraints on targets

mark.reinhold at oracle.com mark.reinhold at oracle.com
Tue Oct 16 09:38:15 PDT 2012


2012/10/11 9:37 -0700, chris.hegarty at oracle.com:
> 1) Extend the Jigsaw module-file format [2] (jmod) to accommodate Operating
> System and Architecture values in the module header.
> 
> ModuleFileHeader {
> ...
>     u2 osLength;       // Length of following Operating System, in bytes <<< ADDED
>     b* os;             // Operating System, in Java-modified UTF-8 <<< ADDED
>     u2 archLength;     // Length of following Architecture, in bytes <<< ADDED
>     b* arch;           // Architecture, in Java-modified UTF-8  <<< ADDED
> }
> 
> The os and arch values are Java-modified UTF-8 strings, representing the
> Operating System and Architecture where the module-file/library is intended to
> be deployed.
> 
> A value of 0 is a valid value for both osLength and archLength. This
> effectively means that these values are unset, and the module-file/library is
> agnostic of Operating System and Architecture. It should be considered a
> candidate for any module library.

Is it valid to specify an OS but not an architecture, or the other way
around?

You can write OS-dependent code in otherwise pure Java, so we should
allow osLength > 0 && archLength == 0.

If you specify an architecture, however, then you must specify an OS,
so archLength > 0 implies osLength > 0.

> 2) Update CLIs
> 
> Both jmod and jpkg need to be updated to support passing of os and arch values
> during creation.
> 
> Define two new arguments -os, -arch for both jmod and jpkg. These arguments are
> optional. If specified, can only be specified once. For example:
> 
> ./bin/jmod create -L m.lib -os linux -arch x64

Please stick to the existing GNU-style option syntax: These should be
--os and --arch.

> ./bin/jmod id -L m.lib
> path /export/chris/repos/jigsaw/constraints/test/m.lib
> version 0.1
> os: linux
> arch: x64

s/os:/os/
s/arch:/arch/

> ...
> 
> Webrev:
>   http://cr.openjdk.java.net/~chegar/jigsaw/constraints.00/webrev/

I'll have a closer look at this shortly.

- Mark



More information about the jigsaw-dev mailing list