Via library dependencies
Despite installation via sbt-redacted is the recommended way to add @redacted to your existing
project, you can also opt for adding manually the required dependencies.
The procedure is pretty straightforward although, can't stress it enough, using sbt-plugin would be more future-proof,
since there are plans to extend the compiler plugin, and using the sbt plugin would make its configuration less
error-prone.
If you're still convinced, all you have to do is edit build.sbt like so
lazy val redactedVersion = "x.y.z" // use latest version of the library
// resolvers += DefaultMavenRepository
libraryDependencies ++= Seq(
"io.github.polentino" %% "redacted" % redactedVersion cross CrossVersion.full,
compilerPlugin("io.github.polentino" %% "redacted-plugin" % redactedVersion cross CrossVersion.full)
)
Scala.js and Scala Native
redacted is published for the JVM, Scala.js and Scala Native. The annotation library is cross-published, so use
%%% to let sbt pick the right platform artifact; the compiler plugin always stays JVM-only (it runs inside the
compiler and is never shipped in the final binary), so keep depending on it with %%:
lazy val redactedVersion = "x.y.z" // use latest version of the library
libraryDependencies ++= Seq(
"io.github.polentino" %%% "redacted" % redactedVersion cross CrossVersion.full,
compilerPlugin("io.github.polentino" %% "redacted-plugin" % redactedVersion cross CrossVersion.full)
)
Once done that, just import the annotation in your .scala file, and use it like so
package com.your.project
import io.github.polentino.redacted._
final case class YourClass(@redacted email: String, lastLogin: Timestamp)