当前位置: 首页>>代码示例>>Java>>正文


Java FileSet.Selector方法代码示例

本文整理汇总了Java中com.sun.squawk.builder.util.FileSet.Selector方法的典型用法代码示例。如果您正苦于以下问题:Java FileSet.Selector方法的具体用法?Java FileSet.Selector怎么用?Java FileSet.Selector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.squawk.builder.util.FileSet的用法示例。


在下文中一共展示了FileSet.Selector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preverify

import com.sun.squawk.builder.util.FileSet; //导入方法依赖的package包/类
public void preverify(String classPath, File classesDir, File j2meclassesDir) {

        // See if any of the classes actually need re-preverifying
        FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(classesDir, j2meclassesDir));
        if (!new FileSet(classesDir, outOfDate).list().iterator().hasNext()) {
            return;
        }

        log(info, "[running preverifier ...]");

        // Ensure that the preverifier is executable which may not be the case if
        // Squawk was checked out with a Java CVS client (Java doesn't know anything
        // about 'execute' file permissions and so cannot preserve them).
        chmod(platform.preverifier(), "+x");

        if (classPath == null) {
            classPath = "";
        } else {
            classPath = " -classpath " + toPlatformPath(classPath, true);
        }
        exec(platform.preverifier() + (verbose?" -verbose ":"") + classPath + " -d " + j2meclassesDir + " " + classesDir);
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:23,代码来源:Build.java

示例2: processImports

import com.sun.squawk.builder.util.FileSet; //导入方法依赖的package包/类
/**
 * Preprocess a given set of Java import file source files.
 *
 * @param   dstDir     the directory containing the generated Java src files (typically "native")
 * @param   srcDirs    the set of directories that are searched recursively for the source files to be imported
 * @param   j2me       specifies if the classes being compiled are to be deployed on a J2ME platform
 * @return the preprocessor output directory
 */
public File processImports(
        File dstDir,
        File[] srcDirs,
        boolean j2me) {
    // Get the preprocessor output directory
    SourceProcessor sp = new SourceProcessor();


    for (int i = 0; i != srcDirs.length; ++i) {

        File sourceDir = srcDirs[i];

        // A selector that matches a source file whose preprocessed copy does not exist,
        // is younger than the source file or has a last modification date
        // earlier than the last modification date of the properties
        FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(sourceDir, dstDir)) {

            public boolean isSelected(
                    File file) {
                if (super.isSelected(file)) {
                    return true;
                }
                File preprocessedFile = getMapper().map(file);
                long fileLastModified = preprocessedFile.lastModified();
                return (fileLastModified < env.propertiesLastModified);
            }
        };

        FileSet.Selector selector = new FileSet.AndSelector(JAVA_SOURCE_SELECTOR, outOfDate);
        FileSet fs = new FileSet(sourceDir, selector);
        sp.execute(fs, dstDir);
    }
    return dstDir;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:43,代码来源:Build.java

示例3: preverify

import com.sun.squawk.builder.util.FileSet; //导入方法依赖的package包/类
/**
 * Run the CLDC preverifier over a set of classes in the "classes" directory
 * and write the resulting classes to the "j2meclasses" directory.
 *
 * @param   classPath  directories in which to look for classes
 * @param   baseDir    the directory under which the "j2meclasses" and "classes" directories
 */
public void preverify(String classPath, File baseDir) {


    // Get the preverifier input and output directories
    File classesDir = isJava5SyntaxSupported()?new File(baseDir, "weaved"):new File(baseDir, "classes");
    File j2meclassesDir = mkdir(baseDir, "j2meclasses");

    // See if any of the classes actually need re-preverifying
    FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(classesDir, j2meclassesDir));
    if (!new FileSet(classesDir, outOfDate).list().iterator().hasNext()) {
        return;
    }

    log(info, "[running preverifier ...]");

    // Ensure that the preverifier is executable which may not be the case if
    // Squawk was checked out with a Java CVS client (Java doesn't know anything
    // about 'execute' file permissions and so cannot preserve them).
    chmod(platform.preverifier(), "+x");

    if (classPath == null) {
        classPath = "";
    } else {
        classPath = " -classpath " + toPlatformPath(classPath, true);
    }
    exec(platform.preverifier() + (verbose?" -verbose ":"") + classPath + " -d " + j2meclassesDir + " " + classesDir);
}
 
开发者ID:sics-sse,项目名称:moped,代码行数:35,代码来源:Build.java

示例4: preprocess

