Skip to content

Commit

Permalink
Play nicely with OpenJDK
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym committed Apr 14, 2015
1 parent 40de0d2 commit 25826a5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,21 @@ javaOptions in run ++= Seq(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+DebugNonSafepoints"
)

sources in Compile := {
if (isOracleJvmWithCommercial) (sources in Compile).value
else (sources in Compile).value.filterNot(_.getName == "FlightRecordingProfiler.java")
}

resources in Compile := {
if (isOracleJvmWithCommercial) (resources in Compile).value
else (resources in Compile).value.filterNot(_.getName == "org.openjdk.jmh.profile.Profiler")
}

def isOracleJvmWithCommercial = {
import java.lang.management.ManagementFactory
val jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments()
jvmArgs.contains(unlockCommercial)
}

def unlockCommercial = "-XX:+UnlockCommercialFeatures"

0 comments on commit 25826a5

Please sign in to comment.