org.gradle.api.Project.files()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.gradle.api.Project.files()方法的一些代码示例,展示了Project.files()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.files()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:files

Project.files介绍

暂无

代码示例

代码示例来源:origin: linkedin/rest.li

jarOutputStream.close();
return classpath.filter(File::isDirectory).plus(project.files(pathingJarPath));

代码示例来源:origin: diffplug/spotless

public void propertiesFile(Object... files) {
  requireElementsNonNull(files);
  propertyActions.add(map -> {
    FormatterProperties preferences = FormatterProperties.from(getProject().files(files));
    /* FreshMarkStep.State serializes the properties and not the files.
     * Therefore they must be stored in a hash-map like used by Properties.*/
    preferences.getProperties().forEach((key, value) -> map.put(key.toString(), value));
  });
}

代码示例来源:origin: diffplug/spotless

private FormatterStep createStep() {
    Project project = getProject();
    return DBeaverSQLFormatterStep.create(project.files(configFiles).getFiles());
  }
}

代码示例来源:origin: diffplug/spotless

/**
 * FileCollections pass through raw.
 * Strings are treated as the 'include' arg to fileTree, with project.rootDir as the dir.
 * List<String> are treated as the 'includes' arg to fileTree, with project.rootDir as the dir.
 * Anything else gets passed to getProject().files().
 */
public void target(Object... targets) {
  requireElementsNonNull(targets);
  if (targets.length == 0) {
    this.target = getProject().files();
  } else if (targets.length == 1) {
    this.target = parseTarget(targets[0]);
  } else {
    if (Stream.of(targets).allMatch(o -> o instanceof String)) {
      this.target = parseTarget(Arrays.asList(targets));
    } else {
      FileCollection union = getProject().files();
      for (Object target : targets) {
        union = union.plus(parseTarget(target));
      }
      this.target = union;
    }
  }
}

代码示例来源:origin: diffplug/spotless

/** If the user hasn't specified the files yet, we'll assume he/she means all of the kotlin files. */
  @Override
  protected void setupTask(SpotlessTask task) {
    if (target == null) {
      JavaPluginConvention javaPlugin = getProject().getConvention().findPlugin(JavaPluginConvention.class);
      if (javaPlugin == null) {
        throw new GradleException("You must either specify 'target' manually or apply a kotlin plugin.");
      }
      FileCollection union = getProject().files();
      for (SourceSet sourceSet : javaPlugin.getSourceSets()) {
        union = union.plus(sourceSet.getAllSource().filter(file -> {
          String name = file.getName();
          return name.endsWith(".kt") || name.endsWith(".kts");
        }));
      }
      target = union;
    }
    super.setupTask(task);
  }
}

代码示例来源:origin: diffplug/spotless

/** If the user hasn't specified the files yet, we'll assume he/she means all of the kotlin files. */
  @Override
  protected void setupTask(SpotlessTask task) {
    if (target == null) {
      JavaPluginConvention javaPlugin = getProject().getConvention().findPlugin(JavaPluginConvention.class);
      if (javaPlugin == null) {
        throw new GradleException("You must either specify 'target' manually or apply the 'scala' plugin.");
      }
      FileCollection union = getProject().files();
      for (SourceSet sourceSet : javaPlugin.getSourceSets()) {
        union = union.plus(sourceSet.getAllSource().filter(file -> {
          String name = file.getName();
          return name.endsWith(".scala") || name.endsWith(".sc");
        }));
      }
      target = union;
    }
    super.setupTask(task);
  }
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
    requireElementsNonNull(configFiles);
    Project project = getProject();
    builder.setPreferences(project.files(configFiles).getFiles());
    replaceStep(builder.build());
  }
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
  requireElementsNonNull(configFiles);
  Project project = getProject();
  builder.setPreferences(project.files(configFiles).getFiles());
  replaceStep(builder.build());
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
  requireElementsNonNull(configFiles);
  Project project = getProject();
  builder.setPreferences(project.files(configFiles).getFiles());
  replaceStep(builder.build());
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
  requireElementsNonNull(configFiles);
  Project project = getProject();
  builder.setPreferences(project.files(configFiles).getFiles());
  replaceStep(builder.build());
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
  requireElementsNonNull(configFiles);
  Project project = getProject();
  builder.setPreferences(project.files(configFiles).getFiles());
  replaceStep(builder.build());
}

代码示例来源:origin: diffplug/spotless

public void configFile(Object... configFiles) {
    requireElementsNonNull(configFiles);
    Project project = extension.getProject();
    builder.setPreferences(project.files(configFiles).getFiles());
    extension.replaceStep(builder.build());
  }
}

代码示例来源:origin: lenskit/lenskit

@SuppressWarnings("unchecked")
public LenskitExtension(Project project) {
  ObjectFactory objF = project.getObjects();
  threadCount = objF.property(Integer.class);
  threadCount.set(0);
  maxMemory = objF.property(String.class);
  classpath = project.files();
  logLevel = objF.property(String.class);
  logLevel.set("INFO");
  logFileLevel = objF.property(String.class);
  jvmArgs = objF.property((Class) List.class);
}

代码示例来源:origin: diffplug/spotless

return getProject().files(target);

代码示例来源:origin: diffplug/spotless

/** If the user hasn't specified the files yet, we'll assume he/she means all of the java files. */
  @Override
  protected void setupTask(SpotlessTask task) {
    if (target == null) {
      JavaPluginConvention javaPlugin = getProject().getConvention().findPlugin(JavaPluginConvention.class);
      if (javaPlugin == null) {
        throw new GradleException("You must apply the java plugin before the spotless plugin if you are using the java extension.");
      }
      FileCollection union = getProject().files();
      for (SourceSet sourceSet : javaPlugin.getSourceSets()) {
        union = union.plus(sourceSet.getAllJava());
      }
      target = union;
    }

    steps.replaceAll(step -> {
      if (LicenseHeaderStep.name().equals(step.getName())) {
        return step.filterByFile(LicenseHeaderStep.unsupportedJvmFilesFilter());
      } else {
        return step;
      }
    });
    super.setupTask(task);
  }
}

代码示例来源:origin: diffplug/spotless

FileCollection union = getProject().files();
for (SourceSet sourceSet : convention.getSourceSets()) {
  GroovySourceSet groovySourceSet = new DslObject(sourceSet).getConvention().getPlugin(GroovySourceSet.class);

代码示例来源:origin: MinecraftForge/ForgeGradle

protected FileCollection resolveFiles(List<Object> objects)
  {
    Object[] files = new Object[objects.size()];
    int i = 0;
    for (Object obj : objects)
      files[i++] = resolveFile(obj);
    return project.files(files).getAsFileTree();
  }
}

代码示例来源:origin: net.sf.proguard/proguard-gradle

@InputFiles
protected FileCollection getInJarFileCollection()
{
  return getProject().files(inJarFiles);
}

代码示例来源:origin: MinecraftForge/ForgeGradle

@InputFiles
public FileCollection getChangedSources()
{
  return getProject().files(changed);
}

代码示例来源:origin: MinecraftForge/ForgeGradle

public FileCollection getCollections()
{
  List<Configuration> configs = Lists.newArrayListWithCapacity(configurations.size());
  for (String s : configurations)
    configs.add(getProject().getConfigurations().getByName(s));
  return getProject().files(configs);
}

相关文章