eed3si9n / ifdef   0.3.0

Apache License 2.0 GitHub

`@ifdef` is an annotation that implements conditional compilation in Scala

Scala versions: 3.x 2.13 2.12
Scala.js versions: 1.x
Scala Native versions: 0.5
sbt plugins: 1.x

ifdef

@ifdef is an annotation that implements conditional compilation in Scala.

See https://eed3si9n.com/ifdef-in-scala-via-pre-typer-processing/ for details.

setup

addSbtPlugin("com.eed3si9n.ifdef" % "sbt-ifdef" % "x.y.z")

usage

package example

import com.eed3si9n.ifdef.ifdef

class A {
  def foo: Int = 42
}

@ifdef("test")
class ATest extends munit.FunSuite {
  test("hello") {
    val actual = new A().foo
    val expected = 42
    assertEquals(actual, expected)
  }
}

license

ifdef is released under Apache License Version 2.0.