2019-07-15 15:55:19 +03:00
|
|
|
buildscript {
|
2020-03-31 17:49:27 +03:00
|
|
|
ext.kotlin_version = '1.4-M1'
|
2019-07-15 15:55:19 +03:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2020-03-31 17:49:27 +03:00
|
|
|
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
|
2019-07-15 15:55:19 +03:00
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
def printOutput(def output) {
|
|
|
|
return tasks.create("printOutput") {
|
|
|
|
for (line in output.toString().readLines()) {
|
|
|
|
println "#educational_plugin" + line
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
allprojects {
|
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
repositories {
|
2020-02-05 17:17:38 +03:00
|
|
|
jcenter()
|
2020-03-31 17:49:27 +03:00
|
|
|
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
|
2019-07-15 15:55:19 +03:00
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
2019-07-19 19:20:21 +03:00
|
|
|
compile "org.jetbrains.kotlin:kotlin-reflect"
|
2019-07-22 14:41:31 +03:00
|
|
|
|
|
|
|
// coroutines
|
|
|
|
def coroutines_version = '1.2.1'
|
|
|
|
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
|
|
|
compile "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$coroutines_version"
|
|
|
|
|
|
|
|
// Logging support for samples:
|
|
|
|
compile 'io.github.microutils:kotlin-logging:1.6.24'
|
|
|
|
compile 'org.slf4j:slf4j-simple:1.8.0-beta4'
|
2020-03-18 01:26:17 +03:00
|
|
|
|
|
|
|
// Zircon
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3"
|
|
|
|
implementation "org.hexworks.zircon:zircon.core-jvm:2020.0.2-PREVIEW"
|
|
|
|
implementation "org.hexworks.zircon:zircon.jvm.swing:2020.0.2-PREVIEW"
|
2019-07-15 15:55:19 +03:00
|
|
|
}
|
|
|
|
compileKotlin.destinationDir = compileJava.destinationDir
|
|
|
|
compileKotlin {
|
|
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
compileTestKotlin {
|
|
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
apply plugin: 'application'
|
|
|
|
sourceCompatibility = 1.8
|
|
|
|
dependencies {
|
|
|
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
2020-02-05 17:17:38 +03:00
|
|
|
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
|
|
|
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
|
|
|
|
|
2019-07-15 15:55:19 +03:00
|
|
|
compile project(':util').sourceSets.main.output
|
|
|
|
testCompile project(':util').sourceSets.test.output
|
|
|
|
}
|
|
|
|
def srcList = []
|
|
|
|
def testList = []
|
|
|
|
rootProject.projectDir.eachDirRecurse {
|
|
|
|
if (!isTaskDir(it) || it.path.contains(".idea") || "util".equals(it.path)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
def srcDir = new File(it, "src")
|
|
|
|
srcList.add(srcDir)
|
|
|
|
def testDir = new File(it, "test")
|
|
|
|
testList.add(testDir)
|
|
|
|
}
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDirs = srcList
|
|
|
|
}
|
|
|
|
kotlin {
|
|
|
|
srcDirs = srcList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
srcDirs = testList
|
|
|
|
}
|
|
|
|
kotlin {
|
|
|
|
srcDirs = testList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static def isTaskDir(File dir) {
|
|
|
|
return new File(dir, "src").exists()
|
|
|
|
}
|
|
|
|
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : ""
|
|
|
|
test {
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
afterTest { TestDescriptor test, TestResult result ->
|
|
|
|
if (result.resultType == TestResult.ResultType.FAILURE) {
|
|
|
|
def message = result.exception?.message ?: "Wrong answer"
|
|
|
|
def lines = message.readLines()
|
|
|
|
println "#educational_plugin FAILED + " + lines[0]
|
|
|
|
lines[1..-1].forEach { line ->
|
|
|
|
println "#educational_plugin" + line
|
|
|
|
}
|
|
|
|
// we need this to separate output of different tests
|
|
|
|
println
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
def runOutput = new ByteArrayOutputStream()
|
|
|
|
tasks.run.setStandardOutput(runOutput)
|
|
|
|
tasks.run.doLast { printOutput(runOutput) }
|
|
|
|
project(':util') {
|
|
|
|
dependencies {
|
|
|
|
compile group: 'junit', name: 'junit', version: '4.12'
|
|
|
|
}
|
|
|
|
}
|