Hi Rene,

Thanks for the ideas.

The input files are not specified in the configure phase, because my input
file is actually an artifact (a very large one) that has to be downloaded
first. I don't want to download it during the configure stage, and that's
what happens if I attempt to specify it as an input file there. Probably I
should do it in a different way. I've found some example that looked like
the following:

configurations {
    artifactFiles
}

dependencies {
    artifactFiles 'com.company.module:module:1.0.0@war'
}

task {
    inputs.files
configurations.artifactFiles.resolvedConfiguration.resolvedArtifacts
}

The second may indeed be true, but then it is weird. To me, a missing
(expected) output file means that a task failed - that should be the logical
default behavior, with may be an option to override it.
May be I need to put some condition at the end of the task, to indicate
failure if the output task does not get created? How could I do it?

Regards,

Andrew


On Thu, Apr 28, 2011 at 8:04 PM, Rene Groeschke <[email protected]> wrote:

> Hi Andrew,
> I have two assumptions about your problem:
> 1. the assignment of the input files should be done during the
> configuration phase of the task and not in a doLast closure. In your
> existing task setup, the input files are never considered.
> 2. when gradle is executed, it stores the hash of the output file. If you
> never create one, even though you marked a specific path for the output
> file, gradle recognizes, that the output file of your task hasn't changed
> (since it does not exist after your first run, the second run of your task
> (create a non existing outputfile) is up-to-date.
>
> regards,
> René
>
>
> Am Do, 28.04.2011, 18:10, schrieb Andrew Schetinin:
> > Hi,
> >
> >
> > I'm developing a new task, and trying to make it working, but it only
> > runs once (or I need to specify "-C rebuild" argument to rebuild the
> cache
> > and cause it to be triggered).
> >
> > I defined a task like the following:
> >
> >
> > task myExtract { logger.info "Configuring..." destDir = new File(
> buildDir,
> > 'extracted-file.war' )
> > destFile = new File( destDir, 'include-jars.txt' ) outputs.file destFile
> //
> > <<<<<<<<<<<<<<<<<<<<<< OUTPUT FILE
> > logger.info "Task output: ${destFile}" doLast { logger.info"Extracting..."
> > inputs.files configurations.repoFiles // <<<<<<<<<< INPUT FILES
> > destDir.mkdir() // <<<<<<<< creating the output folder (but not the
> output
> > file!) inputs.files.each { File f -> logger.info "Extracting
> > ${f.absolutePath}"
> > }
> > }
> > }
> >
> >
> > I expected it to be triggered always, because at the moment I don't
> > create the output file. Otherwise, the task passes, since there is no
> real
> > functionality in it, not yet.
> >
> > Somehow, Gradle caches the mere fact that the task passed, and never
> > really verifies that the file that was declared as the output file had
> > been created (I've searched for that file everywhere, just in case - no
> > luck).
> >
> > So, it runs once, and then states that the task is up-to-date.
> > Only if I run it with "-C rebuild", the task gets executed again.
> >
> >
> > It looks like it breaks the whole idea of declaring output files/dirs, or
> > am I misunderstanding something?
> >
> >
> > Thank you in advance,
> >
> >
> > Andrew
> >
> >
> >
> > --
> > --
> > Andrew Schetinin
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


-- 
--
Andrew Schetinin

Reply via email to