Hi blackwolf,
I think the problem is your pimped clean task:
----------------------------------
deleteDirClosure = {
it.eachDir(deleteDirClosure)
it.eachFile {
it.delete()
}
}
clean {
if (buildDir.exists()) {
deleteDirClosure(buildDir)
}
}
----------------------------------
This snippet deletes your buildDir directory during the configuration phase and
not during the execution phase of your build file. This means that the buildDir
is deleted each time you run any gradle task on your project. So the compiled
classes are not available anymore and the compile task is executed again. The
clean task should work without your custom snippet above. what problem do you
get?
regards,
René
Am 26.09.11 20:45, schrieb blackwolf:
My gradle.build file is really simple:
apply from: "${System.getenv().GRADLE_COMMON}/plugins/common.gradle"
dependencies {
compile group: 'commons-logging', name: 'commons-logging', version: '1.1'
compile group: 'log4j', name: 'log4j', version: '1.2.14'
testCompile group: 'junit', name: 'junit', version: '4.4'
testCompile group: 'org.easymock', name: 'easymock', version: '2.3'
testCompile group: 'org.easymock', name: 'easymockclassextension',
version: '2.3'
}
artifactoryPublish {
dependsOn test
publishConfigs("archives")
}
and common.gradle is:
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'artifactory'
// Define some useful paths and set buildDir
USEFUL_PATH_1 = "foo"
USEFUL_PATH_2 = "bar"
buildDir = "/var/tmp/${System.getenv().USER}/build/" + PROJECT_SPECIFIC_PATH
// Define the source sets.
sourceSets {
main {
java {
srcDirs 'main/java'
}
resources {
srcDirs 'main/resources'
}
}
test {
java {
srcDirs 'test/java'
}
resources {
srcDirs 'test/resources'
}
}
}
// Use our Artifactory virtual repository to resolve all dependencies.
repositories {
mavenRepo urls: ARTIFACTORY_URL
}
// Turn on deprecation and unchecked warnings.
compileJava {
options.compilerArgs.add '-Xlint:deprecation'
options.compilerArgs.add '-Xlint:unchecked'
}
compileTestJava {
options.compilerArgs.add '-Xlint:deprecation'
options.compilerArgs.add '-Xlint:unchecked'
}
// Fix the clean task.
deleteDirClosure = {
it.eachDir(deleteDirClosure)
it.eachFile {
it.delete()
}
}
clean {
if (buildDir.exists()) {
deleteDirClosure(buildDir)
}
}
// Configuration for uploading build artifacts to Artifactory.
artifactory {
// Some Artifactory-specific stuff.
}
the output of 'gradle build -i' is:
Executing task ':MY_PROJECT:compileJava' due to:
Output file /var/tmp/dumitru/build/PROJECT_SPECIFIC_PATH/dependency-cache
for task ':MY_PROJECT:compileJava' has changed.
Output file /var/tmp/dumitru/build/PROJECT_SPECIFIC_PATH/classes/main for
task ':MY_PROJECT:compileJava' has changed.
Output file
/var/tmp/dumitru/build/PROJECT_SPECIFIC_PATH/classes/main/PACKAGE_PATH/JAVA_CLASS.class
has been removed for task ':MY_PROJECT:compileJava'.
Output file
/var/tmp/dumitru/build/PROJECT_SPECIFIC_PATH/classes/main/PACKAGE_PATH/JAVA_CLASS.class
has been removed for task ':MY_PROJECT:compileJava'.
(and a few more lines like this)
I should mention that I made some changes to the gradle source code: I added
a custom dependency resolver, but it doesn't process any dependency for this
project, and I changed AbstractProject.path to always be
'Project.PATH_SEPARATOR + name' (that's why the task name is
":MY_PROJECT:compileJava" instead of just ":compileJava"). However, it seems
to me that none of these changes should affect the incremental build code.
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Having-trouble-with-the-incremental-build-tp4842302p4842431.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
-----------------------
regards,
René
rene groeschke
http://www.breskeby.com
@breskeby
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email