@@ -51,8 +51,14 @@ val commonSettings = Seq(
5151 " -Xfatal-warnings" ,
5252 s " -Xlint:-missing-interpolator,-adapted-args, ${if (scalaBinaryVersion.value == " 2.12" ) " -unused," else " " }_ " ,
5353 ),
54+ scalacOptions ++= {
55+ if (scalaBinaryVersion.value == " 2.12" ) Seq (
56+ " -Ycache-plugin-class-loader:last-modified" ,
57+ " -Ycache-macro-class-loader:last-modified" ,
58+ ) else Seq .empty
59+ },
5460 // some Java 8 related tests use Java interface static methods, Scala 2.11.12 requires JDK8 target for that
55- scalacOptions in Test ++= (if (scalaBinaryVersion.value == " 2.11" ) Seq (" -target:jvm-1.8" ) else Seq () ),
61+ scalacOptions in Test ++= (if (scalaBinaryVersion.value == " 2.11" ) Seq (" -target:jvm-1.8" ) else Nil ),
5662 apiURL := Some (url(" http://avsystem.github.io/scala-commons/api" )),
5763 autoAPIMappings := true ,
5864
@@ -131,19 +137,20 @@ val CompileAndTest = "compile->compile;test->test"
131137lazy val commons = project.in(file(" ." ))
132138 .enablePlugins(ScalaUnidocPlugin )
133139 .aggregate(
140+ `commons-analyzer`,
141+ `commons-macros`,
134142 `commons-annotations`,
135143 `commons-annotations-js`,
136- `commons-macros`,
137144 `commons-core`,
138145 `commons-core-js`,
139- `commons-analyzer`,
140146 `commons-jetty`,
141- `commons-benchmark`,
142147 `commons-mongo`,
143148 `commons-spring`,
144149 `commons-redis`,
145150 `commons-akka`,
146151 `commons-kafka`,
152+ `commons-benchmark`,
153+ `commons-benchmark-js`,
147154 )
148155 .settings(
149156 commonSettings,
@@ -159,6 +166,7 @@ lazy val commons = project.in(file("."))
159166 `commons-core-js`,
160167 `commons-benchmark`,
161168 `commons-benchmark-js`,
169+ `commons-comprof`,
162170 ),
163171 )
164172
@@ -344,3 +352,30 @@ lazy val `commons-akka` = project
344352 " com.typesafe.akka" %% " akka-testkit" % akkaVersion % Test ,
345353 ),
346354 )
355+
356+ lazy val `commons-comprof` = project
357+ .dependsOn(`commons-core`)
358+ .settings(
359+ jvmCommonSettings,
360+ noPublishSettings,
361+ ideSkipProject := true ,
362+ addCompilerPlugin(" ch.epfl.scala" %% " scalac-profiling" % " 1.0.0" ),
363+ scalacOptions ++= Seq (
364+ s " -P:scalac-profiling:sourceroot: ${baseDirectory.value}" ,
365+ " -P:scalac-profiling:generate-macro-flamegraph" ,
366+ " -P:scalac-profiling:no-profiledb" ,
367+ " -Ystatistics" ,
368+ ),
369+ sourceGenerators in Compile += Def .task {
370+ val originalSrc = (sourceDirectory in `commons-core`).value /
371+ " main/scala/com/avsystem/commons/rest/openapi/OpenApi.scala"
372+ val originalContent = IO .read(originalSrc)
373+ (0 until 10 ).map { i =>
374+ val pkg = f " oa $i%02d "
375+ val newContent = originalContent.replaceAllLiterally(" package rest.openapi" , s " package rest. $pkg" )
376+ val newFile = (sourceManaged in Compile ).value / pkg / " OpenApi.scala"
377+ IO .write(newFile, newContent)
378+ newFile
379+ }
380+ }.taskValue
381+ )
0 commit comments