-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
117 lines (95 loc) · 4.41 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
import sbt.Keys._
import sbt._
import gov.nasa.jpl.imce.sbt._
import gov.nasa.jpl.imce.sbt.ProjectHelper._
updateOptions := updateOptions.value.withCachedResolution(true)
resolvers ++= {
if (git.gitUncommittedChanges.value)
Seq[Resolver](Resolver.mavenLocal)
else
Seq.empty[Resolver]
}
lazy val root = Project("oti-uml-canonical_xmi-loader", file("."))
.enablePlugins(IMCEGitPlugin)
.settings(dynamicScriptsResourceSettings("org.omg.oti.uml.canonical_xmi.loader"))
.settings(IMCEPlugin.strictScalacFatalWarningsSettings)
.settings(
IMCEKeys.licenseYearOrRange := "2014",
IMCEKeys.organizationInfo := IMCEPlugin.Organizations.oti,
IMCEKeys.targetJDK := IMCEKeys.jdk18.value,
buildInfoPackage := "org.omg.oti.uml.canonical_xmi.loader",
buildInfoKeys ++= Seq[BuildInfoKey](BuildInfoKey.action("buildDateUTC") { buildUTCDate.value }),
mappings in (Compile, packageSrc) ++= {
import Path.{flat, relativeTo}
val base = (sourceManaged in Compile).value
val srcs = (managedSources in Compile).value
srcs pair (relativeTo(base) | flat)
},
projectID := {
val previous = projectID.value
previous.extra(
"build.date.utc" -> buildUTCDate.value,
"artifact.kind" -> "generic.library")
},
git.baseVersion := Versions.version,
resourceDirectory in Compile := baseDirectory.value / "resources",
resolvers += Resolver.bintrayRepo("jpl-imce", "gov.nasa.jpl.imce"),
resolvers += Resolver.bintrayRepo("tiwg", "org.omg.tiwg"),
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases",
scalacOptions in (Compile, compile) += s"-P:artima-supersafe:config-file:${baseDirectory.value}/project/supersafe.cfg",
scalacOptions in (Test, compile) += s"-P:artima-supersafe:config-file:${baseDirectory.value}/project/supersafe.cfg",
scalacOptions in (Compile, doc) += "-Xplugin-disable:artima-supersafe",
scalacOptions in (Test, doc) += "-Xplugin-disable:artima-supersafe"
)
.dependsOnSourceProjectOrLibraryArtifacts(
"oti-uml-canonical_xmi-serialization",
"org.omg.oti.uml.canonical_xmi.serialization",
Seq(
"org.omg.tiwg" %% "org.omg.oti.uml.canonical_xmi.serialization"
% Versions_oti_uml_canonical_xmi_serialization.version
% "compile" withSources() withJavadoc() artifacts
Artifact("org.omg.oti.uml.canonical_xmi.serialization", "zip", "zip", "resource")
)
)
def dynamicScriptsResourceSettings(projectName: String): Seq[Setting[_]] = {
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport._
def addIfExists(f: File, name: String): Seq[(File, String)] =
if (!f.exists) Seq()
else Seq((f, name))
val QUALIFIED_NAME = "^[a-zA-Z][\\w_]*(\\.[a-zA-Z][\\w_]*)*$".r
Seq(
// the '*-resource.zip' archive will start from: 'dynamicScripts'
com.typesafe.sbt.packager.Keys.topLevelDirectory in Universal := None,
// name the '*-resource.zip' in the same way as other artifacts
com.typesafe.sbt.packager.Keys.packageName in Universal :=
normalizedName.value + "_" + scalaBinaryVersion.value + "-" + version.value + "-resource",
// contents of the '*-resource.zip' to be produced by 'universal:packageBin'
mappings in Universal ++= {
val dir = baseDirectory.value
val bin = (packageBin in Compile).value
val src = (packageSrc in Compile).value
val doc = (packageDoc in Compile).value
val binT = (packageBin in Test).value
val srcT = (packageSrc in Test).value
val docT = (packageDoc in Test).value
(dir * ".classpath").pair(rebase(dir, projectName)) ++
(dir * "*.md").pair(rebase(dir, projectName)) ++
(dir / "resources" ***).pair(rebase(dir, projectName)) ++
addIfExists(bin, projectName + "/lib/" + bin.name) ++
addIfExists(binT, projectName + "/lib/" + binT.name) ++
addIfExists(src, projectName + "/lib.sources/" + src.name) ++
addIfExists(srcT, projectName + "/lib.sources/" + srcT.name) ++
addIfExists(doc, projectName + "/lib.javadoc/" + doc.name) ++
addIfExists(docT, projectName + "/lib.javadoc/" + docT.name)
},
artifacts += {
val n = (name in Universal).value
Artifact(n, "zip", "zip", Some("resource"), Seq(), None, Map())
},
packagedArtifacts += {
val p = (packageBin in Universal).value
val n = (name in Universal).value
Artifact(n, "zip", "zip", Some("resource"), Seq(), None, Map()) -> p
}
)
}