protected void addDependenciesJspC(Project project) {
    ConfigurableFileCollection configurableFileCollection =
        project.files(getUnzippedJarDir(project));

    configurableFileCollection.builtBy(UNZIP_JAR_TASK_NAME);

    GradleUtil.addDependency(project, JspCPlugin.CONFIGURATION_NAME, configurableFileCollection);
  }
  @InputFiles
  @SkipWhenEmpty
  public FileCollection getSourceFiles() {
    Project project = getProject();

    File sourceDir = getSourceDir();

    if (sourceDir == null) {
      return project.files();
    }

    ConfigurableFileTree configurableFileTree = project.fileTree(sourceDir);

    configurableFileTree.include(getSoySrcIncludes());
    configurableFileTree.include(getSrcIncludes());

    return configurableFileTree;
  }
  @OutputFiles
  public FileCollection getSourceMapFiles() {
    Project project = getProject();

    List<File> sourceMapFiles = new ArrayList<>();

    if (isGenerateSourceMap()) {
      FileCollection cssFiles = getCSSFiles();

      for (File cssFile : cssFiles) {
        File sourceMapFile = project.file(cssFile + ".map");

        sourceMapFiles.add(sourceMapFile);
      }
    }

    return project.files(sourceMapFiles);
  }
  @OutputDirectories
  public FileCollection getOutputDirs() {
    Project project = getProject();

    Set<File> outputDirs = new HashSet<>();

    FileCollection cssFiles = getCSSFiles();

    String outputDirName = _removeTrailingSlash(getOutputDirName());

    for (File cssFile : cssFiles) {
      File outputDir = project.file(cssFile + "/../" + outputDirName);

      outputDirs.add(outputDir);
    }

    return project.files(outputDirs);
  }
  @InputFiles
  @SkipWhenEmpty
  public FileCollection getCSSFiles() {
    Project project = getProject();

    List<String> dirNames = getDirNames();
    File docrootDir = getDocrootDir();

    if (dirNames.isEmpty() || (docrootDir == null)) {
      return project.files();
    }

    Map<String, Object> args = new HashMap<>();

    args.put("dir", docrootDir);
    args.put("exclude", "**/" + _addTrailingSlash(getOutputDirName()));

    for (String dirName : dirNames) {
      dirName = dirName.replace('\\', '/');

      if (dirName.equals("/")) {
        dirName = "";
      } else {
        dirName = _removeLeadingSlash(dirName);
        dirName = _removeTrailingSlash(dirName);

        dirName += "/";
      }

      List<String> includes = new ArrayList<>(2);

      includes.add(dirName + "**/*.css");
      includes.add(dirName + "**/*.scss");

      args.put("includes", includes);
    }

    return project.fileTree(args);
  }
Example #6
0
  protected void resolve() {

    // resolve fields
    baseName = resolve(baseName, true);
    appendix = resolve(appendix, true);
    version = resolve(version, true);
    classifier = resolve(classifier, true);
    extension = resolve(extension, true);

    // resolve classpath
    if (classpath != null) classpath = project.files(classpath);

    // skip if its already been set by the user.
    if (archiveSet) return;

    StringBuilder builder = new StringBuilder();
    builder.append(baseName);

    if (!Strings.isNullOrEmpty((String) appendix)) {
      builder.append('-');
      builder.append(appendix);
    }

    if (!Strings.isNullOrEmpty((String) version)) {
      builder.append('-');
      builder.append(version);
    }

    if (!Strings.isNullOrEmpty((String) classifier)) {
      builder.append('-');
      builder.append(classifier);
    }

    builder.append('.');
    builder.append(extension);

    archiveName = builder.toString();
  }
Example #7
0
 public Object getClasspath() {
   if (classpath == null) classpath = project.files((Object) new String[] {});
   return classpath;
 }