-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache generated file paths relative to the build directory (changed from project directory) #979
Conversation
fedf561
to
7999b03
Compare
|
…rom project directory) A project's build directory can be reassigned to something other than `<the project>/build`. This would typically be done via some build logic that's checked in to source control and applied to any machine that builds the code. This would usually mean that all machines' build directories have the same path relative to the project root. However, it's possible to build directory to be re-mapped in other ways, that result in a different relative path. When this happens, the paths for source/generated files must be cached as their paths relative to the build directory, instead of the project.
7999b03
to
b28e657
Compare
get() = tables.getSourceFilesWithoutGeneratedContent() | ||
.filter { source -> source != RelativeFile.ANY } | ||
.toSet() | ||
.mapNotNullToSet { it.absolute() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not need to check for AbsoluteFile.ANY_ABSOLUTE
like we were for the old RelativeFile marker? I couldn't tell from the other changes if this is just not needed anymore or if it's happening implicitly somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. It's happening implicitly elsewhere, but it also doesn't matter since ANY_ABSOLUTE
actually gets added to this set downstream in case it didn't exist already.
@Deprecated("no", ReplaceWith("absolute")) | ||
fun GeneratedFileWithSources.toSourceFile(): AbsoluteFile = absolute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why deprecate this instead of just replacing the usages now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sometimes do this to get IDE help with a simple migration, but I forgot to delete the leftover function afterwards. I'll clean this up in a followup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup PR here: #979 (comment)
task(":compileKotlin")?.outcome shouldBe TaskOutcome.SUCCESS | ||
} | ||
|
||
rootA.path.deleteRecursivelyOrFail() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we delete the rootA files here? My initial reaction based on the rest of the setup is that the project A files have been cached, and we're going to verify that those cached files can be used in project B, but that them still existing locally for project A shouldn't affect project B.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a sanity check, just to ensure that they aren't affecting project B.
A project's build directory can be reassigned to something other than
<the project>/build
. This would typically be done via some build logic that's checked in to source control and applied to any machine that builds the code. This would usually mean that all machines' build directories have the same path relative to the project root.It's possible to build directory to be re-mapped in other ways, that result in a different relative path. When this happens, the paths for source/generated files must be cached as their paths relative to the build directory, instead of the project.