FileDocCategorySizeDatePackage
IDETool.javaAPI DocphoneME MR2 API (J2ME)9992Wed May 02 17:59:48 BST 2007makedep

IDETool

public abstract class IDETool extends Object
Base class for the creation of IDE projects files for building the VM. Currently only Win32/VC6 project files are supported. See Win32IDETool.java for more details.

Fields Summary
static File
pwd
String
buildspace
command-line argument
String
product
command-line argument
String
platform
command-line argument
String
database
command-line argument
String
workspace
command-line argument
Properties
userSettings
User settings
config.Configurator
configurator
private Vector
apiSources
private Vector
vmSources
private Vector
jccSources
Constructors Summary
Methods Summary
public static voidfatal(java.lang.String message)

        System.out.println("Error: " + message);
        System.exit(1);
    
java.util.VectorfindAPISources()

        Vector v = new Vector();
        String s = File.separator;
        String cldc_ver;
        if (isOptionEnabled("ENABLE_REFLECTION")) {
            cldc_ver = "cldc1.1plus";
        } else if (isOptionEnabled("ENABLE_CLDC_11")) {
            cldc_ver = "cldc1.1";
        } else {
            cldc_ver = "cldc1.0";
        }

        findSources(v, workspace + s + "src" + s + "javaapi" + s + cldc_ver,
                    ".java");
        findSources(v, workspace + s + "src" + s + "javaapi" + s + "share",
                    ".java");
        return v;
    
java.util.VectorfindJccSources()

        Vector v = new Vector();
        String s = File.separator;
        findSources(v, workspace + s + "src" + s + "tools" + s + "jcc",
                    ".java");
        return v;
    
voidfindSources(java.util.Vector v, java.lang.String path, java.lang.String extension)

        File dir = new File(path);
        if (dir.isDirectory()) {
            if (path.endsWith("SCCS")) {
                return;
            }
            if (path.endsWith("CVS")) {
                return;
            }

            String files[] = dir.list();
            for (int i=0; i<files.length; i++) {
                findSources(v, path + File.separator + files[i], extension);
            }
        } else {
            if (extension.equals(".java")) {
                if (!isOptionEnabled("ENABLE_ISOLATES") &&
                    (path.indexOf("isolate") != -1 ||
                     path.endsWith("Reflect.java"))) {
                    return;
                }
                if (!isOptionEnabled("ENABLE_DYNUPDATE") &&
                    path.indexOf("dynupdate") != -1) {
                    return;
                }
                if (!isOptionEnabled("ENABLE_METHOD_TRAPS") &&
                    path.endsWith("MethodTrap.java")) {
                    return;
                }
                if (!isOptionEnabled("ENABLE_JAVA_DEBUGGER") &&
                    path.endsWith("DebuggerInvoke.java")) {
                    return;
                }
            }
            if (path.endsWith(extension)) {
                v.addElement(path);
            }
        }
    
public java.util.VectorgetAPISources()

        if (apiSources == null) {
            apiSources = findAPISources();
        }
        return apiSources;
    
public java.lang.StringgetAbsolutePath(java.lang.String path)

        File file = new File(path);
        if (!file.isAbsolute()) {
            path = pwd + File.separator + path;
        }

        while (path.indexOf("..") >= 0) {
            Vector v = splitPath(path);
            removeOneDotDot(v);
            path = joinPath(v);
        }

        return path;
    
public java.lang.StringgetBuildSpaceArg()


       
        return buildspace;
    
public java.lang.StringgetDatabaseArg()

        return database;
    
public abstract java.lang.StringgetExecutablePath(java.lang.String name)

public java.util.VectorgetJccSources()

        if (jccSources == null) {
            jccSources = findJccSources();
        }
        return jccSources;
    
java.lang.StringgetOutputFileFullPath(java.lang.String f)

        // IMPL_NOTE: allow different name than "win32_i386_ide"
        return buildspace + File.separator +
            "win32_i386_ide" + File.separator + f;
    
public java.lang.StringgetPlatformArg()

        return platform;
    
public java.lang.StringgetProductArg()

        return product;
    
