-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92d762a
commit 29a3e8e
Showing
11 changed files
with
164 additions
and
41 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
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,35 @@ | ||
package com.earldouglas.sbt.war | ||
|
||
import sbt.Def.Initialize | ||
import sbt.Keys._ | ||
import sbt.Keys.{`package` => pkg} | ||
import sbt._ | ||
|
||
import java.io.{File => JavaFile} | ||
|
||
object Compat { | ||
|
||
val Compile_pkg_artifact = Compile / pkg / artifact | ||
val Compile_sourceDirectory = Compile / sourceDirectory | ||
val Compile_target = Compile / target | ||
val Global_onLoad = Global / onLoad | ||
val pkg_artifact = pkg / artifact | ||
|
||
val warContents: Initialize[Task[Map[String, JavaFile]]] = | ||
WebappComponentsPlugin.warContents | ||
|
||
def managedJars(config: Configuration): Initialize[Task[Seq[File]]] = | ||
Def.task { | ||
Classpaths | ||
.managedJars(config, classpathTypes.value, update.value) | ||
.map(_.data) | ||
.toSeq | ||
} | ||
|
||
def toFile(file: TaskKey[File]): Initialize[Task[File]] = | ||
file | ||
|
||
val classpathFiles: Initialize[Task[Seq[File]]] = | ||
(Runtime / fullClasspath) | ||
.map(_.files) | ||
} |
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,51 @@ | ||
package com.earldouglas.sbt.war | ||
|
||
import sbt.Def.Initialize | ||
import sbt.Keys._ | ||
import sbt.Keys.{`package` => pkg} | ||
import sbt._ | ||
import sbt.given | ||
|
||
import java.io.{File => JavaFile} | ||
|
||
import scala.language.implicitConversions | ||
|
||
object Compat: | ||
|
||
val Compile_pkg_artifact = Compile / pkg / artifact | ||
val Compile_sourceDirectory = Compile / sourceDirectory | ||
val Compile_target = Compile / target | ||
val Global_onLoad = Global / onLoad | ||
val pkg_artifact = pkg / artifact | ||
|
||
val warContents: Initialize[Task[Map[String, HashedVirtualFileRef]]] = | ||
Def.task: | ||
val conv: FileConverter = fileConverter.value | ||
WebappComponentsPlugin | ||
.warContents | ||
.value | ||
.map: | ||
case (dst, src) => dst -> conv.toVirtualFile(src.toPath()) | ||
|
||
def managedJars(config: Configuration): Initialize[Task[Seq[File]]] = | ||
Def.task: | ||
Classpaths | ||
.managedJars(config, classpathTypes.value, update.value, fileConverter.value) | ||
.map(_.data) | ||
.map(fileConverter.value.toPath(_)) | ||
.map(_.toFile()) | ||
.toList | ||
|
||
def toFile(file: TaskKey[HashedVirtualFileRef]): Initialize[Task[File]] = | ||
Def.task: | ||
fileConverter.value | ||
.toPath(file.value) | ||
.toFile() | ||
|
||
val classpathFiles: Initialize[Task[Seq[File]]] = | ||
Def.task: | ||
(Runtime / fullClasspath) | ||
.value | ||
.map(_.data) | ||
.map(fileConverter.value.toPath(_)) | ||
.map(_.toFile()) |
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
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
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,13 @@ | ||
package com.earldouglas.sbt.war | ||
import java.util.{List => JavaList} | ||
import java.util.{Map => JavaMap} | ||
import scala.collection.JavaConverters._ | ||
|
||
object TestCompat { | ||
|
||
def asScala[A, B](javaMap: JavaMap[A, B]): Map[A, B] = | ||
javaMap.asScala.toMap | ||
|
||
def asScala[A](javaList: JavaList[A]): List[A] = | ||
javaList.asScala.toList | ||
} |
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,20 @@ | ||
package com.earldouglas.sbt.war | ||
|
||
import java.net.HttpURLConnection | ||
import java.net.URI | ||
import scala.jdk.CollectionConverters._ | ||
import scala.io.Source | ||
import java.util.{List => JavaList} | ||
import java.util.{Map => JavaMap} | ||
|
||
object TestCompat: | ||
|
||
def asScala[A, B](javaMap: JavaMap[A, B]): Map[A, B] = | ||
javaMap | ||
.asScala | ||
.toMap | ||
|
||
def asScala[A](javaList: JavaList[A]): List[A] = | ||
javaList | ||
.asScala | ||
.toList |
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