aboutsummaryrefslogtreecommitdiff
path: root/nailgun_launcher
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 01:47:57 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 11:56:25 -0400
commit244f86a9cdf19904169456c234a2752f125dd427 (patch)
tree51e1f79100cc3651dfce66d4a284584d6bef3997 /nailgun_launcher
parent4eb753e4d4ef5be7443b99832892bac697b10b50 (diff)
downloadcbt-244f86a9cdf19904169456c234a2752f125dd427.tar.gz
cbt-244f86a9cdf19904169456c234a2752f125dd427.tar.bz2
cbt-244f86a9cdf19904169456c234a2752f125dd427.zip
revamp loop feature
now CBT and builds pass their file names to the current build via the context. The build then simply blocks until any file changes. Then it returns with a special exit code, which the bash script picks up and restarts CBT. Thats works well for looping over project files. It works less well for looping over builds and CBT itself. For this a build has to success once, so that the .cbt-loop.tmp file exists. Then looping works for cbt and builds, but the file list is not updated in case of compile errors, etc. Fixes - https://github.com/cvogt/cbt/issues/406 - https://github.com/cvogt/cbt/issues/405 - https://github.com/cvogt/cbt/issues/202 - https://github.com/cvogt/cbt/issues/50 - https://github.com/cvogt/cbt/issues/22 We should improve for 1.0 in https://github.com/cvogt/cbt/issues/419 to handle looping over build files and cbt itself smarter.
Diffstat (limited to 'nailgun_launcher')
-rw-r--r--nailgun_launcher/NailgunLauncher.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/nailgun_launcher/NailgunLauncher.java b/nailgun_launcher/NailgunLauncher.java
index d89c764..958b052 100644
--- a/nailgun_launcher/NailgunLauncher.java
+++ b/nailgun_launcher/NailgunLauncher.java
@@ -51,6 +51,10 @@ public class NailgunLauncher{
ClassLoader.getSystemClassLoader().getParent()
);
+ public static List<File> compatibilitySourceFiles;
+ public static List<File> nailgunLauncherSourceFiles;
+ public static List<File> stage1SourceFiles;
+
public static void main( String[] args ) throws Throwable {
long _start = System.currentTimeMillis();
if(args[0].equals("check-alive")){
@@ -80,7 +84,6 @@ public class NailgunLauncher{
}
// ---------------------
- _assert(System.getenv("CBT_HOME") != null, "environment variable CBT_HOME not defined");
String CBT_HOME = System.getenv("CBT_HOME");
String cache = CBT_HOME + "/cache/";
String compatibilityTarget = CBT_HOME + "/compatibility/" + TARGET;
@@ -132,7 +135,8 @@ public class NailgunLauncher{
final String compatibilityTarget, final ClassLoaderCache classLoaderCache
) throws Throwable {
_assert(TARGET != null, "environment variable TARGET not defined");
- String nailgunTarget = cbtHome + "/" + NAILGUN + TARGET;
+ String nailgunSources = cbtHome + "/" + NAILGUN;
+ String nailgunTarget = nailgunSources + TARGET;
String stage1Sources = cbtHome + "/" + STAGE1;
String stage1Target = stage1Sources + TARGET;
File compatibilitySources = new File(cbtHome + "/compatibility");
@@ -142,13 +146,20 @@ public class NailgunLauncher{
ClassLoader rootClassLoader = new CbtURLClassLoader( new URL[]{}, ClassLoader.getSystemClassLoader().getParent() ); // wrap for caching
EarlyDependencies earlyDeps = new EarlyDependencies(mavenCache, mavenUrl, classLoaderCache, rootClassLoader);
+ nailgunLauncherSourceFiles = new ArrayList<File>();
+ for( File f: new File(nailgunSources).listFiles() ){
+ if( f.isFile() && f.toString().endsWith(".java") ){
+ nailgunLauncherSourceFiles.add(f);
+ }
+ }
+
long nailgunLauncherLastModified = new File( nailgunTarget + "../classes.last-success" ).lastModified();
long compatibilityLastModified;
if(!compatibilityTarget.startsWith(cbtHome)){
compatibilityLastModified = new File( compatibilityTarget + "../classes.last-success" ).lastModified();
} else {
- List<File> compatibilitySourceFiles = new ArrayList<File>();
+ compatibilitySourceFiles = new ArrayList<File>();
for( File f: compatibilitySources.listFiles() ){
if( f.isFile() && f.toString().endsWith(".java") ){
compatibilitySourceFiles.add(f);
@@ -174,7 +185,7 @@ public class NailgunLauncher{
append( append( nailgunClasspathArray, compatibilityTarget ), stage1Target );
String stage1Classpath = classpath( stage1ClasspathArray );
- List<File> stage1SourceFiles = new ArrayList<File>();
+ stage1SourceFiles = new ArrayList<File>();
for( File f: new File(stage1Sources).listFiles() ){
if( f.isFile() && f.toString().endsWith(".scala") ){
stage1SourceFiles.add(f);