From f3c83f4751814984fb9aedeb991725620a287f33 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 8 Nov 2017 19:51:23 +0300 Subject: Download dependencies from TeamCity --- core/build.gradle | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'core/build.gradle') diff --git a/core/build.gradle b/core/build.gradle index c705e2cf..3d3e2317 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,7 +2,7 @@ import javax.tools.ToolProvider buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_compiler_to_compile_core_version" } } @@ -11,18 +11,19 @@ apply plugin: 'kotlin' sourceCompatibility = 1.6 dependencies { - compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version - compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_version + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_compiler_version" compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" compile files("../lib/intellij-core-analysis.jar") - compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: kotlin_version - compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: kotlin_version - compile files("../lib/kotlin-ide-common.jar") - compile files("../lib/markdown.jar") + compile "teamcity:kotlin-compiler:$kotlin_compiler_version" + compile "teamcity:kotlin-script-runtime:$kotlin_compiler_version" + + compile "teamcity:kotlin-ide-common:$kotlin_compiler_version" + compile "teamcity:markdown:$kotlin_compiler_version" //tools.jar def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") }) -- cgit From 4626531f95e60e03086da163cde5edf5411a8d9b Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 9 Nov 2017 21:43:37 +0300 Subject: Drop dependency on intellij-core-analysis Instead of it, download idea.jar and manually strip it Also, depends on same as kotlin-compiler openapi version --- build.gradle | 10 +++- buildSrc/build.gradle | 8 +--- .../org/jetbrains/DependenciesVersionGetter.groovy | 14 ++++++ core/build.gradle | 30 ++++++++++-- .../main/kotlin/Analysis/CoreProjectFileIndex.kt | 16 +++++-- gradle.properties | 3 ++ lib/intellij-core-analysis.jar | Bin 40325875 -> 0 bytes settings.gradle | 3 +- strippedIdeaJar/build.gradle | 52 +++++++++++++++++++++ strippedIdeaJar/ideaJar.pro | 8 ++++ 10 files changed, 129 insertions(+), 15 deletions(-) create mode 100644 buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy delete mode 100644 lib/intellij-core-analysis.jar create mode 100644 strippedIdeaJar/build.gradle create mode 100644 strippedIdeaJar/ideaJar.pro (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index b89a8c92..bd960ca8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.DependenciesVersionGetter + allprojects { group 'org.jetbrains.dokka' version dokka_version @@ -15,6 +17,8 @@ allprojects { maven { url "http://dl.bintray.com/kotlin/kotlin-eap" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "http://dl.bintray.com/jetbrains/intellij-plugin-service" } ivy(repo) } dependencies { @@ -64,4 +68,8 @@ def bintrayPublication(project, List _publications) { task wrapper(type: Wrapper) { gradleVersion = '4.2.1' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" -} \ No newline at end of file +} + +def versions = DependenciesVersionGetter.getVersions(project, kotlin_compiler_version) + +ext.ideaVersion = versions["idea.build.id"] \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 76c7c4ee..874dabc9 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -2,12 +2,8 @@ apply plugin: 'groovy' repositories { mavenCentral() jcenter() - maven { - url "https://dl.bintray.com/kotlin/kotlin-eap" - } - maven { - url "https://dl.bintray.com/kotlin/kotlin-dev" - } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { compile 'com.github.jengelman.gradle.plugins:shadow:2.0.1' diff --git a/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy b/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy new file mode 100644 index 00000000..194f11af --- /dev/null +++ b/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy @@ -0,0 +1,14 @@ +package org.jetbrains + +import org.gradle.api.Project + +class DependenciesVersionGetter { + static Properties getVersions(Project project, String artifactVersionSelector) { + def dep = project.dependencies.create(group: 'teamcity', name: 'dependencies', version: artifactVersionSelector, ext: 'properties') + def file = project.configurations.detachedConfiguration(dep).resolve().first() + + def prop = new Properties() + prop.load(new FileReader(file)) + return prop + } +} diff --git a/core/build.gradle b/core/build.gradle index 3d3e2317..3420e4e7 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -3,6 +3,7 @@ import javax.tools.ToolProvider buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_compiler_to_compile_core_version" + classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:$gradle_intellij_plugin_version" } } @@ -17,8 +18,6 @@ dependencies { compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" - compile files("../lib/intellij-core-analysis.jar") - compile "teamcity:kotlin-compiler:$kotlin_compiler_version" compile "teamcity:kotlin-script-runtime:$kotlin_compiler_version" @@ -33,7 +32,32 @@ dependencies { compile project(":integration") testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_compiler_to_compile_core_version testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0" } +apply plugin: 'org.jetbrains.intellij' + +{ -> + intellij { + version = ideaVersion + instrumentCode = false + configureDefaultDependencies = false + extraDependencies 'intellij-core' + } + + ["patchPluginXml", "prepareSandbox", "prepareTestingSandbox", + "verifyPlugin", "runIde", "buildPlugin", "publishPlugin"].each { + tasks.remove(tasks.findByName(it)) + } +}() + +afterEvaluate { + dependencies { + compile intellij { + include("openapi.jar") + } + compile intellijExtra("intellij-core") { include("intellij-core.jar") } + compile project(path: ":strippedIdeaJar", configuration: "proguardOut") + } +} diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt index 21f7e2da..2f2f94b3 100644 --- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt +++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt @@ -32,7 +32,11 @@ import java.io.File * classes from projectModel-{api,impl}. */ class CoreProjectFileIndex(private val project: Project, contentRoots: List) : ProjectFileIndex, ModuleFileIndex { - override fun iterateContentUnderDirectory(p0: VirtualFile, p1: ContentIterator, p2: VirtualFileFilter): Boolean { + override fun iterateContent(p0: ContentIterator, p1: VirtualFileFilter?): Boolean { + throw UnsupportedOperationException() + } + + override fun iterateContentUnderDirectory(p0: VirtualFile, p1: ContentIterator, p2: VirtualFileFilter?): Boolean { throw UnsupportedOperationException() } @@ -74,7 +78,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List? { + override fun getRootFiles(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getRootUrls(p0: OrderRootType?): Array? { + override fun getRootUrls(p0: OrderRootType): Array { throw UnsupportedOperationException() } @@ -307,6 +311,10 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List { throw UnsupportedOperationException() } diff --git a/gradle.properties b/gradle.properties index 516cd0eb..29da4702 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,9 @@ kotlin_compiler_version=1.2.20-dev-65 kotlin_compiler_to_compile_core_version=1.2.0-rc-39 kotlin_for_gradle_version=1.0.7 +#IntelliJ plugin to download openapi.jar +gradle_intellij_plugin_version=0.3.0-SNAPSHOT + ant_version=1.9.6 #Maven plugin dependencies diff --git a/lib/intellij-core-analysis.jar b/lib/intellij-core-analysis.jar deleted file mode 100644 index 50520e0c..00000000 Binary files a/lib/intellij-core-analysis.jar and /dev/null differ diff --git a/settings.gradle b/settings.gradle index 4dcfd255..e6694bf9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,4 +6,5 @@ include 'core', 'runners:maven-plugin', 'runners:gradle-plugin', 'runners:android-gradle-plugin', - 'runners:gradle-integration-tests' + 'runners:gradle-integration-tests', + 'strippedIdeaJar' diff --git a/strippedIdeaJar/build.gradle b/strippedIdeaJar/build.gradle new file mode 100644 index 00000000..e8104d00 --- /dev/null +++ b/strippedIdeaJar/build.gradle @@ -0,0 +1,52 @@ +import proguard.gradle.ProGuardTask + +buildscript { + dependencies { + classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:$gradle_intellij_plugin_version" + classpath "net.sf.proguard:proguard-gradle:5.3.3" + } +} + +apply plugin: 'org.jetbrains.intellij' + +{ -> + intellij { + version = ideaVersion + instrumentCode = false + configureDefaultDependencies = false + } + + ["patchPluginXml", "prepareSandbox", "prepareTestingSandbox", + "verifyPlugin", "runIde", "buildPlugin", "publishPlugin"].each { + tasks.remove(tasks.findByName(it)) + } +}() + +configurations { + proguardInput + proguardOut +} + +afterEvaluate { + dependencies { + proguardInput intellij { include("idea.jar") } + } +} + + +task strip(type: ProGuardTask) { + configuration file('ideaJar.pro') + afterEvaluate { + injars configurations.proguardInput.files, filter: "**.class" + outjars file("$buildDir/idea-stripped.jar") + } +} + + +afterEvaluate { + artifacts { + proguardOut(strip.outputs.files.singleFile) { + builtBy strip + } + } +} \ No newline at end of file diff --git a/strippedIdeaJar/ideaJar.pro b/strippedIdeaJar/ideaJar.pro new file mode 100644 index 00000000..63efbd95 --- /dev/null +++ b/strippedIdeaJar/ideaJar.pro @@ -0,0 +1,8 @@ + +-dontwarn ** + +-dontobfuscate +-dontoptimize + +-keep class com.intellij.openapi.roots.impl.ProjectOrderEnumerator { *; } +-keep class com.intellij.core.CoreModuleManager { *; } -- cgit From a89a21542d0603f89a8e61196891130416f75495 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 9 Nov 2017 22:38:02 +0300 Subject: Use maven to resolve kotlin-compiler dependency instead of ivy --- build.gradle | 3 +-- core/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index bd960ca8..92de25cc 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,6 @@ allprojects { version dokka_version def repo = { - artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/[revision]/maven/org/jetbrains/kotlin/[module]/[revision]/[module]-[revision](.[ext])") - artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/[revision]/maven/org/jetbrains/kotlin/[module]/[revision]/[module]-[revision]-source.jar") artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/[revision]/internal/[module](.[ext])") } @@ -35,6 +33,7 @@ allprojects { maven { url "http://dl.bintray.com/kotlin/kotlin-eap" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } maven { url 'https://jitpack.io' } + maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$kotlin_compiler_version/maven" } ivy(repo) } } diff --git a/core/build.gradle b/core/build.gradle index 3420e4e7..c31b3945 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -18,8 +18,8 @@ dependencies { compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" - compile "teamcity:kotlin-compiler:$kotlin_compiler_version" - compile "teamcity:kotlin-script-runtime:$kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-compiler:$kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-script-runtime:$kotlin_compiler_version" compile "teamcity:kotlin-ide-common:$kotlin_compiler_version" compile "teamcity:markdown:$kotlin_compiler_version" -- cgit From 17ab40f3854c3fa0b65e0fb3d881a2700a0b3d3d Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 14 Nov 2017 13:13:34 +0300 Subject: Take intellij-core-analysis back Use plain maven-like repository to resolve it, remove usage of gradle-intellij-plugin --- build.gradle | 2 -- core/build.gradle | 37 +++++++++++---------------- runners/gradle-plugin/build.gradle | 8 ++++++ settings.gradle | 3 +-- strippedIdeaJar/build.gradle | 52 -------------------------------------- strippedIdeaJar/ideaJar.pro | 8 ------ 6 files changed, 24 insertions(+), 86 deletions(-) delete mode 100644 strippedIdeaJar/build.gradle delete mode 100644 strippedIdeaJar/ideaJar.pro (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index 92de25cc..f9c2bd70 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,6 @@ allprojects { maven { url "http://dl.bintray.com/kotlin/kotlin-eap" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "http://dl.bintray.com/jetbrains/intellij-plugin-service" } ivy(repo) } dependencies { diff --git a/core/build.gradle b/core/build.gradle index c31b3945..3c602a6b 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -3,7 +3,6 @@ import javax.tools.ToolProvider buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_compiler_to_compile_core_version" - classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:$gradle_intellij_plugin_version" } } @@ -11,6 +10,15 @@ apply plugin: 'kotlin' sourceCompatibility = 1.6 +repositories { + maven { url 'https://www.jetbrains.com/intellij-repository/snapshots' } + maven { url 'https://www.jetbrains.com/intellij-repository/releases' } +} + +configurations { + intellijCore +} + dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_compiler_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_compiler_version" @@ -34,30 +42,15 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_compiler_to_compile_core_version testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0" -} -apply plugin: 'org.jetbrains.intellij' + intellijCore "com.jetbrains.intellij.idea:intellij-core:$ideaVersion" +} -{ -> - intellij { - version = ideaVersion - instrumentCode = false - configureDefaultDependencies = false - extraDependencies 'intellij-core' - } - - ["patchPluginXml", "prepareSandbox", "prepareTestingSandbox", - "verifyPlugin", "runIde", "buildPlugin", "publishPlugin"].each { - tasks.remove(tasks.findByName(it)) - } -}() afterEvaluate { dependencies { - compile intellij { - include("openapi.jar") - } - compile intellijExtra("intellij-core") { include("intellij-core.jar") } - compile project(path: ":strippedIdeaJar", configuration: "proguardOut") + compile zipTree(configurations.intellijCore.singleFile).matching ({ + include("intellij-core-analysis.jar") + }) } -} +} \ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle index 5af6b427..fff58092 100644 --- a/runners/gradle-plugin/build.gradle +++ b/runners/gradle-plugin/build.gradle @@ -10,6 +10,14 @@ tasks.withType(AbstractCompile) { classpath += configurations.shadow } + +compileKotlin { + + kotlinOptions { + freeCompilerArgs += "-Xjsr305-annotations=strict" + } + +} dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' diff --git a/settings.gradle b/settings.gradle index e6694bf9..4dcfd255 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,5 +6,4 @@ include 'core', 'runners:maven-plugin', 'runners:gradle-plugin', 'runners:android-gradle-plugin', - 'runners:gradle-integration-tests', - 'strippedIdeaJar' + 'runners:gradle-integration-tests' diff --git a/strippedIdeaJar/build.gradle b/strippedIdeaJar/build.gradle deleted file mode 100644 index e8104d00..00000000 --- a/strippedIdeaJar/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -import proguard.gradle.ProGuardTask - -buildscript { - dependencies { - classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:$gradle_intellij_plugin_version" - classpath "net.sf.proguard:proguard-gradle:5.3.3" - } -} - -apply plugin: 'org.jetbrains.intellij' - -{ -> - intellij { - version = ideaVersion - instrumentCode = false - configureDefaultDependencies = false - } - - ["patchPluginXml", "prepareSandbox", "prepareTestingSandbox", - "verifyPlugin", "runIde", "buildPlugin", "publishPlugin"].each { - tasks.remove(tasks.findByName(it)) - } -}() - -configurations { - proguardInput - proguardOut -} - -afterEvaluate { - dependencies { - proguardInput intellij { include("idea.jar") } - } -} - - -task strip(type: ProGuardTask) { - configuration file('ideaJar.pro') - afterEvaluate { - injars configurations.proguardInput.files, filter: "**.class" - outjars file("$buildDir/idea-stripped.jar") - } -} - - -afterEvaluate { - artifacts { - proguardOut(strip.outputs.files.singleFile) { - builtBy strip - } - } -} \ No newline at end of file diff --git a/strippedIdeaJar/ideaJar.pro b/strippedIdeaJar/ideaJar.pro deleted file mode 100644 index 63efbd95..00000000 --- a/strippedIdeaJar/ideaJar.pro +++ /dev/null @@ -1,8 +0,0 @@ - --dontwarn ** - --dontobfuscate --dontoptimize - --keep class com.intellij.openapi.roots.impl.ProjectOrderEnumerator { *; } --keep class com.intellij.core.CoreModuleManager { *; } -- cgit From afea8e9e9c4b88af8c7eb7fc2d993d2eca29c4a1 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 21 Nov 2017 16:46:59 +0300 Subject: Fix reporting of FileComparisonFailure by adding idea_rt dependency --- build.gradle | 29 +++++++++++++++- core/build.gradle | 22 ++---------- .../rt/execution/junit/FileComparisonFailure.java | 39 ---------------------- .../rt/execution/junit/KnownException.java | 6 ---- runners/gradle-integration-tests/build.gradle | 1 + .../rt/execution/junit/FileComparisonFailure.java | 39 ---------------------- .../rt/execution/junit/KnownException.java | 6 ---- 7 files changed, 32 insertions(+), 110 deletions(-) delete mode 100644 core/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java delete mode 100644 core/src/test/java/com/intellij/rt/execution/junit/KnownException.java delete mode 100644 runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java delete mode 100644 runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/KnownException.java (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index f9c2bd70..e64427b7 100644 --- a/build.gradle +++ b/build.gradle @@ -69,4 +69,31 @@ task wrapper(type: Wrapper) { def versions = DependenciesVersionGetter.getVersions(project, kotlin_compiler_version) -ext.ideaVersion = versions["idea.build.id"] \ No newline at end of file +ext.ideaVersion = versions["idea.build.id"] + +configurations { + ideaIC + intellijCore +} + +repositories { + maven { url 'https://www.jetbrains.com/intellij-repository/snapshots' } + maven { url 'https://www.jetbrains.com/intellij-repository/releases' } +} + +dependencies { + intellijCore "com.jetbrains.intellij.idea:intellij-core:$ideaVersion" + ideaIC "com.jetbrains.intellij.idea:ideaIC:$ideaVersion" +} + +def intellijCoreAnalysis() { + return zipTree(configurations.intellijCore.singleFile).matching ({ + include("intellij-core-analysis.jar") + }) +} + +def ideaRT() { + return zipTree(project.configurations.ideaIC.singleFile).matching ({ + include("lib/idea_rt.jar") + }) +} \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index 3c602a6b..68d3da89 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -10,15 +10,6 @@ apply plugin: 'kotlin' sourceCompatibility = 1.6 -repositories { - maven { url 'https://www.jetbrains.com/intellij-repository/snapshots' } - maven { url 'https://www.jetbrains.com/intellij-repository/releases' } -} - -configurations { - intellijCore -} - dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_compiler_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_compiler_version" @@ -32,6 +23,8 @@ dependencies { compile "teamcity:kotlin-ide-common:$kotlin_compiler_version" compile "teamcity:markdown:$kotlin_compiler_version" + compile intellijCoreAnalysis() + //tools.jar def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") }) compileOnly toolsJar @@ -43,14 +36,5 @@ dependencies { testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_compiler_to_compile_core_version testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0" - intellijCore "com.jetbrains.intellij.idea:intellij-core:$ideaVersion" -} - - -afterEvaluate { - dependencies { - compile zipTree(configurations.intellijCore.singleFile).matching ({ - include("intellij-core-analysis.jar") - }) - } + testCompile ideaRT() } \ No newline at end of file diff --git a/core/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java b/core/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java deleted file mode 100644 index cbb1cc3c..00000000 --- a/core/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java +++ /dev/null @@ -1,39 +0,0 @@ - -package com.intellij.rt.execution.junit; - -import junit.framework.ComparisonFailure; - -public class FileComparisonFailure extends ComparisonFailure implements KnownException { - private final String myExpected; - private final String myActual; - private final String myFilePath; - private final String myActualFilePath; - - public FileComparisonFailure(String message, String expected, String actual, String filePath) { - this(message, expected, actual, filePath, (String)null); - } - - public FileComparisonFailure(String message, String expected, String actual, String expectedFilePath, String actualFilePath) { - super(message, expected, actual); - this.myExpected = expected; - this.myActual = actual; - this.myFilePath = expectedFilePath; - this.myActualFilePath = actualFilePath; - } - - public String getFilePath() { - return this.myFilePath; - } - - public String getActualFilePath() { - return this.myActualFilePath; - } - - public String getExpected() { - return this.myExpected; - } - - public String getActual() { - return this.myActual; - } -} diff --git a/core/src/test/java/com/intellij/rt/execution/junit/KnownException.java b/core/src/test/java/com/intellij/rt/execution/junit/KnownException.java deleted file mode 100644 index c24653ea..00000000 --- a/core/src/test/java/com/intellij/rt/execution/junit/KnownException.java +++ /dev/null @@ -1,6 +0,0 @@ - -package com.intellij.rt.execution.junit; - -interface KnownException { - -} diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle index 1b4ff5ed..f807c12b 100644 --- a/runners/gradle-integration-tests/build.gradle +++ b/runners/gradle-integration-tests/build.gradle @@ -14,6 +14,7 @@ dependencies { testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_version testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_version testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_for_gradle_version + testCompile ideaRT() dokkaPlugin project(path: ':runners:gradle-plugin', configuration: 'shadow') dokkaAndroidPlugin project(path: ':runners:android-gradle-plugin', configuration: 'shadow') diff --git a/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java b/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java deleted file mode 100644 index cbb1cc3c..00000000 --- a/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/FileComparisonFailure.java +++ /dev/null @@ -1,39 +0,0 @@ - -package com.intellij.rt.execution.junit; - -import junit.framework.ComparisonFailure; - -public class FileComparisonFailure extends ComparisonFailure implements KnownException { - private final String myExpected; - private final String myActual; - private final String myFilePath; - private final String myActualFilePath; - - public FileComparisonFailure(String message, String expected, String actual, String filePath) { - this(message, expected, actual, filePath, (String)null); - } - - public FileComparisonFailure(String message, String expected, String actual, String expectedFilePath, String actualFilePath) { - super(message, expected, actual); - this.myExpected = expected; - this.myActual = actual; - this.myFilePath = expectedFilePath; - this.myActualFilePath = actualFilePath; - } - - public String getFilePath() { - return this.myFilePath; - } - - public String getActualFilePath() { - return this.myActualFilePath; - } - - public String getExpected() { - return this.myExpected; - } - - public String getActual() { - return this.myActual; - } -} diff --git a/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/KnownException.java b/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/KnownException.java deleted file mode 100644 index c24653ea..00000000 --- a/runners/gradle-integration-tests/src/test/java/com/intellij/rt/execution/junit/KnownException.java +++ /dev/null @@ -1,6 +0,0 @@ - -package com.intellij.rt.execution.junit; - -interface KnownException { - -} -- cgit From f94beaa25f07333ad47738d5d7fafdd3dd302b04 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 14 Nov 2017 16:19:46 +0300 Subject: Clarify Kotlin Versions and config in project --- build.gradle | 4 ++-- core/build.gradle | 26 +++++++++++++++++--------- gradle.properties | 7 +++---- integration/build.gradle | 17 ++++++++++++++--- runners/android-gradle-plugin/build.gradle | 12 +++++++++--- runners/ant/build.gradle | 11 ++++++++++- runners/build.gradle | 12 ++---------- runners/cli/build.gradle | 10 +++++++++- runners/fatjar/build.gradle | 2 +- runners/gradle-integration-tests/build.gradle | 16 +++++++++++++--- runners/gradle-plugin/build.gradle | 13 ++++++++----- runners/maven-plugin/build.gradle | 15 ++++++++++----- 12 files changed, 98 insertions(+), 47 deletions(-) (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index e64427b7..0002ee69 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ allprojects { maven { url "http://dl.bintray.com/kotlin/kotlin-eap" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } maven { url 'https://jitpack.io' } - maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$kotlin_compiler_version/maven" } + maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$bundled_kotlin_compiler_version/maven" } ivy(repo) } } @@ -67,7 +67,7 @@ task wrapper(type: Wrapper) { distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } -def versions = DependenciesVersionGetter.getVersions(project, kotlin_compiler_version) +def versions = DependenciesVersionGetter.getVersions(project, bundled_kotlin_compiler_version) ext.ideaVersion = versions["idea.build.id"] diff --git a/core/build.gradle b/core/build.gradle index 68d3da89..a8f0f275 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,26 +2,34 @@ import javax.tools.ToolProvider buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_compiler_to_compile_core_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'kotlin' -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + languageVersion = "1.2" + apiVersion = languageVersion + jvmTarget = "1.8" + } +} dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_compiler_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-reflect:$bundled_kotlin_compiler_version" compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" - compile "org.jetbrains.kotlin:kotlin-compiler:$kotlin_compiler_version" - compile "org.jetbrains.kotlin:kotlin-script-runtime:$kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version" + compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version" - compile "teamcity:kotlin-ide-common:$kotlin_compiler_version" - compile "teamcity:markdown:$kotlin_compiler_version" + compile "teamcity:kotlin-ide-common:$bundled_kotlin_compiler_version" + compile "teamcity:markdown:$bundled_kotlin_compiler_version" compile intellijCoreAnalysis() @@ -33,7 +41,7 @@ dependencies { compile project(":integration") testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_compiler_to_compile_core_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0" testCompile ideaRT() diff --git a/gradle.properties b/gradle.properties index 154d7776..d109426b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,9 @@ dokka_version=0.9.16 dokka_publication_channel=dokka #Kotlin compiler and plugin -kotlin_version=1.1.51 -kotlin_compiler_version=1.2.20-dev-175 -kotlin_compiler_to_compile_core_version=1.2.0-rc-39 -kotlin_for_gradle_version=1.0.7 +bundled_kotlin_compiler_version=1.2.20-dev-175 +kotlin_version=1.2.0-rc-39 +kotlin_for_gradle_runtime_version=1.0.7 #IntelliJ plugin to download openapi.jar gradle_intellij_plugin_version=0.3.0-SNAPSHOT diff --git a/integration/build.gradle b/integration/build.gradle index 571ad0b3..32ca3454 100644 --- a/integration/build.gradle +++ b/integration/build.gradle @@ -1,14 +1,25 @@ buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_for_gradle_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'kotlin' + +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + languageVersion = "1.2" + apiVersion = "1.0" + jvmTarget = "1.8" + } +} + dependencies { - compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_version - compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_version + compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version + compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version compile('com.github.yole:jkid:7d9c529c87') { transitive = false } diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle index 193b8eee..5050fd87 100644 --- a/runners/android-gradle-plugin/build.gradle +++ b/runners/android-gradle-plugin/build.gradle @@ -3,13 +3,19 @@ import org.jetbrains.CorrectShadowPublishing apply plugin: 'java' apply plugin: 'kotlin' -sourceCompatibility = 1.8 apply plugin: 'com.github.johnrengelman.shadow' apply plugin: "com.gradle.plugin-publish" -tasks.withType(AbstractCompile) { - classpath += configurations.shadow +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = "1.2" + apiVersion = "1.0" + jvmTarget = "1.8" + } } repositories { diff --git a/runners/ant/build.gradle b/runners/ant/build.gradle index 85328d95..e7dcd441 100644 --- a/runners/ant/build.gradle +++ b/runners/ant/build.gradle @@ -1,6 +1,15 @@ apply plugin: 'kotlin' -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = "1.2" + apiVersion = languageVersion + jvmTarget = "1.8" + } +} dependencies { compile project(":core") diff --git a/runners/build.gradle b/runners/build.gradle index f1d2873c..23d232d2 100644 --- a/runners/build.gradle +++ b/runners/build.gradle @@ -1,15 +1,7 @@ -configure([project("ant"), project("cli"), project("fatjar"), project("maven-plugin")]) { +subprojects { buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } -} - -configure([project("gradle-plugin"), project("android-gradle-plugin"), project("gradle-integration-tests")]) { - buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_for_gradle_version" - } - } -} +} \ No newline at end of file diff --git a/runners/cli/build.gradle b/runners/cli/build.gradle index 13b0c941..7f733140 100644 --- a/runners/cli/build.gradle +++ b/runners/cli/build.gradle @@ -1,6 +1,14 @@ apply plugin: 'kotlin' -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + languageVersion = "1.2" + apiVersion = languageVersion + jvmTarget = "1.8" + } +} dependencies { compile project(":core") diff --git a/runners/fatjar/build.gradle b/runners/fatjar/build.gradle index fc9abeda..4ce0416c 100644 --- a/runners/fatjar/build.gradle +++ b/runners/fatjar/build.gradle @@ -1,7 +1,7 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer import org.jetbrains.PluginXmlTransformer -apply plugin: 'kotlin' +apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' dependencies { diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle index f807c12b..1809589f 100644 --- a/runners/gradle-integration-tests/build.gradle +++ b/runners/gradle-integration-tests/build.gradle @@ -2,6 +2,16 @@ apply plugin: 'kotlin' +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = "1.2" + apiVersion = "1.0" + jvmTarget = "1.8" + } +} configurations { dokkaPlugin @@ -11,9 +21,9 @@ configurations { dependencies { - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_version - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_version - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_for_gradle_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_runtime_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_for_gradle_runtime_version testCompile ideaRT() dokkaPlugin project(path: ':runners:gradle-plugin', configuration: 'shadow') diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle index 21603a26..790f3132 100644 --- a/runners/gradle-plugin/build.gradle +++ b/runners/gradle-plugin/build.gradle @@ -1,23 +1,26 @@ apply plugin: 'java' apply plugin: 'kotlin' -sourceCompatibility = 1.8 apply plugin: 'com.github.johnrengelman.shadow' apply plugin: "com.gradle.plugin-publish" +sourceCompatibility = 1.8 -compileKotlin { +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { - freeCompilerArgs += "-Xjsr305-annotations=strict" + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = "1.2" + apiVersion = "1.0" + jvmTarget = "1.8" } } dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_version - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_version + shadow group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version + shadow group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version compile project(":integration") diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle index a9a77a8b..0e8d6a4d 100644 --- a/runners/maven-plugin/build.gradle +++ b/runners/maven-plugin/build.gradle @@ -1,17 +1,22 @@ import groovy.io.FileType import org.jetbrains.CrossPlatformExec -import shadow.org.apache.commons.io.FileUtils -import java.nio.file.FileVisitResult import java.nio.file.Files -import java.nio.file.Paths import java.nio.file.StandardCopyOption -import java.nio.file.attribute.BasicFileAttributes - apply plugin: 'kotlin' apply plugin: 'com.github.johnrengelman.shadow' +sourceCompatibility = 1.8 + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = "1.2" + apiVersion = languageVersion + jvmTarget = "1.8" + } +} dependencies { shadow project(":runners:fatjar") -- cgit From 3eb23215edcd1cf92966f8d39afe754fef0c7a19 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 21 Feb 2018 11:51:06 +0300 Subject: Update bundled kotlin compiler --- build.gradle | 2 + core/build.gradle | 2 +- .../main/kotlin/Analysis/AnalysisEnvironment.kt | 53 ++++++++++++++++++++-- .../main/kotlin/Analysis/CoreKotlinCacheService.kt | 30 ++++++++++++ .../main/kotlin/Analysis/CoreProjectFileIndex.kt | 30 ++++++------ .../kotlin/Kotlin/DescriptorDocumentationParser.kt | 2 +- .../src/main/kotlin/Kotlin/DocumentationBuilder.kt | 10 ++++ gradle.properties | 4 +- 8 files changed, 111 insertions(+), 22 deletions(-) create mode 100644 core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt (limited to 'core/build.gradle') diff --git a/build.gradle b/build.gradle index ee76c9cb..f1748259 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ allprojects { def repo = { artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/[revision]/internal/[module](.[ext])") + artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/[revision]/([module]_[ext]/)[module](.[ext])") } buildscript { @@ -70,6 +71,7 @@ task wrapper(type: Wrapper) { def versions = DependenciesVersionGetter.getVersions(project, bundled_kotlin_compiler_version) ext.ideaVersion = versions["idea.build.id"] +ext.markdownVersion = versions["markdown.build.id"].replace("%20", " ") configurations { ideaIC diff --git a/core/build.gradle b/core/build.gradle index a8f0f275..1a93bb48 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -29,7 +29,7 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version" compile "teamcity:kotlin-ide-common:$bundled_kotlin_compiler_version" - compile "teamcity:markdown:$bundled_kotlin_compiler_version" + compile "teamcity:markdown:$markdownVersion" compile intellijCoreAnalysis() diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index 56249ac4..5522d4f0 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka +import com.google.common.collect.ImmutableMap import com.intellij.core.CoreApplicationEnvironment import com.intellij.core.CoreModuleManager import com.intellij.mock.MockComponentManager @@ -17,6 +18,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.io.URLUtil import org.jetbrains.kotlin.analyzer.* +import org.jetbrains.kotlin.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles @@ -34,16 +36,19 @@ import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.JvmBuiltIns -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.CompilerEnvironment +import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice +import org.jetbrains.kotlin.util.slicedMap.WritableSlice import java.io.File /** @@ -158,7 +163,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { val resolverForModule = resolverForProject.resolverForModule(module) val moduleDescriptor = resolverForProject.descriptorForModule(module) builtIns.initialize(moduleDescriptor, true) - return DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) + val created = DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) + val projectComponentManager = environment.project as MockComponentManager + projectComponentManager.registerService(KotlinCacheService::class.java, CoreKotlinCacheService(created)) + + return created } fun loadLanguageVersionSettings(languageVersionString: String?, apiVersionString: String?) { @@ -247,6 +256,42 @@ class DokkaResolutionFacade(override val project: Project, val resolveSession: ResolveSession get() = getFrontendService(ResolveSession::class.java) override fun analyze(element: KtElement, bodyResolveMode: BodyResolveMode): BindingContext { + if (element is KtDeclaration) { + val descriptor = resolveToDescriptor(element) + return object : BindingContext { + override fun getKeys(p0: WritableSlice?): Collection { + throw UnsupportedOperationException() + } + + override fun getType(p0: KtExpression): KotlinType? { + throw UnsupportedOperationException() + } + + override fun get(slice: ReadOnlySlice?, key: K): V? { + if (key != element) { + throw UnsupportedOperationException() + } + return when { + slice == BindingContext.DECLARATION_TO_DESCRIPTOR -> descriptor as V + slice == BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER && (element as KtParameter).hasValOrVar() -> descriptor as V + else -> null + } + } + + override fun getDiagnostics(): Diagnostics { + throw UnsupportedOperationException() + } + + override fun addOwnDataTo(p0: BindingTrace, p1: Boolean) { + throw UnsupportedOperationException() + } + + override fun getSliceContents(p0: ReadOnlySlice): ImmutableMap { + throw UnsupportedOperationException() + } + + } + } throw UnsupportedOperationException() } diff --git a/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt new file mode 100644 index 00000000..31b8ffc7 --- /dev/null +++ b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt @@ -0,0 +1,30 @@ +package org.jetbrains.dokka + +import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.analyzer.ModuleInfo +import org.jetbrains.kotlin.caches.resolve.KotlinCacheService +import org.jetbrains.kotlin.idea.resolve.ResolutionFacade +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.resolve.TargetPlatform +import org.jetbrains.kotlin.resolve.diagnostics.KotlinSuppressCache + + +class CoreKotlinCacheService(private val resolutionFacade: DokkaResolutionFacade) : KotlinCacheService { + override fun getResolutionFacade(elements: List): ResolutionFacade { + return resolutionFacade + } + + override fun getResolutionFacadeByFile(file: PsiFile, platform: TargetPlatform): ResolutionFacade { + return resolutionFacade + } + + override fun getResolutionFacadeByModuleInfo(moduleInfo: ModuleInfo, platform: TargetPlatform): ResolutionFacade? { + return resolutionFacade + } + + override fun getSuppressionCache(): KotlinSuppressCache { + throw UnsupportedOperationException() + } + +} + diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt index 2f2f94b3..4f6a7c76 100644 --- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt +++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt @@ -228,24 +228,26 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List { + override fun getFiles(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getPresentableName(): String { + override fun getUrls(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getUrls(p0: OrderRootType?): Array { + override fun accept(p0: RootPolicy, p1: R?): R { throw UnsupportedOperationException() } - override fun getOwnerModule(): Module = module - override fun accept(p0: RootPolicy?, p1: R?): R { + override fun getPresentableName(): String { throw UnsupportedOperationException() } + override fun getOwnerModule(): Module = module + + override fun isValid(): Boolean { throw UnsupportedOperationException() } @@ -262,29 +264,29 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List { throw UnsupportedOperationException() } - override fun getJdk(): Sdk = sdk - - override fun getFiles(p0: OrderRootType?): Array { + override fun getUrls(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getPresentableName(): String { + override fun accept(p0: RootPolicy, p1: R?): R { throw UnsupportedOperationException() } - override fun getUrls(p0: OrderRootType?): Array { + override fun getJdkName(): String? { throw UnsupportedOperationException() } - override fun getOwnerModule(): Module { + override fun getJdk(): Sdk = sdk + + override fun getPresentableName(): String { throw UnsupportedOperationException() } - override fun accept(p0: RootPolicy?, p1: R?): R { + override fun getOwnerModule(): Module { throw UnsupportedOperationException() } @@ -358,7 +360,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List getModuleExtension(p0: Class?): T { + override fun getModuleExtension(p0: Class): T { throw UnsupportedOperationException() } diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt index eb8c12d0..f2d9d3a7 100644 --- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt +++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt @@ -81,7 +81,7 @@ class DescriptorDocumentationParser val suppressAnnotation = annotations.findAnnotation(FqName(Suppress::class.qualifiedName!!)) return if (suppressAnnotation != null) { @Suppress("UNCHECKED_CAST") - (suppressAnnotation.argumentValue("names") as List).any { it.value == "NOT_DOCUMENTED" } + (suppressAnnotation.argumentValue("names")?.value as List).any { it.value == "NOT_DOCUMENTED" } } else containingDeclaration?.isSuppressWarning() ?: false } diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 61bf50d6..916f89c9 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -15,7 +15,9 @@ import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtModifierListOwner import org.jetbrains.kotlin.psi.KtParameter import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -779,6 +781,14 @@ class DocumentationBuilder "\"" + StringUtil.escapeStringCharacters(value) + "\"" is EnumEntrySyntheticClassDescriptor -> value.containingDeclaration.name.asString() + "." + value.name.asString() + is Pair<*, *> -> { + val (classId, name) = value + if (classId is ClassId && name is Name) { + classId.shortClassName.asString() + "." + name.asString() + } else { + value.toString() + } + } else -> value.toString() }.let { valueString -> DocumentationNode(valueString, Content.Empty, NodeKind.Value) diff --git a/gradle.properties b/gradle.properties index 4a6475b1..cabae269 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ dokka_version=0.9.16 dokka_publication_channel=dokka #Kotlin compiler and plugin -bundled_kotlin_compiler_version=1.2.20-dev-419 -kotlin_version=1.2.0 +bundled_kotlin_compiler_version=1.2.40-dev-529 +kotlin_version=1.2.21 kotlin_for_gradle_runtime_version=1.1.60 ant_version=1.9.6 -- cgit