-
Notifications
You must be signed in to change notification settings - Fork 81
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
Post life cycle #244
Post life cycle #244
Conversation
…suites. Added some documentation.
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.
Thank you for this contribution! I just did a quickly review, will need a closer look another time
import mdoc._ | ||
import mdoc.internal.cli.{Exit, Settings} |
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.
Settings can’t be exposed in the public api since it’s internal. We could add a public interface on the class if that helps
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.
@olafurpg Apologies for closing this but the CI/CD failed. In particular one tests assumes that the files are processed in a given order. Need to correct this.
Settings are not required so I will remove it.
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.
You can add MainSettings
as an argument
We can add public methods down the road to access fields on the private Settings
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.
Alternatively, we can add a abstract class Settings
in the public mdoc
API and pass that in even if it has no public members for now. It's desirable to pass in one parameter just so we can pass in more information in the future without breaking the public API
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 understand the use of MainSettings
. Settings
does not extend this class. Note that I call onStart
method in MainOps
. Can you explain?
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.
Settings is a case class which gets auto generated methods like “copy” that break binary compatibility on removal/addition of fields. This makes case classes essentially unsuitable for public APIs unless you’re certain you will never need to add/remove a field.
MainSettings is just a thin wrapper around the case class that has a stable api that we can evolve in a binary compatible way.
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 for the explanation. MainSettings
is now being used. I have tried to make as few changes as possible. They are basically limited to MainOps
. Not too happy with it because I would have liked to make the calls within the MainOps.run
method. However this would entail changing the parameters of the constructor or run
(Context
is used in many places and my not be the best change).
Please see #245
import scala.meta.inputs.Input | ||
import scala.meta.io.AbsolutePath | ||
import scala.collection.JavaConverters._ | ||
import scala.meta.io.RelativePath | ||
|
||
trait PostModifier { | ||
val name: String | ||
def onStart(settings: Settings): Unit |
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.
These need to have default implementations for backwards compatibility
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.
Ok. Will do. Will a simple return of ()
do?
Apologies for the newbie questions.
I as planning to make another pull request. Should I or do I keep working here? If I do open a new one, their seem to be a "review pull " option. Should I use that instead?
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.
: Unit = ()
is a fine default implementation
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.
Done
Pull request for #213. Note that
onWatchIterationEnd
not implemented.