scalac-options icon indicating copy to clipboard operation
scalac-options copied to clipboard

[proposal] ScalacOption class based on types

Open satorg opened this issue 3 years ago • 4 comments

I started sketching out some ideas according to our conversations with @armanbilge and @DavidGregory084. See also #2.

Basically, it is very similar to how org.http4s.Header works:

case class Deprecation(value: Boolean)
object Deprecation {
  implicit val deprecationScalacOption: ScalacOption.Aux[Deprecation, ScalacOption.Single] = new ScalacOption {
    type Type = ScalacOption.Single
    def baseName = "deprecation"
    // and so on
  }
}

Then in build.sbt:

val deprecation: Option[Deprecation] =
  ScalacOptions.parse(scalacOptions.value) // `parse` is not implemented yet
    .get[Deprecation]

Still requires a lot of work and refinements. And tests of course :)

Note: I put all the new classes into a proposal sub-package just to do not interfere with the existing code.

satorg avatar Oct 07 '22 10:10 satorg

Ok.. But it won't work for options like -encoding utf-8 because of a parameter passed separately 😊 I need to think harder :)

satorg avatar Oct 07 '22 10:10 satorg

@satorg so where did we leave this one? 😅 FTR no pressure or anything, just trying to figure if/how things are blocked. We do have to do sbt-tl 0.5.x sometime, but believe me I am in no rush 😬

armanbilge avatar Dec 11 '22 00:12 armanbilge

Yeah, personally I would really love to continue on this... Just got distracted a little bit with some other less pleasant but more urgent stuff, unfortunately. Hopefully, I will sort it out soon and be able to return to more pleasant things like this one :)

satorg avatar Dec 11 '22 00:12 satorg

I know the feeling :) thanks for the update and hope you have a nice holiday!

more pleasant things like this one :)

Ha, that's fantastic. I am not nearly so thrilled about scalac options 😂 so I'm glad we found the right person for the job 😉

armanbilge avatar Dec 11 '22 00:12 armanbilge