-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
163 lines (151 loc) · 4.6 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import SonatypeKeys._
val commonSettings = Vector(
name := "shocon",
organization := "eu.unicredit",
version := "0.1.9-SNAPSHOT",
scalaVersion := "2.12.2",
crossScalaVersions :=
Vector("2.11.11", "2.12.2")
)
lazy val root = project.in(file(".")).
settings(commonSettings: _*).
aggregate(shoconJS, shoconJVM)
lazy val fixResources = taskKey[Unit](
"Fix application.conf presence on first clean build.")
lazy val shocon = crossProject.in(file(".")).
settings(commonSettings: _*).
settings(
scalacOptions ++=
Seq(
"-feature",
"-unchecked",
"-language:implicitConversions"
)
).
settings(
sonatypeSettings: _*
).
settings(
fixResources := {
val compileConf = (resourceDirectory in Compile).value / "application.conf"
if (compileConf.exists)
IO.copyFile(
compileConf,
(classDirectory in Compile).value / "application.conf"
)
val testConf = (resourceDirectory in Test).value / "application.conf"
if (testConf.exists) {
IO.copyFile(
testConf,
(classDirectory in Test).value / "application.conf"
)
}
},
compile in Compile := (compile in Compile).dependsOn(fixResources).value,
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % "0.4.2",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
),
pomExtra := {
<url>https://github.com/unicredit/shocon</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:github.com/unicredit/shocon</connection>
<developerConnection>scm:git:git@github.com:unicredit/shocon</developerConnection>
<url>github.com/unicredit/shocon</url>
</scm>
<developers>
<developer>
<id>evacchi</id>
<name>Edoardo Vacchi</name>
<url>https://github.com/evacchi/</url>
</developer>
<developer>
<id>andreaTP</id>
<name>Andrea Peruffo</name>
<url>https://github.com/andreaTP/</url>
</developer>
</developers>
}
).
jvmSettings(
libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test"
).
jsConfigure(
_.enablePlugins(ScalaJSJUnitPlugin)
).
jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-java-time" % "0.2.0",
scalaJSUseRhino in Global := true,
parallelExecution in Test := true
)
lazy val shoconJVM = shocon.jvm
lazy val shoconJS = shocon.js
lazy val plugin = project
.settings(
commonSettings ++
sonatypeSettings ++
publishingSettings: _*)
.settings(
name := "sbt-shocon",
description := "sbt plugin for shocon",
sbtPlugin := true,
scalaVersion := "2.10.6",
crossScalaVersions := Seq("2.10.6"),
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion),
scalacOptions ++= Seq(
"-feature",
"-unchecked",
"-language:implicitConversions"),
sourceGenerators in Compile += Def.task {
val file = (sourceManaged in Compile).value / "Version.scala"
IO.write(file,
s"""package eu.unicredit.shocon.sbtplugin
|object Version { val shoconVersion = "${version.value}" }
""".stripMargin)
Seq(file)
}.taskValue,
// configuration for testing with sbt-scripted
ScriptedPlugin.scriptedSettings,
scriptedLaunchOpts <++= version apply { version =>
Seq("-Xmx1024M", "-Dplugin.version=" + version)
},
scriptedBufferLog := false,
publishLocal <<= publishLocal.dependsOn((publishLocal in (shoconJS)))
)
lazy val publishingSettings = Seq(
pomExtra := {
<url>https://github.com/unicredit/shocon</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:github.com/unicredit/shocon</connection>
<developerConnection>scm:git:git@github.com:unicredit/shocon</developerConnection>
<url>github.com/unicredit/shocon</url>
</scm>
<developers>
<developer>
<id>evacchi</id>
<name>Edoardo Vacchi</name>
<url>https://github.com/evacchi/</url>
</developer>
<developer>
<id>andreaTP</id>
<name>Andrea Peruffo</name>
<url>https://github.com/andreaTP/</url>
</developer>
</developers>
}
)
publishMavenStyle := true
pomIncludeRepository := { x => false }
credentials += Credentials(Path.userHome / ".ivy2" / "sonatype.credentials")