-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbuild.sbt
195 lines (168 loc) · 7.13 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
val baseSettings = Seq(
organization := "com.codedx",
version := "UNVERSIONED",
BuildKeys.releaseDate := "N/A"
)
val scalaSettings = Seq(
scalacOptions := List("-deprecation", "-unchecked", "-feature", "-target:jvm-1.7"),
scalaVersion := "2.10.4"
)
val javaSettings = Seq(
javacOptions := List("-source", "1.7", "-target", "1.7", "-Xlint:-options")
)
val javaOnly = Seq(
autoScalaLibrary := false,
crossPaths := false
)
val withTesting = Seq(
libraryDependencies += Dependencies.scalactic,
libraryDependencies += Dependencies.scalaTest,
libraryDependencies += Dependencies.scalaMock
)
lazy val Bytefrog = file("bytefrog")
lazy val BytefrogFilterInjector = ProjectRef(Bytefrog, "FilterInjector")
lazy val BytefrogInstrumentation = ProjectRef(Bytefrog, "Instrumentation")
lazy val BytefrogUtil = ProjectRef(Bytefrog, "Util")
lazy val Shared = Project("Shared", file("shared"))
.settings(
baseSettings,
scalaSettings,
javaSettings,
withTesting,
libraryDependencies ++= Dependencies.jsonb ++ Dependencies.logging
)
lazy val Agent = Project("Agent", file("agent"))
.enablePlugins(AssemblyPlugin)
.dependsOn(
BytefrogFilterInjector,
BytefrogInstrumentation,
BytefrogUtil,
Shared
)
.settings(
baseSettings,
scalaSettings,
javaSettings,
javaOnly,
withTesting,
// put the servlet API in the provided scope; we'll deal with resolving references
// later, and we don't want to conflict with any containers we're injecting ourselves
// into...
libraryDependencies ++= Seq(
Dependencies.servletApi % "provided"
) ++ Dependencies.jsonb ++ Dependencies.asm,
libraryDependencies += Dependencies.minlog,
assembledMappings in assembly := {
val mappings = (assembledMappings in assembly).value
def fileStartsWith(file: String, prefix: String) = {
val frontslashFile = file.replaceAllLiterally("\\", "/")
frontslashFile.startsWith(prefix)
}
val warnItems = for {
set <- mappings
(f, dest) <- set.mappings
if f.isFile
if
dest != "module-info.class" && // we exclude this in the merge strategy
!fileStartsWith(dest, "META-INF/") &&
!fileStartsWith(dest, "beans_1_0.xsd") &&
!fileStartsWith(dest, "beans_1_1.xsd") &&
!fileStartsWith(dest, "beans_2_0.xsd") &&
!fileStartsWith(dest, "messages.properties") &&
!fileStartsWith(dest, "library.properties") &&
!fileStartsWith(dest, "overview.html") &&
!fileStartsWith(dest, "overviewj.html") &&
!fileStartsWith(dest, "rootdoc.txt") &&
!fileStartsWith(dest, "com/codedx/bytefrog/") &&
!fileStartsWith(dest, "com/codedx/codepulse/agent/") &&
!fileStartsWith(dest, "com/codedx/codepulse/utility/")
} yield dest
if (warnItems.nonEmpty) sys.error(s"Items outside of our namespace (do they need to be shaded?): ${warnItems mkString ", "}")
mappings
},
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("ch.qos.logback.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("com.esotericsoftware.minlog.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("fm.ua.ikysil.smap.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("groovy.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("groovyjarjarantlr.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("groovyjarjarasm.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("groovyjarjarcommonscli.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.decorator.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.el.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.enterprise.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.inject.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.interceptor.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("javax.json.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.apache.commons.logging.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.apache.groovy.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.codehaus.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.eclipse.yasson.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.glassfish.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.objectweb.asm.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("org.slf4j.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll,
ShadeRule.rename("scala.**" -> "com.codedx.codepulse.agent.thirdparty.@0").inAll
),
assemblyMergeStrategy in assembly := {
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
// assembly settings for agent jar
assemblyJarName in assembly := "agent.jar",
packageOptions in assembly += {
Package.ManifestAttributes(
"Premain-Class" -> "com.codedx.codepulse.agent.javaagent.JavaAgent",
"Agent-Class" -> "com.codedx.codepulse.agent.javaagent.JavaAgent",
"Boot-Class-Path" -> (assemblyJarName in assembly).value,
"Can-Redefine-Classes" -> "true",
"Can-Retransform-Classes" -> "true"
)
}
)
lazy val HQ = Project("HQ", file("hq"))
.dependsOn(Shared)
.settings(
baseSettings,
scalaSettings,
withTesting,
libraryDependencies += Dependencies.commons.lang,
libraryDependencies ++= Seq(Dependencies.reactive, Dependencies.dispatch) ++ Dependencies.jsonb ++ Dependencies.logging
)
lazy val CodePulse = Project("CodePulse", file("codepulse"))
.dependsOn(Shared, HQ)
.settings(
compile in Compile := (Def.taskDyn {
val c = (compile in Compile).value
Def.task {
import sys.process._
var powershellCmd = "powershell"
if (System.getProperty("os.name") == "Linux") {
powershellCmd = "pwsh"
}
val publishCmd = powershellCmd + " -file publish-symbol-service.ps1"
println("Running: " + publishCmd)
val exitCode = publishCmd.!
val msg = if (exitCode == 0) "The .NET Symbol Service is up-to-date" else "ERROR: UNABLE TO PUBLISH .NET SYMBOL SERVICE!!!"
println(msg)
c
}
}).value,
baseSettings,
scalaSettings,
withTesting,
com.earldouglas.xsbtwebplugin.WebPlugin.webSettings,
VersionSystem.versionSettings,
Distributor.distribSettings(Agent),
FetchCache.settings,
libraryDependencies ++= Seq(
Dependencies.jettyWebapp, Dependencies.jettyOrbit, Dependencies.servletApi,
Dependencies.lift_webkit,
Dependencies.akka, Dependencies.reactive,
Dependencies.commons.io, Dependencies.commons.lang,
Dependencies.concLinkedHashMap, Dependencies.juniversalchardet, Dependencies.dependencyCheckCore,
Dependencies.slick, Dependencies.h2,
Dependencies.javaparser
) ++ Dependencies.asm ++ Dependencies.jackson ++ Dependencies.jna ++ Dependencies.astamCorrelator
)