buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'com.eriwen:gradle-js-plugin:0.2'
    }
}

configurations {
    rhino
}

dependencies {
    rhino 'org.mozilla:rhino:1.7R3'
}

apply plugin: 'js'

js {
    file2 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file2.js'])
    file1 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file1.js'])
    inputs.files file2 + file1
    outputs.file file("${buildDir}/all-debug.js")
    compilationLevel = 'WHITESPACE_ONLY'
}

js {
    file2 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file2.js'])
    file1 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file1.js'])
    inputs.files file2 + file1
    outputs.file file("${buildDir}/all.js")
}

task jsDev(type: com.eriwen.gradle.js.tasks.JsTask) {
    file2 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file2.js'])
    file1 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file1.js'])
    inputs.files file2 + file1
    outputs.file file("${buildDir}/all-debug.js")
    compilationLevel = 'WHITESPACE_ONLY'
}

task jsProd(type: com.eriwen.gradle.js.tasks.JsTask) {
    file2 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file2.js'])
    file1 = fileTree(dir: "${projectDir}/src/test/resources", includes: ['file1.js'])
    inputs.files file2 + file1
    outputs.file file("${buildDir}/all.js")
}