Code Monkey home page Code Monkey logo

Comments (7)

DavidGregory084 avatar DavidGregory084 commented on August 12, 2024 2

If you want to disable fatal warnings for part of your build for whatever reason, how would you do that with sbt-tpolecat?

To answer this specific question, you could do something like:

lazy val foo = project.in(file("foo"))
  .settings(
    tpolecatScalacOptions ~= { _.filterNot(Set(ScalacOptions.fatalWarnings)) }
  )

Or you could set the more specific option key just for the default mode tpolecatCiModeOptions if you wanted to be extremely specific.

from sbt-tpolecat.

armanbilge avatar armanbilge commented on August 12, 2024 1

Ok, thanks, that's helpful. So tlFatalWarnings might live on as a one liner to do that ☝️

from sbt-tpolecat.

DavidGregory084 avatar DavidGregory084 commented on August 12, 2024 1

I have a PR open with sbt to make removing options nicer (sbt/sbt#6856) but unfortunately it's stuck on a legal review of the CLA at the moment 😢

from sbt-tpolecat.

DavidGregory084 avatar DavidGregory084 commented on August 12, 2024

If Someone™️ wants to do the work to add a JavacOptions DSL I don't have any objection in principle, but since I rarely use mixed projects personally I wasn't planning to do it myself. 😛
We'd need to bear in mind that javac options have evolved over time in much the same way as Scala compiler options, although generally with much greater attention to deprecating old options before removal.
I don't have any objection to setting javacOptions directly either.
Both are definitely a breaking change for users that currently set their own javacOptions.

BTW, how do you think that tlFatalWarnings and tpolecatOptionsMode should be unified?

from sbt-tpolecat.

armanbilge avatar armanbilge commented on August 12, 2024

Yeah, it's somewhat a question of philosophy. If The sbt-tpolecat Way is to individually add lints instead of doing the lazy -Xlint:all, then probably this doesn't make sense and it can just be an sbt-typelevel-settings thing.

BTW, how do you think that tlFatalWarnings and tpolecatOptionsMode should be unified?

That's a good question. I'm a little confused I guess. If you want to disable fatal warnings for part of your build for whatever reason, how would you do that with sbt-tpolecat?

from sbt-tpolecat.

DavidGregory084 avatar DavidGregory084 commented on August 12, 2024

At the moment there are different modes for the plugin, and default "option sets" for each mode. For the "development" mode we have:

tpolecatDevModeOptions := ScalacOptions.default

for "CI" mode we have:

tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings

for "release" mode we have:

tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal

If you want to enable a certain mode you can either use a command:

> tpolecatDevMode

or set an environment variable:

SBT_TPOLECAT_DEV=true sbt prePR

If no environment variable is set then you get the default mode (CI mode).

So at the moment, if you want to disable fatal warnings, you can either fiddle with the option sets to set them how you like in each mode, or set SBT_TPOLECAT_DEV to any value in your CI build, or run the tpolecatDevMode command as the first part of a command chain.

The reason that the default mode is the CI mode is that existing users didn't want the behaviour to change (i.e. fatal warnings should be enabled in the default configuration for this plugin).

from sbt-tpolecat.

DavidGregory084 avatar DavidGregory084 commented on August 12, 2024

Good places to look to understand what we need to configure here:

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html
https://docs.oracle.com/en/java/javase/11/tools/javac.html
https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html

Annoyingly the page for the javac command keeps moving in each JDK release 😆

from sbt-tpolecat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.