11import sbt ._
2- import Multiversion .sparkVersion
32import com .typesafe .sbt .SbtNativePackager .autoImport .NativePackagerHelper ._
4- import sbt .Keys .{scalaVersion , test }
5- import sbtassembly .AssemblyPlugin .autoImport .{assemblyExcludedJars , assemblyOption }
3+ import sbt .Keys .scalaVersion
64
7- lazy val commonSettings = Seq (
8- version := " 1.2.1"
9- )
10-
11- sparkVersion := " 2.4.0" // default spark version
5+ ThisBuild / organization := " it.agilelab"
6+ ThisBuild / version := " 1.3.0-SNAPSHOT"
127
138scalacOptions ++= Seq (
149 " -target:jvm-1.8" ,
@@ -30,21 +25,6 @@ resolvers ++= Seq(
3025 " Cloudera" at " https://repository.cloudera.com/artifactory/cloudera-repos/"
3126)
3227
33- def calcVersionScala (sparkVersion : String ): String = {
34- sparkVersion.head match {
35- case '1' => " 2.10.6"
36- case '2' => " 2.11.11"
37- case _ => throw new Exception (" This Spark version is not supported" )
38- }
39- }
40-
41- /*
42- MODULE: "DQ_ROOT"
43- */
44- lazy val root = (project in file(" ." )).settings(
45- name := " DataQuality-framework"
46- ).aggregate(core, common)
47-
4828/*
4929 MODULE: "DQ_COMMON"
5030 */
@@ -55,23 +35,24 @@ lazy val common =
5535/*
5636 MODULE: "DQ_CORE"
5737 */
38+
5839lazy val core = (project in file(" dq-core" ))
5940 .enablePlugins(UniversalPlugin , UniversalDeployPlugin )
6041 .settings(
61- sparkVersion := sparkVersion.all(ScopeFilter (inProjects(ProjectRef (file(" ." ), " root" )))).value.head,
62- scalaVersion := calcVersionScala(sparkVersion.value),
63- commonSettings,
64- libraryDependencies ++= {
65- // val sv = sparkVersion.all(ScopeFilter(inProjects(ProjectRef(file("."), "root")))).value.head
66- Dependencies .dq_core ++ Dependencies .sparkDependenciesCalculation(sparkVersion.value)
42+ libraryDependencies ++= {
43+ Dependencies .dq_core ++ Dependencies .getSparkDependencies(sparkVersion.value)
6744 },
68- unmanagedResourceDirectories in Compile += baseDirectory(_ / " src/main/resources" ).value,
69- excludeFilter in Compile in unmanagedResources := " *" ,
70- unmanagedJars in Compile += file(" dq-core/lib/ojdbc7.jar" ),
71- assemblyExcludedJars in assembly := (fullClasspath in assembly).value.filter(_.data.getName startsWith " spark-assembly" ),
72- assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = true ),
73- test in assembly := {},
74- assemblyMergeStrategy in assembly := {
45+ Compile / unmanagedResourceDirectories += baseDirectory(_ / " src/main/resources" ).value,
46+ Compile / unmanagedJars += file(" dq-core/lib/ojdbc7.jar" ),
47+
48+ run in Compile := Defaults .runTask(fullClasspath in Compile , mainClass in (Compile , run), runner in (Compile , run)).evaluated,
49+ runMain in Compile := Defaults .runMainTask(fullClasspath in Compile , runner in(Compile , run)).evaluated,
50+ parallelExecution in Test := false ,
51+ assembly / assemblyJarName := s " dq- ${name.value}_ ${sparkVersion.value}_ ${scalaVersion.value}- ${version.value}.jar " ,
52+ assembly / test := {},
53+ assembly / assemblyMergeStrategy := {
54+ case PathList (" org" ," aopalliance" , xs @ _* ) => MergeStrategy .last
55+ case PathList (" javax" , " inject" , xs @ _* ) => MergeStrategy .last
7556 case PathList (" javax" , " servlet" , xs @ _* ) => MergeStrategy .last
7657 case PathList (" javax" , " activation" , xs @ _* ) => MergeStrategy .last
7758 case PathList (" org" , " apache" , xs @ _* ) => MergeStrategy .last
@@ -89,8 +70,8 @@ lazy val core = (project in file("dq-core"))
8970 val oldStrategy = (assemblyMergeStrategy in assembly).value
9071 oldStrategy(x)
9172 },
92- mappings in Universal += {
93- // TODO: Add paths application configuration files
73+
74+ Universal / mappings += {
9475 val confFile = buildEnv.value match {
9576 case BuildEnv .Stage => " conf/qa.conf"
9677 case BuildEnv .Test => " conf/test.conf"
@@ -99,18 +80,15 @@ lazy val core = (project in file("dq-core"))
9980 }
10081 ((resourceDirectory in Compile ).value / confFile) -> " conf/application.conf"
10182 },
102- mappings in Universal ++= {
103- // TODO: Add paths application integration files
83+
84+ Universal / mappings ++= {
10485 val integrationFolder = integrationEnv.value match {
10586 case _ => " integration/dev"
10687 }
10788 directory((resourceDirectory in Compile ).value / integrationFolder / " bin" ) ++
10889 directory((resourceDirectory in Compile ).value / integrationFolder / " conf" )
10990 },
110- mappings in Universal <+= (assembly in Compile ) map { jar =>
111- jar -> (" lib/" + jar.getName)
112- },
113- assemblyJarName in assembly := s " dq-core_ ${sparkVersion.value}_ ${scalaVersion.value}.jar "
91+ Universal / mappings += (assembly in Compile ).map(jar => jar -> (" lib/" + jar.getName)).value
11492 )
11593
11694/*
@@ -119,90 +97,29 @@ lazy val core = (project in file("dq-core"))
11997lazy val ui = (project in file(" dq-ui" ))
12098 .enablePlugins(PlayScala )
12199 .settings(
122- inThisBuild(
123- commonSettings ++ List (scalaVersion := " 2.11.12" )
124- ),
125- incOptions := incOptions.value.withNameHashing(true ),
100+ scalaVersion := " 2.11.12" ,
126101 updateOptions := updateOptions.value.withCachedResolution(cachedResoluton = true ),
127102 // we use nodejs to make our typescript build as fast as possible
128103 JsEngineKeys .engineType := JsEngineKeys .EngineType .Node ,
129104 libraryDependencies ++= {
130- val ngVersion = " 4.4.4"
131- Seq (
132- jdbc, cache, ws, specs2% Test , evolutions, guice,
133- " com.typesafe.play" %% " play-json" % " 2.5.14" ,
134- " org.scalatestplus.play" %% " scalatestplus-play" % " 2.0.0" % " test" ,
135- " joda-time" % " joda-time" % " 2.9.9" ,
136- " org.joda" % " joda-convert" % " 1.9.2" ,
137- " org.squeryl" %% " squeryl" % " 0.9.9" ,
138- " com.gilt" % " jerkson_2.11" % " 0.6.9" ,
139- " org.webjars" %% " webjars-play" % " 2.7.3" ,
140- " org.postgresql" % " postgresql" % " 42.1.1" ,
141- " org.typelevel" %% " cats-core" % " 1.1.0" ,
142-
143- // angular2 dependencies
144- " org.webjars.npm" % " angular__common" % ngVersion,
145- " org.webjars.npm" % " angular__compiler" % ngVersion,
146- " org.webjars.npm" % " angular__core" % ngVersion,
147- " org.webjars.npm" % " angular__http" % ngVersion,
148- " org.webjars.npm" % " angular__forms" % ngVersion,
149- " org.webjars.npm" % " angular__router" % ngVersion,
150- " org.webjars.npm" % " angular__platform-browser-dynamic" % ngVersion,
151- " org.webjars.npm" % " angular__platform-browser" % ngVersion,
152- " org.webjars.npm" % " angular__cdk" % " 2.0.0-beta.10" ,
153- " org.webjars.npm" % " angular__material" % " 2.0.0-beta.10" ,
154- " org.webjars.npm" % " angular__animations" % ngVersion,
155- " org.webjars.npm" % " systemjs" % " 0.20.14" ,
156- " org.webjars.npm" % " rxjs" % " 5.4.2" ,
157- " org.webjars.npm" % " reflect-metadata" % " 0.1.8" ,
158- " org.webjars.npm" % " zone.js" % " 0.8.4" ,
159- " org.webjars.npm" % " core-js" % " 2.4.1" ,
160- " org.webjars.npm" % " symbol-observable" % " 1.0.1" ,
161-
162- " org.webjars.npm" % " angular__flex-layout" % " 2.0.0-beta.9" ,
163-
164- " org.webjars.npm" % " typescript" % " 2.4.1" ,
165- " org.webjars.npm" % " codemirror" % " 5.30.0" ,
166- " org.webjars.npm" % " ng2-codemirror" % " 1.1.3" ,
167-
168- // tslint dependency
169- " org.webjars.npm" % " types__jasmine" % " 2.5.53" % " test" ,
170- // test
171- " org.webjars.npm" % " jasmine-core" % " 2.6.4" ,
172- " org.webjars.npm" % " ng2-file-upload" % " 1.2.0" ,
173- " org.webjars.npm" % " file-saver" % " 1.3.8" ,
174- " org.webjars.npm" % " types__file-saver" % " 1.3.0"
175- )
105+ Seq (jdbc, cache, ws, specs2 % Test , evolutions, guice) ++ Dependencies .dq_ui ++ Dependencies .getJSDependencies(" 4.4.4" )
176106 },
177107 dependencyOverrides += " org.webjars.npm" % " minimatch" % " 3.0.0" ,
178108 // use the webjars npm directory (target/web/node_modules ) for resolution of module imports of angular2/core etc
179109 resolveFromWebjarsNodeModulesDir := true ,
180110 // compile our tests as commonjs instead of systemjs modules
181- (projectTestFile in typescript) := Some (" tsconfig.test.json" )
111+ typescript / projectTestFile := Some (" tsconfig.test.json" )
182112 ).dependsOn(common)
183113
184114/*
185115 MODULE: "DQ_API"
186116 */
187117lazy val api = (project in file(" dq-api" ))
188118 .settings(
189- inThisBuild(
190- commonSettings ++ List (scalaVersion := " 2.11.12" )
191- ),
192- incOptions := incOptions.value.withNameHashing(true ),
119+ scalaVersion := " 2.11.12" ,
193120 updateOptions := updateOptions.value.withCachedResolution(cachedResoluton = true ),
194121 libraryDependencies ++= {
195- val ngVersion = " 4.4.4"
196- Seq (
197- jdbc, cache, ws, specs2% Test , evolutions, guice,
198- " com.typesafe.play" %% " play-json" % " 2.5.14" ,
199- " org.squeryl" %% " squeryl" % " 0.9.9" ,
200- " org.postgresql" % " postgresql" % " 42.1.1" ,
201- " com.gilt" % " jerkson_2.11" % " 0.6.9" ,
202- " org.webjars" % " swagger-ui" % " 3.1.5" ,
203- " org.scalatest" %% " scalatest" % " 3.0.4" % Test ,
204- " org.scalatestplus.play" %% " scalatestplus-play" % " 3.1.2" % Test
205- )
122+ Seq (jdbc, cache, ws, specs2 % Test , evolutions, guice) ++ Dependencies .dq_api
206123 }
207124 )
208125
@@ -212,22 +129,9 @@ lazy val api = (project in file("dq-api"))
212129lazy val be = (project in file(" dq-be" ))
213130 .enablePlugins(PlayScala )
214131 .settings(
215- inThisBuild(
216- commonSettings ++ List (scalaVersion := " 2.11.12" )
217- ),
218- incOptions := incOptions.value.withNameHashing(true ),
132+ scalaVersion := " 2.11.12" ,
219133 updateOptions := updateOptions.value.withCachedResolution(cachedResoluton = true ),
220134 libraryDependencies ++= {
221- val ngVersion = " 4.4.4"
222- Seq (
223- jdbc, cache, ws, specs2% Test , evolutions, guice,
224- " com.typesafe.play" %% " play-json" % " 2.5.14" ,
225- " org.squeryl" %% " squeryl" % " 0.9.9" ,
226- " org.postgresql" % " postgresql" % " 42.1.1" ,
227- " com.gilt" % " jerkson_2.11" % " 0.6.9" ,
228- " org.webjars" % " swagger-ui" % " 3.1.5" ,
229- " org.scalatest" %% " scalatest" % " 3.0.4" % Test ,
230- " org.scalatestplus.play" %% " scalatestplus-play" % " 3.1.2" % Test
231- )
135+ Seq (jdbc, cache, ws, specs2 % Test , evolutions, guice) ++ Dependencies .dq_be
232136 }
233137 ).dependsOn(api,common)
0 commit comments