plugins {
    id 'artemis-fluid'
    id 'artemis'
}

dependencies {
    api project(":components")
    api group: "com.google.guava", name: "guava", version: "$guavaVersion"
    api group: 'org.jetbrains', name: 'annotations', version: '19.0.0'
    api group: "net.mostlyoriginal.artemis-odb", name: "contrib-network", version: "$artemisContribVersion"
    implementation (group: "com.esotericsoftware", name: "kryo") {
        version { strictly "$kryoVersion" }
    }
    implementation group: "org.mindrot", name: "jbcrypt", version: "0.4"
    implementation group: "com.badlogicgames.gdx", name: "gdx-platform", version: "$gdxVersion", classifier: "natives-desktop"
    implementation group: "org.ini4j", name: "ini4j", version: "$ini4jVersion"
    implementation group: "net.mostlyoriginal.artemis-odb", name: "contrib-core", version: "$artemisContribVersion"
    implementation group: "net.mostlyoriginal.artemis-odb", name: "contrib-jam", version: "$artemisContribVersion"
    implementation group: "net.mostlyoriginal.artemis-odb", name: "contrib-eventbus", version: "$artemisContribVersion"

}

ext {
    fluidOutputDir = file("$buildDir/generated-sources/fluid/")
}

sourceSets {
    main.java.srcDirs = ["src/", fluidOutputDir]
    main.resources.srcDirs = ["resources/"]
}

fluid {
    generatedSourcesDirectory = fluidOutputDir
    classpath = sourceSets.main.compileClasspath

    // optional parameters. Uncomment to activate.
    // preferences.prefixComponentGetter = "_" // prefix for E::[get]pos()
    // preferences.prefixComponentCreate = "" // prefix for E::[]pos()
    // preferences.prefixComponentHas = "has" // prefix for E::[has]Pos()
    // preferences.prefixComponentRemove = "remove" // prefix for E::[remove]Pos()
    // preferences.generateTagMethods = true // add tag convenience methods.
    // preferences.generateGroupMethods = true // add group convenience methods.
    // preferences.generateBooleanComponentAccessors = true // Generate boolean accessors for flag components?
    // preferences.swallowGettersWithParameters = false // global setting. overridden by @Fluid annotation.
}

weave {
    classesDir = new File(buildDir, "classes/java/main")
    enableArtemisPlugin = true
    enablePooledWeaving = true
    generateLinkMutators = true
    optimizeEntitySystems = true
}

compileJava.dependsOn fluid

// Help intellIJ pick up the generated classes.
idea {
    module {
        generatedSourceDirs += fluidOutputDir
        excludeDirs -= file("$buildDir")
        excludeDirs -= file("$buildDir/src")
        excludeDirs += file("$buildDir/dependency-cache")
        excludeDirs += file("$buildDir/libs")
        excludeDirs += file("$buildDir/tmp")
    }
}
