-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.sbt
181 lines (161 loc) · 5.4 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import Dependencies._
ThisBuild / scalaVersion := scala212
ThisBuild / organization := "com.eed3si9n.jarjarabrams"
ThisBuild / organizationName := "eed3si9n"
ThisBuild / organizationHomepage := Some(url("http://eed3si9n.com/"))
ThisBuild / version := {
val old = (ThisBuild / version).value
if ((ThisBuild / isSnapshot).value) "1.9.0-SNAPSHOT"
else old
}
ThisBuild / description := "utility to shade Scala libraries"
ThisBuild / licenses := Seq(
"Apache 2" -> new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")
)
ThisBuild / homepage := Some(url("https://github.com/eed3si9n/jarjar-abrams"))
lazy val jarjar = project
.in(file("jarjar"))
.disablePlugins(ScalafmtPlugin)
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.settings(nocomma {
organization := "com.eed3si9n.jarjar"
name := "jarjar"
crossScalaVersions := Vector(scala212)
crossPaths := false
autoScalaLibrary := false
libraryDependencies ++= Seq(
"org.ow2.asm" % "asm" % "9.6",
"org.ow2.asm" % "asm-commons" % "9.6",
"org.apache.commons" % "commons-lang3" % "3.8.1",
"junit" % "junit" % "4.12" % "it,test",
"com.github.sbt" % "junit-interface" % "0.13.2" % "it,test"
)
mainClass := Some("com.eed3si9n.jarjar.Main")
testFrameworks += new TestFramework("com.novocode.junit.JUnitFramework")
IntegrationTest / fork := true
IntegrationTest / envVars := Map(
"JARJAR_CLASSPATH" -> (Runtime / fullClasspath).value
.map(_.data)
.mkString(System.getProperty("path.separator"))
)
assemblyMergeStrategy := {
case PathList("module-info.class") => MergeStrategy.discard
case x if x.endsWith("/module-info.class") => MergeStrategy.discard
case x =>
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
oldStrategy(x)
}
})
lazy val ant_jarjar = project
.in(file("ant-jarjar"))
.disablePlugins(ScalafmtPlugin)
.dependsOn(jarjar)
.settings(nocomma {
organization := "com.eed3si9n.jarjar"
name := "ant-jarjar"
crossScalaVersions := Vector(scala212)
crossPaths := false
autoScalaLibrary := false
libraryDependencies ++= Seq(
"org.apache.ant" % "ant" % "1.10.14",
)
})
lazy val maven_jarjar = project
.in(file("maven-jarjar"))
.disablePlugins(ScalafmtPlugin)
.dependsOn(jarjar)
.settings(nocomma {
organization := "com.eed3si9n.jarjar"
name := "maven-jarjar"
crossScalaVersions := Vector(scala212)
crossPaths := false
autoScalaLibrary := false
libraryDependencies ++= Seq(
"org.apache.maven" % "maven-plugin-api" % "3.9.4",
)
})
lazy val jarjar_assembly = project
.settings(nocomma {
organization := "com.eed3si9n.jarjar"
crossScalaVersions := Vector(scala212)
crossPaths := false
autoScalaLibrary := false
name := "JarJar Assembly"
Compile / packageBin := (jarjar / assembly).value
})
lazy val jarjar_abrams_assembly = project
.settings(nocomma {
crossScalaVersions := Vector(scala212, scala213)
name := "jarjar-abrams-assembly"
Compile / packageBin := (core / assembly).value
})
lazy val core = project
.enablePlugins(ContrabandPlugin)
.dependsOn(jarjar)
.settings(nocomma {
name := "jarjar-abrams-core"
crossScalaVersions := Vector(scala212, scala213)
libraryDependencies ++= {
if (scalaVersion.value.startsWith("2.10.")) Nil
else Vector(verify % Test)
}
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
Compile / managedSourceDirectories += (Compile / generateContrabands / sourceManaged).value
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala"
Test / sources := {
val orig = (Test / sources).value
if (scalaVersion.value.startsWith("2.10.")) Nil
else orig
}
testFrameworks += new TestFramework("verify.runner.Framework")
Compile / scalacOptions += "-deprecation"
Compile / scalacOptions ++= {
if (scalaVersion.value.startsWith("2.13.")) Vector("-Xlint", "-Xsource:3")
else if (scalaVersion.value.startsWith("2.12.")) Vector("-Xlint", "-Xfatal-warnings")
else Vector("-Xlint")
}
})
lazy val sbtplugin = project
.enablePlugins(SbtPlugin)
.dependsOn(core)
.settings(nocomma {
name := "sbt-jarjar-abrams"
Compile / scalacOptions ++= Vector("-Xlint", "-Xfatal-warnings")
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Vector("-Xmx1024M", "-Dplugin.version=" + version.value)
}
pluginCrossBuild / sbtVersion := "1.2.8"
scriptedSbt := "1.9.7"
scriptedBufferLog := false
})
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/eed3si9n/jarjar-abrams"),
"scm:[email protected]:eed3si9n/jarjar-abrams.git"
)
)
ThisBuild / developers := List(
Developer(
id = "eed3si9n",
name = "Eugene Yokota",
email = "@eed3si9n",
url = url("http://eed3si9n.com")
)
)
ThisBuild / pomIncludeRepository := { _ =>
false
}
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / publishMavenStyle := true
ThisBuild / assemblyMergeStrategy := {
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
oldStrategy(x)
}