Implement runners without intellij plugin, share common part
This commit is contained in:
committed by
Vyacheslav Gerasimov
parent
0a95e7b20f
commit
434bbafe58
@@ -41,12 +41,11 @@ rootProject.apply {
|
|||||||
from(rootProject.file("../versions.gradle.kts"))
|
from(rootProject.file("../versions.gradle.kts"))
|
||||||
}
|
}
|
||||||
|
|
||||||
val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled")
|
val intellijUltimateEnabled by extra(project.getBooleanProperty("intellijUltimateEnabled")
|
||||||
?: project.hasProperty("teamcity")
|
?: project.hasProperty("teamcity")
|
||||||
|| System.getenv("TEAMCITY_VERSION") != null
|
|| System.getenv("TEAMCITY_VERSION") != null)
|
||||||
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
|
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
|
||||||
extra["intellijUltimateEnabled"] = intellijUltimateEnabled
|
|
||||||
extra["intellijSeparateSdks"] = intellijSeparateSdks
|
|
||||||
extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
|
extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
|
||||||
extra["intellijReleaseType"] = "releases" // or "snapshots"
|
extra["intellijReleaseType"] = "releases" // or "snapshots"
|
||||||
extra["versions.androidDxSources"] = "5.0.0_r2"
|
extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
import org.gradle.api.GradleException
|
import org.gradle.api.GradleException
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.artifacts.ModuleDependency
|
import org.gradle.api.artifacts.ModuleDependency
|
||||||
import org.gradle.kotlin.dsl.extra
|
|
||||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||||
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
||||||
import org.gradle.kotlin.dsl.DependencyHandlerScope
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.tasks.JavaExec
|
||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
private fun Project.intellijRepoDir() = File("${project.rootDir.absoluteFile}/buildSrc/prepare-deps/intellij-sdk/build/repo")
|
private fun Project.intellijRepoDir() = File("${project.rootDir.absoluteFile}/buildSrc/prepare-deps/intellij-sdk/build/repo")
|
||||||
|
|
||||||
@@ -93,4 +95,53 @@ fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: D
|
|||||||
if (!rootProject.extra.has("versions.androidStudioRelease")) {
|
if (!rootProject.extra.has("versions.androidStudioRelease")) {
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File, body: JavaExec.() -> Unit): JavaExec {
|
||||||
|
|
||||||
|
return task<JavaExec>(name) {
|
||||||
|
val ideaSandboxConfigDir = File(ideaSandboxDir, "config")
|
||||||
|
|
||||||
|
classpath = the<JavaPluginConvention>().sourceSets["main"].runtimeClasspath
|
||||||
|
|
||||||
|
main = "com.intellij.idea.Main"
|
||||||
|
|
||||||
|
workingDir = File(intellijRootDir(), "bin")
|
||||||
|
|
||||||
|
jvmArgs(
|
||||||
|
"-Xmx1250m",
|
||||||
|
"-XX:ReservedCodeCacheSize=240m",
|
||||||
|
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||||
|
"-ea",
|
||||||
|
"-Didea.is.internal=true",
|
||||||
|
"-Didea.debug.mode=true",
|
||||||
|
"-Didea.system.path=$ideaSandboxDir",
|
||||||
|
"-Didea.config.path=$ideaSandboxConfigDir",
|
||||||
|
"-Dapple.laf.useScreenMenuBar=true",
|
||||||
|
"-Dapple.awt.graphics.UseQuartz=true",
|
||||||
|
"-Dsun.io.useCanonCaches=false",
|
||||||
|
"-Dplugin.path=${ideaPluginDir.parentFile.absolutePath}",
|
||||||
|
"-Dkotlin.internal.mode.enabled=true",
|
||||||
|
"-Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (project.hasProperty("noPCE")) {
|
||||||
|
jvmArgs("-Didea.ProcessCanceledException=disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
args()
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
val disabledPluginsFile = File(ideaSandboxConfigDir, "disabled_plugins.txt")
|
||||||
|
val disabledPluginsContents = disabledPluginsFile.takeIf { it.isFile }?.readLines()
|
||||||
|
val filteredContents = disabledPluginsContents?.filterNot { it.contains("org.jetbrains.kotlin") }
|
||||||
|
if (filteredContents != null && filteredContents.size != disabledPluginsContents.size) {
|
||||||
|
with(disabledPluginsFile.printWriter()) {
|
||||||
|
filteredContents.forEach(this::println)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1066,6 +1066,7 @@
|
|||||||
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
|
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
|
||||||
"reporting": "org.gradle.api.reporting.ReportingExtension",
|
"reporting": "org.gradle.api.reporting.ReportingExtension",
|
||||||
"pluginBundle": "com.gradle.publish.PluginBundleExtension",
|
"pluginBundle": "com.gradle.publish.PluginBundleExtension",
|
||||||
|
"gradlePlugin": "org.gradle.plugin.devel.GradlePluginDevelopmentExtension",
|
||||||
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension",
|
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension",
|
||||||
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
|
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
|
||||||
"groovyRuntime": "org.gradle.api.tasks.GroovyRuntime",
|
"groovyRuntime": "org.gradle.api.tasks.GroovyRuntime",
|
||||||
@@ -3674,6 +3675,7 @@
|
|||||||
"compileOnly",
|
"compileOnly",
|
||||||
"default",
|
"default",
|
||||||
"implementation",
|
"implementation",
|
||||||
|
"instrumentationClasspath",
|
||||||
"kapt",
|
"kapt",
|
||||||
"kaptTest",
|
"kaptTest",
|
||||||
"runtime",
|
"runtime",
|
||||||
|
|||||||
@@ -1,16 +1,3 @@
|
|||||||
import org.jetbrains.intellij.tasks.PrepareSandboxTask
|
|
||||||
import org.jetbrains.intellij.tasks.RunIdeTask
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") // for intellij plugin
|
|
||||||
maven(url = "http://dl.bintray.com/jetbrains/intellij-plugin-service") // for intellij plugin
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.3.0-SNAPSHOT")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply { plugin("kotlin") }
|
apply { plugin("kotlin") }
|
||||||
|
|
||||||
@@ -19,49 +6,16 @@ dependencies {
|
|||||||
compileOnly(project(":idea:idea-maven"))
|
compileOnly(project(":idea:idea-maven"))
|
||||||
compileOnly(project(":idea:idea-gradle"))
|
compileOnly(project(":idea:idea-gradle"))
|
||||||
compileOnly(project(":idea:idea-jvm"))
|
compileOnly(project(":idea:idea-jvm"))
|
||||||
compileOnly(intellijDep())
|
|
||||||
|
|
||||||
|
compile(intellijDep())
|
||||||
|
|
||||||
runtimeOnly(files(toolsJar()))
|
runtimeOnly(files(toolsJar()))
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
val ideaPluginDir: File by rootProject.extra
|
||||||
val ideaPluginDir: File by rootProject.extra
|
val ideaSandboxDir: File by rootProject.extra
|
||||||
val ideaSandboxDir: File by rootProject.extra
|
|
||||||
|
|
||||||
tasks.findByName("runIde")?.let { tasks.remove(it) }
|
runIdeTask("runIde", ideaPluginDir, ideaSandboxDir) {
|
||||||
tasks.findByName("prepareSandbox")?.let { tasks.remove(it) }
|
|
||||||
|
|
||||||
val prepareSandbox by task<PrepareSandboxTask> {
|
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin")
|
||||||
configDirectory = File(ideaSandboxDir, "config")
|
|
||||||
// the rest are just some "fake" values, to keeping PrepareSandboxTask happy
|
|
||||||
setPluginName("Kotlin")
|
|
||||||
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin")
|
|
||||||
setPluginJar(File(ideaPluginDir, "lib/kotlin-script-runtime.jar")) // any small jar will do
|
|
||||||
destinationDir = File(buildDir, "sandbox-fake")
|
|
||||||
}
|
|
||||||
|
|
||||||
task<RunIdeTask>("runIde") {
|
|
||||||
dependsOn(prepareSandbox)
|
|
||||||
group = "intellij"
|
|
||||||
description = "Runs Intellij IDEA with installed plugin."
|
|
||||||
setIdeaDirectory(intellijRootDir())
|
|
||||||
setConfigDirectory(File(ideaSandboxDir, "config"))
|
|
||||||
setSystemDirectory(ideaSandboxDir)
|
|
||||||
setPluginsDirectory(ideaPluginDir.parent)
|
|
||||||
jvmArgs(
|
|
||||||
"-Xmx1250m",
|
|
||||||
"-XX:ReservedCodeCacheSize=240m",
|
|
||||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
|
||||||
"-ea",
|
|
||||||
"-Didea.is.internal=true",
|
|
||||||
"-Didea.debug.mode=true",
|
|
||||||
"-Dapple.laf.useScreenMenuBar=true",
|
|
||||||
"-Dapple.awt.graphics.UseQuartz=true",
|
|
||||||
"-Dsun.io.useCanonCaches=false",
|
|
||||||
"-Dkotlin.internal.mode.enabled=true"
|
|
||||||
)
|
|
||||||
if (project.hasProperty("noPCE")) {
|
|
||||||
jvmArgs("-Didea.ProcessCanceledException=disabled")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,4 @@
|
|||||||
|
|
||||||
import org.jetbrains.intellij.tasks.PrepareSandboxTask
|
|
||||||
import org.jetbrains.intellij.tasks.RunIdeTask
|
|
||||||
|
|
||||||
val intellijUltimateEnabled : Boolean by rootProject.extra
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") // for intellij plugin
|
|
||||||
maven(url = "http://dl.bintray.com/jetbrains/intellij-plugin-service") // for intellij plugin
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.3.0-SNAPSHOT")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply { plugin("kotlin") }
|
apply { plugin("kotlin") }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -23,51 +7,18 @@ dependencies {
|
|||||||
compileOnly(project(":idea:idea-gradle"))
|
compileOnly(project(":idea:idea-gradle"))
|
||||||
compileOnly(project(":idea:idea-jvm"))
|
compileOnly(project(":idea:idea-jvm"))
|
||||||
|
|
||||||
|
compile(intellijDep())
|
||||||
runtimeOnly(files(toolsJar()))
|
runtimeOnly(files(toolsJar()))
|
||||||
compileOnly(intellijDep())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
val intellijUltimateEnabled : Boolean by rootProject.extra
|
||||||
val ideaUltimatePluginDir: File by rootProject.extra
|
|
||||||
val ideaUltimateSandboxDir: File by rootProject.extra
|
|
||||||
|
|
||||||
tasks.findByName("runIde")?.let { tasks.remove(it) }
|
val ideaUltimatePluginDir: File by rootProject.extra
|
||||||
tasks.findByName("prepareSandbox")?.let { tasks.remove(it) }
|
val ideaUltimateSandboxDir: File by rootProject.extra
|
||||||
|
|
||||||
val prepareSandbox by task<PrepareSandboxTask> {
|
if (intellijUltimateEnabled) {
|
||||||
configDirectory = File(ideaUltimateSandboxDir, "config")
|
|
||||||
// the rest are just some "fake" values, to keeping PrepareSandboxTask happy
|
runIdeTask("runUltimate", ideaUltimatePluginDir, ideaUltimateSandboxDir) {
|
||||||
setPluginName("Kotlin")
|
|
||||||
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin", ":ultimate:idea-ultimate-plugin")
|
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin", ":ultimate:idea-ultimate-plugin")
|
||||||
setPluginJar(File(ideaUltimatePluginDir, "lib/kotlin-script-runtime.jar")) // any small jar will do
|
|
||||||
destinationDir = File(buildDir, "sandbox-fake")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
task<RunIdeTask>("runUltimate") {
|
|
||||||
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin", ":ultimate:idea-ultimate-plugin")
|
|
||||||
dependsOn(prepareSandbox)
|
|
||||||
group = "intellij"
|
|
||||||
description = "Runs Intellij IDEA Ultimate with installed plugin."
|
|
||||||
setIdeaDirectory(intellijUltimateRootDir())
|
|
||||||
setConfigDirectory(File(ideaUltimateSandboxDir, "config"))
|
|
||||||
setSystemDirectory(ideaUltimateSandboxDir)
|
|
||||||
setPluginsDirectory(ideaUltimatePluginDir.parent)
|
|
||||||
jvmArgs(
|
|
||||||
"-Xmx1250m",
|
|
||||||
"-XX:ReservedCodeCacheSize=240m",
|
|
||||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
|
||||||
"-ea",
|
|
||||||
"-Didea.is.internal=true",
|
|
||||||
"-Didea.debug.mode=true",
|
|
||||||
"-Dapple.laf.useScreenMenuBar=true",
|
|
||||||
"-Dapple.awt.graphics.UseQuartz=true",
|
|
||||||
"-Dsun.io.useCanonCaches=false",
|
|
||||||
"-Dkotlin.internal.mode.enabled=true"
|
|
||||||
)
|
|
||||||
if (project.hasProperty("noPCE")) {
|
|
||||||
jvmArgs("-Didea.ProcessCanceledException=disabled")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user