diff options
-rw-r--r-- | src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy | 68 | ||||
-rw-r--r-- | src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy | 128 | ||||
-rw-r--r-- | src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy | 74 | ||||
-rw-r--r-- | src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy | 108 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java | 26 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/plugins/FregeJarFile.java | 34 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/plugins/FregeRuntime.java | 63 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/tasks/FregeCompile.groovy | 56 | ||||
-rw-r--r-- | src/test/groovy/frege/gradle/plugins/FregeBasePluginTest.groovy (renamed from src/test/groovy/frege/gradle/FregeBasePluginTest.groovy) | 3 | ||||
-rw-r--r-- | src/test/groovy/frege/gradle/plugins/FregePluginTest.groovy (renamed from src/test/groovy/frege/gradle/FregePluginTest.groovy) | 4 | ||||
-rw-r--r-- | src/test/groovy/frege/gradle/tasks/FregeCompileTest.groovy | 39 |
11 files changed, 334 insertions, 269 deletions
diff --git a/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy b/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy new file mode 100644 index 0000000..6bcd339 --- /dev/null +++ b/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy @@ -0,0 +1,68 @@ +package frege.gradle.integtest.fixtures + +import org.gradle.testkit.runner.GradleRunner +import org.gradle.testkit.runner.BuildResult +import org.junit.Rule +import org.junit.rules.TemporaryFolder +import spock.lang.Specification + +class AbstractFregeIntegrationSpec extends Specification { + public static final String DEFAULT_FREGE_VERSION = "3.23.370-g898bc8c" + List<File> pluginClasspath + + @Rule + final TemporaryFolder testProjectDir = new TemporaryFolder() + File buildFile + + def setup() { + buildFile = testProjectDir.newFile('build.gradle') + + + testProjectDir.newFolder("src", "main", "java", "org", "frege") + testProjectDir.newFolder("src", "main", "frege", "org", "frege") + + def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt") + if (pluginClasspathResource == null) { + // try again via file reference + pluginClasspathResource = new File("build/createClasspathManifest/plugin-classpath.txt") + if (pluginClasspathResource == null) { + throw new IllegalStateException("Did not find plugin classpath resource, run `integTestClasses` build task.") + } + } + pluginClasspath = pluginClasspathResource.readLines().collect { new File(it) } + } + + + BuildResult run(String task) { + run(null, task); + } + + BuildResult run(String gradleVersion, String task) { + def writer = new StringWriter(); + GradleRunner runner = newRunner(task, writer, gradleVersion) + def result = runner.build() + println writer; + return result; + } + + BuildResult fail(String task) { + def writer = new StringWriter(); + GradleRunner runner = newRunner(task, writer, null) + def result = runner.buildAndFail() + println writer; + return result; + } + + private GradleRunner newRunner(String task, StringWriter writer, String gradleVersion) { + def runner = GradleRunner.create() + .withProjectDir(testProjectDir.root) + .withArguments(task) + .withPluginClasspath(pluginClasspath) + .forwardStdOutput(writer) + if (gradleVersion) { + runner.withGradleVersion(gradleVersion) + } + runner + } + +} diff --git a/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy new file mode 100644 index 0000000..e837a2a --- /dev/null +++ b/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy @@ -0,0 +1,128 @@ +package frege.gradle.plugins + +import frege.gradle.integtest.fixtures.AbstractFregeIntegrationSpec +import org.gradle.testkit.runner.BuildResult +import spock.lang.Unroll +import static org.gradle.testkit.runner.TaskOutcome.* + +class FregePluginIntegTest extends AbstractFregeIntegrationSpec { + + def setup() { + buildFile << """ + plugins { + id 'org.frege-lang' + } + + repositories { + jcenter() + } + """ + } + + def "can handle non existing source directories"() { + given: + buildFile << """ + dependencies { + compile "org.frege-lang:frege:$DEFAULT_FREGE_VERSION" + } + """ + + when: + def result = run("classes") + then: + result.task(":compileFrege").outcome == UP_TO_DATE + } + + @Unroll + def "can compile and run frege code (gradle: #gradleVersion, frege: #fregeVersion)"() { + given: + buildFile << """ + dependencies { + compile "org.frege-lang:frege:$fregeVersion" + } + ${sayHelloTask()} + """ + + def fregeSourceFile = testProjectDir.newFile("src/main/frege/org/frege/HelloFrege.fr") + + fregeSourceFile << """ + module org.frege.HelloFrege where + + greeting = "Hello Frege!" + + main _ = do + println greeting + """ + + when: + def result = run(gradleVersion, "sayHello") + + then: + result.output.contains("Hello Frege!") + result.task(":sayHello").outcome == SUCCESS + + where: + fregeVersion | gradleVersion + DEFAULT_FREGE_VERSION | "2.9" + DEFAULT_FREGE_VERSION | "2.8" + "3.22.367-g2737683" | "2.9" + "3.22.367-g2737683" | "2.8" + } + + def "can reference java from frege"() { + given: + buildFile << """ + dependencies { + compile "org.frege-lang:frege:$DEFAULT_FREGE_VERSION" + } + ${sayHelloTask()} + """ + + and: + javaCode() + fregeCallingJava() + when: + BuildResult result = run("sayHello") + then: + result.task(":compileJava").outcome == SUCCESS + result.task(":compileFrege").outcome == SUCCESS + result.output.contains("hello from java") + } + + def fregeCallingJava() { + + File fregeSourceFile = testProjectDir.newFile("src/main/frege/org/frege/HelloFrege.fr") + fregeSourceFile << """ + module org.frege.HelloFrege where + + data StaticHello = pure native org.frege.StaticHello where + pure native helloJava org.frege.StaticHello.helloJava:: () -> String + + + main _ = do + println(StaticHello.helloJava()) + + """ + } + + def javaCode(String sourceRoot = "java") { + def javaSourceFile = testProjectDir.newFile("src/main/$sourceRoot/org/frege/StaticHello.java") + + javaSourceFile << """ + package org.frege; + + public class StaticHello { + public static String helloJava() { + return "hello from java"; + } + } + """ + } + + def sayHelloTask() { + return """ task sayHello(type: JavaExec) { + classpath = sourceSets.main.runtimeClasspath + main = 'org.frege.HelloFrege' + } """ + } +}
\ No newline at end of file diff --git a/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy new file mode 100644 index 0000000..3845e23 --- /dev/null +++ b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy @@ -0,0 +1,74 @@ +package frege.gradle.tasks +import frege.gradle.integtest.fixtures.AbstractFregeIntegrationSpec + +import static org.gradle.testkit.runner.TaskOutcome.FAILED + +class FregeCompileIntegTest extends AbstractFregeIntegrationSpec { + + List<File> pluginClasspath + + def setup() { + buildFile << """ + plugins { + id 'org.frege-lang.base' + } + + import frege.gradle.tasks.FregeCompile + + repositories { jcenter() } + + configurations { frege {} } + + dependencies { + frege "org.frege-lang:frege:$DEFAULT_FREGE_VERSION" + } + + task compile(type: FregeCompile) { + destinationDir = file("frege-output") + source("frege-src") + module = "frege-src" + classpath = configurations.frege + fregepath = configurations.frege + } + """ + + testProjectDir.newFolder("frege-src") + } + + def "shows compile errors"() { + given: + simpleFrege() + failingFrege() + when: + def result = fail("compile") + + then: + result.task(":compile").outcome == FAILED + result.output.contains("Failing.fr:6: can't resolve `Hello`") + } + + def failingFrege() { + def failingFrege = testProjectDir.newFile("frege-src/Failing.fr") + failingFrege << """ + + module Failing where + + failingFun _ = do + println(Hello) + """ + } + + def simpleFrege() { + + def helloFrege = testProjectDir.newFile("frege-src/Hello.fr") + helloFrege << """ + + module Hello where + + import frege.prelude.PreludeBase + + main _ = do + println("Hello From Frege") + """ + } +} diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy deleted file mode 100644 index b6936a8..0000000 --- a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy +++ /dev/null @@ -1,108 +0,0 @@ -package frege.plugin -import org.gradle.testkit.runner.GradleRunner -import org.junit.Rule -import org.junit.rules.TemporaryFolder -import spock.lang.Specification -import spock.lang.Unroll - -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS - -class FregePluginIntegTest extends Specification { - - public static final String DEFAULT_FREGE_VERSION = "3.23.370-g898bc8c" - @Rule - final TemporaryFolder testProjectDir = new TemporaryFolder() - File buildFile - - List<File> pluginClasspath - - def setup() { - buildFile = testProjectDir.newFile('build.gradle') - - buildFile << """ - plugins { - id 'org.frege-lang' - } - - repositories { - jcenter() - } - """ - def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt") - if (pluginClasspathResource == null) { - // try again via file reference - pluginClasspathResource = new File("build/createClasspathManifest/plugin-classpath.txt") - if (pluginClasspathResource == null) { - throw new IllegalStateException("Did not find plugin classpath resource, run `integTestClasses` build task.") - } - } - pluginClasspath = pluginClasspathResource.readLines().collect { new File(it) } - } - - def "can handle non existing source directories"() { - given: - buildFile << """ - dependencies { - compile "org.frege-lang:frege:$DEFAULT_FREGE_VERSION" - } - """ - - when: - def result = GradleRunner.create() - .withProjectDir(testProjectDir.root) - .withArguments('classes') - .withPluginClasspath(pluginClasspath) - .build() - then: - result.task(":compileFrege") != null - } - - @Unroll - def "can compile and run frege code (gradle: #gradleVersion, frege: #fregeVersion)"() { - given: - buildFile << """ - dependencies { - compile "org.frege-lang:frege:$fregeVersion" - } - - task sayHello(type: JavaExec){ - doFirst { - println classpath.files - } - classpath = sourceSets.main.runtimeClasspath - main = 'HelloFrege' - } - """ - - testProjectDir.newFolder("src", "main", "frege") - def fregeSourceFile = testProjectDir.newFile("src/main/frege/HelloFrege.fr") - - fregeSourceFile << """ -module HelloFrege where - -greeting = "Hello Frege!" - -main _ = do - println greeting -""" - - when: - def result = GradleRunner.create() - .withGradleVersion(gradleVersion) - .withProjectDir(testProjectDir.root) - .withArguments('sayHello') - .withPluginClasspath(pluginClasspath) - .build() - - then: - result.output.contains("Hello Frege!") - result.task(":sayHello").outcome == SUCCESS - - where: - fregeVersion | gradleVersion - DEFAULT_FREGE_VERSION | "2.9" - DEFAULT_FREGE_VERSION | "2.8" - "3.22.367-g2737683" | "2.9" - "3.22.367-g2737683" | "2.8" - } -}
\ No newline at end of file diff --git a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java b/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java index 8bf5399..a2ebc25 100644 --- a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java +++ b/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java @@ -30,22 +30,20 @@ public class FregeBasePlugin implements Plugin<Project> { } @Override - public void apply(Project project) { + public void apply(final Project project) { // Workaround to build proper jars on Windows, see https://github.com/Frege/frege-gradle-plugin/issues/9 this.project = project; System.setProperty("file.encoding", "UTF-8"); project.getPluginManager().apply(JavaBasePlugin.class); fregePluginExtension = project.getExtensions().create(EXTENSION_NAME, FregePluginExtension.class); JavaBasePlugin javaBasePlugin = project.getPlugins().getPlugin(JavaBasePlugin.class); - - configureCompileDefaults(new FregeRuntime(project)); configureSourceSetDefaults(javaBasePlugin); } private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) { project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() { - public void execute(SourceSet sourceSet) { + public void execute(final SourceSet sourceSet) { final DefaultFregeSourceSet fregeSourceSet = new DefaultFregeSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), fileResolver); new DslObject(sourceSet).getConvention().getPlugins().put("frege", fregeSourceSet); @@ -63,6 +61,12 @@ public class FregeBasePlugin implements Plugin<Project> { FregeCompile compile = project.getTasks().create(compileTaskName, FregeCompile.class); compile.setModule(project.file(defaultSourcePath).getAbsolutePath()); javaBasePlugin.configureForSourceSet(sourceSet, compile); + compile.getConventionMapping().map("fregepath", new Callable() { + public Object call() throws Exception { + return sourceSet.getCompileClasspath(); + } + }); + compile.dependsOn(sourceSet.getCompileJavaTaskName()); compile.setDescription(String.format("Compiles the %s Frege source.", sourceSet.getName())); compile.setSource(fregeSourceSet.getFrege()); @@ -70,18 +74,4 @@ public class FregeBasePlugin implements Plugin<Project> { } }); } - - private void configureCompileDefaults(final FregeRuntime fregeRuntime) { - this.project.getTasks().withType(FregeCompile.class, new Action<FregeCompile>() { - public void execute(final FregeCompile compile) { - compile.getConventionMapping().map("fregeClasspath", new Callable() { - public Object call() throws Exception { - return fregeRuntime.inferFregeClasspath(compile.getClasspath()); - } - - }); - } - }); - } - } diff --git a/src/main/groovy/frege/gradle/plugins/FregeJarFile.java b/src/main/groovy/frege/gradle/plugins/FregeJarFile.java deleted file mode 100644 index eaf7d8f..0000000 --- a/src/main/groovy/frege/gradle/plugins/FregeJarFile.java +++ /dev/null @@ -1,34 +0,0 @@ -package frege.gradle.plugins; - -import org.gradle.util.VersionNumber; - -import java.io.File; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FregeJarFile { - private static final Pattern FILE_NAME_PATTERN = Pattern.compile("(frege(?:-all)?)-(\\d.*?)(-indy)?.jar"); - private final File file; - private final Matcher matcher; - private String version; - - private FregeJarFile(File file, Matcher matcher) { - this.file = file; - this.matcher = matcher; - } - - - public static FregeJarFile parse(File file) { - Matcher matcher = FILE_NAME_PATTERN.matcher(file.getName()); - return matcher.matches() ? new FregeJarFile(file, matcher) : null; - } - - public String getDependencyNotation() { - return "org.frege-lang:frege:" + getVersion(); - - } - - public VersionNumber getVersion() { - return VersionNumber.parse(matcher.group(2)); - } -} diff --git a/src/main/groovy/frege/gradle/plugins/FregeRuntime.java b/src/main/groovy/frege/gradle/plugins/FregeRuntime.java deleted file mode 100644 index 4265d0b..0000000 --- a/src/main/groovy/frege/gradle/plugins/FregeRuntime.java +++ /dev/null @@ -1,63 +0,0 @@ -package frege.gradle.plugins; - -import com.google.common.collect.Lists; -import org.gradle.api.Buildable; -import org.gradle.api.GradleException; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Dependency; -import org.gradle.api.file.FileCollection; -import org.gradle.api.internal.file.collections.LazilyInitializedFileCollection; -import org.gradle.api.internal.tasks.TaskDependencyResolveContext; - -import java.io.File; -import java.util.List; - -public class FregeRuntime { - - private final Project project; - - public FregeRuntime(Project project) { - this.project = project; - } - - - public FileCollection inferFregeClasspath(final Iterable<File> classpath) { - return new LazilyInitializedFileCollection() { - public String getDisplayName() { - return "Frege runtime classpath"; - } - - public FileCollection createDelegate() { - final FregeJarFile fregeJar = FregeRuntime.this.findFregeJarFile(classpath); - if (fregeJar == null) { - throw new GradleException(String.format("Cannot infer Frege class path because no Frege Jar was found on class path: %s", classpath)); - } - String notation = fregeJar.getDependencyNotation(); - List<Dependency> dependencies = Lists.newArrayList(); - dependencies.add(project.getDependencies().create(notation)); - return project.getConfigurations().detachedConfiguration(dependencies.toArray(new Dependency[dependencies.size()])); - } - - public void visitDependencies(TaskDependencyResolveContext context) { - if (classpath instanceof Buildable) { - context.add(classpath); - } - } - - }; - } - - private FregeJarFile findFregeJarFile(Iterable<File> classpath) { - if (classpath == null) { - return null; - } - for (File file : classpath) { - FregeJarFile fregeJar = FregeJarFile.parse(file); - if (fregeJar != null) { - return fregeJar; - } - } - return null; - } - -} diff --git a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy index 13b617c..290f750 100644 --- a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy +++ b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy @@ -1,10 +1,10 @@ package frege.gradle.tasks + import groovy.transform.TypeChecked -import groovy.transform.TypeCheckingMode import org.gradle.api.Action -import org.gradle.api.artifacts.Configuration import org.gradle.api.file.FileCollection import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.compile.AbstractCompile @@ -13,67 +13,51 @@ import org.gradle.process.JavaExecSpec @TypeChecked class FregeCompile extends AbstractCompile { - FileCollection fregeClasspath FileCollection classpath @Input String stackSize = "4m" - @Optional @Input boolean hints = false - @Optional @Input boolean optimize = false - @Optional - @Input boolean verbose = false - @Optional @Input boolean inline = true - @Optional @Input boolean make = true - @Optional @Input boolean compileGeneratedJava = true - @Optional @Input String target = "" - @Optional @Input boolean comments = false - @Optional @Input boolean suppressWarnings = false - @Optional @Input String explain = "" - @Optional @Input String extraArgs = "" - @Optional @Input String allArgs = "" // this is an option to overrule all other settings - @Optional @Input String module = "" - @Optional - @Input - List<File> fregePaths = [] + @Optional @InputFiles + FileCollection fregepath @Input String mainClass = "frege.compiler.Main" @@ -82,11 +66,9 @@ class FregeCompile extends AbstractCompile { @Input List<String> allJvmArgs = [] - @Optional @Input String encoding = "" - @Optional @Input String prefix = "" @@ -95,8 +77,6 @@ class FregeCompile extends AbstractCompile { @Override @TaskAction protected void compile() { - logConfigurationInfo() - def jvmArgs = allJvmArgs if (jvmArgs.isEmpty()) { jvmArgs << "-Xss$stackSize".toString() @@ -106,14 +86,20 @@ class FregeCompile extends AbstractCompile { logger.info("Calling Frege compiler with compilerArgs: '$compilerArgs'") //TODO integrate with gradle compiler daemon infrastructure and skip internal execution + + def errOutputStream = new ByteArrayOutputStream(); + def outOutputStream = new ByteArrayOutputStream(); project.javaexec(new Action<JavaExecSpec>() { @Override void execute(JavaExecSpec javaExecSpec) { javaExecSpec.args = compilerArgs - javaExecSpec.classpath = FregeCompile.this.classpath + FregeCompile.this.fregeClasspath + javaExecSpec.classpath = FregeCompile.this.classpath javaExecSpec.main = mainClass + javaExecSpec.errorOutput = System.err; + javaExecSpec.standardOutput = System.out; } }); + } public FregeCompile source(Object... sources) { @@ -125,16 +111,6 @@ class FregeCompile extends AbstractCompile { return this; } - void logConfigurationInfo() { - def path = project.files(compileConfig()).getAsPath() - logger.info("Compile configuation as path: $path") - } - - @TypeChecked(TypeCheckingMode.SKIP) - Configuration compileConfig() { - project.configurations.compile - } - protected List<String> assembleArguments() { List args = [] if (hints) @@ -161,10 +137,10 @@ class FregeCompile extends AbstractCompile { if (verbose) args << "-v" - def fp = fregePaths - if (!fp.isEmpty()) { + + if (fregepath != null && !fregepath.isEmpty()) { args << "-fp" - args << fp.collect { f -> f.absolutePath }.join(File.pathSeparator) + args << fregepath.files.collect { f -> f.absolutePath }.join(File.pathSeparator) } if (sourcePaths != null && !sourcePaths.isEmpty()) { @@ -183,7 +159,7 @@ class FregeCompile extends AbstractCompile { } args << "-d" - args << getDestinationDir() + args << getDestinationDir().absolutePath if (!module.isEmpty()) { logger.info "compiling module '$module'" @@ -191,8 +167,6 @@ class FregeCompile extends AbstractCompile { } else { args = (args + extraArgs.split().toList()).toList() } - args } - } diff --git a/src/test/groovy/frege/gradle/FregeBasePluginTest.groovy b/src/test/groovy/frege/gradle/plugins/FregeBasePluginTest.groovy index 3ca1bb2..04b5587 100644 --- a/src/test/groovy/frege/gradle/FregeBasePluginTest.groovy +++ b/src/test/groovy/frege/gradle/plugins/FregeBasePluginTest.groovy @@ -1,6 +1,5 @@ -package frege.gradle +package frege.gradle.plugins -import frege.gradle.plugins.FregeBasePlugin import org.gradle.api.Project import org.gradle.testfixtures.ProjectBuilder import spock.lang.Specification diff --git a/src/test/groovy/frege/gradle/FregePluginTest.groovy b/src/test/groovy/frege/gradle/plugins/FregePluginTest.groovy index 2fc6d86..1867c88 100644 --- a/src/test/groovy/frege/gradle/FregePluginTest.groovy +++ b/src/test/groovy/frege/gradle/plugins/FregePluginTest.groovy @@ -1,7 +1,5 @@ -package frege.gradle +package frege.gradle.plugins -import frege.gradle.plugins.FregeBasePlugin -import frege.gradle.plugins.FregePlugin import org.gradle.api.Project import org.gradle.testfixtures.ProjectBuilder import spock.lang.Specification diff --git a/src/test/groovy/frege/gradle/tasks/FregeCompileTest.groovy b/src/test/groovy/frege/gradle/tasks/FregeCompileTest.groovy new file mode 100644 index 0000000..c9224ea --- /dev/null +++ b/src/test/groovy/frege/gradle/tasks/FregeCompileTest.groovy @@ -0,0 +1,39 @@ +package frege.gradle.tasks + +import org.gradle.api.Project +import org.gradle.testfixtures.ProjectBuilder +import spock.lang.Specification + +class FregeCompileTest extends Specification { + Project project = ProjectBuilder.builder().build() + FregeCompile compile + + def setup() { + when: + compile = project.tasks.create("fregeCompile", FregeCompile) + } + + + def "configured sourcePaths tracked"() { + when: + compile.source("someFolder") + then: + compile.sourcePaths == [project.file("someFolder")] + } + + + def "default assembleArguments"() { + given: + compile.destinationDir = project.file("testoutput") + expect: + compile.assembleArguments() == ["-inline", "-make", "-d", project.file("testoutput").absolutePath] + } + + def "with prefix"() { + given: + compile.destinationDir = project.file("testoutput") + compile.prefix = "somePrefix" + expect: + compile.assembleArguments() == ["-inline", "-make", "-prefix", "somePrefix", "-d", project.file("testoutput").absolutePath] + } +} |