import com.sun.squawk.builder.util.FileSet; //导入方法依赖的package包/类
public File preprocess(File baseDir, File[] srcDirs, boolean j2me, boolean vm2c, boolean stripHostCode) {

	 // Get the preprocessor output directory
        final File preprocessedDir;
        boolean resetJava5Syntax = false;
        if (vm2c && !isJava5SyntaxSupported()) {
            log(brief, "[preprocessing with forced JAVA5SYNTAX for vm2c]");
            preprocessedDir = mkdir(baseDir, RomCommand.PREPROCESSED_FOR_VM2C_DIR_NAME);
            updateProperty("JAVA5SYNTAX", "true");
            isJava5SyntaxSupported = true;
            resetJava5Syntax = true;
        } else {
            preprocessedDir = mkdir(baseDir, stripHostCode ? "preprocessed.target" : "preprocessed");	    
        }

        // Preprocess the sources
        preprocessor.processAssertions = j2me;
        preprocessor.verbose = verbose;
        // @TODO: Should be true for desktop builds. host == target?
        preprocessor.showLineNumbers = true;

	preprocessor.hosted = !stripHostCode;
	
	for (int i = 0; i != srcDirs.length; ++i) {

            File sourceDir = srcDirs[i];

            // A selector that matches a source file whose preprocessed copy does not exist,
            // is younger than the source file or has a last modification date
            // earlier than the last modification date of the properties
            FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(sourceDir, preprocessedDir)) {
                public boolean isSelected(File file) {
                    if (super.isSelected(file)) {
                        return true;
                    }
                    File preprocessedFile = getMapper().map(file);
                    long fileLastModified = preprocessedFile.lastModified();
                    return (fileLastModified < propertiesLastModified);
                }
            };

            FileSet.Selector selector = new FileSet.AndSelector(JAVA_SOURCE_SELECTOR, outOfDate);
            FileSet fs = new FileSet(sourceDir, selector);
            preprocessor.execute(fs, preprocessedDir);

            FileSet htmlFiles = new FileSet(sourceDir, HTML_SELECTOR);
            for (Iterator iterator = htmlFiles.list().iterator(); iterator.hasNext();) {
                File htmlFile = (File) iterator.next();
                File toHtmlFile = htmlFiles.replaceBaseDir(htmlFile, preprocessedDir);
                cp(htmlFile, toHtmlFile, false);
            }

        }

        if (resetJava5Syntax) {
            updateProperty("JAVA5SYNTAX", "false");
            isJava5SyntaxSupported = false;
        }

        return preprocessedDir;
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:62,代码来源:Build.java

示例5: preprocess

import com.sun.squawk.builder.util.FileSet; //导入方法依赖的package包/类
/**
 * Preprocess a given set of Java source files.
 *
 * @param   baseDir    the directory under which the "preprocessed" directory exists
 * @param   srcDirs    the set of directories that are searched recursively for the source files to be compiled
 * @param   j2me       specifies if the classes being compiled are to be deployed on a J2ME platform
 * @param   vm2c       use true if preprocessing as part of vm2c compile
 * @return the preprocessor output directory
 */
public File preprocess(File baseDir, File[] srcDirs, boolean j2me, boolean vm2c) {
    // Get the preprocessor output directory
    final File preprocessedDir;
    boolean resetJava5Syntax = false;
    if (vm2c && !isJava5SyntaxSupported()) {
        log(brief, "[preprocessing with forced JAVA5SYNTAX for vm2c]");
        preprocessedDir = mkdir(baseDir, RomCommand.PREPROCESSED_FOR_VM2C_DIR_NAME);
        updateProperty("JAVA5SYNTAX", "true");
        isJava5SyntaxSupported = true;
        resetJava5Syntax = true;
    } else {
        preprocessedDir = mkdir(baseDir, "preprocessed");
    }

    // Preprocess the sources
    preprocessor.processAssertions = j2me;
    preprocessor.verbose = verbose;
    // @TODO: Should be true for desktop builds. host == target?
    preprocessor.showLineNumbers = true;

    for (int i = 0; i != srcDirs.length; ++i) {

        File sourceDir = srcDirs[i];

        // A selector that matches a source file whose preprocessed copy does not exist,
        // is younger than the source file or has a last modification date
        // earlier than the last modification date of the properties
        FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(sourceDir, preprocessedDir)) {
            public boolean isSelected(File file) {
                if (super.isSelected(file)) {
                    return true;
                }
                File preprocessedFile = getMapper().map(file);
                long fileLastModified = preprocessedFile.lastModified();
                return (fileLastModified < propertiesLastModified);
            }
        };

        FileSet.Selector selector = new FileSet.AndSelector(JAVA_SOURCE_SELECTOR, outOfDate);
        FileSet fs = new FileSet(sourceDir, selector);
        preprocessor.execute(fs, preprocessedDir);

        FileSet htmlFiles = new FileSet(sourceDir, HTML_SELECTOR);
        for (Iterator iterator = htmlFiles.list().iterator(); iterator.hasNext();) {
            File htmlFile = (File) iterator.next();
            File toHtmlFile = htmlFiles.replaceBaseDir(htmlFile, preprocessedDir);
            cp(htmlFile, toHtmlFile, false);
        }

    }

    if (resetJava5Syntax) {
        updateProperty("JAVA5SYNTAX", "false");
        isJava5SyntaxSupported = false;
    }

    return preprocessedDir;
}
 
开发者ID:sics-sse,项目名称:moped,代码行数:68,代码来源:Build.java


注:本文中的com.sun.squawk.builder.util.FileSet.Selector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。