buildscript {
  repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
  }
}

allprojects {
  group 'io.routr'
  version '2.0'
}

subprojects {
  apply plugin: 'java'

  repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
  }

  dependencies {
    compileOnly 'com.google.protobuf:protobuf-java:3.19.4'
    implementation 'javax.annotation:javax.annotation-api:1.2'
    implementation 'org.reflections:reflections:0.10.2'
    implementation 'javax.sip:jain-sip-ri:1.3.0-91'
    implementation 'org.slf4j:slf4j-api:2.0.9'
    implementation 'org.apache.logging.log4j:log4j-core:2.17.1'
    implementation 'org.apache.logging.log4j:log4j-1.2-api:2.17.1'
    implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.22.0'
    implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.5'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.6'
    implementation 'org.graalvm.sdk:graal-sdk:22.3.2'
    implementation 'org.graalvm.truffle:truffle-api:22.3.2'
    implementation 'org.graalvm.js:js:22.3.2'
    implementation 'org.graalvm.regex:regex:22.3.2'
    implementation 'org.eclipse.jetty:jetty-server:11.0.13'
    implementation 'org.eclipse.jetty:jetty-servlet:11.0.13'
    implementation 'io.nats:jnats:2.16.8'
    implementation 'io.grpc:grpc-all:1.51.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
  }

  test {
    useJUnitPlatform()
    // Uncomment to see test output
    // testLogging {
    //   showStandardStreams = true
    // }
  }
}

project(':mods:edgeport') {
  task copyRuntimeLibs(type: Copy) {
    from configurations.runtimeClasspath
    into "$rootDir/mods/$project.name/libs"
  }

  tasks.withType(Jar) {
    destinationDirectory = file("$rootDir/mods/$project.name/libs")
  }
}

project(':mods:requester') {
  task copyRuntimeLibs(type: Copy, dependsOn: ':mods:edgeport:copyRuntimeLibs') {
    from configurations.runtimeClasspath
    into "$rootDir/mods/$project.name/libs"
  }
  
  tasks.withType(Jar) {
    destinationDirectory = file("$rootDir/mods/$project.name/libs")
  }

  dependencies {
    implementation project(':mods:edgeport')
  }
}
