Skip to content

Conversation

huxi
Copy link
Contributor

@huxi huxi commented Jul 7, 2016

Any of the checked boxes below indicate that I took action:

For all non-trivial changes that modify the behavior or public API:

  • Before submitting a pull request, I started a discussion on the
    Gradle developer list
    or can reference a JIRA issue.
  • I wrote a design document. A design document can be
    brief but explains the use case or problem you are trying to solve,
    touches on the planned implementation approach as well as the test cases
    that verify the behavior. Optimally, design documents should be submitted
    as a separate pull request. Samples
    can be found in the Gradle GitHub repository. Please let us know if you need help with
    creating the design document. We are happy to help!
  • The pull request contains an appropriate level of unit and integration
    test coverage to verify the behavior. Before submitting the pull request
    I ran a build on your local machine via the command
    ./gradlew quickCheck <impacted-subproject>:check.
  • The pull request updates the Gradle documentation like user guide,
    DSL reference and Javadocs where applicable.
  • Internal code-review: REVIEW-6267

huxi added 4 commits July 7, 2016 10:54
Return empty SimpleFileCollection instead of throwing UnsupportedOperationException.
- added missing mocks
- changed upToDate() to skipped('SKIPPED')
@wolfs wolfs added this to the waiting-for-gradle-team milestone Jul 12, 2016
huxi added 2 commits July 14, 2016 21:05
# Conflicts:
#	subprojects/core/src/main/java/org/gradle/api/internal/changedetection/changes/NoHistoryArtifactState.java
NoHistoryArtifactState.getOutputFiles() is now always returning the same immutable EMPTY_FILE_COLLECTION instance instead of returning a new SimpleFileCollection for every call.
@huxi
Copy link
Contributor Author

huxi commented Jul 14, 2016

Fixed the merge conflict and enhanced NoHistoryArtifactState.getOutputFiles() a bit.

- made sure that EmptyFileSet and EmptyFileCollection point to the same singleton instance after deserialization.
- added test verifiying this.
@huxi
Copy link
Contributor Author

huxi commented Jul 15, 2016

I changed EmptyFileSet and EmptyFileCollection into proper singletons.

Both are currently private static inner classes of the package-private NoHistoryArtifactState which is definitely OK for now. The question remains if they would be useful in other contexts in which case they would have to be moved somewhere else.

I guess that NoHistoryArtifactState should also be a singleton but I don't know future plans regarding that class. It would certainly reduce GC pressure to always return the same instance instead of new instances over at ShortCircuitTaskArtifactStateRepository.

@huxi
Copy link
Contributor Author

huxi commented Aug 14, 2016

49d7688 broke this PR again.

TaskExecutionHistory.getOutputFiles() has been replaced by TaskExecutionHistory.getOutputFiles(String propertyName), preventing me from doing a general FileCollection outputFiles = repository.getStateFor(task).getExecutionHistory().getOutputFiles();

This changed method is used by SimpleStaleClassCleaner and the propertyName argument is set manually, per task (e.g. return new SimpleStaleClassCleaner(taskOutputs, "destinationDir"); in CleaningGroovyCompiler).

I have no idea how to find correct propertyName value(s) for given tasks in a generic way and it appears like no such way exists at the moment.

So, unfortunately, I see no way to fix my PR anymore.

@lptr (author of 49d7688) & @eljobe (current GRADLE-2579 assignee): Please let me know if this PR is relevant at all to you.

If it is then please let me know how to retrieve the above propertyName in a generic, non-hardcoded way. Alternatively, you could restore the previously available, general TaskExecutionHistory.getOutputFiles() method.

I just need a way to retrieve any files previously generated by a given task so I can delete them if sourceFiles of said task have become empty.

@lptr
Copy link
Member

lptr commented Aug 16, 2016

@huxi: sorry for the long silence on this one. We definitely want to get the underlying problem fixed, and your PR provides some good basis to build on. I will have time to look into it in more detail in two weeks when I come back from vacation. Meanwhile, if you want to get it to work, you can use TaskOutputsInternal.getFileProperties() to see what properties there are.

@huxi
Copy link
Contributor Author

huxi commented Aug 16, 2016

@lptr No problem, I know you were all pretty busy with getting 3.0 out of the door.

