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

Java SourceDirectorySet类代码示例

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

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



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

示例1: create

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
public AntlrSpec create(AntlrTask antlrTask, Set<File> grammarFiles, SourceDirectorySet sourceDirectorySet) {
    List<String> arguments = Lists.newLinkedList(antlrTask.getArguments());

    if (antlrTask.isTrace() && !arguments.contains("-trace")) {
        arguments.add("-trace");
    }
    if (antlrTask.isTraceLexer() && !arguments.contains("-traceLexer")) {
        arguments.add("-traceLexer");
    }
    if (antlrTask.isTraceParser() && !arguments.contains("-traceParser")) {
        arguments.add("-traceParser");
    }
    if (antlrTask.isTraceTreeWalker() && !arguments.contains("-traceTreeWalker")) {
        arguments.add("-traceTreeWalker");
    }

    return new AntlrSpec(arguments, grammarFiles, sourceDirectorySet.getSrcDirs(), antlrTask.getOutputDirectory(), antlrTask.getMaxHeapSize());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:AntlrSpecFactory.java


示例2: renderSourceSetDirectories

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private void renderSourceSetDirectories(LanguageSourceSet sourceSet, TextReportBuilder builder) {
    Set<File> srcDirs = sourceSet.getSource().getSrcDirs();
    if (srcDirs.isEmpty()) {
        builder.item("No source directories");
    } else {
        for (File file : srcDirs) {
            builder.item("srcDir", file);
        }
        SourceDirectorySet source = sourceSet.getSource();
        Set<String> includes = source.getIncludes();
        if (!includes.isEmpty()) {
            builder.item("includes", includes);
        }
        Set<String> excludes = source.getExcludes();
        if (!excludes.isEmpty()) {
            builder.item("excludes", excludes);
        }
        Set<String> filterIncludes = source.getFilter().getIncludes();
        if (!filterIncludes.isEmpty()) {
            builder.item("limit to", filterIncludes);
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:SourceSetRenderer.java


示例3: getSourceRoots

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
List<File> getSourceRoots() {
    if (sourceRoots == null) {
        sourceRoots = Lists.newArrayList();
        for (Object source : sources) {
            if (isDirectory(source)) {
                sourceRoots.add((File) source);
            } else if (isDirectoryTree(source)) {
                sourceRoots.add(((DirectoryTree) source).getDir());
            } else if (isSourceDirectorySet(source)) {
                sourceRoots.addAll(((SourceDirectorySet) source).getSrcDirs());
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }
    return sourceRoots;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:CompilationSourceDirs.java


示例4: doGetSrcDirTrees

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private Set<DirectoryTree> doGetSrcDirTrees() {
    Set<DirectoryTree> result = new LinkedHashSet<DirectoryTree>();
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            SourceDirectorySet nested = (SourceDirectorySet) path;
            result.addAll(nested.getSrcDirTrees());
        } else {
            for (File srcDir : fileResolver.resolveFiles(path)) {
                if (srcDir.exists() && !srcDir.isDirectory()) {
                    throw new InvalidUserDataException(String.format("Source directory '%s' is not a directory.", srcDir));
                }
                result.add(directoryFileTreeFactory.create(srcDir, patterns));
            }
        }
    }
    return result;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultSourceDirectorySet.java


示例5: createCompileJavaTaskForBinary

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private void createCompileJavaTaskForBinary(final SourceSet sourceSet, SourceDirectorySet javaSourceSet, Project target) {
    JavaCompile compileTask = target.getTasks().create(sourceSet.getCompileJavaTaskName(), JavaCompile.class);
    compileTask.setDescription("Compiles " + javaSourceSet + ".");
    compileTask.setSource(javaSourceSet);
    ConventionMapping conventionMapping = compileTask.getConventionMapping();
    conventionMapping.map("classpath", new Callable<Object>() {
        public Object call() throws Exception {
            return sourceSet.getCompileClasspath();
        }
    });
    conventionMapping.map("destinationDir", new Callable<Object>() {
        public Object call() throws Exception {
            return sourceSet.getOutput().getClassesDir();
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:JavaBasePlugin.java


示例6: setDefaultSrcDir

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
/**
 * Set the default directory for each source sets if it is empty.
 */
public void setDefaultSrcDir() {
    all(new Action<FunctionalSourceSet>() {
        @Override
        public void execute(final FunctionalSourceSet functionalSourceSet) {
            functionalSourceSet.all(
                    new Action<LanguageSourceSet>() {
                        @Override
                        public void execute(LanguageSourceSet languageSourceSet) {
                            SourceDirectorySet source = languageSourceSet.getSource();
                            if (source.getSrcDirs().isEmpty()) {
                                source.srcDir("src/" + functionalSourceSet.getName() + "/" + languageSourceSet.getName());
                            }
                        }
                    });
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidComponentModelSourceSet.java


示例7: convertSourceFile

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
/**
 * Convert a FunctionalSourceSet to an AndroidSourceFile.
 */
private static void convertSourceFile(
        AndroidSourceFile androidFile,
        FunctionalSourceSet source,
        String sourceName) {
    LanguageSourceSet languageSourceSet = source.findByName(sourceName);
    if (languageSourceSet == null) {
        return;
    }
    SourceDirectorySet dir = languageSourceSet.getSource();
    if (dir == null) {
        return;
    }
    // We use the first file in the file tree until Gradle has a way to specify one source file
    // instead of an entire source set.
    Set<File> files = dir.getAsFileTree().getFiles();
    if (!files.isEmpty()) {
        androidFile.srcFile(Iterables.getOnlyElement(files));
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidConfigAdaptor.java


示例8: convertSourceSet

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
/**
 * Convert a FunctionalSourceSet to an AndroidSourceDirectorySet.
 */
private static void convertSourceSet(
        AndroidSourceDirectorySet androidDir,
        FunctionalSourceSet source,
        String sourceName) {
    LanguageSourceSet languageSourceSet = source.findByName(sourceName);
    if (languageSourceSet == null) {
        return;
    }
    SourceDirectorySet dir = languageSourceSet.getSource();
    if (dir == null) {
        return;
    }
    androidDir.setSrcDirs(dir.getSrcDirs());
    androidDir.include(dir.getIncludes());
    androidDir.exclude(dir.getExcludes());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidConfigAdaptor.java


示例9: doGetSrcDirTrees

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private Set<DirectoryTree> doGetSrcDirTrees() {
    Set<DirectoryTree> result = new LinkedHashSet<DirectoryTree>();
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            SourceDirectorySet nested = (SourceDirectorySet) path;
            result.addAll(nested.getSrcDirTrees());
        } else {
            File srcDir = fileResolver.resolve(path);
            if (srcDir.exists() && !srcDir.isDirectory()) {
                throw new InvalidUserDataException(String.format("Source directory '%s' is not a directory.", srcDir));
            }
            result.add(new DirectoryFileTree(srcDir, patterns));
        }
    }
    return result;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:17,代码来源:DefaultSourceDirectorySet.java


示例10: tryToGetSourceDirectoriesFromSourceSet

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private Collection<File> tryToGetSourceDirectoriesFromSourceSet(final Object sourceSet) {
    if (sourceSet == null) {
        return null;
    }

    if (sourceSet instanceof SourceDirectorySet) {
        final SourceDirectorySet set = (SourceDirectorySet) sourceSet;
        return set.getSrcDirs();
    }

    final String methodName = "getSrcDirs";
    final Object srcDirs = tryToInvokeMethod(sourceSet, methodName);
    if (srcDirs instanceof Collection<?>) {
        try {
            return (Collection<File>) srcDirs;
        } catch (ClassCastException e) {
            LOGGER.debug("Can not cast result of '" + methodName + "' to Collection<File>");
        }
    }

    return null;
}
 
开发者ID:itavero,项目名称:gradle-pylizard,代码行数:23,代码来源:SourceSetAnalyzer.java


示例11: configureSourceSetDefaults

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private static void configureSourceSetDefaults(final Project project, final SourceDirectorySetFactory sourceDirectorySetFactory) {
    final JavaBasePlugin javaPlugin = project.getPlugins().getPlugin(JavaBasePlugin.class);
    project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() {
        @Override
        public void execute(final SourceSet sourceSet) {
            String displayName = (String) InvokerHelper.invokeMethod(sourceSet, "getDisplayName", null);
            Convention sourceSetConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
            DefaultScalaSourceSet scalaSourceSet = new DefaultScalaSourceSet(displayName, sourceDirectorySetFactory);
            sourceSetConvention.getPlugins().put("scala", scalaSourceSet);
            final SourceDirectorySet scalaDirectorySet = scalaSourceSet.getScala();
            scalaDirectorySet.srcDir(new Callable<File>() {
                @Override
                public File call() throws Exception {
                    return project.file("src/" + sourceSet.getName() + "/scala");
                }
            });
            sourceSet.getAllJava().source(scalaDirectorySet);
            sourceSet.getAllSource().source(scalaDirectorySet);
            sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() {
                @Override
                public boolean isSatisfiedBy(FileTreeElement element) {
                    return scalaDirectorySet.contains(element.getFile());
                }
            });

            configureScalaCompile(project, javaPlugin, sourceSet);
        }

    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:ScalaBasePlugin.java


示例12: visitDependencies

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
@Override
public void visitDependencies(TaskDependencyResolveContext context) {
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            context.add(((SourceDirectorySet) path).getBuildDependencies());
        } else {
            context.add(fileResolver.resolveFiles(path));
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultSourceDirectorySet.java


示例13: createProcessResourcesTaskForBinary

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private void createProcessResourcesTaskForBinary(final SourceSet sourceSet, SourceDirectorySet resourceSet, final Project target) {
    Copy resourcesTask = target.getTasks().create(sourceSet.getProcessResourcesTaskName(), ProcessResources.class);
    resourcesTask.setDescription("Processes " + resourceSet + ".");
    new DslObject(resourcesTask).getConventionMapping().map("destinationDir", new Callable<File>() {
        public File call() throws Exception {
            return sourceSet.getOutput().getResourcesDir();
        }
    });
    resourcesTask.from(resourceSet);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:JavaBasePlugin.java


示例14: getSourceRootsFiles

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
@Internal
private List<File> getSourceRootsFiles() {
  // accessing the List<Object> field not the FileTree from getSource
  return source.stream()
      .filter(it -> it instanceof SourceDirectorySet)
      .flatMap(it -> ((SourceDirectorySet) it).getSrcDirs().stream())
      .collect(Collectors.toList());
}
 
开发者ID:gradle-clojure,项目名称:gradle-clojure,代码行数:9,代码来源:ClojureCompile.java


示例15: generateClasses

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
@TaskAction
public void generateClasses() throws IOException {
    // Clean the destination directory
    getProject().delete(getDestinationDir());

    // Initialize spoon
    SpoonAPI spoon = new Launcher();
    spoon.addProcessor(EVENT_CLASS_PROCESSOR);

    final Environment environment = spoon.getEnvironment();
    environment.setComplianceLevel(Integer.parseInt(JavaVersion.toVersion(getSourceCompatibility()).getMajorVersion()));
    environment.setNoClasspath(!this.validateCode);

    // Configure AST generator
    final SpoonModelBuilder compiler = spoon.createCompiler();
    compiler.setSourceClasspath(toPathArray(getClasspath().getFiles()));

    for (Object source : this.source) {
        if (!(source instanceof SourceDirectorySet)) {
            throw new UnsupportedOperationException("Source of type " + source.getClass() + " is not supported.");
        }

        ((SourceDirectorySet) source).getSrcDirs().forEach(compiler::addInputSource);
    }

    this.factory = compiler.getFactory();

    // Generate AST
    compiler.build();

    // Analyse AST
    final EventInterfaceProcessor processor = new EventInterfaceProcessor(getSource());
    compiler.process(Collections.singletonList(processor));
    final Map<CtType<?>, List<Property>> foundProperties = processor.getFoundProperties();

    this.sorter = new PropertySorter(this.sortPriorityPrefix, this.groupingPrefixes);

    dumpClasses(foundProperties);
}
 
开发者ID:SpongePowered,项目名称:event-impl-gen,代码行数:40,代码来源:EventImplGenTask.java


示例16: AbstractLanguageSourceSet

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
public AbstractLanguageSourceSet(String name, FunctionalSourceSet parent, String typeName, SourceDirectorySet source) {
    this.name = name;
    this.fullName = parent.getName() + StringUtils.capitalize(name);
    this.displayName = String.format("%s '%s:%s'", typeName, parent.getName(), name);
    this.source = source;
    super.builtBy(source.getBuildDependencies());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:8,代码来源:AbstractLanguageSourceSet.java


示例17: getSourceDirs

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
List<File> getSourceDirs() {
    List<File> sourceDirs = new LinkedList<File>();
    for (Object s : source) {
        if (s instanceof SourceDirectorySet) {
            sourceDirs.addAll(((SourceDirectorySet) s).getSrcDirs());
        } else {
            throw new UnsupportedOperationException();
        }
    }
    return sourceDirs;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:CompilationSourceDirs.java


示例18: areSourceDirsKnown

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
public boolean areSourceDirsKnown() {
    for (Object s : source) {
        if (!(s instanceof SourceDirectorySet)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:9,代码来源:CompilationSourceDirs.java


示例19: maybeSetSourceDir

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private void maybeSetSourceDir(SourceDirectorySet sourceSet, Task task, String propertyName) {
    // TODO:DAZ Handle multiple output directories
    Object value = task.property(propertyName);
    if (value != null) {
        sourceSet.srcDir(value);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:8,代码来源:ConfigureGeneratedSourceSets.java


示例20: getSourceDirs

import org.gradle.api.file.SourceDirectorySet; //导入依赖的package包/类
private List<File> getSourceDirs() {
    List<File> sourceDirs = new LinkedList<File>();
    for (Object s : source) {
        if (s instanceof SourceDirectorySet) {
            sourceDirs.addAll(((SourceDirectorySet) s).getSrcDirs());
        } else {
            return emptyList();
        }
    }
    return sourceDirs;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:Compile.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationEncodedValue类代码示例发布时间:2022-05-22
下一篇:
Java CMenuItem类代码示例发布时间: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