If a script has been identified as an empty script, then this information is cached and the script is never used again unless the cache is cleaned (even after contents are added). Also, truely empty scripts (with no content - even whitespace) cause an NPE.
To reproduce this problem:
- create a build.gradle and add no content (not even \n)
- run gradle -t, you should get a NullPointerException
- add a single carriage return to the build.gradle
- run gradle -t, you should get an empty task list (which is correct)
- add the following to build.gradle: createTask('check')
- run gradle -t, you will get an empty task list (not correct) because it has been cached as empty and is now stuck that way
I added testCases to DefaultCachePropertiesHandlerTest to cover both of these problems.