From 874169b42b61691c21102d01c559bab6c6396e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andre=CC=81n?= Date: Sat, 20 May 2017 15:55:14 +0200 Subject: [PATCH] Fixed unidoc filter and unused property setter --- build.sbt | 2 +- project/Doc.scala | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index 169324b47f..4140bc4126 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,6 @@ import com.typesafe.tools.mima.plugin.MimaPlugin import akka.AkkaBuild._ initialize := { - System.setProperty("akka.mode", "test") // Is there better place for this? (and more importantly, what is it?) // Load system properties from a file to make configuration from Jenkins easier loadSystemProperties("project/akka-build.properties") initialize.value @@ -40,6 +39,7 @@ lazy val root = Project( base = file("."), aggregate = aggregatedProjects ).settings(rootSettings: _*) + .settings(unidocRootIgnoreProjects := Seq(remoteTests, benchJmh, protobuf, akkaScalaNightly, docs)) lazy val akkaScalaNightly = akkaModule("akka-scala-nightly") // remove dependencies that we have to build ourselves (Scala STM) diff --git a/project/Doc.scala b/project/Doc.scala index a65878f230..e437c9903c 100644 --- a/project/Doc.scala +++ b/project/Doc.scala @@ -97,6 +97,12 @@ object UnidocRoot extends AutoPlugin { val genjavadocEnabled = CliOption("akka.genjavadoc.enabled", false) } + object autoImport { + val unidocRootIgnoreProjects = settingKey[Seq[Project]]("Projects to ignore when generating unidoc") + val unidocRootProjectFilter = settingKey[ScopeFilter.ProjectFilter]("project filter for generating unidoc") + } + import autoImport._ + override def trigger = noTrigger val akkaSettings = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(Seq( @@ -107,23 +113,20 @@ object UnidocRoot extends AutoPlugin { sources in(JavaUnidoc, unidoc) ~= (_.filterNot(_.getPath.contains("Access$minusControl$minusAllow$minusOrigin"))) )).getOrElse(Nil) - def settings(ignoreAggregates: Seq[Project], ignoreProjects: Seq[Project]) = { - val withoutAggregates = ignoreAggregates.foldLeft(inAnyProject) { _ -- inAggregates(_, transitive = true, includeRoot = true) } - val docProjectFilter = ignoreProjects.foldLeft(withoutAggregates) { _ -- inProjects(_) } - + def settings() = { inTask(unidoc)(Seq( - unidocProjectFilter in ScalaUnidoc := docProjectFilter, - unidocProjectFilter in JavaUnidoc := docProjectFilter, + unidocRootProjectFilter := { + val ignoreProjects = unidocRootIgnoreProjects.value + ignoreProjects.foldLeft(inAnyProject) { _ -- inProjects(_) } + }, + unidocProjectFilter in ScalaUnidoc := unidocRootProjectFilter.value, + unidocProjectFilter in JavaUnidoc := unidocRootProjectFilter.value, apiMappings in ScalaUnidoc := (apiMappings in (Compile, doc)).value )) } override lazy val projectSettings = - CliOptions.genjavadocEnabled.ifTrue(scalaJavaUnidocSettings).getOrElse(scalaUnidocSettings) ++ - // TODO These should be excluded, but I haven't figured out how to exclude them without having the project - // reference available anymore (since the Project's are in build.sbt now) - // AkkaBuild.remoteTests, AkkaBuild.benchJmh, AkkaBuild.protobuf, AkkaBuild.akkaScalaNightly, AkkaBuild.docs)) - settings(Seq(), Seq()) + CliOptions.genjavadocEnabled.ifTrue(scalaJavaUnidocSettings).getOrElse(scalaUnidocSettings) ++ settings() } /**