plugins {
    id "java-library"
    id "maven-publish"
}

description = "gRPC: Jakarta Servlet"
sourceCompatibility = 1.8
targetCompatibility = 1.8

// Set up classpaths and source directories for different servlet tests
configurations {
    itImplementation.extendsFrom(implementation)
    jettyTestImplementation.extendsFrom(itImplementation)
    tomcatTestImplementation.extendsFrom(itImplementation)
    undertowTestImplementation.extendsFrom(itImplementation)
}

sourceSets {
    undertowTest {
        java {
            include '**/Undertow*.java'
        }
    }
    tomcatTest {
        java {
            include '**/Tomcat*.java'
        }
    }
    // Only run these tests if java 11+ is being used
    if (JavaVersion.current().isJava11Compatible()) {
        jettyTest {
            java {
                include '**/Jetty*.java'
            }
        }
    }
}

// Mechanically transform sources from grpc-servlet to use the corrected packages
def migrate(String name, String inputDir, SourceSet sourceSet) {
    def outputDir = layout.buildDirectory.dir('generated/sources/jakarta-' + name)
    sourceSet.java.srcDir outputDir
    return tasks.register('migrateSources' + name.capitalize(), Sync) { task ->
        into(outputDir)
        from("$inputDir/io/grpc/servlet") {
            into('io/grpc/servlet/jakarta')
            filter { String line ->
                line.replaceAll('javax\\.servlet', 'jakarta.servlet')
                    .replaceAll('io\\.grpc\\.servlet', 'io.grpc.servlet.jakarta')
            }
        }
    }
}

compileJava.dependsOn migrate('main', '../src/main/java', sourceSets.main)

sourcesJar.dependsOn migrateSourcesMain

// Build the set of sourceSets and classpaths to modify, since Jetty 11 requires Java 11
// and must be skipped
compileUndertowTestJava.dependsOn(migrate('undertowTest', '../src/undertowTest/java', sourceSets.undertowTest))
compileTomcatTestJava.dependsOn(migrate('tomcatTest', '../src/tomcatTest/java', sourceSets.tomcatTest))
if (JavaVersion.current().isJava11Compatible()) {
    compileJettyTestJava.dependsOn(migrate('jettyTest', '../src/jettyTest/java', sourceSets.jettyTest))
}

// Disable checkstyle for this project, since it consists only of generated code
tasks.withType(Checkstyle) {
    enabled = false
}

dependencies {
    api project(':grpc-api')
    compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0',
            libraries.javax.annotation

    implementation project(':grpc-core'),
            libraries.guava

    itImplementation project(':grpc-servlet-jakarta'),
            project(':grpc-netty'),
            project(':grpc-core').sourceSets.test.runtimeClasspath,
            libraries.junit
    itImplementation(project(':grpc-interop-testing')) {
        // Avoid grpc-netty-shaded dependency
        exclude group: 'io.grpc', module: 'grpc-alts'
        exclude group: 'io.grpc', module: 'grpc-xds'
    }

    tomcatTestImplementation 'org.apache.tomcat.embed:tomcat-embed-core:10.0.14'

    jettyTestImplementation "org.eclipse.jetty:jetty-servlet:11.0.7",
            "org.eclipse.jetty.http2:http2-server:11.0.7"

    undertowTestImplementation 'io.undertow:undertow-servlet-jakartaee9:2.2.13.Final'
}

// Set up individual classpaths for each test, to avoid any mismatch,
// and ensure they are only used when supported by the current jvm
check.dependsOn(tasks.register('undertowTest', Test) {
    classpath = sourceSets.undertowTest.runtimeClasspath
    testClassesDirs = sourceSets.undertowTest.output.classesDirs
})
check.dependsOn(tasks.register('tomcat10Test', Test) {
    classpath = sourceSets.tomcatTest.runtimeClasspath
    testClassesDirs = sourceSets.tomcatTest.output.classesDirs

    // Provide a temporary directory for tomcat to be deleted after test finishes
    def tomcatTempDir = "$buildDir/tomcat_catalina_base"
    systemProperty 'catalina.base', tomcatTempDir
    doLast {
        file(tomcatTempDir).deleteDir()
    }

    // tomcat-embed-core 10 presently performs illegal reflective access on
    // java.io.ObjectStreamClass$Caches.localDescs and sun.rmi.transport.Target.ccl,
    // see https://lists.apache.org/thread/s0xr7tk2kfkkxfjps9n7dhh4cypfdhyy
    if (JavaVersion.current().isJava9Compatible()) {
        jvmArgs += ['--add-opens=java.base/java.io=ALL-UNNAMED', '--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED']
    }
})
// Only run these tests if java 11+ is being used
if (JavaVersion.current().isJava11Compatible()) {
    check.dependsOn(tasks.register('jetty11Test', Test) {
        classpath = sourceSets.jettyTest.runtimeClasspath
        testClassesDirs = sourceSets.jettyTest.output.classesDirs
    })
}
