This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.sbt
94 lines (83 loc) · 3.44 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
import org.scalajs.core.tools.linker.ModuleKind
import sbt.Keys.{libraryDependencies, resolvers}
import sbtcrossproject.CrossPlugin.autoImport.crossProject
val ivyLocal = Resolver.file("ivy", file(Path.userHome.absolutePath + "/.ivy2/local"))(Resolver.ivyStylePatterns)
name := "webapi-parser"
ThisBuild / version := "0.5.0"
publish := {}
jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv()
val muleNexus = "https://repository-master.mulesoft.org/nexus/content/repositories"
val settings = Common.settings ++ Common.publish ++ Seq(
organization := "org.raml",
resolvers ++= List(ivyLocal, Resolver.mavenLocal),
resolvers += "MuleSoftSnapshots" at s"$muleNexus/snapshots",
resolvers += "MuleSoftReleases" at s"$muleNexus/releases",
resolvers += "jitpack" at "https://jitpack.io",
assembly / aggregate := false,
Compile / publishArtifact := true,
Test / publishArtifact := false,
useGpgAgent := false,
pgpPassphrase := sys.env.get("GPG_PASSPHRASE").map(_.toArray),
credentials ++= Common.credentials(),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.0.5" % "test",
"com.github.amlorg" %%% "amf-webapi" % "4.0.3",
"com.github.amlorg" %%% "amf-validation" % "4.0.3"
)
)
lazy val Javadoc = config("genjavadoc") extend Compile
lazy val javadocSettings = inConfig(Javadoc)(Defaults.configSettings) ++ Seq(
scalaVersion := "2.12.6",
addCompilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.13" cross CrossVersion.full),
scalacOptions += s"-P:genjavadoc:out=${target.value}/java",
scalacOptions += s"-P:genjavadoc:suppressSynthetic=true",
Compile / packageDoc := (Javadoc/ packageDoc).value,
Javadoc / sources :=
(target.value / "java" ** "*.java").get ++
(Compile / sources).value.filter(_.getName.endsWith(".java")),
Javadoc / javacOptions := Seq(),
Javadoc / packageDoc / artifactName:= ((sv, mod, art) =>
"" + mod.name + "-" + mod.revision + "-javadoc.jar")
)
/** **********************************************
* WebAPI-Parser
********************************************** */
lazy val webapi = crossProject(JSPlatform, JVMPlatform)
.settings(name := "webapi-parser")
.in(file("./"))
.settings(settings)
.configs(Javadoc)
.settings(javadocSettings: _*)
.jvmSettings(
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided",
assembly / aggregate := true,
assembly / test := {},
assembly / assemblyOutputPath := file(s"./webapi-parser-${version.value}.jar"),
assembly / assemblyMergeStrategy := {
case x if x.toString.contains("commons/logging") => {
MergeStrategy.discard
}
case x if x.toString.endsWith("JS_DEPENDENCIES") => {
MergeStrategy.discard
}
case PathList(ps @ _*) if ps.last endsWith "JS_DEPENDENCIES" => {
MergeStrategy.discard
}
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)
.jsSettings(
scalaJSModuleKind := ModuleKind.CommonJSModule,
Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "webapi-parser-module.js",
scalacOptions += "-P:scalajs:suppressExportDeprecations"
)
lazy val webapiJVM = webapi.jvm.in(file("./jvm"))
lazy val webapiJS = webapi.js.in(file("./js"))
// Assemble .jar containing all dependencies. Can be used as local jar dependency in
// another projects.
addCommandAlias(
"assembleFatJar",
"; clean; webapiJVM/assembly"
)