-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
176 lines (126 loc) · 5.7 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
import sbt.Keys._
import sbt._
import scala.io.Source
import spray.json.{DefaultJsonProtocol, _}
import complete.DefaultParsers._
import scala.language.postfixOps
import gov.nasa.jpl.imce.sbt._
import gov.nasa.jpl.imce.sbt.ProjectHelper._
import java.io.File
import java.nio.file.Files
licenses in GlobalScope += "Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")
updateOptions := updateOptions.value.withCachedResolution(true)
shellPrompt in ThisBuild := { state => Project.extract(state).currentRef.project + "> " }
resolvers := {
val previous = resolvers.value
if (git.gitUncommittedChanges.value)
Seq[Resolver](Resolver.mavenLocal) ++ previous
else
previous
}
lazy val mdInstallDirectory = SettingKey[File]("md-install-directory", "MagicDraw Installation Directory")
mdInstallDirectory in Global :=
baseDirectory.value / "target" / "md.package"
lazy val testsInputsDir = SettingKey[File]("tests-inputs-dir", "Directory to scan for input *.json tests")
lazy val testsResultDir = SettingKey[File]("tests-result-dir", "Directory for the tests results to archive as the test resource artifact")
lazy val testsResultsSetupTask = taskKey[Unit]("Create the tests results directory")
lazy val mdJVMFlags = SettingKey[Seq[String]]("md-jvm-flags", "Extra JVM flags for running MD (e.g., debugging)")
lazy val setupFuseki = taskKey[File]("Location of the apache jena fuseki server extracted from dependencies")
lazy val artifactZipFile = taskKey[File]("Location of the zip artifact file")
lazy val setupProfileGenerator = taskKey[File]("Location of the profile generator directory extracted from dependencies")
lazy val packageProfiles = taskKey[File]("Location of the generated profiles")
lazy val imce_ontologies_fuseki =
Project("gov-nasa-jpl-imce-ontologies-fuseki", file("."))
.enablePlugins(AetherPlugin)
.enablePlugins(GitVersioning)
.enablePlugins(UniversalPlugin)
.settings(
projectID := {
val previous = projectID.value
previous.extra(
"artifact.kind" -> "analysis")
},
scalaVersion := "2.11.8",
// disable automatic dependency on the Scala library
autoScalaLibrary := false,
// disable using the Scala version in output paths and artifacts
crossPaths := false,
publishMavenStyle := true,
// do not include all repositories in the POM
pomAllRepositories := false,
// make sure no repositories show up in the POM file
pomIncludeRepository := { _ => false },
// disable publishing the main jar produced by `package`
publishArtifact in(Compile, packageBin) := false,
// disable publishing the main API jar
publishArtifact in(Compile, packageDoc) := false,
// disable publishing the main sources jar
publishArtifact in(Compile, packageSrc) := false,
// disable publishing the jar produced by `test:package`
publishArtifact in(Test, packageBin) := false,
// disable publishing the test API jar
publishArtifact in(Test, packageDoc) := false,
// disable publishing the test sources jar
publishArtifact in(Test, packageSrc) := false,
sourceGenerators in Compile := Seq(),
managedSources in Compile := Seq(),
libraryDependencies ++= Seq(
"gov.nasa.jpl.imce"
% "gov.nasa.jpl.imce.ontologies.tools"
% "0.6.0"
artifacts
Artifact("gov.nasa.jpl.imce.ontologies.tools", "zip", "zip", "resource"),
"gov.nasa.jpl.imce" %% "imce.third_party.jena_libraries"
% "3.4.+"
artifacts
Artifact("imce.third_party.jena_libraries", "zip", "zip", "resource"),
"org.apache.jena" % "apache-jena-fuseki" % "2.4.1"
% "compile"
artifacts
Artifact("apache-jena-fuseki", "tar.gz", "tar.gz")
),
setupFuseki := {
val slog = streams.value.log
val fusekiDir = baseDirectory.value / "target" / "fuseki"
if (fusekiDir.exists()) {
slog.warn(s"Apache jena fuseki already extracted in $fusekiDir")
} else {
IO.createDirectory(fusekiDir)
val jfilter: DependencyFilter = new DependencyFilter {
def apply(c: String, m: ModuleID, a: Artifact): Boolean =
a.extension == "tar.gz" &&
m.organization.startsWith("org.apache.jena") &&
m.name.startsWith("apache-jena-fuseki")
}
update.value
.matching(jfilter)
.headOption
.fold[Unit] {
slog.error("Cannot find apache-jena-fuseki tar.gz!")
} { tgz =>
slog.warn(s"found: $tgz")
val dir = target.value / "tarball"
Process(Seq("tar", "--strip-components", "1", "-zxf", tgz.getAbsolutePath), Some(fusekiDir)).! match {
case 0 => ()
case n => sys.error("Error extracting " + tgz + ". Exit code: " + n)
}
}
}
fusekiDir
},
//makePom := { artifactZipFile; makePom.value },
sourceGenerators in Compile := Seq(),
managedSources in Compile := Seq(),
// disable publishing the main jar produced by `package`
publishArtifact in(Compile, packageBin) := false,
// disable publishing the main API jar
publishArtifact in(Compile, packageDoc) := false,
// disable publishing the main sources jar
publishArtifact in(Compile, packageSrc) := false,
// disable publishing the jar produced by `test:package`
publishArtifact in(Test, packageBin) := false,
// disable publishing the test API jar
publishArtifact in(Test, packageDoc) := false,
// disable publishing the test sources jar
publishArtifact in(Test, packageSrc) := false
)