home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
- // @Modified build 480 cm20010124 - removed the '-depend' option
-
- // This script sets up the tools options for for Sun's Java
- // development kit.
-
- var gOutput = getOutput();
- var helpers = getMapFile("ApplicationHelpers");
- var gOptions = getMapFile("JDKToolsStandardOptions");
-
- function DoCommand()
- {
- alert("The jdkOptions script only contains funtions\nthat can be used by other scripts");
- }
-
- function ChooseDebugOptions()
- {
- var standardOptions = gOptions.lookup("jdk-debugger", "");
-
- var editedOptions = DebugOptions(standardOptions);
-
- if (editedOptions != null)
- {
- gOptions.setValue("jdk-debugger", editedOptions);
- }
- }
-
- function DebugOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- value = "";
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- AddSpecialOption(
- list,
- checked,
- "Show command line",
- "",
- gOptions.lookup("showCommandLine", false),
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable recompiling of class file if necessary ( -cs, -checksource )",
- "-cs",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off asynchronous garbage collection ( -noasyncgc )",
- "-noasyncgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off garbage collection of Java classes ( -noclassgc )",
- "-noclassgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable Java profiling ( -prof )",
- "-prof",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output the build version information.( -version )",
- "-version",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output usage information ( -help )",
- "-help",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output additional information ( -v,-verbose )",
- "-v",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier on all code ( -verify )",
- "-verify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier (default, -verifyremote )",
- "-verifyremote",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Disable the java verifier. ( -noverify )",
- "-noverify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables garbage collector output messages. ( -verbosegc )",
- "-verbosegc",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java debug options", list, checked,
- null, true, "Classpaths...", EditClasspaths);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
-
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
- gOptions.setValue("showCommandLine", selected);
-
- while (resultPosition.valid && listPosition.valid)
- {
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
-
- if (selected )
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
-
- return returnValue;
- }
- return null;
- }
-
- function GetRunOptions()
- {
- var options;
- var runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- options = gOptions.lookup("jdk-runapplicationwindow", "");
- }
- else
- {
- options = gOptions.lookup("jdk-runapplication", "");
- }
-
- return options;
- }
-
- function ChooseRunOptions()
- {
- var standardOptions;
- var runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- standardOptions = gOptions.lookup("jdk-runapplicationwindow", "");
- }
- else
- {
- standardOptions = gOptions.lookup("jdk-runapplication", "");
- }
-
- var editedOptions = RunOptions(standardOptions);
-
- if (editedOptions != null)
- {
- // Get the value again because RunOptions may have changed it
- runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- gOptions.setValue("jdk-runapplicationwindow", editedOptions);
- }
- else
- {
- gOptions.setValue("jdk-runapplication", editedOptions);
- }
- }
- }
-
- function RunOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- value = "";
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- AddSpecialOption(
- list,
- checked,
- "Show command line",
- "",
- gOptions.lookup("showCommandLine", false),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Run in window ( use javaw )",
- "",
- gOptions.lookup("runInWindow", false),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Show console window",
- "",
- gOptions.lookup("showConsoleWindow", false),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Use interactive process",
- "",
- gOptions.lookup("useInteractiveProcess", true),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Enable RMIC in builds",
- "",
- gOptions.lookup("enableRMICinBuilds", false),
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable jdb to attach itself to this session ( -debug )",
- "-debug",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable recompiling of class file if necessary ( -cs, -checksource )",
- "-cs",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off asynchronous garbage collection ( -noasyncgc )",
- "-noasyncgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off garbage collection of Java classes ( -noclassgc )",
- "-noclassgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable Java profiling ( -prof )",
- "-prof",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output the build version information.( -version )",
- "-version",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output usage information ( -help )",
- "-help",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn method tracing on (java_g only ) ( -tm )",
- "-tm",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn instruction tracing on (java_g only - huge output) ( -t )",
- "-t",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output additional information ( -v,-verbose )",
- "-v",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier on all code ( -verify )",
- "-verify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier (default, -verifyremote )",
- "-verifyremote",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Disable the java verifier. ( -noverify )",
- "-noverify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables garbage collector output messages. ( -verbosegc )",
- "-verbosegc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Sets the maximum size of the memory allocation pool to 16m. (-mx16m )",
- "-mx16m",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Sets the startup size of the memory allocation pool to 1m. (-ms1m )",
- "-ms1m",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked,
- null, true, "Classpaths...", EditClasspaths);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
-
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
- gOptions.setValue("showCommandLine", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("runInWindow", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("showConsoleWindow", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("useInteractiveProcess", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("enableRMICinBuilds", selected);
-
- while (resultPosition.valid && listPosition.valid)
- {
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
-
- if (selected )
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- function EditClasspaths()
- {
- var classpaths = gOptions.lookup("customClasspaths", "");
- var classpathUtilities = getScriptObject("\\Library\\classpathUtilities");
-
- var newclasspaths = classpathUtilities.EditClasspaths(
- "Edit JDK custom classpaths (do not add a path for classes.zip)",
- classpaths);
- gOptions.setValue("customClasspaths", newclasspaths);
- }
-
- function CompileOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- // debugging tables
- value = AddOption(
- list,
- checked,
- "Output deprecated API messages ( -deprecation )",
- "-deprecation",
- value,
- action, null);
-
- // debugging tables
- value = AddOption(
- list,
- checked,
- "Enable generation of debugging table ( -g )",
- "-g",
- value,
- action, null);
-
- // warnings
- value = AddOption(
- list,
- checked,
- "Turn off warnings ( -nowarn )",
- "-nowarn",
- value,
- action, null);
-
- // optimiation
- value = AddOption(
- list,
- checked,
- "Optimize generated code ( -O )",
- "-O",
- value,
- action, null);
-
- // verbose
- value = AddOption(
- list,
- checked,
- "Output additional information ( -verbose )",
- "-verbose",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose compile options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
-
- function AppletViewerOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- // debugging tables
- value = AddOption(
- list,
- checked,
- "Start the appletviewer in the debugger ( -debug )",
- "-debug ",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose appletviewer options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- function DebuggerOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- value = AddOption(
- list,
- checked,
- "Enable recompiling of class file if necessary ( -cs, -checksource )",
- "-cs",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off asynchronous garbage collection ( -noasyncgc )",
- "-noasyncgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn off garbage collection of Java classes ( -noclassgc )",
- "-noclassgc",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enable Java profiling ( -prof )",
- "-prof",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output the build version information.( -version )",
- "-version",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output usage information ( -help )",
- "-help",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Turn tracing on (java_g only ) ( -t )",
- "-t",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output additional information ( -v,-verbose )",
- "-v",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier on all code ( -verify )",
- "-verify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables the java verifier (default, -verifyremote )",
- "-verifyremote",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Disable the java verifier. ( -noverify )",
- "-noverify",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Enables garbage collector output messages. ( -verbosegc )",
- "-verbosegc",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- // Use this function to add a command line option
- // when preparing to use the editProperties dialog
- function AddOption(optionsList, checkedList,
- option, optionValue,
- optionString,
- actionList, action)
- {
- if (typeof(optionString) == "string")
- {
- optionsList.addTail(newAssociation(option, optionValue));
- var index1 = optionString.indexOf(optionValue + " ");
- var index2 = optionString.indexOf(optionValue);
- if (index1 != -1)
- {
- checkedList.addTail(true);
-
- // Remove this option from the list
- optionString = replaceInString(optionString, index1,
- optionValue.length, "");
- }
- else if (index2 != -1 && index2 + optionValue.length == optionString.length)
- {
- checkedList.addTail(true);
-
- // Remove this option from the list
- optionString = replaceInString(optionString, index2,
- optionValue.length, "");
- }
- else
- {
- checkedList.addTail(false);
- }
- }
-
- if (actionList)
- {
- actionList.addTail(action);
- }
-
- return optionString;
- }
-
- // Use this function to add a special command line option
- // when preparing to use the editProperties dialog
- function AddSpecialOption(optionsList, checkedList,
- option, optionValue,
- checkOn,
- actionList, action)
- {
- optionsList.addTail(newAssociation(option, optionValue));
- checkedList.addTail(checkOn);
-
- if (actionList)
- {
- actionList.addTail(action);
- }
- }
-
- function UpdateOptions()
- {
- var buildmode = gOptions.lookup("jdk-buildmode", "release");
- if (buildmode == "release")
- {
- // Update tools
- var compilePath = helpers.lookup("jdk-compiler_release", null);
- helpers.setValue("jdk-compiler", compilePath);
- var appletviewerPath = helpers.lookup("jdk-appletviewer_release", null);
- helpers.setValue("jdk-appletviewer", appletviewerPath);
- var runApplicationPath = helpers.lookup("jdk-runapplication_release", null);
- helpers.setValue("jdk-runapplication", runApplicationPath);
- var runApplicationWindowPath = helpers.lookup("jdk-runapplicationwindow_release", null);
- helpers.setValue("jdk-runapplicationwindow", runApplicationWindowPath);
-
- // Update tool options
- var compileOptions = gOptions.lookup("jdk-compiler_release", "");
- gOptions.setValue("jdk-compiler",compileOptions);
- var appletviewerOptions = gOptions.lookup("jdk-appletviewer_release", "");
- gOptions.setValue("jdk-appletviewer",appletviewerOptions);
- var runApplicationOptions = gOptions.lookup("jdk-runapplication_release", "");
- gOptions.setValue("jdk-runapplication",runApplicationOptions);
- var runApplicationWindowOptions = gOptions.lookup("jdk-runapplicationwindow_release", "");
- gOptions.setValue("jdk-runapplicationwindow",runApplicationWindowOptions);
- }
-
- if (buildmode == "debug")
- {
- // Update tools
- var compilePath = helpers.lookup("jdk-compiler_debug", null);
- helpers.setValue("jdk-compiler", compilePath);
- var appletviewerPath = helpers.lookup("jdk-appletviewer_debug", null);
- helpers.setValue("jdk-appletviewer", appletviewerPath);
- var runApplicationPath = helpers.lookup("jdk-runapplication_debug", null);
- helpers.setValue("jdk-runapplication", runApplicationPath);
- var runApplicationWindowPath = helpers.lookup("jdk-runapplicationwindow_debug", null);
- helpers.setValue("jdk-runapplicationwindow", runApplicationWindowPath);
-
- // Update tool options
- var compileOptions = gOptions.lookup("jdk-compiler_debug", "-g");
- gOptions.setValue("jdk-compiler",compileOptions);
- var appletviewerOptions = gOptions.lookup("jdk-appletviewer_debug", "");
- gOptions.setValue("jdk-appletviewer",appletviewerOptions);
- var runApplicationOptions = gOptions.lookup("jdk-runapplication_debug", "");
- gOptions.setValue("jdk-runapplication",runApplicationOptions);
- var runApplicationWindowOptions = gOptions.lookup("jdk-runapplicationwindow_debug", "");
- gOptions.setValue("jdk-runapplicationwindow",runApplicationWindowOptions);
- }
- }
-
- !!/Script
-