-
Notifications
You must be signed in to change notification settings - Fork 3
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
Replace buildDir
with layout.buildDirectory
and do some other housekeeping
#185
Conversation
…, so it can run even if apiJar does not
…paths for exclusion, not just directory names
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.
Submitting a partial review because some of these path differences seem like they might break things.
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.
For places that could work with any of project.layout.buildDirectory.file("file")
, BuildUtils.getBuildDirFile(project, "file")
, or a String
; is there an order of preference to which one to use?
catch (UnknownTaskException ignore) { | ||
return defaultValue | ||
} | ||
} |
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.
For Distribution.getArtifactId
static Optional<TaskProvider> getOptionalTask(Project project, String taskName)
{
try {
return Optional.of(project.tasks.named(taskName))
}
catch (UnknownTaskException ignore) {
return Optional.empty()
}
}
I tend to prefer the provider version if I know that it will work, simply because it seems to be the way Gradle is heading, but I also don't think it matters much. It annoys me that it's not at all obvious in various places where the string is needed vs. the file vs. the provider. I'm pretty sure the ant builder interface requires strings most of the time, for example. |
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.
Looks good. I just pushed a change to remove TaskUtils.getFromTaskIfPresent
. They aren't actually used and TaskUtils.getOptionalTask
can accomplish the same thing.
Rationale
In Gradle 8.3, the use of
project.buildDir
was deprecated in favor ofproject.layout.buildDirectory
. We make adjustments here to upgrade to the new world order. We also take this opportunity to do a little housecleaning of a good number of stray semicolons that are cluttering the space and to replace almost all remaining usages oftask.findTaskByName
withtask.named
.Related Pull Requests
Changes
project.buildDir
BuildUtils.includeModules
to be able to specify full module paths for exclusion, not just directory names