aboutsummaryrefslogtreecommitdiff
path: root/compatibility
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-04-27 23:35:58 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2016-04-28 15:03:57 -0400
commit53247b5610b0168a3dd93d3d8f1224b78995ecde (patch)
treecc2b25cc8e842de565c03ae1192a460e66652fbb /compatibility
parent9951f3f3e65337d2ca567ffb1760a6545fe14998 (diff)
downloadcbt-53247b5610b0168a3dd93d3d8f1224b78995ecde.tar.gz
cbt-53247b5610b0168a3dd93d3d8f1224b78995ecde.tar.bz2
cbt-53247b5610b0168a3dd93d3d8f1224b78995ecde.zip
Reproducible builds, composing different CBT version and various improvements
One large commit, because it is was hard to do these things in isolation or to separate them now. CBT now knows how to load other versions of itself - Support for reproducible builds (!), by providing a CBT git URL and hash to tie build to - Support for composing builds using different CBT versions (!) - introduce (in compatibility/) Java interfaces all CBT versions need to stay compatible with, so they can talk to each other. And put extension methods to these interfaces in cbt package object Class loading - add some sanity checks for class loading - improve class loader invalidation to fix bugs - implement caching in Java land class loaders. In particular to prevent the system class loader to repeatedly generate ClassNotFound exceptions in each sink of the class loader DAG for non JDK classes (meaning major speed up for projects with many classes). - getting rid of transient class loader cache unifying into "persistent" one instead (which is still wrong as invalidation eventually needs to invalidate entire sub graphs of the class loading DAG, not single class loaders. Seems like we'll have to abandon the hashmap based approach and tie caching to dependency objects) Other Caching - cache dependencies extracted from xml files, which was one major time killer, but invalidate cache when cbt changed (maven dependency user facing api needs simplification now!) - memorize last successful compile time in the file system rather than memory, to guard against unnecessary recompiling even across launches (or when using cbt direct) Structural improvements - Factor out ClassLoaderCache on Java land into its own class. - Port MultiClassLoader to Java land, to better compose classloaders in NailgunLauncher. - Remove many global constants and variables (in object paths and in NailgunLauncher) and pass them through instead. Needed for composing of builds. - move more code from resolver into Lib for less entanglement with classes (needed to compatibility interfaces) and better re-usability - remove canBeCached. Everything can be cached now, but we need to be careful about correct invalidation. - remove build announcing produced jars. We can add if ever needed. - change callNullary to return exit code instead of Unit as preparation for next commit introducing "recursive" ScalaTest - Makes ScalaTest support work (still a bit too inflexible, but mostly works well)
Diffstat (limited to 'compatibility')
-rw-r--r--compatibility/ArtifactInfo.java7
-rw-r--r--compatibility/BuildInterface.java11
-rw-r--r--compatibility/Context.java21
-rw-r--r--compatibility/Dependency.java10
-rw-r--r--compatibility/Result.java11
5 files changed, 60 insertions, 0 deletions
diff --git a/compatibility/ArtifactInfo.java b/compatibility/ArtifactInfo.java
new file mode 100644
index 0000000..a2e6006
--- /dev/null
+++ b/compatibility/ArtifactInfo.java
@@ -0,0 +1,7 @@
+package cbt;
+
+public interface ArtifactInfo extends Dependency{
+ public abstract String artifactId();
+ public abstract String groupId();
+ public abstract String version();
+}
diff --git a/compatibility/BuildInterface.java b/compatibility/BuildInterface.java
new file mode 100644
index 0000000..fea43be
--- /dev/null
+++ b/compatibility/BuildInterface.java
@@ -0,0 +1,11 @@
+package cbt;
+import java.io.*;
+
+public interface BuildInterface extends Dependency{
+ public abstract BuildInterface copy(Context context); // needed to configure builds
+ public abstract String show(); // needed for debugging
+ public abstract String scalaVersion(); // needed to propagate scalaVersion to dependent builds
+ public abstract String[] crossScalaVersionsArray(); // FIXME: this probably can't use Scala classes
+ public abstract BuildInterface finalBuild(); // needed to propagage through build builds. Maybe we can get rid of this.
+ public abstract File[] triggerLoopFilesArray(); // needed for watching files across composed builds
+}
diff --git a/compatibility/Context.java b/compatibility/Context.java
new file mode 100644
index 0000000..387c24a
--- /dev/null
+++ b/compatibility/Context.java
@@ -0,0 +1,21 @@
+package cbt;
+import java.io.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+// TODO: try to reduce the number of members
+public abstract class Context{
+ public abstract File projectDirectory();
+ public abstract File cwd();
+ public abstract String[] argsArray();
+ public abstract String[] enabledLoggersArray();
+ public abstract Long startCompat();
+ public abstract Boolean cbtHasChangedCompat();
+ public abstract String versionOrNull();
+ public abstract String scalaVersionOrNull(); // needed to propagate scalaVersion to dependendee builds
+ public abstract ConcurrentHashMap<String,Object> permanentKeys();
+ public abstract ConcurrentHashMap<Object,ClassLoader> permanentClassLoaders();
+ public abstract File cache();
+ public abstract File cbtHome();
+ public abstract File compatibilityTarget();
+ public abstract BuildInterface parentBuildOrNull();
+}
diff --git a/compatibility/Dependency.java b/compatibility/Dependency.java
new file mode 100644
index 0000000..d491174
--- /dev/null
+++ b/compatibility/Dependency.java
@@ -0,0 +1,10 @@
+package cbt;
+import java.io.*;
+
+public interface Dependency{
+ public abstract String show();
+ public abstract Boolean needsUpdateCompat();
+ public abstract Dependency[] dependenciesArray();
+ public abstract File[] dependencyClasspathArray();
+ public abstract File[] exportedClasspathArray();
+}
diff --git a/compatibility/Result.java b/compatibility/Result.java
new file mode 100644
index 0000000..220aa3a
--- /dev/null
+++ b/compatibility/Result.java
@@ -0,0 +1,11 @@
+/*
+package cbt;
+import java.io.*;
+public interface Result<T>{
+ public abstract Integer exitCode();
+ public abstract OutputStream out();
+ public abstract OutputStream err();
+ public abstract InputStream in();
+ public abstract T value();
+}
+*/