-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
120 lines (103 loc) · 3.3 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
// shadow sbt-scalajs' crossProject and CrossType from Scala.js 0.6.x
import org.jetbrains.sbtidea.Keys.createRunnerProject
addCommandAlias(
"ci",
Seq(
"project root",
"versionDump",
"scalafmtCheckAll",
"scalafix --check",
"test:scalafix --check",
"+clean",
"+test:compile",
"+test",
"intellij/updateIntellij",
"intellij/test"
).mkString(";", ";", "")
)
addCommandAlias(
"fix",
Seq(
"root/scalafmtAll",
"root/scalafmtSbt",
"root/scalafix",
"root/test:scalafix"
).mkString(";", ";", "")
)
addCommandAlias(
"release",
Seq(
"project root",
"+publishSigned",
"sonatypeBundleRelease"
).mkString(";", ";", "")
)
// See https://github.com/JetBrains/sbt-idea-plugin/issues/76 for
// why this contrived sequence of actions exists ...
addCommandAlias(
"packageIntellijPlugin",
Seq(
"project root",
"intellij/packageArtifact",
"intellij/doPatchPluginXml",
"intellij/packageArtifactZip"
).mkString(";", ";", "")
)
ThisBuild / scalaVersion := WeaverPlugin.scala213
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.4"
lazy val root = project
.in(file("."))
.enablePlugins(ScalafixPlugin)
.aggregate(intellij)
.settings(WeaverPlugin.doNotPublishArtifact)
// #################################################################################################
// Intellij
// #################################################################################################
ThisBuild / intellijBuild := "203"
ThisBuild / intellijPluginName := "weaver-intellij"
import org.jetbrains.sbtidea.Keys._
import org.jetbrains.sbtidea.SbtIdeaPlugin
import sbt.Keys._
import sbt._
// Prevents sbt-idea-plugin from automatically
// downloading intellij binaries on startup
ThisBuild / doProjectSetup := {}
lazy val intellij = (project in file("modules/intellij"))
.enablePlugins(SbtIdeaPlugin, BuildInfoPlugin)
.disablePlugins(WeaverPlugin)
.settings(
scalaVersion := "2.13.4",
intellijPlugins := Seq(
"com.intellij.java".toPlugin,
"org.intellij.scala:2020.3.16".toPlugin
),
libraryDependencies ++= Seq(
"io.get-coursier" %% "coursier" % "2.0.0-RC6-24",
"com.novocode" % "junit-interface" % "0.11" % Test
),
patchPluginXml := pluginXmlOptions { xml =>
xml.version = version.value
},
// packageArtifact in publishPlugin := packagePlugin.value,
packageMethod := PackagingMethod.Standalone(),
scalacOptions ++= (WeaverPlugin.commonCompilerOptions),
buildInfoKeys := Seq[BuildInfoKey](name, version),
buildInfoPackage := "weaver.build",
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
packageArtifactZip := {
val dump = (ThisBuild / baseDirectory).value / "intellijPlugin"
val result = packageArtifactZip.value
IO.write(dump, result.getAbsolutePath)
result
}
)
// #################################################################################################
// Misc
// #################################################################################################
lazy val versionDump =
taskKey[Unit]("Dumps the version in a file named version")
versionDump := {
val file = (ThisBuild / baseDirectory).value / "version"
IO.write(file, (Compile / version).value)
}