Build: Improve intellij-sdk repo up-to-date check time & layout
Up-to-date check is very heavy for intellij repo due to artifact size. If module directory in repo is written only by one task we can assume that task if up-to-date if target directory exists.
This commit is contained in:
Generated
+1
@@ -6,6 +6,7 @@
|
||||
<w>instrumentator</w>
|
||||
<w>protobuf</w>
|
||||
<w>redirector</w>
|
||||
<w>remapper</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
@@ -74,11 +74,12 @@ repositories {
|
||||
|
||||
val intellij by configurations.creating
|
||||
val intellijUltimate by configurations.creating
|
||||
val androidStudio by configurations.creating
|
||||
val sources by configurations.creating
|
||||
val `jps-standalone` by configurations.creating
|
||||
val `jps-build-test` by configurations.creating
|
||||
val `intellij-core` by configurations.creating
|
||||
val `plugins-NodeJS` by configurations.creating
|
||||
val jpsStandalone by configurations.creating
|
||||
val jpsBuildTest by configurations.creating
|
||||
val intellijCore by configurations.creating
|
||||
val nodeJS by configurations.creating
|
||||
|
||||
/**
|
||||
* Special repository for annotations.jar required for idea runtime only.
|
||||
@@ -87,15 +88,14 @@ val `plugins-NodeJS` by configurations.creating
|
||||
*/
|
||||
val intellijRuntimeAnnotations = "intellij-runtime-annotations"
|
||||
|
||||
val customDepsRepoDir = File(rootProject.rootDir, "../dependencies/repo")
|
||||
val customDepsRepoDir = rootProject.rootDir.parentFile.resolve("dependencies/repo")
|
||||
val customDepsOrg: String by rootProject.extra
|
||||
val customDepsRevision = intellijVersion
|
||||
val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision")
|
||||
val repoDir = customDepsRepoModulesDir
|
||||
val repoDir = File(customDepsRepoDir, customDepsOrg)
|
||||
|
||||
dependencies {
|
||||
if (androidStudioRelease != null) {
|
||||
intellij("google:android-studio-ide:$androidStudioBuild")
|
||||
androidStudio("google:android-studio-ide:$androidStudioBuild")
|
||||
} else {
|
||||
if (installIntellijCommunity) {
|
||||
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
|
||||
@@ -110,67 +110,40 @@ dependencies {
|
||||
}
|
||||
|
||||
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
|
||||
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
|
||||
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
|
||||
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
|
||||
jpsStandalone("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
|
||||
jpsBuildTest("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
|
||||
intellijCore("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
|
||||
if (intellijUltimateEnabled) {
|
||||
`plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
|
||||
nodeJS("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
|
||||
}
|
||||
}
|
||||
|
||||
fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration,
|
||||
pathRemap: (String) -> String = { it },
|
||||
extractor: (Configuration) -> Any) {
|
||||
dependsOn(sourceConfig)
|
||||
inputs.files(sourceConfig)
|
||||
val targetDir = File(repoDir, sourceConfig.name)
|
||||
outputs.dirs(targetDir)
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(extractor(sourceConfig))
|
||||
into(targetDir)
|
||||
eachFile {
|
||||
path = pathRemap(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun removePathPrefix(path: String): String {
|
||||
if (androidStudioRelease == null) return path
|
||||
val slashes = if (studioOs == "mac") 2 else 1
|
||||
var result = path
|
||||
repeat(slashes) {
|
||||
result = result.substringAfter('/')
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
val unzipIntellijSdk by tasks.creating {
|
||||
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
|
||||
zipTree(it.singleFile).matching {
|
||||
exclude("**/plugins/Kotlin/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val unzipIntellijUltimateSdk by tasks.creating {
|
||||
configureExtractFromConfigurationTask(intellijUltimate) {
|
||||
zipTree(it.singleFile).matching {
|
||||
exclude("plugins/Kotlin/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } }
|
||||
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
|
||||
|
||||
val makeIntellijAnnotations by tasks.creating(Copy::class.java) {
|
||||
dependsOn(unzipIntellijCore)
|
||||
from(repoDir.resolve(`intellij-core`.name).resolve("annotations.jar"))
|
||||
into(repoDir.resolve(intellijRuntimeAnnotations))
|
||||
}
|
||||
dependsOn(makeIntellijCore)
|
||||
|
||||
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
|
||||
from(repoDir.resolve("intellij-core/$intellijVersion/artifacts/annotations.jar"))
|
||||
|
||||
val targetDir = File(repoDir, "$intellijRuntimeAnnotations/$intellijVersion")
|
||||
into(targetDir)
|
||||
|
||||
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
|
||||
outputs.files(ivyFile)
|
||||
|
||||
doLast {
|
||||
writeIvyXml(
|
||||
customDepsOrg,
|
||||
intellijRuntimeAnnotations,
|
||||
intellijVersion,
|
||||
intellijRuntimeAnnotations,
|
||||
targetDir,
|
||||
targetDir,
|
||||
targetDir,
|
||||
allowAnnotations = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val mergeSources by tasks.creating(Jar::class.java) {
|
||||
dependsOn(sources)
|
||||
@@ -181,14 +154,130 @@ val mergeSources by tasks.creating(Jar::class.java) {
|
||||
version = intellijVersion
|
||||
}
|
||||
|
||||
val copyJpsBuildTest by tasks.creating { configureExtractFromConfigurationTask(`jps-build-test`) { it.singleFile } }
|
||||
val sourcesFile = mergeSources.outputs.files.singleFile
|
||||
|
||||
val unzipNodeJSPlugin by tasks.creating { configureExtractFromConfigurationTask(`plugins-NodeJS`) { zipTree(it.singleFile) } }
|
||||
val makeIde = if (androidStudioBuild != null) {
|
||||
buildIvyRepositoryTask(
|
||||
androidStudio,
|
||||
customDepsOrg,
|
||||
customDepsRepoDir,
|
||||
if (studioOs == "mac")
|
||||
::skipContentsDirectory
|
||||
else
|
||||
::skipToplevelDirectory
|
||||
)
|
||||
} else {
|
||||
val task = if (installIntellijUltimate) {
|
||||
buildIvyRepositoryTask(intellijUltimate, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
} else {
|
||||
buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
}
|
||||
|
||||
task.configure {
|
||||
dependsOn(mergeSources)
|
||||
}
|
||||
|
||||
task
|
||||
}
|
||||
|
||||
val build by tasks.creating {
|
||||
dependsOn(
|
||||
makeIntellijCore,
|
||||
makeIde,
|
||||
buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile),
|
||||
buildIvyRepositoryTask(jpsBuildTest, customDepsOrg, customDepsRepoDir, null, sourcesFile),
|
||||
makeIntellijAnnotations
|
||||
)
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
dependsOn(
|
||||
buildIvyRepositoryTask(nodeJS, customDepsOrg, customDepsRepoDir, ::skipToplevelDirectory, sourcesFile)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun buildIvyRepositoryTask(
|
||||
configuration: Configuration,
|
||||
organization: String,
|
||||
repoDirectory: File,
|
||||
pathRemap: ((String) -> String)? = null,
|
||||
sources: File? = null
|
||||
) = tasks.register("buildIvyRepositoryFor${configuration.name.capitalize()}") {
|
||||
|
||||
fun ResolvedArtifact.moduleDirectory(): File =
|
||||
File(repoDirectory, "$organization/${moduleVersion.id.name}/${moduleVersion.id.version}")
|
||||
|
||||
dependsOn(configuration)
|
||||
inputs.files(configuration)
|
||||
|
||||
outputs.upToDateWhen {
|
||||
configuration.resolvedConfiguration.resolvedArtifacts.single()
|
||||
.let { it.moduleDirectory() }
|
||||
.exists()
|
||||
}
|
||||
|
||||
doFirst {
|
||||
configuration.resolvedConfiguration.resolvedArtifacts.single().run {
|
||||
val moduleDirectory = moduleDirectory()
|
||||
val artifactsDirectory = File(moduleDirectory(), "artifacts")
|
||||
|
||||
logger.info("Unpacking ${file.name} into ${artifactsDirectory.absolutePath}")
|
||||
copy {
|
||||
from(zipTree(file).matching {
|
||||
exclude("**/plugins/Kotlin/**")
|
||||
})
|
||||
|
||||
into(artifactsDirectory)
|
||||
|
||||
if (pathRemap != null) {
|
||||
eachFile {
|
||||
path = pathRemap(path)
|
||||
}
|
||||
}
|
||||
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
|
||||
writeIvyXml(
|
||||
organization,
|
||||
moduleVersion.id.name,
|
||||
moduleVersion.id.version,
|
||||
moduleVersion.id.name,
|
||||
File(artifactsDirectory, "lib"),
|
||||
File(artifactsDirectory, "lib"),
|
||||
File(moduleDirectory, "ivy"),
|
||||
*listOfNotNull(sources).toTypedArray()
|
||||
)
|
||||
|
||||
val pluginsDirectory = File(artifactsDirectory, "plugins")
|
||||
if (pluginsDirectory.exists()) {
|
||||
file(File(artifactsDirectory, "plugins"))
|
||||
.listFiles { file: File -> file.isDirectory }
|
||||
.forEach {
|
||||
writeIvyXml(
|
||||
organization,
|
||||
it.name,
|
||||
moduleVersion.id.version,
|
||||
it.name,
|
||||
File(it, "lib"),
|
||||
File(it, "lib"),
|
||||
File(moduleDirectory, "ivy"),
|
||||
*listOfNotNull(sources).toTypedArray()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun writeIvyXml(
|
||||
organization: String,
|
||||
moduleName: String,
|
||||
version: String,
|
||||
fileName: String,
|
||||
baseDir: File,
|
||||
artifactDir: File,
|
||||
targetDir: File,
|
||||
vararg sourcesJar: File,
|
||||
allowAnnotations: Boolean = false
|
||||
) {
|
||||
@@ -198,116 +287,40 @@ fun writeIvyXml(
|
||||
&& !jar.name.startsWith("kotlin-")
|
||||
&& (allowAnnotations || jar.name != "annotations.jar") // see comments for [intellijAnnotations] above
|
||||
|
||||
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
|
||||
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(organization, moduleName, version))) {
|
||||
addConfiguration(DefaultIvyConfiguration("default"))
|
||||
addConfiguration(DefaultIvyConfiguration("sources"))
|
||||
baseDir.listFiles()?.forEach { jarFile ->
|
||||
artifactDir.listFiles()?.forEach { jarFile ->
|
||||
if (shouldIncludeIntellijJar(jarFile)) {
|
||||
val relativeName = jarFile.toRelativeString(baseDir).removeSuffix(".jar")
|
||||
addArtifact(
|
||||
FileBasedIvyArtifact(jarFile, DefaultIvyPublicationIdentity(customDepsOrg, jarFile.nameWithoutExtension, intellijVersion)).also {
|
||||
FileBasedIvyArtifact(
|
||||
jarFile,
|
||||
DefaultIvyPublicationIdentity(organization, relativeName, version)
|
||||
).also {
|
||||
it.conf = "default"
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar.forEach {
|
||||
val sourcesArtifactName = it.name.substringBeforeLast("-").substringBeforeLast("-")
|
||||
addArtifact(
|
||||
FileBasedIvyArtifact(it, DefaultIvyPublicationIdentity(customDepsOrg, sourcesArtifactName, intellijVersion)).also { artifact ->
|
||||
FileBasedIvyArtifact(
|
||||
it,
|
||||
DefaultIvyPublicationIdentity(organization, sourcesArtifactName, version)
|
||||
).also { artifact ->
|
||||
artifact.conf = "sources"
|
||||
artifact.classifier = "sources"
|
||||
}
|
||||
)
|
||||
}
|
||||
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
|
||||
|
||||
writeTo(File(targetDir, "$fileName.ivy.xml"))
|
||||
}
|
||||
}
|
||||
|
||||
val prepareIvyXmls by tasks.creating {
|
||||
dependsOn(unzipIntellijCore, makeIntellijAnnotations, unzipJpsStandalone, mergeSources, copyJpsBuildTest)
|
||||
fun skipToplevelDirectory(path: String) = path.substringAfter('/')
|
||||
|
||||
val intellijSdkDir = File(repoDir, intellij.name)
|
||||
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
|
||||
|
||||
if (installIntellijCommunity) {
|
||||
dependsOn(unzipIntellijSdk)
|
||||
inputs.dir(intellijSdkDir)
|
||||
outputs.file(File(repoDir, "${intellij.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
dependsOn(unzipIntellijUltimateSdk)
|
||||
inputs.dir(intellijUltimateSdkDir)
|
||||
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`)
|
||||
flatDeps.forEach {
|
||||
inputs.dir(File(repoDir, it.name))
|
||||
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
|
||||
}
|
||||
inputs.dir(File(repoDir, sources.name))
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
dependsOn(unzipNodeJSPlugin)
|
||||
inputs.dir(File(repoDir, `plugins-NodeJS`.name))
|
||||
outputs.file(File(repoDir, "${`plugins-NodeJS`.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
doFirst {
|
||||
val sources = File(repoDir, sources.name).listFiles()
|
||||
|
||||
if (installIntellijCommunity) {
|
||||
val libDir = File(intellijSdkDir, "lib")
|
||||
writeIvyXml(
|
||||
intellij.name,
|
||||
intellij.name,
|
||||
libDir,
|
||||
*sources
|
||||
)
|
||||
|
||||
File(intellijSdkDir, "plugins").listFiles { file: File -> file.isDirectory }.forEach {
|
||||
writeIvyXml(it.name, "intellij.plugin.${it.name}", File(it, "lib"), *sources)
|
||||
}
|
||||
}
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
val libDir = File(intellijUltimateSdkDir, "lib")
|
||||
writeIvyXml(
|
||||
intellij.name, // important! the module name should be "intellij"
|
||||
intellijUltimate.name,
|
||||
libDir,
|
||||
*sources
|
||||
)
|
||||
|
||||
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
|
||||
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", File(it, "lib"), *sources)
|
||||
}
|
||||
}
|
||||
|
||||
flatDeps.forEach {
|
||||
writeIvyXml(it.name, it.name, File(repoDir, it.name), *sources)
|
||||
}
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
|
||||
writeIvyXml("NodeJS", `plugins-NodeJS`.name, File(repoDir, nodeJsBaseDir), *sources)
|
||||
}
|
||||
|
||||
val intellijAnnotationsDir = File(repoDir, intellijRuntimeAnnotations)
|
||||
writeIvyXml(
|
||||
intellijRuntimeAnnotations, intellijRuntimeAnnotations,
|
||||
intellijAnnotationsDir, *sources,
|
||||
allowAnnotations = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val build by tasks.creating {
|
||||
dependsOn(prepareIvyXmls)
|
||||
}
|
||||
|
||||
val clean by tasks.creating(Delete::class) {
|
||||
delete(customDepsRepoModulesDir)
|
||||
delete(buildDir)
|
||||
}
|
||||
fun skipContentsDirectory(path: String) = path.substringAfter("Contents/")
|
||||
|
||||
@@ -14,49 +14,57 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
// usages in build scripts are not tracked properly
|
||||
@file:Suppress("unused")
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.ModuleDependency
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
||||
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}/dependencies/repo")
|
||||
|
||||
private fun Project.ideModuleName() = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
Ide.Kind.AndroidStudio -> "android-studio-ide"
|
||||
Ide.Kind.IntelliJ -> {
|
||||
if (getBooleanProperty("intellijUltimateEnabled") == true) "ideaIU" else "ideaIC"
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.ideModuleVersion() = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
Ide.Kind.AndroidStudio -> rootProject.findProperty("versions.androidStudioBuild")
|
||||
Ide.Kind.IntelliJ -> rootProject.findProperty("versions.intellijSdk")
|
||||
}
|
||||
|
||||
fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = ivy {
|
||||
val baseDir = project.intellijRepoDir()
|
||||
setUrl(baseDir)
|
||||
|
||||
if (IdeVersionConfigurator.currentIde.kind == Ide.Kind.IntelliJ) {
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate.ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate.plugin.[module].ivy.xml")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate/plugins/[module]/lib/[artifact](-[classifier]).jar")
|
||||
}
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/ivy/[module].ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/${project.ideModuleName()}/[revision]/ivy/[module].ivy.xml") // bundled plugins
|
||||
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module].ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij.plugin.[module].ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module].ivy.xml")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij/plugins/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module]/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact].jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact](-[revision])(-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/sources/[artifact]-[revision]-[classifier].[ext]")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/artifacts/lib/[artifact](-[classifier]).[ext]")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/artifacts/[artifact](-[classifier]).[ext]")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/${project.ideModuleName()}/[revision]/artifacts/plugins/[module]/lib/[artifact](-[classifier]).[ext]") // bundled plugins
|
||||
|
||||
metadataSources {
|
||||
ivyDescriptor()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.intellijDep(module: String = "intellij") = "kotlin.build:$module:${rootProject.extra["versions.intellijSdk"]}"
|
||||
fun Project.intellijDep(module: String? = null) = "kotlin.build:${module ?: ideModuleName()}:${ideModuleVersion()}"
|
||||
|
||||
fun Project.intellijCoreDep() = intellijDep("intellij-core")
|
||||
fun Project.intellijCoreDep() = "kotlin.build:intellij-core:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.jpsBuildTest() = "kotlin.build:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
|
||||
|
||||
/**
|
||||
* Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
|
||||
@@ -69,11 +77,11 @@ fun Project.intellijCoreDep() = intellijDep("intellij-core")
|
||||
* So, we are excluding `annotaions.jar` from all other `kotlin.build` and using this one for runtime only
|
||||
* to avoid accidentally including `annotations.jar` by calling `intellijDep()`.
|
||||
*/
|
||||
fun Project.intellijRuntimeAnnotations() = intellijDep("intellij-runtime-annotations")
|
||||
fun Project.intellijRuntimeAnnotations() = "kotlin.build:intellij-runtime-annotations:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin)
|
||||
|
||||
fun Project.intellijUltimateDep() = intellijDep("intellij")
|
||||
fun Project.intellijUltimateDep() = intellijDep("ideaIU")
|
||||
|
||||
fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin)
|
||||
|
||||
@@ -96,32 +104,39 @@ fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = n
|
||||
|
||||
// Workaround. Top-level Kotlin function in a default package can't be called from a non-default package
|
||||
object IntellijRootUtils {
|
||||
fun getRepositoryRootDir(project: Project): File = with (project.rootProject) {
|
||||
return File(intellijRepoDir(), "kotlin.build/${extra["versions.intellijSdk"]}")
|
||||
fun getRepositoryRootDir(project: Project): File = with(project.rootProject) {
|
||||
return File(intellijRepoDir(), "kotlin.build")
|
||||
}
|
||||
|
||||
fun getIntellijRootDir(project: Project): File = with (project.rootProject) {
|
||||
return File(getRepositoryRootDir(this), "intellij${if (isIntellijCommunityAvailable()) "" else "Ultimate"}")
|
||||
fun getIntellijRootDir(project: Project): File = with(project.rootProject) {
|
||||
return File(
|
||||
getRepositoryRootDir(this),
|
||||
"${ideModuleName()}/${ideModuleVersion()}/artifacts"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
|
||||
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
|
||||
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
|
||||
|
||||
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
|
||||
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(), rootProject = project.rootProject)
|
||||
includeJars(
|
||||
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
|
||||
rootProject = project.rootProject
|
||||
)
|
||||
|
||||
fun Project.isIntellijCommunityAvailable() = !(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
|
||||
fun Project.isIntellijCommunityAvailable() =
|
||||
!(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
|
||||
|
||||
fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean)
|
||||
|
||||
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
|
||||
|
||||
fun Project.intellijUltimateRootDir() =
|
||||
if (isIntellijUltimateSdkAvailable())
|
||||
File(intellijRepoDir(), "kotlin.build/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate")
|
||||
else
|
||||
throw GradleException("intellij ultimate SDK is not available")
|
||||
if (isIntellijUltimateSdkAvailable())
|
||||
File(intellijRepoDir(), "kotlin.build/ideaIU/${rootProject.extra["versions.intellijSdk"]}/artifacts")
|
||||
else
|
||||
throw GradleException("intellij ultimate SDK is not available")
|
||||
|
||||
fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: DependencyHandlerScope.() -> Unit) {
|
||||
if (!rootProject.extra.has("versions.androidStudioRelease")) {
|
||||
|
||||
@@ -24,8 +24,8 @@ dependencies {
|
||||
testCompile(projectTests(":jps-plugin"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "groovy-all", "jps-builders", rootProject = rootProject) }
|
||||
testCompile(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
testCompile(intellijDep("jps-build-test"))
|
||||
testCompile(jpsStandalone()) { includeJars("jps-model") }
|
||||
testCompile(jpsBuildTest())
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -9,7 +9,7 @@ dependencies {
|
||||
compile(project(":core:deserialization"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
compileOnly(jpsStandalone()) { includeJars("jps-model") }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -35,8 +35,8 @@ dependencies {
|
||||
testRuntime(project(":kotlin-reflect"))
|
||||
|
||||
if (Ide.IJ()) {
|
||||
testCompileOnly(intellijDep("jps-build-test"))
|
||||
testCompile(intellijDep("jps-build-test"))
|
||||
testCompileOnly(jpsBuildTest())
|
||||
testCompile(jpsBuildTest())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ dependencies {
|
||||
compile(project(":js:js.frontend"))
|
||||
compile(project(":kotlin-native:kotlin-native-library-reader"))
|
||||
compileOnly(intellijDep())
|
||||
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
compileOnly(jpsStandalone()) { includeJars("jps-model") }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -27,7 +27,7 @@ dependencies {
|
||||
fatJarContents(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
fatJarContents(intellijDep()) { includeIntellijCoreJarDependencies(project, { !(it.startsWith("jdom") || it.startsWith("log4j")) }) }
|
||||
fatJarContents(intellijDep()) { includeJars("jna-platform") }
|
||||
fatJarContentsStripServices(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
|
||||
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro", "jdom", "log4j", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ dependencies {
|
||||
includeJars("jdom", "trove4j", "jps-model", "openapi", "util", "asm-all", rootProject = rootProject)
|
||||
}
|
||||
}
|
||||
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||
compileOnly(jpsStandalone()) { includeJars("jps-builders", "jps-builders-6") }
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testCompile(project(":compiler:incremental-compilation-impl"))
|
||||
testCompile(projectTests(":compiler:tests-common"))
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(projectTests(":kotlin-build-common"))
|
||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||
testCompileOnly(jpsStandalone()) { includeJars("jps-builders", "jps-builders-6") }
|
||||
Ide.IJ {
|
||||
testCompile(intellijDep("devkit"))
|
||||
}
|
||||
@@ -40,7 +40,7 @@ dependencies {
|
||||
} else {
|
||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
||||
}
|
||||
testCompile(intellijDep("jps-build-test"))
|
||||
testCompile(jpsBuildTest())
|
||||
compilerModules.forEach {
|
||||
testRuntime(project(it))
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ dependencies {
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
|
||||
testRuntime(intellijPluginDep("junit")) { includeJars("idea-junit", "resources_en") }
|
||||
testRuntime(intellijPluginDep("junit"))
|
||||
|
||||
robolectricClasspath(commonDep("org.robolectric", "robolectric"))
|
||||
robolectricClasspath("org.robolectric:android-all:4.4_r1-robolectric-1")
|
||||
|
||||
@@ -96,7 +96,7 @@ dependencies {
|
||||
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j") }
|
||||
}
|
||||
}
|
||||
fatJarContentsStripServices(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
@@ -87,7 +87,7 @@ dependencies {
|
||||
}
|
||||
}
|
||||
fatJarContents(intellijDep()) { includeJars("jna-platform", "lz4-1.3.0") }
|
||||
fatJarContentsStripServices(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
|
||||
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j" ) }
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ dependencies {
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
compileOnly(intellijUltimatePluginDep("NodeJS"))
|
||||
compileOnly(nodeJSPlugin())
|
||||
compileOnly(intellijUltimateDep()) { includeJars("trove4j", "openapi", "platform-api", "platform-impl", "java-api", "java-impl", "idea", "util", "jdom") }
|
||||
compileOnly(intellijUltimatePluginDep("CSS"))
|
||||
compileOnly(intellijUltimatePluginDep("DatabaseTools"))
|
||||
@@ -107,6 +107,7 @@ dependencies {
|
||||
testRuntime(intellijPluginDep("smali"))
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
testCompile(nodeJSPlugin())
|
||||
testCompile(intellijUltimatePluginDep("CSS"))
|
||||
testCompile(intellijUltimatePluginDep("DatabaseTools"))
|
||||
testCompile(intellijUltimatePluginDep("JavaEE"))
|
||||
@@ -116,7 +117,6 @@ dependencies {
|
||||
testCompile(intellijUltimatePluginDep("uml"))
|
||||
testCompile(intellijUltimatePluginDep("JavaScriptLanguage"))
|
||||
testCompile(intellijUltimatePluginDep("JavaScriptDebugger"))
|
||||
testCompile(intellijUltimatePluginDep("NodeJS"))
|
||||
testCompile(intellijUltimatePluginDep("properties"))
|
||||
testCompile(intellijUltimatePluginDep("java-i18n"))
|
||||
testCompile(intellijUltimatePluginDep("gradle"))
|
||||
|
||||
Reference in New Issue
Block a user