plugins {
    id 'java'
    id 'io.freefair.sass-base' version '8.4'
    id 'io.freefair.sass-java' version '8.4'
    id 'application'
    id 'jvm-test-suite'

    id 'com.google.cloud.tools.jib' version '3.4.5'
}

application {
    mainClass = 'nu.marginalia.search.SearchMain'
    applicationName = 'search-service-legacy'
}

tasks.distZip.enabled = false


java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(rootProject.ext.jvmVersion))
    }
}
sass {
    sourceMapEnabled = true
    sourceMapEmbed = true
    outputStyle = EXPANDED
}

apply from: "$rootProject.projectDir/srcsets.gradle"
apply from: "$rootProject.projectDir/docker.gradle"

dependencies {
    implementation project(':code:common:db')
    implementation project(':code:common:model')
    implementation project(':code:common:service')
    implementation project(':code:common:config')
    implementation project(':code:index:query')

    implementation project(':code:libraries:easy-lsh')
    implementation project(':code:libraries:language-processing')
    implementation project(':code:libraries:braille-block-punch-cards')
    implementation project(':code:libraries:term-frequency-dict')

    implementation project(':code:functions:live-capture:api')
    implementation project(':code:functions:math:api')
    implementation project(':code:functions:domain-info:api')
    implementation project(':code:functions:search-query:api')


    implementation project(':code:index:api')
    implementation project(':code:common:renderer')

    implementation project(':code:features-search:screenshots')
    implementation project(':code:features-search:random-websites')

    implementation libs.bundles.slf4j

    implementation libs.roaringbitmap
    implementation libs.prometheus
    implementation libs.notnull
    implementation libs.guava
    implementation dependencies.create(libs.guice.get()) {
        exclude group: 'com.google.guava'
    }
    implementation libs.handlebars
    implementation dependencies.create(libs.spark.get()) {
        exclude group: 'org.eclipse.jetty'
    }
    implementation libs.bundles.jetty
    implementation libs.opencsv
    implementation libs.trove
    implementation libs.fastutil
    implementation libs.bundles.gson
    implementation libs.bundles.mariadb
    implementation libs.bundles.nlp

    testImplementation libs.bundles.slf4j.test
    testImplementation libs.bundles.junit
    testImplementation libs.mockito

    testImplementation platform('org.testcontainers:testcontainers-bom:1.17.4')
    testImplementation libs.commons.codec
    testImplementation 'org.testcontainers:mariadb:1.17.4'
    testImplementation 'org.testcontainers:junit-jupiter:1.17.4'
    testImplementation project(':code:libraries:test-helpers')
}

tasks.register('paperDoll', Test) {
    useJUnitPlatform {
        includeTags "paperdoll"
    }
    jvmArgs = [ '-DrunPaperDoll=true', '--enable-preview' ]
}
