Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sbt-web 1.1 #3227

Merged
merged 1 commit into from Jul 29, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -159,6 +159,7 @@ object PlayImport {
val updateSecret = TaskKey[File]("play-update-secret", "Update the application conf to generate an application secret", KeyRanks.BTask)

val assetsPrefix = SettingKey[String]("assets-prefix")
val playAggregateAssets = SettingKey[Boolean]("play-aggregate-assets", "Determines whether assets from project dependencies are included.")
val playPackageAssets = TaskKey[File]("play-package-assets")

val playMonitoredFiles = TaskKey[Seq[String]]("play-monitored-files")
@@ -361,10 +361,14 @@ trait PlayRun extends PlayInternalKeys {
}

val playAllAssetsSetting = playAllAssets := {
(playPrefixAndAssets ?).all(ScopeFilter(
inDependencies(ThisProject),
inConfigurations(Compile)
)).value.flatten
if (playAggregateAssets.value) {
(playPrefixAndAssets ?).all(ScopeFilter(
inDependencies(ThisProject),
inConfigurations(Compile)
)).value.flatten
} else {
Seq(playPrefixAndAssets.value)
}
}

val playAssetsClassLoaderSetting = playAssetsClassLoader := { parent =>
@@ -376,10 +380,15 @@ trait PlayRun extends PlayInternalKeys {
}

val playPackageAssetsMappingsSetting = playPackageAssetsMappings := {
val allPipelines = (playPrefixAndPipeline ?).all(ScopeFilter(
inDependencies(ThisProject),
inConfigurations(Compile)
)).value.flatten
val allPipelines =
if (playAggregateAssets.value) {
(playPrefixAndPipeline ?).all(ScopeFilter(
inDependencies(ThisProject),
inConfigurations(Compile)
)).value.flatten
} else {
Seq(playPrefixAndPipeline.value)
}

val allMappings = allPipelines.flatMap {
case (prefix, pipeline) => pipeline.map {
@@ -159,6 +159,9 @@ trait PlaySettings {
// all user classes, in this project and any other subprojects that it depends on
playReloaderClasspath <<= Classpaths.concatDistinct(exportedProducts in Runtime, internalDependencyClasspath in Runtime),

// filter out asset directories from the classpath (supports sbt-web 1.0 and 1.1)
playReloaderClasspath ~= { _.filter(_.get(WebKeys.webModulesLib.key).isEmpty) },

This comment has been minimized.

Copy link
@jroper

jroper Jul 29, 2014

Member

Nice.


playCommonClassloader <<= playCommonClassloaderTask,

playDependencyClassLoader := createURLClassLoader,
@@ -223,6 +226,9 @@ trait PlaySettings {
(compile in Compile).value
},

// Assets
playAggregateAssets := true,

// Assets for run mode
playPrefixAndAssetsSetting,
playAllAssetsSetting,
@@ -250,7 +256,12 @@ trait PlaySettings {
// Assets for testing
public in TestAssets := (public in TestAssets).value / assetsPrefix.value,
fullClasspath in Test ++= {
val testAssetDirs = ((assets in TestAssets) ?).all(ScopeFilter(inDependencies(ThisProject))).value.flatten
val testAssetDirs = {
if (playAggregateAssets.value)
((assets in TestAssets) ?).all(ScopeFilter(inDependencies(ThisProject))).value.flatten
else
Seq((assets in TestAssets).value)
}
testAssetDirs.map(dir => Attributed.blank(dir.getParentFile))
},

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.