blob: f909b50b6059962441c911609e7dd8df4324fe83 [file] [log] [blame]
/*
* 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.*
buildscript {
dependencies {
classpath("gradle.plugin.org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.4.8")
}
}
plugins {
id("AndroidXPlugin")
id("kotlin")
}
apply(plugin: "org.jetbrains.intellij")
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_STDLIB)
implementation project(":compose:compose-compiler-hosted")
compileOnly("org.jetbrains.kotlin:kotlin-compiler:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-plugin:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-intellij-core:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-platform-api:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-platform-impl:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-j2k:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-java-impl:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-openapi:$KOTLIN_VERSION")
compileOnly("org.jetbrains.kotlin:kotlin-jps-common-ide:$KOTLIN_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
}