/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java application project to get you started.
 * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.7/userguide/building_java_projects.html in the Gradle documentation.
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
    id 'java'
    id 'org.springframework.boot' version '3.2.5'
    id 'io.spring.dependency-management' version '1.1.4'
}

apply plugin: 'eclipse'

repositories {
    // Use Maven Central for resolving dependencies.
    jcenter()
    mavenCentral()
}

group = 'com.mistermeow'

dependencies {
    // This dependency is used by the application.
    implementation libs.guava
    implementation 'javax:javaee-api:8.0'
    implementation 'org.jsoup:jsoup:1.17.2'
    implementation group: 'org.apache.opennlp', name: 'opennlp-tools', version: '2.3.2'
    implementation 'commons-codec:commons-codec:1.13'
    implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.25.1'
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
    implementation 'org.springframework.boot:spring-boot-starter-web'
}

// Apply a specific Java toolchain to ease working on different environments.
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
    sourceCompatibility = '17'
}


sourceSets {
  main {
    java {
      srcDirs 'src/main/java/meowindexer', 'src/main/java/meowcrawler', 'src/main/java/meowdbmanager', 'src/main/java/meowranker', 'src/main/java/meowEngine'
    }
  }
}

task runEngine(type: JavaExec) {
    // Define the main class for the application.
    main = 'meowEngine.Main'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

task runIndexer(type: JavaExec) {
    // Define the main class for the application.
    main = 'meowindexer.Main'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

task runCrawler(type: JavaExec) {
    // Define the main class for the application.
    main = 'meowcrawler.Main'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

task runDBManager(type: JavaExec) {
    // Define the main class for the application.
    main = 'meowdbmanager.Main'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

task runQueueManager(type: JavaExec) {
    // Define the main class for the application.
    main = 'QueueManagerMain'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

task runRanker(type: JavaExec) {
    // Define the main class for the application.
    main = 'meowranker.Main'
    // Define the classpath for the application.
    classpath = sourceSets.main.runtimeClasspath
}

tasks.register('ranker') {
    group = "mistermeow run"
    dependsOn runRanker
}

tasks.register('queueManager') {
    group = "mistermeow run"
    dependsOn runQueueManager
}

tasks.register('crawl') {
    group = "mistermeow run"
    dependsOn runCrawler
}

tasks.register('index') {
    group = "mistermeow run"
    dependsOn runIndexer
}

tasks.register('dbmanager') {
    group = "mistermeow run"
    dependsOn runDBManager
}

tasks.register('engine') {
    group = "mistermeow run"
    dependsOn runEngine
}

application {
    // Define the main class for the application.
    mainClass = 'meowEngine.Main'
}
