apply from: "$rootDir/gradle/gradle_scripts/junit.gradle"

testing {
    suites {
        localTest(JvmTestSuite) {
            useJUnitJupiter()

            dependencies {
                implementation project(':core')
                implementation project(':beacon')
                implementation project(':app')
                implementation project(':base')
                implementation project()
            }

            targets {
                configureEach {
                    testTask.configure {
                        workingDir = rootDir

                        jvmArgs += ["-Xmx2g"]
                        jvmArgs += jvmRunArgs

                        def exts = files(project.allExtensions.stream().map(p -> p.getTasksByName('jar', true)[0].outputs.files.singleFile).toList())
                        classpath += exts
                        dependsOn(project.allExtensions.stream().map(p -> p.getTasksByName('jar', true)[0]).toList())

                        systemProperty propertyName('fullVersion'), "true"
                        systemProperty propertyName('useVirtualThreads'), "false"
                        systemProperty propertyName("beacon", "port"), "21723"
                        systemProperty propertyName("dataDir"), "$projectDir/local/"
                        systemProperty propertyName("logLevel"), "trace"
                        systemProperty propertyName("writeSysOut"), "true"
                    }
                }
            }
        }
    }
}
