-
Notifications
You must be signed in to change notification settings - Fork 154
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
Create sbt plugin for header check? #210
Comments
Possibly, a new sbt plugin might help - sbt-header works pretty well but it does seem to have its intricacies. @He-Pin created a CopyrightHeaderForBuild.scala in incubator-pekko and it seems to update some project scala files but not all. Not really sure why it seems to update some but certainly seeing many that don't get updated. In the end, we can hand modify some files if it is easier. |
So to clarify, I am not talking about re-implementing sbt-header. Rather the proposed sbt plugin that I speak of would just be an
This is due to what I mentioned, sbt plugins/settings generally only apply to the parent project, not itself. It might be hard to conceptualize, but basically any plugins in Even aside of this limitation, there is merit at last at some point in having this as an sbt plugin because just like the other sbt plugins we created, this is going to be common logic that will have to apply to every single Pekko project. |
@pjfanning Due to the recent work that is being done on header checks, I have thought about this again and I think the case for making a sbt plugin to specifically check for pekko headers is a good one. There is a large amount of code being duplicated and its good to have a centralized place for the header check logic so it can be audited better. If you have no qualms would it be possible to create an |
I'd prefer to create sbt plugins outside of Apache. We end up with all the Apache release rules and other things like that. |
I was personally contemplating about whether to make an
Now this isn't the worst problem in the world, i.e. I can make this configurable via an sbt setting but it would meant that at least for the standard license header we would have to configure this in every project. Specifically regarding having to deal with the ceremony of dealing with ASF release, as far as I understand this is a non issue until we decide to make the first release of Pekko (i.e. we would treat it the exact same way as As a compromise and I guess a technically more well designed solution, I can create |
seems fine |
We would also have to duplicate the license check, i.e .making an sbt setting in |
I'm not sure we need to check for whether the files have Lightbend headers. We should just stick our header on top anyway - regardless of whether it has a Lightbend header or not. Just to be clear, we need to keep the existing headers - all we need to do is check if the file has our header and if not then add it on top without changing any existing text. |
We are currently checking for this, and iirc the way the check is codes is to make sure that someone doesn't remove an existing Lightbend header (which is possible since sbt header gives you the previous and current state). Should confirm this. |
So I just checked pekko core and my understanding of this check was incorrect, i.e. it doesn't check if you remove a Lightbend header from an existing source file. I think this is technically possible and should be looked into, and would also be useful in |
I think this should be good, and there are many common settings for pekko and satellite projects. |
So I just thought about this more comprehensively and I at least came to the conclusion that due to how bespoke the situation with headers is for Pekko (as mentioned before even our standard Apache header is unique!) this is not really worth it because you would end up spending the same amount (if not more) effort in doing all of these bespoke changes in each Pekko repo which kind of defeats the purpose. For this reason at least in my mind we either implement an One counter argument I can think of is that by virtue of having everything centralized in |
So I just realized that we probably have to abstract all of the
sbt-header-check
logic that is done for checking the Apache copyright headers into its own sbt plugin because in the current setup, while it does correctly check for the sources that are part of the main project, it doesn’t check for the sources that are extending the sbt build (i.e.*.scala
files inproject/
).Theoretically to solve this you would have to add do
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
inproject/project/plugins.sbt
(take note of the additional nestedproject
folder) so that the plugin applies to the sbt source files however we would also have to redefine all of the logic inCopyrightHeader.scala
(hence the need to put it into a sbt plugin).@pjfanning What do you think?
The text was updated successfully, but these errors were encountered: