Permalink
Browse files

Optionally re-integrated scala-maven-plugin compilation

Use USE_SBT=0 env setting to activate compilation with scala-maven-plugin, which will also support zinc-server compilation.
  • Loading branch information...
lefou committed May 25, 2018
1 parent 2bc3fa1 commit 4858b6f19c12a239194b20d309237a57996ea3cf
Showing with 155 additions and 86 deletions.
  1. +1 −1 blended-updater-maven-plugin/pom.scala
  2. +1 −1 blended.activemq.brokerstarter/pom.scala
  3. +1 −1 blended.activemq.client/pom.scala
  4. +1 −1 blended.activemq.defaultbroker/pom.scala
  5. +1 −1 blended.akka.http.proxy/pom.scala
  6. +1 −1 blended.akka.http/pom.scala
  7. +1 −1 blended.akka/pom.scala
  8. +31 −2 blended.build/build-common.scala
  9. +30 −0 blended.build/build-plugins.scala
  10. +1 −1 blended.camel.utils/pom.scala
  11. +1 −1 blended.container.context.api/pom.scala
  12. +1 −1 blended.container.context.impl/pom.scala
  13. +1 −1 blended.domino/pom.scala
  14. +1 −1 blended.file/pom.scala
  15. +1 −1 blended.itest/blended.itest.node/pom.scala
  16. +3 −3 blended.itestsupport/pom.scala
  17. +1 −1 blended.jetty.boot/pom.scala
  18. +1 −1 blended.jms.sampler/pom.scala
  19. +11 −10 blended.jms.utils/pom.scala
  20. +1 −1 blended.jmx/pom.scala
  21. +1 −1 blended.jolokia/pom.scala
  22. +1 −1 blended.launcher/pom.scala
  23. +1 −1 blended.mgmt.agent/pom.scala
  24. +1 −1 blended.mgmt.base/pom.scala
  25. +1 −1 blended.mgmt.mock/pom.scala
  26. +1 −1 blended.mgmt.repo.rest/pom.scala
  27. +1 −1 blended.mgmt.repo/pom.scala
  28. +7 −6 blended.mgmt.rest/pom.scala
  29. +2 −2 blended.mgmt.service.jmx/pom.scala
  30. +1 −1 blended.mgmt.ws/pom.scala
  31. +1 −1 blended.persistence.orient/pom.scala
  32. +1 −1 blended.persistence/pom.scala
  33. +2 −1 blended.prickle.akka.http/pom.scala
  34. +1 −1 blended.samples/blended.akka.http.sample.helloworld/pom.scala
  35. +1 −1 blended.samples/blended.samples.camel/pom.scala
  36. +1 −1 blended.samples/blended.samples.jms/pom.scala
  37. +1 −1 blended.samples/blended.samples.spray.helloworld/pom.scala
  38. +1 −1 blended.security.akka.http/pom.scala
  39. +1 −1 blended.security.boot/pom.scala
  40. +2 −2 blended.security.login.rest/pom.scala
  41. +2 −2 blended.security.login/pom.scala
  42. +1 −1 blended.security.scep/pom.scala
  43. +1 −1 blended.security.ssl/pom.scala
  44. +1 −1 blended.security/pom.scala
  45. +1 −1 blended.spray/pom.scala
  46. +1 −1 blended.testsupport.pojosr/pom.scala
  47. +1 −1 blended.testsupport/pom.scala
  48. +7 −7 blended.updater.config/pom.scala
  49. +1 −1 blended.updater.remote/pom.scala
  50. +2 −1 blended.updater.tools/pom.scala
  51. +13 −8 blended.updater.tools/src/main/scala/blended/updater/tools/configbuilder/RuntimeConfigBuilder.scala
  52. +1 −1 blended.updater/pom.scala
  53. +3 −2 blended.util/pom.scala
