From 07b0129a6a26c215cd735df37f888f905d156e0e Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 4 Mar 2019 21:31:29 +0300 Subject: [PATCH] Build: Build android-dx and intellij-sdk repo to dependencies/repo From KOTLIN-CR-2801 reasons to move: - I've changed repo layout and build process in incompatible way and decided to change location - It was difficult to find and annoying to locate, it was very deep and long path - I think dependencies/repo path is very easy to remember and find - It was called dependencies some time ago --- .gitignore | 6 +----- buildSrc/build.gradle.kts | 2 +- buildSrc/prepare-deps/android-dx/build.gradle.kts | 2 +- buildSrc/prepare-deps/intellij-sdk/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/AndroidSdkDependencies.kt | 4 ++-- buildSrc/src/main/kotlin/intellijDependencies.kt | 10 +++++----- buildSrc/src/main/kotlin/pill/plugin.kt | 2 +- .../kotlin-gradle-subplugin-example/build.gradle | 2 +- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 812a913a1f6..badd5c65115 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .idea/shelf /android.tests.dependencies /confluence/target -/dependencies +/dependencies/repo /dist /local /gh-pages @@ -15,10 +15,6 @@ workspace.xml *.versionsBackup /idea/testData/debugger/tinyApp/classes* /jps-plugin/testData/kannotator -/ultimate/dependencies -/ultimate/ideaSDK -/ultimate/out -/ultimate/tmp /js/js.translator/testData/out/ /js/js.translator/testData/out-min/ .gradle/ diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 53dd1935f1d..394e47da24c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -73,7 +73,7 @@ else extra["versions.androidDxSources"] = "5.0.0_r2" -extra["customDepsOrg"] = "kotlin.build.custom.deps" +extra["customDepsOrg"] = "kotlin.build" repositories { if (cacheRedirectorEnabled) { diff --git a/buildSrc/prepare-deps/android-dx/build.gradle.kts b/buildSrc/prepare-deps/android-dx/build.gradle.kts index 8e9373b4f1b..1306a3ffe8d 100644 --- a/buildSrc/prepare-deps/android-dx/build.gradle.kts +++ b/buildSrc/prepare-deps/android-dx/build.gradle.kts @@ -32,7 +32,7 @@ repositories { } } -val customDepsRepoDir = File(buildDir, "repo") +val customDepsRepoDir = File(rootProject.rootDir, "../dependencies/repo") val customDepsOrg: String by rootProject.extra val dxModuleName = "android-dx" val dxRevision = buildToolsVersion diff --git a/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts b/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts index 0466af0d4ce..b09b15c659f 100644 --- a/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts +++ b/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts @@ -87,7 +87,7 @@ val `plugins-NodeJS` by configurations.creating */ val intellijRuntimeAnnotations = "intellij-runtime-annotations" -val customDepsRepoDir = File(buildDir, "repo") +val customDepsRepoDir = File(rootProject.rootDir, "../dependencies/repo") val customDepsOrg: String by rootProject.extra val customDepsRevision = intellijVersion val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision") diff --git a/buildSrc/src/main/kotlin/AndroidSdkDependencies.kt b/buildSrc/src/main/kotlin/AndroidSdkDependencies.kt index e0b3bd766c3..7ad0414912c 100644 --- a/buildSrc/src/main/kotlin/AndroidSdkDependencies.kt +++ b/buildSrc/src/main/kotlin/AndroidSdkDependencies.kt @@ -7,9 +7,9 @@ import org.gradle.kotlin.dsl.extra import java.io.File fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy { - val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo") + val baseDir = File("${project.rootDir}/dependencies/repo") ivyPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[module].ivy.xml") artifactPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[artifact](-[classifier]).jar") } -fun Project.androidDxJar() = "kotlin.build.custom.deps:android-dx:${rootProject.extra["versions.androidBuildTools"]}" +fun Project.androidDxJar() = "kotlin.build:android-dx:${rootProject.extra["versions.androidBuildTools"]}" diff --git a/buildSrc/src/main/kotlin/intellijDependencies.kt b/buildSrc/src/main/kotlin/intellijDependencies.kt index 1c75299b6da..91805ad9fa7 100644 --- a/buildSrc/src/main/kotlin/intellijDependencies.kt +++ b/buildSrc/src/main/kotlin/intellijDependencies.kt @@ -26,7 +26,7 @@ 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}/dependencies/repo") fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = ivy { val baseDir = project.intellijRepoDir() @@ -54,7 +54,7 @@ fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = } } -fun Project.intellijDep(module: String = "intellij") = "kotlin.build.custom.deps:$module:${rootProject.extra["versions.intellijSdk"]}" +fun Project.intellijDep(module: String = "intellij") = "kotlin.build:$module:${rootProject.extra["versions.intellijSdk"]}" fun Project.intellijCoreDep() = intellijDep("intellij-core") @@ -66,7 +66,7 @@ fun Project.intellijCoreDep() = intellijDep("intellij-core") * `@NonNull`, `@Nullabe` from `idea/annotations.jar` has `TYPE` target which leads to different types treatment in Kotlin compiler. * On the other hand, `idea/annotations.jar` contains org/jetbrains/annotations/Async annations which is required for IDEA debugger. * - * So, we are excluding `annotaions.jar` from all other `kotlin.build.custom.deps` and using this one for runtime only + * 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") @@ -97,7 +97,7 @@ 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.custom.deps/${extra["versions.intellijSdk"]}") + return File(intellijRepoDir(), "kotlin.build/${extra["versions.intellijSdk"]}") } fun getIntellijRootDir(project: Project): File = with (project.rootProject) { @@ -119,7 +119,7 @@ fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project) fun Project.intellijUltimateRootDir() = if (isIntellijUltimateSdkAvailable()) - File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate") + File(intellijRepoDir(), "kotlin.build/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate") else throw GradleException("intellij ultimate SDK is not available") diff --git a/buildSrc/src/main/kotlin/pill/plugin.kt b/buildSrc/src/main/kotlin/pill/plugin.kt index 556d3713c3a..9fea8b3a03c 100644 --- a/buildSrc/src/main/kotlin/pill/plugin.kt +++ b/buildSrc/src/main/kotlin/pill/plugin.kt @@ -51,7 +51,7 @@ class JpsCompatiblePlugin : Plugin { DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib-js", "distJar") { null }, DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler", "runtimeJar") { null }, DependencyMapper("org.jetbrains.kotlin", "compiler", *MODULE_CONFIGURATIONS) { null }, - DependencyMapper("kotlin.build.custom.deps", "android", "default") { dep -> + DependencyMapper("kotlin.build", "android", "default") { dep -> val (sdkCommon, otherJars) = dep.moduleArtifacts.map { it.file }.partition { it.name == "sdk-common.jar" } val mainLibrary = PDependency.ModuleLibrary(PLibrary(dep.moduleName, otherJars)) val deferredLibrary = PDependency.ModuleLibrary(PLibrary(dep.moduleName + "-deferred", sdkCommon)) diff --git a/libraries/examples/kotlin-gradle-subplugin-example/build.gradle b/libraries/examples/kotlin-gradle-subplugin-example/build.gradle index 575cecd30dc..57685564498 100644 --- a/libraries/examples/kotlin-gradle-subplugin-example/build.gradle +++ b/libraries/examples/kotlin-gradle-subplugin-example/build.gradle @@ -22,7 +22,7 @@ dependencies { compileOnly gradleApi() - compileOnly("kotlin.build.custom.deps:intellij-core:${rootProject.ext["versions.intellijSdk"]}") { + compileOnly("kotlin.build:intellij-core:${rootProject.ext["versions.intellijSdk"]}") { artifact { name = 'intellij-core' type = 'jar'