Fixed generation of visibilities.json for PublicApiTest

Generate it only from compileKotlin task (and not from tests)
diff --git a/build.gradle b/build.gradle
index f72f9be..e3bd895 100644
--- a/build.gradle
+++ b/build.gradle
@@ -170,11 +170,10 @@
     
     if (platform == "jvm") {
         dokkaJavadoc.dependsOn project(":$coroutines_core").dokka
-
-        tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
+        // dump declarations from main JVM module for binary-compatibility-validator
+        compileKotlin {
             kotlinOptions.freeCompilerArgs += ["-Xdump-declarations-to=${buildDir}/visibilities.json"]
         }
-
     }
 }