@@ -43,7 +43,7 @@ BlendedModel(
)
),
plugins = Seq(
sbtCompilerPlugin,
scalaCompilerPlugin,
Plugin(
gav = Plugins.plugin,
executions = Seq(
@@ -24,6 +24,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -19,6 +19,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -15,7 +15,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -41,7 +41,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -34,7 +34,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
View
@@ -27,7 +27,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -110,6 +110,32 @@ val eclipseProfile = Profile(
)
)
/**
* Removed duplicate plugins by merging their configurations and executions.
*/
def sanitizePlugins(plugins: Seq[Plugin]): Seq[Plugin] = plugins.foldLeft(Seq[Plugin]()){(l,r) =>
l.find(p => p.gav == r.gav) match {
case None => l ++ Seq(r)
case Some(existing) => l.map{ p =>
if(p == existing) {
Plugin(
gav = p.gav,
dependencies = p.dependencies ++ r.dependencies,
extensions = p.extensions || r.extensions,
inherited = p.inherited || r.inherited,
executions = p.executions ++ r.executions,
configuration = (p.configuration, r.configuration) match {
case (None, None) => null
case (Some(c), None) => c
case (None, Some(c)) => c
case (Some(a), Some(b)) => new Config(a.elements ++ b.elements)
}
)
} else p
}
}
}
// We define the BlendedModel with some defaults, so that they can be reused
// throughout the build
@@ -216,7 +242,7 @@ object BlendedModel {
configuration = Config(
rules = Config(
requireMavenVersion = Config(
version = "3.0.5"
version = "3.3.1"
)
)
)
@@ -286,7 +312,7 @@ object BlendedModel {
) = {
if (parent != null) println(s"Project with parent: ${gav}")
val theBuild = {
val usedPlugins = plugins ++ defaultPlugins
val usedPlugins = sanitizePlugins(plugins ++ defaultPlugins)
Option(Build(
resources = resources ++ defaultResources,
testResources = testResources ++ defaultTestResources,
@@ -465,6 +491,9 @@ def featuresMavenPlugins(features: Seq[FeatureDef]) = Seq(
)
)
/**
* A Blended project containing resources for a Blended Container Profile.
*/
object BlendedProfileResourcesContainer {
def apply(
gav: Gav,
@@ -234,6 +234,36 @@ val polyglotTranslatePlugin = Plugin(
)
)
val scalaExecution_addSource: Execution = Execution(
id = "scala-addSource",
goals = Seq("add-source"),
phase = "initialize",
configuration = scalaCompilerConfig
)
val scalaExecution_compile: Execution = Execution(
id = "scala-compile",
goals = Seq("compile"),
configuration = scalaCompilerConfig
)
val scalaExecution_testCompile: Execution = Execution(
id = "scala-testCompile",
goals = Seq("testCompile"),
configuration = scalaCompilerConfig
)
val scalaMavenPlugin = Plugin(
gav = Plugins.scala,
executions = Seq(
scalaExecution_addSource,
scalaExecution_compile,
scalaExecution_testCompile
),
configuration = scalaCompilerConfig
)
val scalaCompilerPlugin = if(System.getenv("USE_SBT") == "0") scalaMavenPlugin else sbtCompilerPlugin
/**
* Scala execution to generate logback-test.xml on the fly.
*/
@@ -19,7 +19,7 @@ BlendedModel(
Blended.akka
),
plugins = Seq(
sbtCompilerPlugin,
scalaCompilerPlugin,
mavenBundlePlugin
)
)
@@ -20,7 +20,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -29,7 +29,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
View
@@ -18,6 +18,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
View
@@ -22,7 +22,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -23,7 +23,7 @@ BlendedModel(
logbackClassic % "test"
),
plugins = Seq(
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -54,14 +54,14 @@ BlendedModel(
)
)
),
sbtCompilerPlugin,
scalaCompilerPlugin,
Plugin(
scalatestMavenPlugin.gav,
executions = Seq(
scalatestExecution
scalatestExecution
),
configuration = new Config(
scalatestConfiguration.elements ++
scalatestConfiguration.elements ++
Seq(
"argLine" -> Some("-javaagent:${project.build.directory}/jolokia/jolokia-jvm-" + BlendedVersions.jolokiaVersion + "-agent.jar=port=7777,host=localhost")
)
@@ -33,7 +33,7 @@ BlendedModel(
))
)
),
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -19,6 +19,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -15,26 +15,27 @@ BlendedModel(
|to monitor the connection via an active ping.
""".stripMargin,
dependencies = Seq(
scalaLib % "provided",
Deps.scalaLib % "provided",
Blended.domino,
Blended.mgmtBase,
Blended.containerContextApi,
Blended.updaterConfig,
camelJms,
Deps.camelJms,
Blended.akka,
jms11Spec,
log4s,
scalaTest % "test",
akkaSlf4j % "test",
mockitoAll % "test",
activeMqBroker % "test",
activeMqKahadbStore % "test",
akkaTestkit % "test",
Deps.jms11Spec,
Deps.log4s,
Deps.scalaTest % "test",
Deps.akkaSlf4j % "test",
Deps.mockitoAll % "test",
Deps.activeMqBroker % "test",
Deps.activeMqKahadbStore % "test",
Deps.akkaTestkit % "test",
Blended.camelUtils % "test",
Blended.testSupport % "test"
),
plugins = Seq(
mavenBundlePlugin,
// FIXME: use scalaCompilerPlugin instead, but it currently has test compile errors when used (TR)
sbtCompilerPlugin,
scalatestMavenPlugin
)
View
@@ -15,6 +15,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -46,7 +46,7 @@ BlendedModel(
)
),
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
Plugin(
gav = Plugins.scalaTest,
configuration = Config(
@@ -45,7 +45,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
// Scalatest, we need to fork the tests, as Laucher depends on sys properties, which we mutate in tests
Plugin(
gav = Plugins.scalaTest,
@@ -23,6 +23,6 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin
scalaCompilerPlugin
)
)
@@ -20,7 +20,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -26,7 +26,7 @@ BlendedModel(
"bundle.namespace" -> "${project.artifactId}"
),
plugins = Seq(
sbtCompilerPlugin,
scalaCompilerPlugin,
Plugin(
gav = Plugins.exec,
executions = Seq(
@@ -26,7 +26,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -22,7 +22,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
@@ -15,8 +15,8 @@ BlendedModel(
"bundle.namespace" -> "${project.artifactId}"
),
dependencies = Seq(
scalaLib % "provided",
slf4j % "provided",
Deps.scalaLib % "provided",
Deps.slf4j,
Blended.mgmtBase,
Blended.akka,
Deps.akkaHttp,
@@ -26,15 +26,16 @@ BlendedModel(
Blended.prickleAkkaHttp,
Blended.securityAkkaHttp,
Blended.updaterRemote,
orgOsgi,
orgOsgiCompendium,
scalaTest % "test",
Deps.orgOsgi,
Deps.orgOsgiCompendium,
Deps.scalaTest % "test",
Deps.akkaHttpTestkit % "test",
mockitoAll % "test",
Deps.mockitoAll % "test",
Deps.logbackClassic % "test"
),
plugins = Seq(
mavenBundlePlugin,
// FIXME: use scalaCompilerPlugin instead, but it currently has test compile errors when used (TR)
sbtCompilerPlugin,
scalatestMavenPlugin
)
@@ -21,7 +21,7 @@ BlendedModel(
),
plugins = Seq(
mavenBundlePlugin,
sbtCompilerPlugin,
scalaCompilerPlugin,
scalatestMavenPlugin
)
)
)
Oops, something went wrong.

0 comments on commit 4858b6f

Please sign in to comment.