Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8225251: Minimise import statements in jpackage sources
Reviewed-by: herrick, asemenyuk
  • Loading branch information
Alexander Matveev committed Jun 24, 2020
1 parent ef3b0ec commit 9584e01d24c190f24a3358d2d62430a758a174ee
Show file tree
Hide file tree
Showing 67 changed files with 352 additions and 189 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,13 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.List;
import java.util.Collection;
import java.util.Objects;
import java.util.Collections;
import java.util.Set;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -35,6 +35,7 @@
import java.util.Map;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.ICON;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;

public class LinuxAppImageBuilder extends AbstractAppImageBuilder {

@@ -84,7 +85,7 @@ public void prepareApplicationFiles(Map<String, ? super Object> params)

// create the additional launchers, if any
List<Map<String, ? super Object>> entryPoints
= StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params);
= ADD_LAUNCHERS.fetchFrom(params);
for (Map<String, ? super Object> entryPoint : entryPoints) {
createLauncherForEntryPoint(AddLauncherArguments.merge(params,
entryPoint, ICON.getID(), ICON_PNG.getID()), params);
@@ -25,7 +25,8 @@

package jdk.incubator.jpackage.internal;

import java.io.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -35,15 +36,23 @@
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.text.MessageFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static jdk.incubator.jpackage.internal.OverridableResource.createResource;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.COPYRIGHT;

public class LinuxDebBundler extends LinuxPackageBundler {

@@ -24,19 +24,29 @@
*/
package jdk.incubator.jpackage.internal;

import java.io.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static jdk.incubator.jpackage.internal.DesktopIntegration.*;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_RUNTIME_IMAGE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.DESCRIPTION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.INSTALL_DIR;

abstract class LinuxPackageBundler extends AbstractBundler {

@@ -25,15 +25,24 @@

package jdk.incubator.jpackage.internal;

import java.io.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
import static jdk.incubator.jpackage.internal.OverridableResource.createResource;

/**
@@ -67,6 +67,7 @@
import static jdk.incubator.jpackage.internal.StandardBundlerParam.MAIN_CLASS;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_APP_IMAGE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;

public class MacAppImageBuilder extends AbstractAppImageBuilder {

@@ -259,7 +260,7 @@ public void prepareApplicationFiles(Map<String, ? super Object> params)

// create additional app launcher(s) and config file(s)
List<Map<String, ? super Object>> entryPoints =
StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params);
ADD_LAUNCHERS.fetchFrom(params);
for (Map<String, ? super Object> entryPoint : entryPoints) {
Map<String, ? super Object> tmp =
AddLauncherArguments.merge(originalParams, entryPoint);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,19 @@
package jdk.incubator.jpackage.internal;

import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.*;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import static jdk.incubator.jpackage.internal.MacAppBundler.*;
import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.ResourceBundle;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERBOSE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.MacAppBundler.DEVELOPER_ID_APP_SIGNING_KEY;
import static jdk.incubator.jpackage.internal.MacAppBundler.DEFAULT_ICNS_ICON;
import static jdk.incubator.jpackage.internal.MacAppBundler.BUNDLE_ID_SIGNING_PREFIX;

public class MacAppStoreBundler extends MacBaseInstallerBundler {

@@ -25,15 +25,28 @@

package jdk.incubator.jpackage.internal;

import java.io.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.*;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.ResourceBundle;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERBOSE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN;
import static jdk.incubator.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER;
import static jdk.incubator.jpackage.internal.MacAppImageBuilder.MAC_CF_BUNDLE_IDENTIFIER;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@

package jdk.incubator.jpackage.internal;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.io.File;
@@ -35,6 +35,8 @@
import java.util.function.Function;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_APP_IMAGE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_RUNTIME_IMAGE;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;


class AppImageBundler extends AbstractBundler {
@@ -62,7 +64,7 @@ final public boolean validate(Map<String, ? super Object> params)

if (!params.containsKey(PREDEFINED_APP_IMAGE.getID())
&& !StandardBundlerParam.isRuntimeInstaller(params)) {
StandardBundlerParam.LAUNCHER_DATA.fetchFrom(params);
LAUNCHER_DATA.fetchFrom(params);
}

if (paramsValidator != null) {
@@ -132,7 +134,7 @@ private Path createRoot(Map<String, ? super Object> params,

IOUtils.writableOutputDir(outputDirectory);

String imageName = StandardBundlerParam.APP_NAME.fetchFrom(params);
String imageName = APP_NAME.fetchFrom(params);
if (Platform.isMac()) {
imageName = imageName + ".app";
}
@@ -27,8 +27,8 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -41,7 +41,9 @@
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;

public class AppImageFile {

@@ -152,7 +154,7 @@ static AppImageFile load(Path appImageDir) throws IOException {
return new AppImageFile();
}

List<String> addLaunchers = new ArrayList<String>();
List<String> addLaunchers = new ArrayList<>();

String platform = xpathQueryNullable(xPath,
"/jpackage-state/@platform", doc);
@@ -27,25 +27,18 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.stream.Stream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@@ -25,14 +25,10 @@

package jdk.incubator.jpackage.internal;

import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import java.util.HashMap;
import java.util.Map;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;

public class BundleParams {

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
package jdk.incubator.jpackage.internal;

import java.io.File;
import java.util.Collection;
import java.util.Map;

/**
@@ -31,7 +31,10 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.JAVA_OPTIONS;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.ARGUMENTS;

/**
* App launcher's config file.
@@ -42,8 +45,8 @@ final class CfgFile {
}

CfgFile initFromParams(Map<String, ? super Object> params) {
launcherData = StandardBundlerParam.LAUNCHER_DATA.fetchFrom(params);
launcherName = StandardBundlerParam.APP_NAME.fetchFrom(params);
launcherData = LAUNCHER_DATA.fetchFrom(params);
launcherName = APP_NAME.fetchFrom(params);
javaOptions = JAVA_OPTIONS.fetchFrom(params);
arguments = ARGUMENTS.fetchFrom(params);
return this;
@@ -29,12 +29,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.InvalidPathException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

0 comments on commit 9584e01

Please sign in to comment.