Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* made Launcher usable outside of official jar
- Loading branch information
Showing
10 changed files
with
161 additions
and
130 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
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,35 @@ | ||
/** These are packaged and published locally and the resulting artifact is used to test the launcher.*/ | ||
package xsbt.boot.test | ||
|
||
class Exit(val code: Int) extends xsbti.Exit | ||
final class MainException(message: String) extends RuntimeException(message) | ||
final class ArgumentTest extends xsbti.AppMain | ||
{ | ||
def run(configuration: xsbti.AppConfiguration) = | ||
if(configuration.arguments.length == 0) | ||
throw new MainException("Arguments were empty") | ||
else | ||
new Exit(0) | ||
} | ||
class AppVersionTest extends xsbti.AppMain | ||
{ | ||
def run(configuration: xsbti.AppConfiguration) = | ||
{ | ||
val expected = configuration.arguments.headOption.getOrElse("") | ||
if(configuration.provider.id.version == expected) | ||
new Exit(0) | ||
else | ||
throw new MainException("app version was " + configuration.provider.id.version + ", expected: " + expected) | ||
} | ||
} | ||
class ExtraTest extends xsbti.AppMain | ||
{ | ||
def run(configuration: xsbti.AppConfiguration) = | ||
{ | ||
configuration.arguments.foreach { arg => | ||
if(getClass.getClassLoader.getResource(arg) eq null) | ||
throw new MainException("Could not find '" + arg + "'") | ||
} | ||
new Exit(0) | ||
} | ||
} |
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,34 @@ | ||
import sbt._ | ||
|
||
trait NoPublish extends ManagedBase | ||
{ | ||
override final def publishAction = task { None } | ||
override final def deliverAction = publishAction | ||
} | ||
trait NoCrossPaths extends Project | ||
{ | ||
override def disableCrossPaths = true | ||
} | ||
trait JavaProject extends BasicScalaProject with NoCrossPaths | ||
{ | ||
// ensure that interfaces are only Java sources and that they cannot reference Scala classes | ||
override def mainSources = descendents(mainSourceRoots, "*.java") | ||
override def compileOrder = CompileOrder.JavaThenScala | ||
} | ||
trait SourceProject extends BasicScalaProject with NoCrossPaths | ||
{ | ||
override def packagePaths = mainResources +++ mainSources // the default artifact is a jar of the main sources and resources | ||
} | ||
trait ManagedBase extends BasicScalaProject | ||
{ | ||
override def deliverScalaDependencies = Nil | ||
override def managedStyle = ManagedStyle.Ivy | ||
override def useDefaultConfigurations = false | ||
val defaultConf = Configurations.Default | ||
val testConf = Configurations.Test | ||
} | ||
trait Component extends DefaultProject | ||
{ | ||
override def projectID = componentID match { case Some(id) => super.projectID extra("e:component" -> id); case None => super.projectID } | ||
def componentID: Option[String] = None | ||
} |
Oops, something went wrong.