forked from aappddeevv/dynamics-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
200 lines (174 loc) · 7.51 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
196
197
198
199
import scala.sys.process._
resolvers in ThisBuild += Resolver.sonatypeRepo("releases")
resolvers in ThisBuild += Resolver.sonatypeRepo("snapshots")
resolvers in ThisBuild += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
resolvers in ThisBuild += Resolver.typesafeRepo("snapshots")
//resolvers += Resolver.bintrayRepo("softprops", "maven") // for retry, what else?
resolvers in ThisBuild += Resolver.bintrayRepo("scalameta", "maven") // for latset scalafmt
resolvers in ThisBuild += Resolver.bintrayRepo("definitelyscala", "maven") // for latest facades
resolvers in ThisBuild += Resolver.jcenterRepo
autoCompilerPlugins := true
lazy val licenseSettings = Seq(
headerMappings := headerMappings.value +
(HeaderFileType.scala -> HeaderCommentStyle.cppStyleLineComment),
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (c) 2017 The Trapelo Group LLC
|This software is licensed under the MIT License (MIT).
|For more information see LICENSE or https://opensource.org/licenses/MIT
|""".stripMargin
)))
lazy val buildSettings = Seq(
organization := "ttg",
licenses ++= Seq(("MIT", url("http://opensource.org/licenses/MIT"))),
scalaVersion := "2.12.4",
scalaModuleInfo ~= (_.map(_.withOverrideScalaVersion(true))),
scalafmtVersion in ThisBuild := "1.5.1",
) ++ licenseSettings
lazy val noPublishSettings = Seq(
skip in publish := true,
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val publishSettings = Seq(
homepage := Some(url("https://github.com/aappddeevv/dynamics-client"))
)
lazy val commonSettings = Seq(
autoAPIMappings := true,
scalacOptions ++=
Dependencies.commonScalacOptions ++
(if (scalaJSVersion.startsWith("0.6."))
Seq("-P:scalajs:sjsDefinedByDefault")
else Nil),
libraryDependencies ++=
(Dependencies.commonDependencies.value ++
Dependencies.myJSDependencies.value),
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.4"),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
)
lazy val dynamicsSettings = buildSettings ++ commonSettings
lazy val root = project.in(file("."))
.settings(dynamicsSettings)
.settings(noPublishSettings)
.settings(name := "dynamics-client")
.aggregate(http, client, clientcommon, common, etl, cli, `cli-main`, docs, adal, apps)
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
lazy val common = project
.settings(dynamicsSettings)
.settings(description := "Common components")
.settings(libraryDependencies ++= Dependencies.monadlessDependencies.value)
.settings(name := "dynamics-client-common")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
lazy val commonio = project
.settings(dynamicsSettings)
.settings(description := "Common components that involve IO (server based).")
.settings(libraryDependencies ++= Dependencies.monadlessDependencies.value)
.settings(name := "dynamics-client-common-io")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(common)
lazy val apps = project
.settings(dynamicsSettings)
.settings(description := "CLI application frameworks")
.settings(libraryDependencies ++= Dependencies.monadlessDependencies.value)
.settings(libraryDependencies ++= Dependencies.appDependencies.value)
.settings(name := "dynamics-client-apps")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(cli,client,common,http,commonio)
lazy val clientcommon = project
.settings(dynamicsSettings)
.settings(description := "Common client components")
.settings(libraryDependencies ++= Dependencies.monadlessDependencies.value)
.settings(name := "dynamics-client-client-common")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(common, http)
lazy val etl = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-etl")
.settings(description := "ETL support")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(common, commonio, client, http)
lazy val http = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-http")
.settings(description := "http client ")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(common)
lazy val adal = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-adal")
.settings(description := "dynamics active directory authentication")
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
.dependsOn(client, common)
lazy val client = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-clients")
.settings(description := "dynamics client")
// need to get rid of dependency on commoni
.dependsOn(http, clientcommon, common, commonio)
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
lazy val cli = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-cli")
.settings(description := "common CLI client infrastructure")
.settings(libraryDependencies ++=
Dependencies.cliDependencies.value ++ Dependencies.monadlessDependencies.value)
.dependsOn(client, etl, adal, commonio)
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin, BuildInfoPlugin)
.settings(
unmanagedResourceDirectories in Compile += baseDirectory.value / "cli/src/main/js",
buildInfoPackage := "dynamics.cli"
)
lazy val `cli-main` = project
.settings(dynamicsSettings)
.settings(name := "dynamics-client-cli-main")
.settings(description := "CLI main")
.settings(libraryDependencies ++=
Dependencies.cliDependencies.value ++ Dependencies.monadlessDependencies.value)
.settings(
scalaJSLinkerConfig ~= {_.withModuleKind(ModuleKind.CommonJSModule) },
scalaJSUseMainModuleInitializer := true,
mainClass in Compile := Some("dynamics.cli.Main"),
)
.dependsOn(cli, commonio)
.enablePlugins(ScalaJSPlugin, AutomateHeaderPlugin)
lazy val docs = project
.settings(buildSettings)
.settings(noPublishSettings)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.appDependencies.value)
.enablePlugins(MicrositesPlugin, ScalaUnidocPlugin, ScalaJSPlugin)
.aggregate(clientcommon, client, http, cli, `cli-main`, etl, common, apps)
.settings(
micrositeName := "dynamics-client",
micrositeDescription := "A Microsoft Dynamics CLI swiss-army knife and browser/server library.",
micrositeBaseUrl := "/dynamics-client",
micrositeGitterChannel := false,
micrositeDocumentationUrl := "/dynamics-client/docs",
micrositeAuthor := "aappddeevv",
micrositeGithubRepo := "dynamics-client",
micrositeGithubOwner := sys.env.get("GITHUB_USER").getOrElse("unknown"),
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
micrositePushSiteWith := GitHub4s
)
.settings(
siteSubdirName in ScalaUnidoc := "api",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc)
)
val npmBuild = taskKey[Unit]("fullOptJS then webpack")
npmBuild := {
(fullOptJS in (`cli-main`, Compile)).value
"npm run afterScalaJSFull" !
}
val npmBuildFast = taskKey[Unit]("fastOptJS then webpack")
npmBuildFast := {
(fastOptJS in (`cli-main`, Compile)).value
"npm run afterScalaJSFast" !
}
addCommandAlias("watchit", "~ ;fastOptJS; npmBuildFast")
addCommandAlias("fmt", ";scalafmt")
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion)
// buildInfoPackage := "dynamics-client"
bintrayReleaseOnPublish in ThisBuild := false
bintrayPackageLabels := Seq("scalajs", "dynamics", "dynamics 365", "crm", "microsoft")
bintrayVcsUrl := Some("git:[email protected]:aappddeevv/dynamics")
bintrayRepository := "maven"