Permalink
Browse files

ASM now compiled once in the build.

* Moved ASM sources to src/asm
* New  ant task builds asm *ONCE*.  Build times improve by a few seconds
* Fixed SBT build for new asm location.  SBT build still broken from actors-migration and partest

Review by @magarciaEPFL
  • Loading branch information...
jsuereth committed May 23, 2012
1 parent d3bb612 commit fad0bf216e196c78fdabc19227435d5e5e593a67
Showing with 58 additions and 54 deletions.
  1. +43 −42 build.xml
  2. +7 −5 project/Build.scala
  3. +8 −7 project/Layers.scala
  4. 0 src/{compiler → asm}/scala/tools/asm/AnnotationVisitor.java
  5. 0 src/{compiler → asm}/scala/tools/asm/AnnotationWriter.java
  6. 0 src/{compiler → asm}/scala/tools/asm/Attribute.java
  7. 0 src/{compiler → asm}/scala/tools/asm/ByteVector.java
  8. 0 src/{compiler → asm}/scala/tools/asm/ClassReader.java
  9. 0 src/{compiler → asm}/scala/tools/asm/ClassVisitor.java
  10. 0 src/{compiler → asm}/scala/tools/asm/ClassWriter.java
  11. 0 src/{compiler → asm}/scala/tools/asm/CustomAttr.java
  12. 0 src/{compiler → asm}/scala/tools/asm/Edge.java
  13. 0 src/{compiler → asm}/scala/tools/asm/FieldVisitor.java
  14. 0 src/{compiler → asm}/scala/tools/asm/FieldWriter.java
  15. 0 src/{compiler → asm}/scala/tools/asm/Frame.java
  16. 0 src/{compiler → asm}/scala/tools/asm/Handle.java
  17. 0 src/{compiler → asm}/scala/tools/asm/Handler.java
  18. 0 src/{compiler → asm}/scala/tools/asm/Item.java
  19. 0 src/{compiler → asm}/scala/tools/asm/Label.java
  20. 0 src/{compiler → asm}/scala/tools/asm/MethodVisitor.java
  21. 0 src/{compiler → asm}/scala/tools/asm/MethodWriter.java
  22. 0 src/{compiler → asm}/scala/tools/asm/Opcodes.java
  23. 0 src/{compiler → asm}/scala/tools/asm/Type.java
  24. 0 src/{compiler → asm}/scala/tools/asm/signature/SignatureReader.java
  25. 0 src/{compiler → asm}/scala/tools/asm/signature/SignatureVisitor.java
  26. 0 src/{compiler → asm}/scala/tools/asm/signature/SignatureWriter.java
  27. 0 src/{compiler → asm}/scala/tools/asm/tree/AbstractInsnNode.java
  28. 0 src/{compiler → asm}/scala/tools/asm/tree/AnnotationNode.java
  29. 0 src/{compiler → asm}/scala/tools/asm/tree/ClassNode.java
  30. 0 src/{compiler → asm}/scala/tools/asm/tree/FieldInsnNode.java
  31. 0 src/{compiler → asm}/scala/tools/asm/tree/FieldNode.java
  32. 0 src/{compiler → asm}/scala/tools/asm/tree/FrameNode.java
  33. 0 src/{compiler → asm}/scala/tools/asm/tree/IincInsnNode.java
  34. 0 src/{compiler → asm}/scala/tools/asm/tree/InnerClassNode.java
  35. 0 src/{compiler → asm}/scala/tools/asm/tree/InsnList.java
  36. 0 src/{compiler → asm}/scala/tools/asm/tree/InsnNode.java
  37. 0 src/{compiler → asm}/scala/tools/asm/tree/IntInsnNode.java
  38. 0 src/{compiler → asm}/scala/tools/asm/tree/InvokeDynamicInsnNode.java
  39. 0 src/{compiler → asm}/scala/tools/asm/tree/JumpInsnNode.java
  40. 0 src/{compiler → asm}/scala/tools/asm/tree/LabelNode.java
  41. 0 src/{compiler → asm}/scala/tools/asm/tree/LdcInsnNode.java
  42. 0 src/{compiler → asm}/scala/tools/asm/tree/LineNumberNode.java
  43. 0 src/{compiler → asm}/scala/tools/asm/tree/LocalVariableNode.java
  44. 0 src/{compiler → asm}/scala/tools/asm/tree/LookupSwitchInsnNode.java
  45. 0 src/{compiler → asm}/scala/tools/asm/tree/MethodInsnNode.java
  46. 0 src/{compiler → asm}/scala/tools/asm/tree/MethodNode.java
  47. 0 src/{compiler → asm}/scala/tools/asm/tree/MultiANewArrayInsnNode.java
  48. 0 src/{compiler → asm}/scala/tools/asm/tree/TableSwitchInsnNode.java
  49. 0 src/{compiler → asm}/scala/tools/asm/tree/TryCatchBlockNode.java
  50. 0 src/{compiler → asm}/scala/tools/asm/tree/TypeInsnNode.java
  51. 0 src/{compiler → asm}/scala/tools/asm/tree/VarInsnNode.java
  52. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/Analyzer.java
  53. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/AnalyzerException.java
  54. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/BasicInterpreter.java
  55. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/BasicValue.java
  56. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/BasicVerifier.java
  57. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/Frame.java
  58. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/Interpreter.java
  59. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/SimpleVerifier.java
  60. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/SmallSet.java
  61. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/SourceInterpreter.java
  62. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/SourceValue.java
  63. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/Subroutine.java
  64. 0 src/{compiler → asm}/scala/tools/asm/tree/analysis/Value.java
  65. 0 src/{compiler → asm}/scala/tools/asm/util/ASMifiable.java
  66. 0 src/{compiler → asm}/scala/tools/asm/util/ASMifier.java
  67. 0 src/{compiler → asm}/scala/tools/asm/util/CheckAnnotationAdapter.java
  68. 0 src/{compiler → asm}/scala/tools/asm/util/CheckClassAdapter.java
  69. 0 src/{compiler → asm}/scala/tools/asm/util/CheckFieldAdapter.java
  70. 0 src/{compiler → asm}/scala/tools/asm/util/CheckMethodAdapter.java
  71. 0 src/{compiler → asm}/scala/tools/asm/util/CheckSignatureAdapter.java
  72. 0 src/{compiler → asm}/scala/tools/asm/util/Printer.java
  73. 0 src/{compiler → asm}/scala/tools/asm/util/SignatureChecker.java
  74. 0 src/{compiler → asm}/scala/tools/asm/util/Textifiable.java
  75. 0 src/{compiler → asm}/scala/tools/asm/util/Textifier.java
  76. 0 src/{compiler → asm}/scala/tools/asm/util/TraceAnnotationVisitor.java
  77. 0 src/{compiler → asm}/scala/tools/asm/util/TraceClassVisitor.java
  78. 0 src/{compiler → asm}/scala/tools/asm/util/TraceFieldVisitor.java
  79. 0 src/{compiler → asm}/scala/tools/asm/util/TraceMethodVisitor.java
  80. 0 src/{compiler → asm}/scala/tools/asm/util/TraceSignatureVisitor.java
