Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move scaladoc-only concerns to a file
- Loading branch information
exoego
committed
Jul 3, 2019
1 parent
14f0fe5
commit 5e5e942
Showing
2 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package scala.build | ||
|
||
import sbt._ | ||
import sbt.Keys.{ artifact, dependencyClasspath, moduleID, resourceManaged } | ||
|
||
object ScaladocSettings { | ||
|
||
val webjarResoources = Seq( | ||
"org.webjars" % "jquery" % "3.4.1" | ||
) | ||
|
||
def extractResourcesFromWebjar = Def.task { | ||
def isWebjar(s: Attributed[File]): Boolean = | ||
s.get(artifact.key).isDefined && s.get(moduleID.key).exists(_.organization == "org.webjars") | ||
val dest = (resourceManaged.value / "webjars").getAbsoluteFile | ||
IO.createDirectory(dest) | ||
val classpathes = (dependencyClasspath in Compile).value | ||
val files: Seq[File] = classpathes.filter(isWebjar).flatMap { classpathEntry => | ||
val jarFile = classpathEntry.data | ||
IO.unzip(jarFile, dest) | ||
} | ||
(files ** "*.min.js").get() | ||
} | ||
|
||
} |