Skip to content

Commit 80d1990

Browse files
authored
Merge pull request #2129 from dotty-staging/topic/dottydoc-subproject
Fix IntellliJ support by making dotty-doc its own subproject
2 parents f009dc0 + 4a0a2b1 commit 80d1990

File tree

2 files changed

+60
-56
lines changed

2 files changed

+60
-56
lines changed

compiler/test/dotty/tools/StdLibSources.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ object StdLibSources {
1111

1212
private final val stdLibPath = "../scala-scala/src/library/"
1313

14-
def blacklistFile: String = "./test/dotc/scala-collections.blacklist"
15-
private def whitelistFile: String = "./test/dotc/scala-collections.whitelist"
14+
def blacklistFile: String = "../compiler/test/dotc/scala-collections.blacklist"
15+
private def whitelistFile: String = "../compiler/test/dotc/scala-collections.whitelist"
1616

1717
def whitelisted: List[String] = {
1818
lazy val whitelistBasedOnBlacklist = all.diff(blacklisted)

project/Build.scala

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ object DottyBuild extends Build {
5959
// Shorthand for compiling a docs site
6060
lazy val dottydoc = inputKey[Unit]("run dottydoc")
6161

62-
/** Dottydoc deps */
63-
lazy val dottydocDeps = SettingKey[Seq[ModuleID]](
64-
"dottydocDeps",
65-
"dottydoc dependencies, should be moved to a dottydoc sbt subproject eventually"
66-
)
67-
6862
override def settings: Seq[Setting[_]] = {
6963
super.settings ++ Seq(
7064
scalaVersion in Global := scalacVersion,
@@ -129,7 +123,7 @@ object DottyBuild extends Build {
129123
// this is only necessary for compatibility with sbt which currently hardcodes the "dotty" artifact name
130124
lazy val dotty = project.in(file(".")).
131125
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
132-
aggregate(`dotty-interfaces`, `dotty-library`, `dotty-compiler`, dottySbtBridgeRef,
126+
aggregate(`dotty-interfaces`, `dotty-library`, `dotty-compiler`, `dotty-doc`, dottySbtBridgeRef,
133127
`scala-library`, `scala-compiler`, `scala-reflect`, `scalap`).
134128
dependsOn(`dotty-compiler`).
135129
dependsOn(`dotty-library`).
@@ -179,6 +173,63 @@ object DottyBuild extends Build {
179173
).
180174
settings(publishing)
181175

176+
lazy val `dotty-doc` = project.in(file("doc-tool")).
177+
dependsOn(`dotty-compiler`, `dotty-compiler` % "test->test").
178+
settings(sourceStructure).
179+
settings(
180+
baseDirectory in (Compile, run) := baseDirectory.value / "..",
181+
baseDirectory in (Test, run) := baseDirectory.value,
182+
183+
connectInput in run := true,
184+
outputStrategy := Some(StdoutOutput),
185+
186+
javaOptions ++= (javaOptions in `dotty-compiler`).value,
187+
fork in run := true,
188+
fork in Test := true,
189+
parallelExecution in Test := false,
190+
191+
genDocs := Def.inputTaskDyn {
192+
val dottyLib = (packageAll in `dotty-compiler`).value("dotty-library")
193+
val dottyInterfaces = (packageAll in `dotty-compiler`).value("dotty-interfaces")
194+
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
195+
val sources =
196+
(unmanagedSources in (Compile, compile)).value ++
197+
(unmanagedSources in (`dotty-compiler`, Compile)).value
198+
val args: Seq[String] = Seq(
199+
"-siteroot", "docs",
200+
"-project", "Dotty",
201+
"-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps"
202+
)
203+
(runMain in Compile).toTask(
204+
s""" dotty.tools.dottydoc.Main ${args.mkString(" ")} ${sources.mkString(" ")}"""
205+
)
206+
}.evaluated,
207+
208+
dottydoc := Def.inputTaskDyn {
209+
val args: Seq[String] = spaceDelimited("<arg>").parsed
210+
val dottyLib = (packageAll in `dotty-compiler`).value("dotty-library")
211+
val dottyInterfaces = (packageAll in `dotty-compiler`).value("dotty-interfaces")
212+
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
213+
val cp: Seq[String] = Seq("-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps")
214+
(runMain in Compile).toTask(s""" dotty.tools.dottydoc.Main ${cp.mkString(" ")} """ + args.mkString(" "))
215+
}.evaluated,
216+
217+
libraryDependencies ++= Seq(
218+
"com.novocode" % "junit-interface" % "0.11" % "test",
219+
"com.vladsch.flexmark" % "flexmark" % "0.11.1",
220+
"com.vladsch.flexmark" % "flexmark-ext-gfm-tasklist" % "0.11.1",
221+
"com.vladsch.flexmark" % "flexmark-ext-gfm-tables" % "0.11.1",
222+
"com.vladsch.flexmark" % "flexmark-ext-autolink" % "0.11.1",
223+
"com.vladsch.flexmark" % "flexmark-ext-anchorlink" % "0.11.1",
224+
"com.vladsch.flexmark" % "flexmark-ext-emoji" % "0.11.1",
225+
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % "0.11.1",
226+
"com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % "0.11.1",
227+
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.8.6",
228+
"nl.big-o" % "liqp" % "0.6.7"
229+
)
230+
).
231+
settings(publishing)
232+
182233
lazy val `dotty-bot` = project.in(file("bot")).
183234
settings(sourceStructure).
184235
settings(
@@ -207,15 +258,6 @@ object DottyBuild extends Build {
207258
// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
208259
lazy val dottyCompilerSettings = Seq(
209260

210-
// necessary evil: dottydoc currently needs to be included in the dotty
211-
// project, for sbt integration
212-
unmanagedResourceDirectories in Compile := Seq((resourceDirectory in Compile).value),
213-
unmanagedResourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "resources",
214-
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
215-
unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src",
216-
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
217-
unmanagedSourceDirectories in Test += baseDirectory.value / ".." / "doc-tool" / "test",
218-
219261
// set system in/out for repl
220262
connectInput in run := true,
221263
outputStrategy := Some(StdoutOutput),
@@ -232,25 +274,11 @@ object DottyBuild extends Build {
232274
//http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
233275
com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys.withSource := true,
234276

235-
dottydocDeps := Seq(
236-
"com.vladsch.flexmark" % "flexmark" % "0.11.1",
237-
"com.vladsch.flexmark" % "flexmark-ext-gfm-tasklist" % "0.11.1",
238-
"com.vladsch.flexmark" % "flexmark-ext-gfm-tables" % "0.11.1",
239-
"com.vladsch.flexmark" % "flexmark-ext-autolink" % "0.11.1",
240-
"com.vladsch.flexmark" % "flexmark-ext-anchorlink" % "0.11.1",
241-
"com.vladsch.flexmark" % "flexmark-ext-emoji" % "0.11.1",
242-
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % "0.11.1",
243-
"com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % "0.11.1",
244-
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.8.6",
245-
"nl.big-o" % "liqp" % "0.6.7"
246-
),
247-
248277
// get libraries onboard
249278
partestDeps := Seq(scalaCompiler,
250279
"org.scala-lang" % "scala-reflect" % scalacVersion,
251280
"org.scala-lang" % "scala-library" % scalacVersion % "test"),
252281
libraryDependencies ++= partestDeps.value,
253-
libraryDependencies ++= dottydocDeps.value,
254282
libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1",
255283
"org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test",
256284
"com.novocode" % "junit-interface" % "0.11" % "test",
@@ -271,30 +299,6 @@ object DottyBuild extends Build {
271299
)
272300
}.evaluated,
273301

274-
genDocs := Def.inputTaskDyn {
275-
val dottyLib = packageAll.value("dotty-library")
276-
val dottyInterfaces = packageAll.value("dotty-interfaces")
277-
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
278-
val sources = (managedSources in (Compile, compile)).value ++ (unmanagedSources in (Compile, compile)).value
279-
val args: Seq[String] = Seq(
280-
"-siteroot", "docs",
281-
"-project", "Dotty",
282-
"-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps"
283-
)
284-
(runMain in Compile).toTask(
285-
s""" dotty.tools.dottydoc.Main ${args.mkString(" ")} ${sources.mkString(" ")}"""
286-
)
287-
}.evaluated,
288-
289-
dottydoc := Def.inputTaskDyn {
290-
val args: Seq[String] = spaceDelimited("<arg>").parsed
291-
val dottyLib = packageAll.value("dotty-library")
292-
val dottyInterfaces = packageAll.value("dotty-interfaces")
293-
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
294-
val cp: Seq[String] = Seq("-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps")
295-
(runMain in Compile).toTask(s""" dotty.tools.dottydoc.Main ${cp.mkString(" ")} """ + args.mkString(" "))
296-
}.evaluated,
297-
298302
// Override run to be able to run compiled classfiles
299303
dotr := {
300304
val args: Seq[String] = spaceDelimited("<arg>").parsed

0 commit comments

Comments
 (0)