-
Notifications
You must be signed in to change notification settings - Fork 950
Make skip work on publishLocal #7165
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
Conversation
14c94cc
to
babeba6
Compare
log: Logger, | ||
ref: ProjectRef | ||
)(notPublishLocal: () => Unit): Unit = { | ||
if (currentCon == publishLocalConf) { |
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.
Is this equality comparison correct for checking if the current publish target is publishLocal
or should something else be done?
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.
A more idiomatic way would be to pass the corresponding skip key to publishTask
directly and then call it with
publish := publishTask(publishConfiguration, publish / skip).value,
publishLocal := publishTask(publishLocalConfiguration, publishLocal / skip).value,
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.
Ah yes that would be nicer, lets see what response I get from sbt maintainer to see if I am on write track and if so I can clean it up later
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.
So I just had a quick look at this and I am not sure if this is possible without breaking binary compatibility (which I think is a concern as they appear to be public functions?)
The first issue is that if I change publishTask
to `
def publishTask(
config: TaskKey[PublishConfiguration],
skipPublish: TaskKey[Boolean]
)
Then this will conflict with an already existing deprecated method (i.e.
@deprecated("Use variant without delivery key", "1.1.1")
def publishTask(
config: TaskKey[PublishConfiguration],
deliverKey: TaskKey[_],
): Initialize[Task[Unit]] =
publishTask(config)
Both methods will have the same type after erasure.
Instead you could define
def publishTask(
config: TaskKey[PublishConfiguration],
skipPublish: Boolean
)
To deal with the erasure problem but on the assumption we are dealing with public functions, such a function is out of place in terms of API design. I could make this private, but I would also have to do some more additional changes to the call site since we are not dealing with a TaskKey
anymore (naively doing publishTask(publishConfiguration, publish / skip).value
doesn't work because the macro cannot expand the .value
at that spot).
If I can get rid of the deprecated publishTask
function then this change makes perfect sense. @eed3si9n What do you think?
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 don't think we can remove methods during 1.x series.
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.
Okay so you fine leaving the implementation it as is?
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.
Okay so you fine leaving the implementation it as is?
Yea.
after this change, if I will people need to set both in order to get the old behavior? asking because I think the old behavior is what is wanted most of the time |
Yes I actually was thinking of this, if one sets skip := false You would have skip := false
publishLocal / skip := (publish / skip).value, // So we don't break previous behaviour |
babeba6
to
5187996
Compare
@SethTisue So I pushed a change with I think should preserve current behaviour as you described |
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.
Overall ok with the direction, but we would like a test.
9dac9c4
to
f81db56
Compare
f81db56
to
2a332a5
Compare
@eed3si9n All tests are passing now, let me know if any additional changes are needed |
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.
Thanks!
I think this PR introduced a bug: #7288 |
So in a project I am working on I noticed the following comment from https://github.com/apache/incubator-pekko-grpc/blob/main/build.sbt#L144-L146, i.e.
This PR updates
publishTask
so that it respectspublishLocal / skip
. The current solution is a bit boilerplatery and is also missing a test however if I am on the right track then let me know and I can update the PR.Also when the PR is ready I can create an equivalent PR for the 1.8.x branch (not sure if another sbt release for 1.8.x is expected). Either that or we can just cherry pick once this is merged