-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
124 lines (114 loc) · 3.65 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
ThisBuild / scalaVersion := "3.3.4"
ThisBuild / organization := "se.lu.nateko.cp"
val commonSettings = Seq(
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-feature",
"-deprecation"
),
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test"
)
val publishSettings = Seq(
publishTo := {
val nexus = "https://repo.icos-cp.eu/content/repositories/"
if (isSnapshot.value)
Some("snapshots" at nexus + "snapshots")
else
Some("releases" at nexus + "releases")
},
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
)
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
//DataCite DOI metadata model, needed for back- and front end
val common = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("common"))
.settings(commonSettings)
.settings(
name := "doi-common",
version := "0.4.0",
cpDeploy := {
sys.error("Please switch to project doiJVM for deployment")
}
)
.settings(publishSettings: _*)
//core functionality that may be reused by different apps (backends)
lazy val core = project
.in(file("core"))
.dependsOn(common.jvm)
.settings(commonSettings ++ publishSettings: _*)
.settings(
name := "doi-core",
libraryDependencies ++= Seq("io.spray" %% "spray-json" % "1.3.6"),
version := "0.4.4"
)
//the DOI minting web app itself
lazy val doi = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(commonSettings)
.settings(
name := "doi",
version := "0.3.1",
libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.10.6",
)
.jsSettings(
name := "doi-js",
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "scalatags" % "0.11.1",
),
scalaJSUseMainModuleInitializer := true
)
.jvmSettings(
name := "doi-jvm",
libraryDependencies ++= Seq(
"de.heikoseeberger" %% "akka-http-play-json" % "1.39.2" cross CrossVersion.for3Use2_13 exclude("com.typesafe.play", "play-json_2.13"),
"com.typesafe.akka" %% "akka-stream" % "2.6.19" cross CrossVersion.for3Use2_13,
"com.typesafe.akka" %% "akka-slf4j" % "2.6.19" cross CrossVersion.for3Use2_13,
"ch.qos.logback" % "logback-classic" % "1.1.3",
"com.sun.mail" % "jakarta.mail" % "1.6.7",
"se.lu.nateko.cp" %% "views-core" % "0.7.10",
"se.lu.nateko.cp" %% "cpauth-core" % "0.10.1",
),
reStart / baseDirectory := {
(reStart / baseDirectory).value.getParentFile
},
assembly / assemblyMergeStrategy := {
case name if(name.endsWith("-fastopt.js") || name.endsWith("module-info.class")) =>
MergeStrategy.discard
case x =>
val originalStrategy = (assembly / assemblyMergeStrategy).value
originalStrategy(x)
}
)
.jsConfigure(_.dependsOn(common.js))
.jvmConfigure(_.dependsOn(core))
lazy val doiJs = doi.js
lazy val doiJvm = doi.jvm
.enablePlugins(IcosCpSbtDeployPlugin, SbtTwirl)
.settings(
cpDeployTarget := "doi",
cpDeployBuildInfoPackage := "se.lu.nateko.cp.doi",
cpDeployPreAssembly := Def.sequential(
common.jvm / clean,
common.js / clean,
core / clean,
doiJs / clean,
clean,
common.jvm / Test / test,
common.js / Test / test,
core / Test / test,
doiJs / Test / test,
Test / test
).value,
Compile / resources ++= {
val jsFile = (doiJs / Compile / fastOptJS).value.data
val srcMap = new java.io.File(jsFile.getAbsolutePath + ".map")
Seq(jsFile, srcMap)
},
watchSources ++= (doiJs / Compile / watchSources).value,
assembly / assembledMappings := {
val finalJsFile = (doiJs / Compile / fullOptJS).value.data
(assembly / assembledMappings).value :+ sbtassembly.MappingSet(None, Vector((finalJsFile, finalJsFile.getName)))
}
)