View
@@ -182,6 +182,7 @@ PROPERTIES
<!-- Sets location of build folders -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build-asm.dir" value="${build.dir}/asm"/>
<property name="build-locker.dir" value="${build.dir}/locker"/>
<property name="build-palo.dir" value="${build.dir}/palo"/>
<property name="build-quick.dir" value="${build.dir}/quick"/>
@@ -412,11 +413,44 @@ INITIALISATION
<taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.classpath"/>
</target>
<!-- ===========================================================================
LOCAL Adapted ASM
============================================================================ -->
<target name="asm.start" depends="init">
<condition property="asm.available">
<available file="${build-asm.dir}/asm.complete"/>
</condition>
</target>
<target name="asm.lib" depends="asm.start" unless="asm.available">
<stopwatch name="asm.lib.timer"/>
<mkdir dir="${build-asm.dir}/classes/"/>
<javac
srcdir="${src.dir}/asm"
destdir="${build-asm.dir}/classes"
classpath="${build-asm.dir}/classes"
includes="**/*.java"
target="1.5" source="1.5">
<compilerarg line="${javac.args} -XDignore.symbol.file"/>
</javac>
<touch file="${build-asm.dir}/asm.complete" verbose="no"/>
<stopwatch name="asm.lib.timer" action="total"/>
</target>
<target name="asm.done" depends="asm.lib">
<path id="asm.classpath">
<pathelement location="${build-asm.dir}/classes/"/>
</path>
</target>
<!-- ===========================================================================
LOCAL REFERENCE BUILD (LOCKER)
============================================================================ -->
<target name="locker.start" depends="init">
<target name="locker.start" depends="asm.done">
<condition property="locker.available">
<available file="${build-locker.dir}/all.complete"/>
</condition>
@@ -482,20 +516,6 @@ LOCAL REFERENCE BUILD (LOCKER)
<target name="locker.comp" depends="locker.pre-comp" if="locker.comp.needed">
<stopwatch name="locker.comp.timer"/>
<mkdir dir="${build-locker.dir}/classes/compiler"/>
<!-- TODO If we have cross dependencies, move this below scalacfork... -->
<javac
srcdir="${src.dir}/compiler"
destdir="${build-locker.dir}/classes/compiler"
includes="**/*.java"
target="1.5" source="1.5">
<compilerarg line="${javac.args}"/>
<classpath>
<pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<pathelement location="${jline.jar}"/>
</classpath>
</javac>
<scalacfork
destdir="${build-locker.dir}/classes/compiler"
compilerpathref="starr.classpath"
@@ -507,6 +527,7 @@ LOCAL REFERENCE BUILD (LOCKER)
<pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<path refid="asm.classpath"/>
<pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
@@ -538,11 +559,13 @@ LOCAL REFERENCE BUILD (LOCKER)
<path id="locker.classpath">
<pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="aux.libs"/>
</path>
<path id="quick.classpath">
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="aux.libs"/>
</path>
</target>
@@ -610,6 +633,7 @@ PACKED LOCKER BUILD (PALO)
<mkdir dir="${build-palo.dir}/lib"/>
<jar destfile="${build-palo.dir}/lib/scala-compiler.jar" manifest="${basedir}/META-INF/MANIFEST.MF">
<fileset dir="${build-locker.dir}/classes/compiler"/>
<fileset dir="${build-asm.dir}/classes/"/>
<!-- filemode / dirmode: see trac ticket #1294 -->
<zipfileset dirmode="755" filemode="644" src="${lib.dir}/fjbg.jar"/>
<zipfileset dirmode="755" filemode="644" src="${lib.dir}/msil.jar"/>
@@ -781,20 +805,6 @@ QUICK BUILD (QUICK)
<target name="quick.comp" depends="quick.pre-comp" unless="quick.comp.available">
<stopwatch name="quick.comp.timer"/>
<mkdir dir="${build-quick.dir}/classes/compiler"/>
<!-- TODO If we have cross dependencies, move this below scalacfork... -->
<javac
srcdir="${src.dir}/compiler"
destdir="${build-quick.dir}/classes/compiler"
includes="**/*.java"
target="1.5" source="1.5">
<compilerarg line="${javac.args}"/>
<classpath>
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<pathelement location="${jline.jar}"/>
</classpath>
</javac>
<scalacfork
destdir="${build-quick.dir}/classes/compiler"
compilerpathref="locker.classpath"
@@ -806,6 +816,7 @@ QUICK BUILD (QUICK)
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<path refid="asm.classpath"/>
<pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
@@ -1064,6 +1075,7 @@ QUICK BUILD (QUICK)
<path id="quick.classpath">
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="aux.libs"/>
</path>
</target>
@@ -1130,6 +1142,7 @@ PACKED QUICK BUILD (PACK)
<mkdir dir="${build-pack.dir}/lib"/>
<jar destfile="${build-pack.dir}/lib/scala-compiler.jar" manifest="${build-pack.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build-quick.dir}/classes/compiler"/>
<fileset dir="${build-asm.dir}/classes"/>
<!-- filemode / dirmode: see trac ticket #1294 -->
<zipfileset dirmode="755" filemode="644" src="${fjbg.jar}"/>
<zipfileset dirmode="755" filemode="644" src="${msil.jar}"/>
@@ -1346,19 +1359,6 @@ BOOTSTRAPPING BUILD (STRAP)
<stopwatch name="strap.comp.timer"/>
<mkdir dir="${build-strap.dir}/classes/compiler"/>
<!-- TODO If we have cross dependencies, move this below scalacfork... -->
<javac
srcdir="${src.dir}/compiler"
destdir="${build-strap.dir}/classes/compiler"
includes="**/*.java"
target="1.5" source="1.5">
<compilerarg line="${javac.args}"/>
<classpath>
<pathelement location="${build-strap.dir}/classes/library"/>
<pathelement location="${build-strap.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<pathelement location="${jline.jar}"/>
</classpath>
</javac>
<scalacfork
destdir="${build-strap.dir}/classes/compiler"
compilerpathref="pack.classpath"
@@ -1370,6 +1370,7 @@ BOOTSTRAPPING BUILD (STRAP)
<pathelement location="${build-strap.dir}/classes/library"/>
<pathelement location="${build-strap.dir}/classes/compiler"/>
<path refid="aux.libs"/>
<path refid="asm.classpath"/>
<pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
View
@@ -184,6 +184,8 @@ object ScalaBuild extends Build with Layers {
lazy val jline = Project("jline", file("src/jline"))
// Fast Java Bytecode Generator (nested in every scala-compiler.jar)
lazy val fjbg = Project("fjbg", file(".")) settings(settingOverrides : _*)
// Our wrapped version of msil.
lazy val asm = Project("asm", file(".")) settings(settingOverrides : _*)
// Forkjoin backport
lazy val forkjoin = Project("forkjoin", file(".")) settings(settingOverrides : _*)
@@ -208,11 +210,11 @@ object ScalaBuild extends Build with Layers {
lazy val locker = Project("locker", file(".")) aggregate(lockerLib, lockerComp)
// Quick is the general purpose project layer for the Scala compiler.
lazy val (quickLib, quickComp) = makeLayer("quick", makeScalaReference("locker", lockerLib, lockerComp, fjbg))
lazy val (quickLib, quickComp) = makeLayer("quick", makeScalaReference("locker", lockerLib, lockerComp))
lazy val quick = Project("quick", file(".")) aggregate(quickLib, quickComp)
// Reference to quick scala instance.
lazy val quickScalaInstance = makeScalaReference("quick", quickLib, quickComp, fjbg)
lazy val quickScalaInstance = makeScalaReference("quick", quickLib, quickComp)
def quickScalaLibraryDependency = unmanagedClasspath in Compile <++= (exportedProducts in quickLib in Compile).identity
def quickScalaCompilerDependency = unmanagedClasspath in Compile <++= (exportedProducts in quickComp in Compile).identity
@@ -312,7 +314,7 @@ object ScalaBuild extends Build with Layers {
// --------------------------------------------------------------
// Real Compiler Artifact
// --------------------------------------------------------------
lazy val packageScalaBinTask = Seq(quickComp, fjbg).map(p => products in p in Compile).join.map(_.flatten).map(productTaskToMapping)
lazy val packageScalaBinTask = Seq(quickComp, fjbg, asm).map(p => products in p in Compile).join.map(_.flatten).map(productTaskToMapping)
lazy val scalaBinArtifactSettings : Seq[Setting[_]] = inConfig(Compile)(Defaults.packageTasks(packageBin, packageScalaBinTask)) ++ Seq(
name := "scala-compiler",
crossPaths := false,
@@ -324,7 +326,7 @@ object ScalaBuild extends Build with Layers {
target <<= (baseDirectory, name) apply (_ / "target" / _)
)
lazy val scalaCompiler = Project("scala-compiler", file(".")) settings(publishSettings:_*) settings(scalaBinArtifactSettings:_*) dependsOn(scalaLibrary)
lazy val fullQuickScalaReference = makeScalaReference("pack", scalaLibrary, scalaCompiler, fjbg)
lazy val fullQuickScalaReference = makeScalaReference("pack", scalaLibrary, scalaCompiler)
// --------------------------------------------------------------
// Testing
@@ -368,7 +370,7 @@ object ScalaBuild extends Build with Layers {
// TODO - Migrate this into the dist project.
// Scaladocs
def distScalaInstance = makeScalaReference("dist", scalaLibrary, scalaCompiler, fjbg)
def distScalaInstance = makeScalaReference("dist", scalaLibrary, scalaCompiler)
lazy val documentationSettings: Seq[Setting[_]] = dependentProjectSettings ++ Seq(
// TODO - Make these work for realz.
defaultExcludes in unmanagedSources in Compile := ((".*" - ".") || HiddenFileFilter ||
View
@@ -14,6 +14,8 @@ trait Layers extends Build {
def forkjoin: Project
/** Reference to Fast-Java-Bytecode-Generator library */
def fjbg: Project
/** Reference to the ASM wrapped project. */
def asm: Project
/** A setting that adds some external dependencies. */
def externalDeps: Setting[_]
/** The root project. */
@@ -22,14 +24,15 @@ trait Layers extends Build {
/** Creates a reference Scala version that can be used to build other projects. This takes in the raw
* library, compiler and fjbg libraries as well as a string representing the layer name (used for compiling the compile-interface).
*/
def makeScalaReference(layer : String, library: Project, compiler: Project, fjbg: Project) =
def makeScalaReference(layer : String, library: Project, compiler: Project) =
scalaInstance <<= (appConfiguration in library,
version in library,
(exportedProducts in library in Compile),
(exportedProducts in compiler in Compile),
(exportedProducts in fjbg in Compile),
(fullClasspath in jline in Runtime)) map {
(app, version: String, lib: Classpath, comp: Classpath, fjbg: Classpath, jline: Classpath) =>
(fullClasspath in jline in Runtime),
(exportedProducts in asm in Runtime)) map {
(app, version: String, lib: Classpath, comp: Classpath, fjbg: Classpath, jline: Classpath, asm: Classpath) =>
val launcher = app.provider.scalaProvider.launcher
(lib,comp) match {
case (Seq(libraryJar), Seq(compilerJar)) =>
@@ -38,7 +41,7 @@ trait Layers extends Build {
libraryJar.data,
compilerJar.data,
launcher,
((fjbg.files++jline.files):_*))
((fjbg.files++jline.files ++ asm.files):_*))
case _ => error("Cannot build a ScalaReference with more than one classpath element")
}
}
@@ -58,7 +61,6 @@ trait Layers extends Build {
defaultExcludes in unmanagedResources := ("*.scala" | "*.java" | "*.disabled"),
// TODO - Allow other scalac option settings.
scalacOptions in Compile <++= (scalaSource in Compile) map (src => Seq("-sourcepath", src.getAbsolutePath)),
classpathOptions := ClasspathOptions.manual,
resourceGenerators in Compile <+= (resourceManaged, Versions.scalaVersions, skip in Compile, streams) map Versions.generateVersionPropertiesFile("library.properties"),
referenceScala
)
@@ -80,8 +82,7 @@ trait Layers extends Build {
dirs.descendentsExcept( ("*.xml" | "*.html" | "*.gif" | "*.png" | "*.js" | "*.css" | "*.tmpl" | "*.swf" | "*.properties" | "*.txt"),"*.scala").get
},
// TODO - Use depends on *and* SBT's magic dependency mechanisms...
unmanagedClasspath in Compile <<= Seq(forkjoin, library, fjbg, jline).map(exportedProducts in Compile in _).join.map(_.flatten),
classpathOptions := ClasspathOptions.manual,
unmanagedClasspath in Compile <<= Seq(forkjoin, library, fjbg, jline, asm).map(exportedProducts in Compile in _).join.map(_.flatten),
externalDeps,
referenceScala
)

0 comments on commit fad0bf2

Please sign in to comment.