diff options
-rw-r--r-- | build.gradle | 10 | ||||
-rw-r--r-- | buildSrc/build.gradle | 8 | ||||
-rw-r--r-- | buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy | 14 | ||||
-rw-r--r-- | core/build.gradle | 30 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt | 16 | ||||
-rw-r--r-- | gradle.properties | 3 | ||||
-rw-r--r-- | lib/intellij-core-analysis.jar | bin | 40325875 -> 0 bytes | |||
-rw-r--r-- | settings.gradle | 3 | ||||
-rw-r--r-- | strippedIdeaJar/build.gradle | 52 | ||||
-rw-r--r-- | strippedIdeaJar/ideaJar.pro | 8 |
10 files changed, 129 insertions, 15 deletions
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<String> _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<ContentRoot>) : 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<Cont throw UnsupportedOperationException() } - override fun setOption(p0: String, p1: String) { + override fun setOption(p0: String, p1: String?) { throw UnsupportedOperationException() } @@ -288,11 +292,11 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont throw UnsupportedOperationException() } - override fun getRootFiles(p0: OrderRootType?): Array<out VirtualFile>? { + override fun getRootFiles(p0: OrderRootType): Array<out VirtualFile> { throw UnsupportedOperationException() } - override fun getRootUrls(p0: OrderRootType?): Array<out String>? { + override fun getRootUrls(p0: OrderRootType): Array<out String> { throw UnsupportedOperationException() } @@ -307,6 +311,10 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont } inner class MyModuleRootManager : ModuleRootManager() { + override fun getExternalSource(): ProjectModelExternalSource? { + throw UnsupportedOperationException() + } + override fun getExcludeRoots(): Array<out VirtualFile> { 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 Binary files differdeleted file mode 100644 index 50520e0c..00000000 --- a/lib/intellij-core-analysis.jar +++ /dev/null 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 { *; } |