src/share/classes/org/openjdk/jigsaw/cli/Packager.java
Print this page
*** 123,132 ****
--- 123,135 ----
private File natlibs;
private File natcmds;
private File config_dir;
+ // default architecture is any
+ private ModuleArchitecture modArch = ModuleArchitecture.ANY;
+
// Installed size
private Integer installedSize = null;
// Platform boot module
private static final String BOOT_MODULE = "jdk.base";
*** 168,178 ****
+ outputfilename + " for "
+ modulename);
outputfile = new File(destination, outputfilename);
ModuleFileWriter writer
= new ModuleFileWriter(outputfile, (fast || jigsawDevMode));
! writer.writeModule(classes, natlibs, natcmds, config_dir);
}
catch (IOException x) {
if (outputfile != null && !outputfile.delete()) {
Throwable t
= new IOException(outputfile +
--- 171,181 ----
+ outputfilename + " for "
+ modulename);
outputfile = new File(destination, outputfilename);
ModuleFileWriter writer
= new ModuleFileWriter(outputfile, (fast || jigsawDevMode));
! writer.writeModule(classes, natlibs, natcmds, config_dir, modArch);
}
catch (IOException x) {
if (outputfile != null && !outputfile.delete()) {
Throwable t
= new IOException(outputfile +
*** 326,336 ****
control.format("Package: %s%n"
+ "Version: %s%n"
+ "Section: misc%n"
+ "Priority: optional%n"
+ "Architecture: "
! + System.getProperty("os.arch") + "%n",
info.id().name(),
translateVersion(info.id().version().toString()));
// If either maintainer name or e-mail is declared as parameter, use it
if (null != maintainer_name || null != maintainer_email) {
--- 329,339 ----
control.format("Package: %s%n"
+ "Version: %s%n"
+ "Section: misc%n"
+ "Priority: optional%n"
+ "Architecture: "
! + System.getProperty("os.arch") + "%n", // ## update to use archOpt
info.id().name(),
translateVersion(info.id().version().toString()));
// If either maintainer name or e-mail is declared as parameter, use it
if (null != maintainer_name || null != maintainer_email) {
*** 589,599 ****
cleanup();
}
}
}
! private static Map<String,Class<? extends Command<SimpleLibrary>>> commands
= new HashMap<>();
static {
commands.put("deb", Deb.class);
commands.put("jmod", Jmod.class);
--- 592,602 ----
cleanup();
}
}
}
! private static final Map<String,Class<? extends Command<SimpleLibrary>>> commands
= new HashMap<>();
static {
commands.put("deb", Deb.class);
commands.put("jmod", Jmod.class);
*** 734,743 ****
--- 737,756 ----
OptionSpec<File> config
= (parser.accepts("config", "Directory with configuration")
.withRequiredArg()
.describedAs("dir")
.ofType(File.class));
+ OptionSpec<String> osOpt
+ = (parser.accepts("os", "Target Operating System of the module")
+ .withRequiredArg()
+ .describedAs("os")
+ .ofType(String.class));
+ OptionSpec<String> archOpt
+ = (parser.accepts("arch", "Target Architecture of the module")
+ .withRequiredArg()
+ .describedAs("arch")
+ .ofType(String.class));
if (args.length == 0) {
usage();
return;
}
*** 805,814 ****
--- 818,829 ----
}
if (opts.has(config)) {
config_dir = opts.valueOf(config);
checkPathArgument(config_dir, "Config");
}
+ modArch = ModuleArchitecture.create(opts.valueOf(osOpt),
+ opts.valueOf(archOpt));
if (opts.has(isize))
installedSize = opts.valueOf(isize);
if (cmd == Deb.class)
(new Deb()).run(null, opts);
*** 822,834 ****
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path doesn't exist
*/
! private static final void checkIfPathExists(File path, String type)
! throws Command.Exception {
!
if (!path.exists())
throw new Command.Exception("%s path doesn't exist: %s",
type, path);
}
--- 837,849 ----
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path doesn't exist
*/
! private static void checkIfPathExists(File path, String type)
! throws Command.Exception
! {
if (!path.exists())
throw new Command.Exception("%s path doesn't exist: %s",
type, path);
}
*** 838,850 ****
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path isn't readable
*/
! private static final void checkIfPathIsReadable(File path, String type)
! throws Command.Exception {
!
if (!path.canRead())
throw new Command.Exception("%s path isn't readable: %s",
type, path);
}
--- 853,865 ----
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path isn't readable
*/
! private static void checkIfPathIsReadable(File path, String type)
! throws Command.Exception
! {
if (!path.canRead())
throw new Command.Exception("%s path isn't readable: %s",
type, path);
}
*** 854,866 ****
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path is not a directory
*/
! private static final void checkIfPathIsDirectory(File path, String type)
! throws Command.Exception {
!
if (!path.isDirectory())
throw new Command.Exception("%s path is not a directory: %s",
type, path);
}
--- 869,881 ----
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path is not a directory
*/
! private static void checkIfPathIsDirectory(File path, String type)
! throws Command.Exception
! {
if (!path.isDirectory())
throw new Command.Exception("%s path is not a directory: %s",
type, path);
}
*** 870,882 ****
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path is not a directory
*/
! private static final void checkPathArgument(File path, String type)
! throws Command.Exception {
!
checkIfPathExists(path, type);
checkIfPathIsReadable(path, type);
checkIfPathIsDirectory(path, type);
}
--- 885,897 ----
* @param path to check
* @param type of path being checked
*
* @throws Command.Exception if path is not a directory
*/
! private static void checkPathArgument(File path, String type)
! throws Command.Exception
! {
checkIfPathExists(path, type);
checkIfPathIsReadable(path, type);
checkIfPathIsDirectory(path, type);
}