aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-04-02 01:50:00 -0400
committerGitHub <noreply@github.com>2017-04-02 01:50:00 -0400
commite7112d59b811ca4a0bda448a18e0c45cb4841abb (patch)
tree2abdb4cc62be231240404ccb8d41d27be03cd458
parent05d9dd8128b21eb64ffe6206af624237ac504b89 (diff)
parent99d3123cdbff73cb9a9dd49bc334b47a5a8b6021 (diff)
downloadcbt-e7112d59b811ca4a0bda448a18e0c45cb4841abb.tar.gz
cbt-e7112d59b811ca4a0bda448a18e0c45cb4841abb.tar.bz2
cbt-e7112d59b811ca4a0bda448a18e0c45cb4841abb.zip
Merge pull request #474 from cvogt/chris2
saner -debug behavior
-rwxr-xr-xcbt13
-rw-r--r--libraries/reflect/reflect.scala8
-rw-r--r--stage1/Stage1Lib.scala4
3 files changed, 19 insertions, 6 deletions
diff --git a/cbt b/cbt
index 6e32e50..eac3987 100755
--- a/cbt
+++ b/cbt
@@ -137,6 +137,10 @@ foo(){
foo "$@"
+if [ ! "$DEBUG" == "" ]; then
+ shift
+fi
+
JAVA_OPTS_CBT=($DEBUG -Xmx1536m -Xss10M -XX:MaxJavaStackTraceDepth=-1 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none)
# ng on osx, install via brew install nailgun
@@ -200,10 +204,19 @@ if [ $nailgun_installed -eq 1 ] || [ "$1" = "publishSigned" ]; then
use_nailgun=1
fi
+if [ $server_up -eq 0 ] && [ ! "$DEBUG" == "" ]; then
+ echo "Can't use \`-debug\` (without \`direct\`) when nailgun is already running. If you started it up with \`-debug\` you can still connect to it. Otherwise use \`cbt kill\` to kill it."
+ exit 1
+fi
+
if [ $use_nailgun -eq 0 ] && [ ! $server_up -eq 0 ]; then
log "Starting background process (nailgun)" "$@"
# try to start nailgun-server, just in case it's not up
java "${options[@]}" "${JAVA_OPTS_CBT[@]}" -jar "$NG_SERVER_JAR" 127.0.0.1:$NAILGUN_PORT >> "$nailgun_out" 2>> "$nailgun_err" &
+ if [ ! "$DEBUG" == "" ]; then
+ echo "Started nailgun server in debug mode"
+ exit 1
+ fi
fi
stage1 () {
diff --git a/libraries/reflect/reflect.scala b/libraries/reflect/reflect.scala
index bd7c245..c2b05ed 100644
--- a/libraries/reflect/reflect.scala
+++ b/libraries/reflect/reflect.scala
@@ -65,7 +65,7 @@ package ops {
}
trait Module {
def getMain( cls: Class[_] ): StaticMethod[Seq[String], ExitCode] = {
- val f = findStaticExitMethodForced[Array[String]]( cls, "main" )
+ val f = findStaticExitMethodOrFail[Array[String]]( cls, "main" )
f.copy(
function = ( args: Seq[String] ) => f.function( args.to )
)
@@ -113,16 +113,16 @@ trait Module {
.replace( File.separator, "." )
}
- def findStaticExitMethodForced[Arg: ClassTag](
+ def findStaticExitMethodOrFail[Arg: ClassTag](
cls: Class[_], name: String
): StaticMethod[Arg, ExitCode] = {
- val f = findStaticMethodForced[Arg, Unit]( cls, name )
+ val f = findStaticMethodOrFail[Arg, Unit]( cls, name )
f.copy(
function = arg => trapExitCode { f.function( arg ); ExitCode.Success }
)
}
- def findStaticMethodForced[Arg, Result](
+ def findStaticMethodOrFail[Arg, Result](
cls: Class[_], name: String
)(
implicit
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala
index 392b885..6e2963e 100644
--- a/stage1/Stage1Lib.scala
+++ b/stage1/Stage1Lib.scala
@@ -80,7 +80,7 @@ class Stage1Lib( logger: Logger ) extends
}
def getCbtMain( cls: Class[_] ): cbt.reflect.StaticMethod[Context, ExitCode] =
- findStaticMethodForced[Context, ExitCode]( cls, "cbtMain" )
+ findStaticMethodOrFail[Context, ExitCode]( cls, "cbtMain" )
def findCbtMain( cls: Class[_] ): Option[cbt.reflect.StaticMethod[Context, ExitCode]] =
findStaticMethod[Context, ExitCode]( cls, "cbtMain" )
@@ -376,7 +376,7 @@ ${sourceFiles.sorted.mkString(" \\\n")}
case d => d
}
- def classLoaderRecursion( dependency: Dependency, latest: Map[(String,String),Dependency])(implicit transientCache: java.util.Map[AnyRef,AnyRef], cache: ClassLoaderCache): ClassLoader = {
+ def classLoaderRecursion( dependency: Dependency, latest: Map[(String,String),Dependency] )(implicit transientCache: java.util.Map[AnyRef,AnyRef], cache: ClassLoaderCache): ClassLoader = {
// FIXME: shouldn't we be using KeyLockedLazyCache instead of hashmap directly here?
val dependencies = dependency.dependencies.toVector
val dependencyClassLoader: ClassLoader = {