| /* |
| * Copyright 2019 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| |
| import androidx.build.CompilationTarget |
| import androidx.build.LibraryGroups |
| import androidx.build.LibraryVersions |
| import androidx.build.Publish |
| import androidx.build.studio.StudioWrapper |
| |
| import static androidx.build.dependencies.DependenciesKt.* |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("kotlin") |
| id("org.jetbrains.intellij") version("0.4.8") |
| } |
| |
| def studioWrapper = StudioWrapper.create(rootProject) |
| |
| // Unfortunately the Intellij plugin requires libs from the Studio installation as soon as it is |
| // applied, so we re-use the same logic in StudioTask to update the Studio installation if needed. |
| studioWrapper.update() |
| ext.binaryPath = studioWrapper.platformUtilities.getBinaryDirectory(studioWrapper).absolutePath |
| ext.studioLibPath = studioWrapper.platformUtilities.getLibDirectory(studioWrapper).absolutePath |
| |
| // more info on options for this DSL here: |
| // https://github.com/JetBrains/gradle-intellij-plugin |
| intellij { |
| pluginName = "compose-ide-plugin" |
| downloadSources = false |
| intellijRepo = "${repos.prebuiltsRoot}/androidx/external" |
| pluginsRepo = "${repos.prebuiltsRoot}/androidx/external" |
| localPath = "${binaryPath}" |
| } |
| |
| runIde { |
| maxHeapSize = "2g" |
| } |
| |
| dependencies { |
| compileOnly(KOTLIN_COMPOSE_STDLIB) |
| implementation project(":compose:compose-compiler-hosted") |
| |
| compileOnly("org.jetbrains.kotlin:kotlin-compiler:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-plugin:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-intellij-core:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-platform-api:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-platform-impl:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-j2k:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-java-impl:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-openapi:$COMPOSE_VERSION") |
| compileOnly("org.jetbrains.kotlin:kotlin-jps-common-ide:$COMPOSE_VERSION") |
| |
| // Intellij plugins have a bunch of implicit dependencies. The Gradle Intellij Plugin usually |
| // adds these automatically, but we are adding them explicitly here. |
| implementation fileTree("$studioLibPath") { |
| include "**/*.jar" |
| } |
| } |
| |
| compileKotlin { |
| kotlinOptions { |
| jvmTarget = '1.8' |
| } |
| } |
| |
| androidx { |
| name = "AndroidX Compose IDE Plugin" |
| publish = Publish.SNAPSHOT_AND_RELEASE |
| toolingProject = true |
| mavenVersion = LibraryVersions.COMPOSE |
| mavenGroup = LibraryGroups.COMPOSE |
| inceptionYear = "2019" |
| description = "Contains the IDE plugin for Compose" |
| compilationTarget = CompilationTarget.HOST |
| } |