public java.util.PropertiesgetUserSettings()

        return userSettings;
    
public java.lang.StringgetWorkSpaceArg()

        return workspace;
    
voidinitConfigurator()

        configurator = new Configurator();

        String workspace = getWorkSpaceArg();
        String input = workspace + "/src/vm/share/utilities/BuildFlags.hpp";

        configurator.readProductFile(product);
        configurator.readPlatformFile(platform);
        configurator.readInputFile(input);
    
public booleanisDefaultBuildspace()

        return workspace.equals("..\\..") && buildspace.equals("..");
    
public booleanisOptionEnabled(java.lang.String name)

        String value = (String)getUserSettings().get(name);
        if ("default".equals(value)) {
            value = configurator.getDefaultValue(name);
        }
        return "true".equals(value);
    
static java.lang.StringjoinPath(java.util.Vector v)

        String sep = "";
        StringBuffer sbuf = new StringBuffer();
        for (int i=0; i<v.size(); i++) {
            sbuf.append(sep);
            sbuf.append(v.elementAt(i));
            sep = File.separator;
        }
        return sbuf.toString();
    
voidmakeDirExist(java.lang.String dirName)

        dirName = getOutputFileFullPath(dirName);
        File dir = new File(dirName);
        if (dir.exists()) {
            if (!dir.isDirectory()) {
                fatal("not a directory: " + dir);
            }
        } else {
            if (!dir.mkdir()) {
                fatal("failed to create directory: "+ dir);
            }
        }
    
public java.io.PrintWriteropenOutputFile(java.lang.String fileName)

        fileName = getOutputFileFullPath(fileName);
        File file = new File(fileName);
        File dir = file.getParentFile();
        if (!dir.exists()) {
            dir.mkdir();
        }
        return new PrintWriter(new FileWriter(fileName));
    
public voidparseArguments(java.lang.String[] args)

        for (int i=0; i<args.length; ) {
            try {
                int n = parseOneArgument(args, i);
                if (n <= 0) {
                    fatal("unknown argument " + args[i]);
                } else {
                    i += n;
                }
            } catch (ArrayIndexOutOfBoundsException e) {
                fatal("parameter missing for argument " + args[i]);
            }
        }

        if (getWorkSpaceArg().indexOf(' ") >= 0) {
            fatal("workspace name \"" + getWorkSpaceArg() +
                  "\" may not contain space character");
        }
        if (getBuildSpaceArg().indexOf(' ") >= 0) {
            fatal("buildspace name \"" + getBuildSpaceArg() +
                  "\" may not contain space character");
        }

    
public intparseOneArgument(java.lang.String[] args, int i)
Override this method in a subclass if you want to parse extra arguments.

throw
ArrayIndexOutOfBoundsException if expected paramater is missing.

        int starting_i = i;

        String arg = args[i++];
        if (arg.equals("-buildspace")) {
            this.buildspace = args[i++];
        }
        else if (arg.equals("-product")) {
            this.product = args[i++];
        }
        else if (arg.equals("-platform")) {
            this.platform = args[i++];
        }
        else if (arg.equals("-database")) {
            this.database = args[i++];
        }
        else if (arg.equals("-workspace")) {
            this.workspace = args[i++];
        }
        else {
            // unknown argument
            return -1;
        }

        return i - starting_i;
    
static voidremoveOneDotDot(java.util.Vector v)

        for (int i=0; i<v.size()-1; i++) {
            if (v.elementAt(i+1).equals("..")) {
                v.removeElementAt(i);
                v.removeElementAt(i);
                return;
            }
        }
    
public voidsetUserSettings(java.util.Properties s)
Sets this.userSettings, which contains the preferences of the user. If the user does not specify a value for a certain build option, a default value is taken. See Configurator.java for details.

        userSettings = s;
    
static java.util.VectorsplitPath(java.lang.String path)

        Vector v = new Vector();

        StringTokenizer st = new StringTokenizer(path, File.separator);
        while (st.hasMoreTokens()) {
            String f = st.nextToken();
            v.addElement(f);
        }
        return v;