import org.jetbrains.kotlin.gradle.tasks.KotlinCompile evaluationDependsOn(":common-util") description = "Kotlin Symbol Processing" val intellijVersion: String by project val kotlinBaseVersion: String by project val libsForTesting by configurations.creating tasks.withType { compilerOptions.freeCompilerArgs.add("-Xjvm-default=all-compatibility") } plugins { kotlin("jvm") id("org.jetbrains.intellij") version "0.6.4" id("org.jetbrains.dokka") version ("1.7.20") } intellij { version = intellijVersion } tasks { val sourcesJar by creating(Jar::class) { archiveClassifier.set("sources") from(sourceSets.main.get().allSource) from(project(":common-util").sourceSets.main.get().allSource) } } fun ModuleDependency.includeJars(vararg names: String) { names.forEach { artifact { name = it type = "jar" extension = "jar" } } } // WARNING: remember to update the dependencies in symbol-processing as well. dependencies { implementation(kotlin("stdlib", kotlinBaseVersion)) implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion") implementation(project(":api")) implementation(project(":common-util")) testImplementation(kotlin("stdlib", kotlinBaseVersion)) testImplementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion") testImplementation("org.jetbrains.kotlin:kotlin-compiler-internal-test-framework:$kotlinBaseVersion") testImplementation("org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlinBaseVersion") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-params:5.8.2") testRuntimeOnly("org.junit.platform:junit-platform-suite:1.8.2") testImplementation(project(":api")) testImplementation(project(":common-util")) testImplementation(project(":test-utils")) libsForTesting(kotlin("stdlib", kotlinBaseVersion)) libsForTesting(kotlin("test", kotlinBaseVersion)) libsForTesting(kotlin("script-runtime", kotlinBaseVersion)) } tasks.register("CopyLibsForTesting") { from(configurations.get("libsForTesting")) into("dist/kotlinc/lib") val escaped = Regex.escape(kotlinBaseVersion) rename("(.+)-$escaped\\.jar", "$1.jar") } fun Project.javaPluginConvention(): JavaPluginConvention = the() val JavaPluginConvention.testSourceSet: SourceSet get() = sourceSets.getByName("test") val Project.testSourceSet: SourceSet get() = javaPluginConvention().testSourceSet tasks.test { dependsOn("CopyLibsForTesting") maxHeapSize = "2g" useJUnitPlatform() systemProperty("idea.is.unit.test", "true") systemProperty("idea.home.path", buildDir) systemProperty("java.awt.headless", "true") environment("NO_FS_ROOTS_ACCESS_CHECK", "true") environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath) environment("PROJECT_BUILD_DIR", buildDir) testLogging { events("passed", "skipped", "failed") } var tempTestDir: File? = null doFirst { tempTestDir = createTempDir() systemProperty("java.io.tmpdir", tempTestDir.toString()) } doLast { tempTestDir?.let { delete(it) } } } repositories { maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/") maven("https://www.jetbrains.com/intellij-repository/snapshots") } val dokkaJavadocJar by tasks.register("dokkaJavadocJar") { dependsOn(tasks.dokkaJavadoc) from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) from(project(":common-util").tasks.dokkaJavadoc.flatMap { it.outputDirectory }) archiveClassifier.set("javadoc") }