TaskOutputsInternal.getFileProperties() won't help (I guess) because I need the previously generated outputs from the history, not the outputs of the current task.

But we can sort this all out when you are back. Have a nice vacation!

@lptr
Copy link
Member

lptr commented Aug 17, 2016

@huxi: you are right. I just reverted that change, see b69d831.

@huxi
Copy link
Contributor Author

huxi commented Aug 17, 2016

OK, thanks. Now enjoy your vacation! 😃

@lptr
Copy link
Member

lptr commented Aug 17, 2016

One problem we still need to look into about this PR is that it calls repository.getStateFor(task), which is an expensive operation. If you look at SkipUpToDateTaskExecuter.execute(), you can see that the information you need is looked up and stored there already, but it happens later in the chain of TaskExecuters. One thing that could be done is to move the lookup into a separate (otherwise no-op) TaskStateLookupTaskExecuter or something that does the lookup and storing of data, so it is available in all the executers further down the chain.

Also, vacation won't start until the weekend. :)

huxi added 4 commits August 18, 2016 06:57
# Conflicts:
#	subprojects/core/src/main/java/org/gradle/api/internal/changedetection/changes/NoHistoryArtifactState.java
Enhanced SkipEmptySourceFilesTaskExecuterTest quite a bit.
@huxi
Copy link
Contributor Author

huxi commented Aug 18, 2016

@lptr I fixed that problem. Nice side effect is better separation of concerns in SkipUpToDateTaskExecuter.

Can't do the ./gradlew quickCheck or ./gradlew quickCheck core:check at the moment since current HEAD explodes in buildSrc for me. I'll try to execute them a bit later. The related tests work in IDEA, though.

I also extended SkipEmptySourceFilesTaskExecuterTest for my use case and tightened the mock call checking.

@huxi
Copy link
Contributor Author

huxi commented Aug 18, 2016

@lptr TL;DR ./gradlew quickCheck :core:check works.

The strange error in buildSrc was caused by a corrupted ~/.gradle/cache. Deleting the cache fixed that problem.

After that, I got failing tests in core, e.g. OutputFilesCollectionSnapshotterTest. It took me a moment to realize that this test doesn't exist anymore. Performing a ./gradlew clean and restarting the build fixed it.

So it looks like I was bitten by GRADLE-2579 while fixing GRADLE-2579. I love the irony! 😃

@wolfs wolfs self-assigned this Aug 30, 2016
@huxi
Copy link
Contributor Author

huxi commented Sep 13, 2016

Any news about this?

@wolfs
Copy link
Member

wolfs commented Sep 14, 2016

I will have time to work on this soon (this week or next week).

@lptr
Copy link
Member

lptr commented Sep 26, 2016

@huxi: sorry about the long delay again. I took your changes here, squashed them, and pushed them straight to master with some fixes. I hope it's alright. I'm closing this PR now.

@lptr lptr closed this Sep 26, 2016
@lptr
Copy link
Member

lptr commented Sep 26, 2016

Oh, and thank you for the contribution, and especially thanks for not letting this drop below the radar!

@huxi
Copy link
Contributor Author

huxi commented Sep 26, 2016

@lptr You are very welcome! This will be included in 3.2, right?

@lptr
Copy link
Member

lptr commented Sep 26, 2016

Yes, it is on track for being included in 3.2.

@huxi
Copy link
Contributor Author

huxi commented Sep 27, 2016

@lptr Awesome! You should set GRADLE-2579, GRADLE-2440 and GRADLE-3520 to fixed/resolved, though.

I seriously consider engraving a small tombstone for this issue. :)

@lptr
Copy link
Member

lptr commented Sep 27, 2016

:)

I didn't see GRADLE-3520 yet, thanks. Will close all those once the fix is through internal reviews.

@jjohannes jjohannes modified the milestones: 3.2, waiting-for-gradle-team Sep 30, 2016
@lptr
Copy link
Member

lptr commented Oct 5, 2016

Well, turns out GRADLE-3520 is not related after all. Even so, we've managed to resolve the other two, so still a great result. :)

@huxi
Copy link
Contributor Author

huxi commented Oct 6, 2016

Ah, I see the difference. It looked like a duplicate on first glance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants