buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.3"
    }
}

apply plugin: 'java-library'

//apply plugin: 'eclipse'

apply plugin: "me.champeau.gradle.jmh"

targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21

group = "com.github.akarnokd" 
ext.githubProjectName = 'akarnokd-misc'

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

if (!hasProperty('mainClass')) {
    ext.mainClass = ''
}



repositories {
    mavenCentral()

    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url 'https://oss.sonatype.org/content/groups/public' }
    //maven { url 'https://oss.jfrog.org/libs-snapshot' }
    maven { url 'https://repo.spring.io/libs-snapshot' }
}

apply plugin: 'maven-publish'

dependencies {
    api 'org.reactivestreams:reactive-streams:1.0.4'

    implementation 'io.reactivex:rxjava:1.+'
    implementation 'io.reactivex:rxjava-string:+'
    implementation 'io.reactivex:rxjava-reactive-streams:+'

    implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
    implementation 'io.reactivex.rxjava3:rxjava:3.1.10'
    //compile 'io.projectreactor:reactor-core:3.0.0.BUILD-SNAPSHOT'
    implementation 'io.projectreactor:reactor-core:3+'
    testImplementation 'io.projectreactor:reactor-test:3+'

    implementation group: 'io.projectreactor.addons', name: 'reactor-extra', version: '3+'

    implementation group: 'io.helidon.common', name: 'helidon-common-reactive', version: '4.0.10'
    
    //compile 'com.typesafe.akka:akka-stream_2.11:2.5-M2'
    implementation 'com.typesafe.akka:akka-stream_2.13:2.8.6'
    
    implementation 'org.jctools:jctools-core:4.+'

//    compile 'com.github.xedin:windmill-core:0.2-SNAPSHOT'

	implementation 'com.aol.simplereact:cyclops-react:+'

    implementation 'org.jooq:jool-java-8:+'

    implementation('io.reactivex:rxjava-math:+') {
    	exclude group: "io.reactivex", module: "rxjava"
    }

    implementation 'com.annimon:stream:+'

    implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.13'

    // -------------------------------------------------------------------

    //compile 'com.github.akarnokd:rxjava2-backport:2.0.0-RC3'
    
    //implementation 'io.projectreactor:reactive-streams-commons:0.6.0.BUILD-SNAPSHOT'

    implementation('com.github.akarnokd:ixjava:1.+') {
    	exclude group: "io.reactivex", module: "rxjava"
    }
    
    implementation('com.github.akarnokd:akarnokd-reactive-rpc:+') {
        exclude group: "io.reactivex.rxjava2", module: "rxjava"
        exclude group: "com.github.akarnokd", module: "*"
    }

    implementation 'com.github.akarnokd:akarnokd-xml:+'

    implementation('com.github.akarnokd:rxjava2-extensions:+') {
    	exclude group: "io.reactivex.rxjava2", module: "rxjava"
    }

    implementation('com.github.akarnokd:rxjava3-extensions:+') {
        exclude group: "io.reactivex.rxjava3", module: "rxjava"
    }

    implementation('com.github.akarnokd:rxjava2-interop:+') {
    	exclude group: "io.reactivex.rxjava2", module: "rxjava"
    }

    implementation('com.github.akarnokd:rxjava2-jdk8-interop:+') {
    	exclude group: "io.reactivex.rxjava2", module: "rxjava"
    	exclude group: "com.github.akarnokd", module: "rxjava2-extensions"
    }

    implementation 'com.github.akarnokd:reactive4java:+'

    implementation 'org.apache.commons:commons-lang3:+'

    // -------------------------------------------------------------------
    
    implementation 'com.google.guava:guava:+'
    implementation group: 'com.google.oauth-client', name: 'google-oauth-client', version:'1.36.0'

    implementation 'org.eclipse.collections:eclipse-collections-api:11.1.0'
    implementation 'org.eclipse.collections:eclipse-collections:11.1.0'
    
    implementation 'javax.servlet:javax.servlet-api:4.0.1'
    
    
    jmhImplementation group: 'junit', name: 'junit', version: '4.13.2'
    testImplementation group: 'junit', name: 'junit', version: '4.13.2'
    testImplementation 'org.mockito:mockito-core:5.12.0'

    //compile 'io.projectreactor:reactor-stream:2.0.5.RELEASE'
    //compile 'com.typesafe.akka:akka-stream-experimental_2.11:2.+'
    //compile 'com.typesafe.akka:akka-actor_2.11:2.4.3'

    //compile 'io.swave:swave-core_2.11:0.5-M1'
    
    implementation 'it.unimi.dsi:fastutil:8.5.13'
    
    implementation 'com.squareup.retrofit2:retrofit:2.11.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
    implementation('com.squareup.retrofit2:adapter-rxjava2:2.11.0') {
        exclude group: "io.reactivex.rxjava2", module: "rxjava"
    }
    
    implementation 'net.objecthunter:exp4j:+'
    
    testImplementation "org.testng:testng:7.10.2"
    testImplementation "org.reactivestreams:reactive-streams-tck:1.0.4"

    testImplementation group: 'io.servicetalk', name: 'servicetalk-concurrent-reactivestreams', version: '0.42.46'

    // https://mvnrepository.com/artifact/org.apache.commons/commons-math3
    implementation 'org.apache.commons:commons-math3:3.6.1'
    implementation 'org.ow2.asm:asm:9.7'

    
    // jmh configurations.api
    
    testImplementation "com.google.truth:truth:1.4.4"
    implementation 'io.minio:minio:8.5.17'
}

processResources {
  from ('src/main/java') {
    include '**/*.conf'
  }
}

jmh {
    jmhVersion = '1.23'
    humanOutputFile = null
    includeTests = false
    duplicateClassesStrategy = 'warn'
    
    // For Epsilon GC, add: "-Xmx12G", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseEpsilonGC"
    // For Shenandoah, add: "-XX:+UseShenandoahGC" [optionally "-XX:+UnlockDiagnosticVMOptions", "-XX:ShenandoahGCHeuristics=passive"]
    // For Parallel GC, add: "-XX:+UseParallelGC"
    // For G1 GC, add: "-XX:+UseG1GC"
    // For ZGC, add: "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC"
    // ---------------------------------------------------------------------------------------
    jvmArgsAppend = ["-Djmh.separateClasspathJAR=true", "-XX:+UseParallelGC"]
    // ---------------------------------------------------------------------------------------
    
    if (project.hasProperty('jmh')) {
        include = ".*" + project.jmh + ".*"
        println(include)
    } else {
        include = ".*"
    }
    
    //jvmArgs = '-XX:MaxInlineLevel=20' use @Fork attribute
}

plugins.withType(EclipsePlugin) {
    project.eclipse.classpath.plusConfigurations += [ configurations.jmh ]
}

javadoc {
    failOnError = false
}

test {
    maxHeapSize = "2g"
    testLogging  {
        events "started", "failed" // "skipped", "passed"
    //    showStandardStreams = true
    }
}
