plugins {
	id "org.jetbrains.intellij" version "1.17.3"
	id "org.jetbrains.kotlin.jvm" version "1.9.10"
	id "java"
}

repositories {
	mavenCentral()
}

dependencies {
	implementation "joda-time:joda-time:2.11.1"
    implementation "org.apache.commons:commons-csv:1.9.0"
	testImplementation "junit:junit:4.13.2" // also includes hamcrest-core
}

sourceSets {
	main {
		kotlin { srcDir "./src/main" }
		resources { srcDir "./src/resources" }
	}
	test {
		kotlin { srcDir "./src/test" }
	}
}

compileKotlin {
	kotlinOptions {
		apiVersion = "1.9"
		languageVersion = "1.9"
        // Compiler flag to allow building against pre-released versions of Kotlin
        // because IJ EAP can be built using pre-released Kotlin but it's still worth doing to check API compatibility
        freeCompilerArgs = ["-Xskip-metadata-version-check"] 
    }
}

intellij {
	// Available IDE versions https://www.jetbrains.com/intellij-repository/releases, https://www.jetbrains.com/intellij-repository/snapshots
	// Bundled Kotlin version https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
	version = "241.18034.62" // IntelliJ 2024.1.4
	// The artifact name is deliberately not "activity-tracker" because
	// *.csv files are stored in the "activity-tracker" directory.
	// If plugin archive has the same name, the directory will be deleted on plugin update.
	pluginName = "activity-tracker-plugin"
    plugins = ["java", "tasks"]
	downloadSources = true
    updateSinceUntilBuild = false // Disable patching plugin.xml because "until" version is too restrictive (it's better to keep it open-ended).
}
