I ran into an issue where when I run ./gradlew build && ./gradlew clean build
the second gradle execution will mark a custom task as up-to-date incorrectly.
The output method is
@OutputDirectories
public Set<File> getDependencies() {
Set<File> insalledSitePackages = getSitePackageFolderSet(dependencyConfiguration.getDependencies());
getLogger().info("Packages dir: {}", insalledSitePackages);
return insalledSitePackages;
}
private Set<File> getSitePackageFolderSet(DependencySet dependencies) {
HashSet<File> sitePackages = new HashSet<File>();
for (Dependency dependency : dependencies) {
sitePackages.add(new File(TaskUtils.sitePackage(getVenvDir(), env.getVersion()), dependency.getName()));
}
return sitePackages;
}
And I see when the task does it’s up-to-date checks that it outputs
Packages dir: [/workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/setuptools-git, /workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/pip]
Input dir: configuration ':virtualEnv'
Packages dir: [/workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/setuptools-git, /workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/pip]
Packages dir: [/workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/setuptools-git, /workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/pip]
Packages dir: [/workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/setuptools-git, /workspace/repo/test-project/build/python-2.6.9-python/venv/lib/python2.6/site-packages/pip]
It appears that Gradle correctly deletes the build directory on the second run, but incorrectly computes the up-to-date status of the task saying on the second run
Skipping task ':installRequiredDependencies2.6.9' as it is up-to-date (took 0.139 secs).