• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleFileCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gradle.api.internal.file.collections.SimpleFileCollection的典型用法代码示例。如果您正苦于以下问题:Java SimpleFileCollection类的具体用法?Java SimpleFileCollection怎么用?Java SimpleFileCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleFileCollection类属于org.gradle.api.internal.file.collections包,在下文中一共展示了SimpleFileCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveAndFilterSourceFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveAndFilterSourceFiles(final GroovyJavaJointCompileSpec spec) {
    final List<String> fileExtensions = CollectionUtils.collect(spec.getGroovyCompileOptions().getFileExtensions(), new Transformer<String, String>() {
        @Override
        public String transform(String extension) {
            return '.' + extension;
        }
    });
    FileCollection filtered = spec.getSource().filter(new Spec<File>() {
        public boolean isSatisfiedBy(File element) {
            for (String fileExtension : fileExtensions) {
                if (hasExtension(element, fileExtension)) {
                    return true;
                }
            }
            return false;
        }
    });

    spec.setSource(new SimpleFileCollection(filtered.getFiles()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:NormalizingGroovyCompiler.java


示例2: initializeCompilation

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
public void initializeCompilation(JavaCompileSpec spec, Collection<String> staleClasses) {
    if (staleClasses.isEmpty()) {
        spec.setSource(new SimpleFileCollection());
        return; //do nothing. No classes need recompilation.
    }

    Factory<PatternSet> patternSetFactory = fileOperations.getFileResolver().getPatternSetFactory();
    PatternSet classesToDelete = patternSetFactory.create();
    PatternSet sourceToCompile = patternSetFactory.create();

    preparePatterns(staleClasses, classesToDelete, sourceToCompile);

    //selectively configure the source
    spec.setSource(spec.getSource().getAsFileTree().matching(sourceToCompile));
    //since we're compiling selectively we need to include the classes compiled previously
    spec.setClasspath(Iterables.concat(spec.getClasspath(), asList(spec.getDestinationDir())));
    //get rid of stale files
    FileTree deleteMe = fileOperations.fileTree(spec.getDestinationDir()).matching(classesToDelete);
    fileOperations.delete(deleteMe);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:IncrementalCompilationInitializer.java


示例3: addResourcesIfNecessary

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void addResourcesIfNecessary() {
	if (this.addResources) {
		SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject());
		final File outputDir = (mainSourceSet == null ? null
				: mainSourceSet.getOutput().getResourcesDir());
		final Set<File> resources = new LinkedHashSet<File>();
		if (mainSourceSet != null) {
			resources.addAll(mainSourceSet.getResources().getSrcDirs());
		}
		List<File> classPath = new ArrayList<File>(getClasspath().getFiles());
		classPath.addAll(0, resources);
		getLogger().info("Adding classpath: " + resources);
		setClasspath(new SimpleFileCollection(classPath));
		if (outputDir != null) {
			for (File directory : resources) {
				FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory);
			}
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:BootRunTask.java


示例4: fromLocalClassloader

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
static FileCollection fromLocalClassloader() {
	Set<File> files = new LinkedHashSet<>();
	Consumer<Class<?>> addPeerClasses = clazz -> {
		URLClassLoader urlClassloader = (URLClassLoader) clazz.getClassLoader();
		for (URL url : urlClassloader.getURLs()) {
			String name = url.getFile();
			if (name != null) {
				files.add(new File(name));
			}
		}
	};
	// add the classes that goomph needs
	addPeerClasses.accept(JavaExecable.class);
	// add the gradle API
	addPeerClasses.accept(JavaExec.class);

	return new SimpleFileCollection(files);
}
 
开发者ID:diffplug,项目名称:goomph,代码行数:19,代码来源:JavaExecableImp.java


示例5: initializeCompilation

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
public void initializeCompilation(JavaCompileSpec spec, Collection<String> staleClasses) {
    if (staleClasses.isEmpty()) {
        spec.setSource(new SimpleFileCollection());
        return; //do nothing. No classes need recompilation.
    }

    PatternSet classesToDelete = new PatternSet();
    PatternSet sourceToCompile = new PatternSet();

    preparePatterns(staleClasses, classesToDelete, sourceToCompile);

    //selectively configure the source
    spec.setSource(spec.getSource().getAsFileTree().matching(sourceToCompile));
    //since we're compiling selectively we need to include the classes compiled previously
    spec.setClasspath(Iterables.concat(spec.getClasspath(), asList(spec.getDestinationDir())));
    //get rid of stale files
    FileTree deleteMe = fileOperations.fileTree(spec.getDestinationDir()).matching(classesToDelete);
    fileOperations.delete(deleteMe);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:20,代码来源:IncrementalCompilationInitializer.java


示例6: getMetadataInternal

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private EnumMap<SysProp, String> getMetadataInternal(File jdkPath) {
    JavaExecAction exec = factory.newJavaExecAction();
    exec.executable(javaExe(jdkPath, "java"));
    File workingDir = Files.createTempDir();
    exec.setWorkingDir(workingDir);
    exec.setClasspath(new SimpleFileCollection(workingDir));
    try {
        writeProbe(workingDir);
        exec.setMain(JavaProbe.CLASSNAME);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        exec.setStandardOutput(baos);
        ByteArrayOutputStream errorOutput = new ByteArrayOutputStream();
        exec.setErrorOutput(errorOutput);
        exec.setIgnoreExitValue(true);
        ExecResult result = exec.execute();
        int exitValue = result.getExitValue();
        if (exitValue == 0) {
            return parseExecOutput(baos.toString());
        }
        return error("Command returned unexpected result code: " + exitValue + "\nError output:\n" + errorOutput);
    } catch (ExecException ex) {
        return error(ex.getMessage());
    } finally {
        try {
            FileUtils.deleteDirectory(workingDir);
        } catch (IOException e) {
            throw new GradleException("Unable to delete temp directory", e);
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:JavaInstallationProbe.java


示例7: resolveAndFilterSourceFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveAndFilterSourceFiles(JavaCompileSpec spec) {
    // this mimics the behavior of the Ant javac task (and therefore AntJavaCompiler),
    // which silently excludes files not ending in .java
    FileCollection javaOnly = spec.getSource().filter(new Spec<File>() {
        public boolean isSatisfiedBy(File element) {
            return hasExtension(element, ".java");
        }
    });

    spec.setSource(new SimpleFileCollection(javaOnly.getFiles()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:NormalizingJavaCompiler.java


示例8: createDelegate

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
@Override
public FileCollectionInternal createDelegate() {
    ImmutableSet.Builder<File> files = ImmutableSet.builder();
    for (ResolvedArtifact artifact : configuration.getResolvedConfiguration().getResolvedArtifacts()) {
        if ((artifact.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier) == matchProjectComponents) {
            files.add(artifact.getFile());
        }
    }
    return new SimpleFileCollection(files.build());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:PlayPluginConfigurations.java


示例9: resolveAndFilterSourceFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveAndFilterSourceFiles(final GroovyJavaJointCompileSpec spec) {
    FileCollection filtered = spec.getSource().filter(new Spec<File>() {
        public boolean isSatisfiedBy(File element) {
            for (String fileExtension : spec.getGroovyCompileOptions().getFileExtensions()) {
                if (element.getName().endsWith("." + fileExtension)) {
                    return true;
                }
            }
            return false;
        }
    });

    spec.setSource(new SimpleFileCollection(filtered.getFiles()));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:15,代码来源:NormalizingGroovyCompiler.java


示例10: resolveAndFilterSourceFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveAndFilterSourceFiles(JavaCompileSpec spec) {
    // this mimics the behavior of the Ant javac task (and therefore AntJavaCompiler),
    // which silently excludes files not ending in .java
    FileCollection javaOnly = spec.getSource().filter(new Spec<File>() {
        public boolean isSatisfiedBy(File element) {
            return element.getName().endsWith(".java");
        }
    });

    spec.setSource(new SimpleFileCollection(javaOnly.getFiles()));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:NormalizingJavaCompiler.java


示例11: getFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
public FileCollection getFiles() {
    List<File> files = new ArrayList<File>();
    for (Map.Entry<String, IncrementalFileSnapshot> entry : snapshots.entrySet()) {
        if (entry.getValue() instanceof FileHashSnapshot) {
            files.add(new File(entry.getKey()));
        }
    }
    return new SimpleFileCollection(files);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:10,代码来源:DefaultFileCollectionSnapshotter.java


示例12: resolveClasspath

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveClasspath(ScalaJavaJointCompileSpec spec) {
    spec.setClasspath(new SimpleFileCollection(Lists.newArrayList(spec.getClasspath())));
    spec.setScalaClasspath(new SimpleFileCollection(Lists.newArrayList(spec.getScalaClasspath())));
    spec.setZincClasspath(new SimpleFileCollection(Lists.newArrayList(spec.getZincClasspath())));

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Class path: {}", spec.getClasspath());
        LOGGER.debug("Scala class path: {}", spec.getScalaClasspath());
        LOGGER.debug("Zinc class path: {}", spec.getZincClasspath());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:NormalizingScalaCompiler.java


示例13: getFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
public FileCollection getFiles() {
    List<File> files = new ArrayList<File>();
    for (Map.Entry<String, FileSnapshot> entry : snapshots.entrySet()) {
        if (entry.getValue() instanceof FileHashSnapshot) {
            files.add(new File(entry.getKey()));
        }
    }
    return new SimpleFileCollection(files);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:10,代码来源:DefaultFileCollectionSnapshotter.java


示例14: SelectiveCompilation

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
public SelectiveCompilation(IncrementalTaskInputs inputs, FileTree source, FileCollection compileClasspath, final File compileDestination,
                            final ClassDependencyInfoSerializer dependencyInfoSerializer, final JarSnapshotCache jarSnapshotCache, final SelectiveJavaCompiler compiler,
                            Iterable<File> sourceDirs, final FileOperations operations) {
    this.operations = operations;
    this.jarSnapshotFeeder = new JarSnapshotFeeder(jarSnapshotCache, new JarSnapshotter(new DefaultHasher()));
    this.compiler = compiler;

    Clock clock = new Clock();
    final InputOutputMapper mapper = new InputOutputMapper(sourceDirs, compileDestination);

    //load dependency info
    final ClassDependencyInfo dependencyInfo = dependencyInfoSerializer.readInfo();

    //including only source java classes that were changed
    final PatternSet changedSourceOnly = new PatternSet();
    InputFileDetailsAction action = new InputFileDetailsAction(mapper, compiler, changedSourceOnly, dependencyInfo);
    inputs.outOfDate(action);
    inputs.removed(action);
    if (fullRebuildNeeded != null) {
        LOG.lifecycle("Stale classes detection completed in {}. Rebuild needed: {}.", clock.getTime(), fullRebuildNeeded);
        this.classpath = compileClasspath;
        this.source = source;
        return;
    }

    compiler.deleteStaleClasses();
    Set<File> filesToCompile = source.matching(changedSourceOnly).getFiles();
    if (filesToCompile.isEmpty()) {
        this.compilationNeeded = false;
        this.classpath = compileClasspath;
        this.source = source;
    } else {
        this.classpath = compileClasspath.plus(new SimpleFileCollection(compileDestination));
        this.source = source.matching(changedSourceOnly);
    }
    LOG.lifecycle("Stale classes detection completed in {}. Compile include patterns: {}.", clock.getTime(), changedSourceOnly.getIncludes());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:38,代码来源:SelectiveCompilation.java


示例15: getOutputFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
@Override
public FileCollection getOutputFiles() {
    ArrayList<File> newOuputFiles = new ArrayList<>();
    for (File file : mTaskExecutionHistory.getOutputFiles()) {
        newOuputFiles.add(
                FileUtils.inFolder(file, mResFiles) ?
                        new IgnoreResFileFile(file.getPath(), mResFiles) : file);
    }
    return new SimpleFileCollection(newOuputFiles);
}
 
开发者ID:Leao,项目名称:CodeColors,代码行数:11,代码来源:IgnoreResFilesTaskActionWrapper.java


示例16: readListOfDepConfigs

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private FileCollection readListOfDepConfigs(@Nonnull final File pDepConfigDir)
{
    File[] listOfFiles = pDepConfigDir.listFiles(new PropertyFileFilter());
    if (listOfFiles == null) {
        throw new GradleException("no dependency configurations found in dir: " + pDepConfigDir);
    }
    return new SimpleFileCollection(listOfFiles);
}
 
开发者ID:checkstyle-addons,项目名称:checkstyle-addons,代码行数:9,代码来源:DependencyConfigs.java


示例17: empty

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private FileCollection empty() {
    return new SimpleFileCollection();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:SourceSetNativeDependencyResolver.java


示例18: getFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
@Override
public FileCollection getFiles() {
    return new SimpleFileCollection();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:EmptyClasspath.java


示例19: resolveClasspath

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveClasspath(JavaCompileSpec spec) {
    spec.setClasspath(new SimpleFileCollection(Lists.newArrayList(spec.getClasspath())));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:NormalizingJavaCompiler.java


示例20: resolveAndFilterSourceFiles

import org.gradle.api.internal.file.collections.SimpleFileCollection; //导入依赖的package包/类
private void resolveAndFilterSourceFiles(final ScalaJavaJointCompileSpec spec) {
    spec.setSource(new SimpleFileCollection(spec.getSource().getFiles()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:NormalizingScalaCompiler.java



注:本文中的org.gradle.api.internal.file.collections.SimpleFileCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GridFSFile类代码示例发布时间:2022-05-22
下一篇:
Java JvmMemManagerTableMeta类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap