Gradle constant no-source on tar action


(Willie) #1

I have a task with this defined

class mytask {
  @OutputDirectory
  File getDocDir() {
    def typeString = type.toString().toLowerCase()
    return new File(project.buildDir, "docs/${typeString}/${project.name}-sphinx-${typeString}")
  }
}

Then, elsewhere in my code base, I have an action defined like this

static class PackageDocumentationAction implements Action<Tar> {

    private final mytask documentationTask

    PackageDocumentationAction(mytask documentationTask) {
      this.documentationTask = documentationTask
      println(this.documentationTask.docDir)
    }

    @Override
    void execute(Tar tar) {
      tar.compression = Compression.GZIP
      tar.baseName = tar.project.name
      tar.classifier = 'docs-' + documentationTask.type.builderName
      tar.extension = 'tar.gz'
      tar.from(documentationTask)
      tar.into("${tar.getBaseName()}-${tar.getVersion()}-${tar.getClassifier()}")
    }
  }

Now, the mytask runs perfectly, no problems there. but, when i try to run the TAR, i get nothing but NO-SOURCEi have tried doing the tar.source to no avail. Whats wrong with this picture?


(Sterling Greene) #2

It’s not clear to me how you have those things wired together.

My suspicion would be that getDocDir isn’t returning the true location of where the output goes or you’re using PackageDocumentationAction as a doLast/doFirst action.