11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package hello;
27
28 import com.oracle.tools.packager.Bundler;
29 import com.oracle.tools.packager.Bundlers;
30 import com.oracle.tools.packager.ConfigException;
31 import com.oracle.tools.packager.JLinkBundlerHelper;
32 import com.oracle.tools.packager.Log;
33 import com.oracle.tools.packager.RelativeFileSet;
34 import com.oracle.tools.packager.StandardBundlerParam;
35 import com.oracle.tools.packager.UnsupportedPlatformException;
36
37 import java.io.File;
38 import java.io.IOException;
39 import java.util.Arrays;
40 import java.util.HashMap;
41 import java.util.HashSet;
42 import java.util.LinkedList;
43 import java.util.Map;
44 import java.util.Queue;
45 import java.util.Set;
46 import java.util.TreeMap;
47 import java.util.TreeSet;
48
49 import static com.oracle.tools.packager.StandardBundlerParam.*;
50 import static com.oracle.tools.packager.StandardBundlerParam.ICON;
51 import static com.oracle.tools.packager.StandardBundlerParam.VERBOSE;
62 }
63
64 File output = new File(".");
65 Set<String> bundlerIDs = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
66 Map<String, ? super Object> params = new TreeMap<>();
67
68 Queue<String> argsQ = new LinkedList<>(Arrays.asList(args));
69 while (!argsQ.isEmpty()) {
70 String arg = argsQ.remove();
71 switch (arg) {
72 case "-o":
73 output = new File(argsQ.remove());
74 output.mkdirs();
75 break;
76
77 case "-b":
78 params.put(argsQ.remove(), argsQ.remove());
79 break;
80
81 case "-modulepath":
82 params.put(JLinkBundlerHelper.MODULE_PATH.getID(), argsQ.remove());
83 break;
84
85 case "-all":
86 // JVM args
87 params.put(StandardBundlerParam.JVM_OPTIONS.getID(), "-Doption.1=bundlerargs\n-Doption.2=bundlerargs\n-Dcollide=jvmoptions");
88 // properties
89 params.put(StandardBundlerParam.JVM_PROPERTIES.getID(), "prop.1=bundlerargs\nprop.2=bundlerargs\ncollide=properties");
90 // userJVM Args
91 params.put(StandardBundlerParam.USER_JVM_OPTIONS.getID(), "-Duser.arg.1\\==bundlerargs\n-Duser.arg.2=\\=bundlerargs\n-Dcollide=\\=userjvmoptions\n-Dcollide\\=jvmoptions=AWESOME");
92 // arguments
93 params.put(StandardBundlerParam.ARGUMENTS.getID(), "argument1\n" +
94 "argument2\n" +
95 "argument3=value\n" +
96 "arg4=with=embedded\n" +
97 "arg5=with=equals=at=end=\n" +
98 "one_equal_at_end=\n" +
99 "=\n" +
100 "\"Prev Arg was just an equals\"\n" +
101 "argument1\n" +
102 "argument1\n" +
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package hello;
27
28 import com.oracle.tools.packager.Bundler;
29 import com.oracle.tools.packager.Bundlers;
30 import com.oracle.tools.packager.ConfigException;
31 import com.oracle.tools.packager.Log;
32 import com.oracle.tools.packager.RelativeFileSet;
33 import com.oracle.tools.packager.StandardBundlerParam;
34 import com.oracle.tools.packager.UnsupportedPlatformException;
35
36 import java.io.File;
37 import java.io.IOException;
38 import java.util.Arrays;
39 import java.util.HashMap;
40 import java.util.HashSet;
41 import java.util.LinkedList;
42 import java.util.Map;
43 import java.util.Queue;
44 import java.util.Set;
45 import java.util.TreeMap;
46 import java.util.TreeSet;
47
48 import static com.oracle.tools.packager.StandardBundlerParam.*;
49 import static com.oracle.tools.packager.StandardBundlerParam.ICON;
50 import static com.oracle.tools.packager.StandardBundlerParam.VERBOSE;
61 }
62
63 File output = new File(".");
64 Set<String> bundlerIDs = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
65 Map<String, ? super Object> params = new TreeMap<>();
66
67 Queue<String> argsQ = new LinkedList<>(Arrays.asList(args));
68 while (!argsQ.isEmpty()) {
69 String arg = argsQ.remove();
70 switch (arg) {
71 case "-o":
72 output = new File(argsQ.remove());
73 output.mkdirs();
74 break;
75
76 case "-b":
77 params.put(argsQ.remove(), argsQ.remove());
78 break;
79
80 case "-modulepath":
81 params.put(StandardBundlerParam.MODULE_PATH.getID(), argsQ.remove());
82 break;
83
84 case "-all":
85 // JVM args
86 params.put(StandardBundlerParam.JVM_OPTIONS.getID(), "-Doption.1=bundlerargs\n-Doption.2=bundlerargs\n-Dcollide=jvmoptions");
87 // properties
88 params.put(StandardBundlerParam.JVM_PROPERTIES.getID(), "prop.1=bundlerargs\nprop.2=bundlerargs\ncollide=properties");
89 // userJVM Args
90 params.put(StandardBundlerParam.USER_JVM_OPTIONS.getID(), "-Duser.arg.1\\==bundlerargs\n-Duser.arg.2=\\=bundlerargs\n-Dcollide=\\=userjvmoptions\n-Dcollide\\=jvmoptions=AWESOME");
91 // arguments
92 params.put(StandardBundlerParam.ARGUMENTS.getID(), "argument1\n" +
93 "argument2\n" +
94 "argument3=value\n" +
95 "arg4=with=embedded\n" +
96 "arg5=with=equals=at=end=\n" +
97 "one_equal_at_end=\n" +
98 "=\n" +
99 "\"Prev Arg was just an equals\"\n" +
100 "argument1\n" +
101 "argument1\n" +
|