Commits

Howard Lewis Ship  committed 4ea659a

Version 1.6.0-annadale-5 adds fastCompile option

fastCompile bypasses the verification stage when not AOT compiling.
This is much faster, as Clojure does not attempt to load the project's
namespaces. However, it should only be used in combination with tests
otherwise there's no validity at all to the Clojure code (it is never
even loaded, never mind tested).

  • Participants
  • Parent commits 731f60d
  • Tags 1.6.0-annadale-5

Comments (0)

Files changed (4)

 syntax: glob
 
+out/*
 build/*
 lib/*
 .gradle/*

File build.gradle

-buildscript {
-    repositories {
-        mavenCentral()
-        maven { url "http://clojars.org/repo" }
-    }
-
-    dependencies {
-        classpath "de.kotka.gradle:gradle-plugin:1.1.0"
-    }
-}
-
-apply plugin: 'idea'
-
-subprojects {
-    group = 'clojuresque'
-    version = '1.6.0-annadale-4'
-
-    ext.kotka = [
-        repository:     "clojuresque/clojuresque",
-        wrapperVersion: "1.8"
-    ]
-
-    apply {
-        plugin 'java'
-        plugin 'kotka'
-        plugin 'idea'
-    }
-
-    repositories {
-        mavenCentral()
-    }
-    
-}
-
-project(':clojuresque') {
-    description = "A Clojure compilation/execution plugin"
-
-    apply {
-        plugin 'groovy'
-    }
-
-    dependencies {
-        compile gradleApi()
-        compile localGroovy()
-
-        compile "de.kotka.gradle:gradle-utils:0.1.1"
-
-        testCompile('org.spockframework:spock-core:0.7-groovy-1.8') {
-            exclude group: 'org.codehaus.groovy', module: 'groovy-all'
-        }
-    }
-
-    compileJava {
-        sourceCompatibility = "1.6"
-        targetCompatibility = "1.6"
-    }
-
-    compileGroovy {
-        sourceCompatibility = "1.6"
-        targetCompatibility = "1.6"
-    }
-
-    processResources {
-        inputs.property "version", {-> project.version}
-        from(sourceSets.main.resources.srcDirs) {
-            expand("version": project.version)
-        }
-    }
-}
-
-project(':clojuresque-runtime') {
-    description = "Clojure compilation/execution runtime support"
-
-    repositories {
-        mavenRepo name: 'clojars', url: 'http://clojars.org/repo'
-    }
-
-    configurations {
-        provided
-    }
-
-    dependencies {
-        provided 'org.clojure:clojure:1.5.1'
-        compile 'io.aviso:pretty:0.1.8'
-    }
-
-    idea.module {
-        scopes.COMPILE.plus += configurations.provided
-    }
-
-    compileJava {
-        sourceCompatibility = "1.6"
-        targetCompatibility = "1.6"
-    }
-
-}
-
-task wrapper(type: Wrapper) {
-    gradleVersion = "1.8"
-}

File clojuresque/src/main/groovy/clojuresque/ClojurePluginExtension.groovy

 package clojuresque
 
 class ClojurePluginExtension {
+    /**
+     * If true, then compilation or verification will enable reflection warnings.
+     * Default if false.
+     */
     def boolean warnOnReflection = false
+    /**
+     * If true, then the compile task will peform AOT compilation. If false (the
+     * default) then all namespaces will be verified, using require and then
+     * source files are copied to the output directory (source files are not
+     * copied when aotCompile is true).
+     */
     def boolean aotCompile       = false
+    /**
+     * If true, then compilation/verification is skipped. Source files are still
+     * copied to the output directory (assuming aotCompile is false, which is expected). 
+     */
+    def boolean fastCompile      = false
 }

File clojuresque/src/main/groovy/clojuresque/tasks/ClojureCompileTask.groovy

             options.add("--warn-on-reflection")
         }
 
-        project.clojureexec {
-            ConfigureUtil.configure delegate, this.jvmOptions
-            systemProperties "clojure.compile.path": destDir.path
-            classpath = project.files(
-                this.clojureRoots.srcDirs,
-                destDir,
-                this.classpath
-            )
-            main = "clojuresque.tasks.compile/main"
-            args = options + this.source.files
+        if (!project.clojure.fastCompile) {
+
+            project.clojureexec {
+                ConfigureUtil.configure delegate, this.jvmOptions
+                systemProperties "clojure.compile.path": destDir.path
+                classpath = project.files(
+                    this.clojureRoots.srcDirs,
+                    destDir,
+                    this.classpath
+                )
+                main = "clojuresque.tasks.compile/main"
+                args = options + this.source.files
+            }
         }
 
         if (!project.clojure.aotCompile) {