mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 08:11:20 +00:00
Add IJ plugin for reusing Compose in plugins (#1715)
* Add IJ plugin for reusing Compose in plugins * Fix issues
This commit is contained in:
3
tooling/.gitignore
vendored
Normal file
3
tooling/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
build/
|
||||
.gradle/
|
||||
.idea
|
||||
5
tooling/build.gradle.kts
Normal file
5
tooling/build.gradle.kts
Normal file
@@ -0,0 +1,5 @@
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
14
tooling/buildSrc/build.gradle.kts
Normal file
14
tooling/buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,14 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(gradleApi())
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
|
||||
implementation("org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.3.0")
|
||||
}
|
||||
0
tooling/buildSrc/settings.gradle.kts
Normal file
0
tooling/buildSrc/settings.gradle.kts
Normal file
36
tooling/buildSrc/src/main/kotlin/IdePluginBuildProperties.kt
Normal file
36
tooling/buildSrc/src/main/kotlin/IdePluginBuildProperties.kt
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
|
||||
class IdePluginBuildProperties(private val project: Project) {
|
||||
val deployVersion get() = gradleProperty("deploy.version")
|
||||
val pluginName get() = gradleProperty("plugin.name")
|
||||
val pluginDependencies get() = gradleProperty("plugin.dependencies").commaSeparatedList()
|
||||
val platformType get() = gradleProperty("platform.type")
|
||||
val platformVersion get() = gradleProperty("platform.version")
|
||||
val platformDownloadSources get() = gradleProperty("platform.download.sources").toBoolean()
|
||||
val pluginChannels get() = gradleProperty("plugin.channels").commaSeparatedList()
|
||||
val pluginSinceBuild get() = gradleProperty("plugin.since.build")
|
||||
val pluginUntilBuild get() = gradleProperty("plugin.until.build")
|
||||
val pluginVerifierIdeVersions get() = gradleProperty("plugin.verifier.ide.versions").commaSeparatedList()
|
||||
val publishToken get() = envVar("IDE_PLUGIN_PUBLISH_TOKEN")
|
||||
|
||||
private fun envVar(key: String): Provider<String> =
|
||||
project.providers.environmentVariable(key)
|
||||
|
||||
private fun gradleProperty(key: String): Provider<String> =
|
||||
project.provider {
|
||||
(project.findProperty(key) as? Any)?.toString()
|
||||
?: error("$project does not specify '$key' property")
|
||||
}
|
||||
|
||||
private fun Provider<String>.toBoolean(): Provider<Boolean> =
|
||||
map { it.toBoolean() }
|
||||
|
||||
private fun Provider<String>.commaSeparatedList(): Provider<List<String>> =
|
||||
map { str -> str.split(",").map { it.trim() }.filter { it.isNotEmpty() } }
|
||||
}
|
||||
24
tooling/buildSrc/src/main/kotlin/gradleUtils.kt
Normal file
24
tooling/buildSrc/src/main/kotlin/gradleUtils.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
||||
|
||||
/*
|
||||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun Project.jvmTarget(version: String) {
|
||||
plugins.withId("java") {
|
||||
tasks.withType<JavaCompile> {
|
||||
sourceCompatibility = version
|
||||
targetCompatibility = version
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
tasks.withType<KotlinJvmCompile> {
|
||||
kotlinOptions.jvmTarget = version
|
||||
}
|
||||
}
|
||||
}
|
||||
49
tooling/buildSrc/src/main/kotlin/idePlugin.kt
Normal file
49
tooling/buildSrc/src/main/kotlin/idePlugin.kt
Normal file
@@ -0,0 +1,49 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.jetbrains.intellij.IntelliJPluginExtension
|
||||
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
|
||||
import org.jetbrains.intellij.tasks.PublishPluginTask
|
||||
import org.jetbrains.intellij.tasks.RunPluginVerifierTask
|
||||
|
||||
/*
|
||||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun Project.intellijPlugin(group: String, fn: IntelliJPluginExtension.() -> Unit = {}) {
|
||||
plugins.apply("org.jetbrains.intellij")
|
||||
|
||||
val idePluginProperties = IdePluginBuildProperties(project)
|
||||
project.group = group
|
||||
project.version = idePluginProperties.deployVersion.get()
|
||||
|
||||
val intellij = project.extensions.getByType(IntelliJPluginExtension::class.java)
|
||||
intellij.apply {
|
||||
pluginName.set(idePluginProperties.pluginName)
|
||||
type.set(idePluginProperties.platformType)
|
||||
version.set(idePluginProperties.platformVersion)
|
||||
downloadSources.set(idePluginProperties.platformDownloadSources)
|
||||
plugins.set(idePluginProperties.pluginDependencies)
|
||||
}
|
||||
|
||||
fn(intellij)
|
||||
|
||||
tasks.named("buildSearchableOptions").configure {
|
||||
// temporary workaround
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.named<PublishPluginTask>("publishPlugin").configure {
|
||||
token.set(idePluginProperties.publishToken)
|
||||
channels.set(idePluginProperties.pluginChannels)
|
||||
}
|
||||
|
||||
tasks.named<PatchPluginXmlTask>("patchPluginXml").configure {
|
||||
sinceBuild.set(idePluginProperties.pluginSinceBuild)
|
||||
untilBuild.set(idePluginProperties.pluginUntilBuild)
|
||||
}
|
||||
|
||||
tasks.named<RunPluginVerifierTask>("runPluginVerifier").configure {
|
||||
ideVersions.set(idePluginProperties.pluginVerifierIdeVersions)
|
||||
}
|
||||
}
|
||||
20
tooling/compose-intellij-platform/build.gradle.kts
Normal file
20
tooling/compose-intellij-platform/build.gradle.kts
Normal file
@@ -0,0 +1,20 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
id("org.jetbrains.compose") version "1.0.1"
|
||||
}
|
||||
|
||||
jvmTarget("11")
|
||||
|
||||
dependencies {
|
||||
api(compose.desktop.common)
|
||||
api(compose.desktop.macos_x64)
|
||||
api(compose.desktop.macos_arm64)
|
||||
api(compose.desktop.windows_x64)
|
||||
api(compose.desktop.linux_x64)
|
||||
api(compose.desktop.linux_arm64)
|
||||
}
|
||||
|
||||
intellijPlugin(group = "org.jetbrains.compose.intellij.platform")
|
||||
17
tooling/compose-intellij-platform/gradle.properties
Normal file
17
tooling/compose-intellij-platform/gradle.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
# Opt-out flag for bundling Kotlin standard library.
|
||||
# See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for details.
|
||||
kotlin.stdlib.default.dependency=false
|
||||
|
||||
deploy.version=0.1-SNAPSHOT
|
||||
|
||||
plugin.name=Compose Intellij Plugin Base
|
||||
plugin.dependencies=
|
||||
plugin.channels=snapshots
|
||||
plugin.since.build=213
|
||||
plugin.until.build=221.*
|
||||
## See https://jb.gg/intellij-platform-builds-list for available build versions.
|
||||
plugin.verifier.ide.versions=2021.3
|
||||
|
||||
platform.type=IC
|
||||
platform.version=2021.3
|
||||
platform.download.sources=true
|
||||
7
tooling/compose-intellij-platform/sample/README.md
Normal file
7
tooling/compose-intellij-platform/sample/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
A few sample projects, showcasing an Intellij plugin
|
||||
for Intellij plugin development.
|
||||
|
||||
To try, run the following in `<ROOT>/tooling` directory:
|
||||
```
|
||||
./gradlew :compose-intellij-platform:sample:all-plugins:runIde
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
}
|
||||
|
||||
jvmTarget("11")
|
||||
|
||||
intellijPlugin(group = "org.jetbrains.compose.intellij.platform.sample.all.plugins") {
|
||||
plugins.set(
|
||||
listOf(
|
||||
project(":compose-intellij-platform"),
|
||||
project(":compose-intellij-platform:sample:base"),
|
||||
project(":compose-intellij-platform:sample:plugin-1"),
|
||||
project(":compose-intellij-platform:sample:plugin-2"),
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
kotlin.stdlib.default.dependency=false
|
||||
deploy.version=0.1-SNAPSHOT
|
||||
plugin.name=All Sample Compose Plugins
|
||||
@@ -0,0 +1,7 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.compose.intellij.platform.sample.all.plugins</id>
|
||||
<vendor>Sample vendor</vendor>
|
||||
|
||||
<depends>org.jetbrains.compose.intellij.platform.sample.plugin1</depends>
|
||||
<depends>org.jetbrains.compose.intellij.platform.sample.plugin2</depends>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,17 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
id("org.jetbrains.compose")
|
||||
}
|
||||
|
||||
jvmTarget("11")
|
||||
|
||||
dependencies {
|
||||
compileOnly(compose.desktop.currentOs)
|
||||
}
|
||||
|
||||
intellijPlugin(group = "org.jetbrains.compose.intellij.platform.sample.base") {
|
||||
plugins.set(listOf(project(":compose-intellij-platform")))
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
plugin.name=Compose Intellij Plugin Sample Base
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.awt.ComposePanel
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.DialogWrapper
|
||||
import javax.swing.JComponent
|
||||
|
||||
abstract class AbstractComposeDemoDialog(project: Project?) : DialogWrapper(project) {
|
||||
init {
|
||||
init()
|
||||
}
|
||||
|
||||
override fun createCenterPanel(): JComponent {
|
||||
return ComposePanel().apply {
|
||||
setBounds(0, 0, 800, 600)
|
||||
setContent {
|
||||
WidgetTheme(darkTheme = true) {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
dialogContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
abstract fun dialogContent()
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Shapes
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.intellij.ide.ui.LafManager
|
||||
import com.intellij.ide.ui.LafManagerListener
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import java.awt.Color as AWTColor
|
||||
import javax.swing.UIManager
|
||||
|
||||
val green200 = Color(0xffa5d6a7)
|
||||
val green500 = Color(0xff4caf50)
|
||||
val green700 = Color(0xff388e3c)
|
||||
|
||||
val teal200 = Color(0xff80deea)
|
||||
|
||||
private val DarkGreenColorPalette = darkColors(
|
||||
primary = green200,
|
||||
primaryVariant = green700,
|
||||
secondary = teal200,
|
||||
onPrimary = Color.Black,
|
||||
onSecondary = Color.White,
|
||||
error = Color.Red,
|
||||
)
|
||||
|
||||
private val LightGreenColorPalette = lightColors(
|
||||
primary = green500,
|
||||
primaryVariant = green700,
|
||||
secondary = teal200,
|
||||
onPrimary = Color.White,
|
||||
onSurface = Color.Black
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun WidgetTheme(
|
||||
darkTheme: Boolean = false,
|
||||
content: @Composable() () -> Unit,
|
||||
) {
|
||||
val colors = if (darkTheme) DarkGreenColorPalette else LightGreenColorPalette
|
||||
val swingColor = SwingColor()
|
||||
|
||||
MaterialTheme(
|
||||
colors = colors.copy(
|
||||
background = swingColor.background,
|
||||
onBackground = swingColor.onBackground,
|
||||
surface = swingColor.background,
|
||||
onSurface = swingColor.onBackground,
|
||||
),
|
||||
typography = typography,
|
||||
shapes = shapes,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
val shapes = Shapes(
|
||||
small = RoundedCornerShape(4.dp),
|
||||
medium = RoundedCornerShape(4.dp),
|
||||
large = RoundedCornerShape(0.dp)
|
||||
)
|
||||
|
||||
val typography = Typography(
|
||||
body1 = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
),
|
||||
body2 = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp
|
||||
),
|
||||
button = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.W500,
|
||||
fontSize = 14.sp
|
||||
),
|
||||
caption = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
),
|
||||
subtitle1 = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
color = Color.Gray
|
||||
),
|
||||
subtitle2 = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
color = Color.Gray
|
||||
),
|
||||
)
|
||||
|
||||
internal class ThemeChangeListener(
|
||||
val updateColors: () -> Unit
|
||||
) : LafManagerListener {
|
||||
override fun lookAndFeelChanged(source: LafManager) {
|
||||
updateColors()
|
||||
}
|
||||
}
|
||||
|
||||
interface SwingColor {
|
||||
val background: Color
|
||||
val onBackground: Color
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SwingColor(): SwingColor {
|
||||
val swingColor = remember { SwingColorImpl() }
|
||||
|
||||
val messageBus = remember {
|
||||
ApplicationManager.getApplication().messageBus.connect()
|
||||
}
|
||||
|
||||
remember(messageBus) {
|
||||
messageBus.subscribe(
|
||||
LafManagerListener.TOPIC,
|
||||
ThemeChangeListener(swingColor::updateCurrentColors)
|
||||
)
|
||||
}
|
||||
|
||||
DisposableEffect(messageBus) {
|
||||
onDispose {
|
||||
messageBus.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
return swingColor
|
||||
}
|
||||
|
||||
private class SwingColorImpl : SwingColor {
|
||||
private val _backgroundState: MutableState<Color> = mutableStateOf(getBackgroundColor)
|
||||
private val _onBackgroundState: MutableState<Color> = mutableStateOf(getOnBackgroundColor)
|
||||
|
||||
override val background: Color get() = _backgroundState.value
|
||||
override val onBackground: Color get() = _onBackgroundState.value
|
||||
|
||||
private val getBackgroundColor get() = getColor(BACKGROUND_KEY)
|
||||
private val getOnBackgroundColor get() = getColor(ON_BACKGROUND_KEY)
|
||||
|
||||
fun updateCurrentColors() {
|
||||
_backgroundState.value = getBackgroundColor
|
||||
_onBackgroundState.value = getOnBackgroundColor
|
||||
}
|
||||
|
||||
private val AWTColor.asComposeColor: Color get() = Color(red, green, blue, alpha)
|
||||
private fun getColor(key: String): Color = UIManager.getColor(key).asComposeColor
|
||||
|
||||
companion object {
|
||||
private const val BACKGROUND_KEY = "Panel.background"
|
||||
private const val ON_BACKGROUND_KEY = "Panel.foreground"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.compose.intellij.platform.sample.base</id>
|
||||
<vendor>Sample vendor</vendor>
|
||||
<depends>org.jetbrains.compose.intellij.platform</depends>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
id("org.jetbrains.compose")
|
||||
}
|
||||
|
||||
jvmTarget("11")
|
||||
|
||||
dependencies {
|
||||
compileOnly(compose.desktop.currentOs)
|
||||
}
|
||||
|
||||
intellijPlugin(group = "org.jetbrains.compose.intellij.platform.sample.plugin1") {
|
||||
plugins.set(
|
||||
listOf(
|
||||
project(":compose-intellij-platform"),
|
||||
project(":compose-intellij-platform:sample:base")
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
plugin.name=Compose Intellij Plugin Base Sample Plugin 1
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.FavoriteBorder
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun Buttons() {
|
||||
Row {
|
||||
val btnEnabled = remember { mutableStateOf(true) }
|
||||
Button(
|
||||
onClick = { btnEnabled.value = !btnEnabled.value},
|
||||
modifier = Modifier.padding(8.dp),
|
||||
enabled = btnEnabled.value
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.FavoriteBorder,
|
||||
contentDescription = "FavoriteBorder",
|
||||
modifier = Modifier.padding(end = 4.dp)
|
||||
)
|
||||
Text(text = "Button")
|
||||
}
|
||||
val btnTextEnabled = remember { mutableStateOf(true) }
|
||||
TextButton(
|
||||
onClick = { btnTextEnabled.value = !btnTextEnabled.value },
|
||||
modifier = Modifier.padding(8.dp),
|
||||
enabled = btnTextEnabled.value
|
||||
) {
|
||||
Text(text = "Text Button")
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = {
|
||||
btnEnabled.value = true
|
||||
btnTextEnabled.value = true
|
||||
},
|
||||
modifier = Modifier.padding(8.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Refresh,
|
||||
contentDescription = "Refresh",
|
||||
modifier = Modifier.padding(0.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
class ComposeDemoAction1 : DumbAwareAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
ComposeDemoDialog1(e.project).show()
|
||||
}
|
||||
}
|
||||
|
||||
class ComposeDemoDialog1(project: Project?) : AbstractComposeDemoDialog(project) {
|
||||
init {
|
||||
title = "Demo Dialog 1"
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun dialogContent() {
|
||||
Row {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxHeight().weight(1f)
|
||||
) {
|
||||
Buttons()
|
||||
Loaders()
|
||||
TextInputs()
|
||||
Toggles()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.LinearProgressIndicator
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun Loaders() {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(16.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.height(30.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(20.dp, 20.dp),
|
||||
strokeWidth = 4.dp
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(30.dp)
|
||||
.padding(start = 8.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextField
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun TextInputs() {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(16.dp)
|
||||
) {
|
||||
var name by remember { mutableStateOf(TextFieldValue("")) }
|
||||
var password by remember { mutableStateOf(TextFieldValue("")) }
|
||||
|
||||
TextField(
|
||||
value = name,
|
||||
onValueChange = { newValue -> name = newValue },
|
||||
modifier = Modifier.padding(8.dp).fillMaxWidth(),
|
||||
textStyle = TextStyle(fontFamily = FontFamily.SansSerif),
|
||||
label = { Text("Account:") },
|
||||
placeholder = { Text("account name") }
|
||||
)
|
||||
|
||||
OutlinedTextField(
|
||||
value = password,
|
||||
modifier = Modifier.padding(8.dp).fillMaxWidth(),
|
||||
label = { Text(text = "Password:") },
|
||||
placeholder = { Text(text = "your password") },
|
||||
textStyle = TextStyle(fontFamily = FontFamily.SansSerif),
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
onValueChange = {
|
||||
password = it
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Checkbox
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.RadioButton
|
||||
import androidx.compose.material.Slider
|
||||
import androidx.compose.material.Switch
|
||||
import androidx.compose.material.SwitchDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun Toggles() {
|
||||
Column {
|
||||
Row {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
var checked by remember { mutableStateOf(true) }
|
||||
Checkbox(
|
||||
checked = checked,
|
||||
modifier = Modifier.padding(8.dp),
|
||||
onCheckedChange = { checked = !checked }
|
||||
)
|
||||
var switched by remember { mutableStateOf(true) }
|
||||
Switch(
|
||||
checked = switched,
|
||||
colors = SwitchDefaults.colors(checkedThumbColor = MaterialTheme.colors.primary),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
onCheckedChange = { switched = it }
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
var selected by remember { mutableStateOf("Kotlin") }
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
RadioButton(selected = selected == "Kotlin", onClick = { selected = "Kotlin" })
|
||||
Text(
|
||||
text = "Kotlin",
|
||||
modifier = Modifier.clickable(onClick = { selected = "Kotlin" }).padding(start = 4.dp)
|
||||
)
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
RadioButton(selected = selected == "Java", onClick = { selected = "Java" })
|
||||
Text(
|
||||
text = "Java",
|
||||
modifier = Modifier.clickable(onClick = { selected = "Java" }).padding(start = 4.dp)
|
||||
)
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
RadioButton(selected = selected == "Swift", onClick = { selected = "Swift" })
|
||||
Text(
|
||||
text = "Swift",
|
||||
modifier = Modifier.clickable(onClick = { selected = "Swift" }).padding(start = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sliderState by remember { mutableStateOf(0f) }
|
||||
Slider(value = sliderState, modifier = Modifier.fillMaxWidth().padding(8.dp),
|
||||
onValueChange = { newValue ->
|
||||
sliderState = newValue
|
||||
}
|
||||
)
|
||||
|
||||
var sliderState2 by remember { mutableStateOf(20f) }
|
||||
Slider(value = sliderState2, modifier = Modifier.fillMaxWidth().padding(8.dp),
|
||||
valueRange = 0f..100f,
|
||||
steps = 5,
|
||||
onValueChange = { newValue ->
|
||||
sliderState2 = newValue
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.compose.intellij.platform.sample.plugin1</id>
|
||||
<vendor>Sample vendor</vendor>
|
||||
|
||||
<depends>org.jetbrains.compose.intellij.platform</depends>
|
||||
<depends>org.jetbrains.compose.intellij.platform.sample.base</depends>
|
||||
|
||||
<actions>
|
||||
<action id="org.jetbrains.compose.intellij.platform.sample.ComposeDemoAction1"
|
||||
class="org.jetbrains.compose.intellij.platform.sample.ComposeDemoAction1"
|
||||
text="Show Compose Dialog 1">
|
||||
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
id("org.jetbrains.compose")
|
||||
}
|
||||
|
||||
jvmTarget("11")
|
||||
|
||||
dependencies {
|
||||
compileOnly(compose.desktop.currentOs)
|
||||
}
|
||||
|
||||
intellijPlugin(group = "org.jetbrains.compose.intellij.platform.sample.plugin2") {
|
||||
plugins.set(
|
||||
listOf(
|
||||
project(":compose-intellij-platform"),
|
||||
project(":compose-intellij-platform:sample:base")
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
plugin.name=Compose Intellij Plugin Base Sample Plugin 2
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
class ComposeDemoAction2 : DumbAwareAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
ComposeDemoDialog2(e.project).show()
|
||||
}
|
||||
}
|
||||
|
||||
class ComposeDemoDialog2(project: Project?) : AbstractComposeDemoDialog(project) {
|
||||
init {
|
||||
title = "Demo Dialog 2"
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun dialogContent() {
|
||||
Row {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxHeight().weight(1f)
|
||||
) {
|
||||
LazyScrollable()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.jetbrains.compose.intellij.platform.sample
|
||||
|
||||
import androidx.compose.desktop.DesktopTheme
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.rememberScrollbarAdapter
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun LazyScrollable() {
|
||||
MaterialTheme {
|
||||
DesktopTheme {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
.padding(10.dp)
|
||||
) {
|
||||
|
||||
val state = rememberLazyListState()
|
||||
val itemCount = 100
|
||||
|
||||
LazyColumn(Modifier.fillMaxSize().padding(end = 12.dp), state) {
|
||||
items(itemCount) { x ->
|
||||
TextBox("Item in ScrollableColumn #$x")
|
||||
Spacer(modifier = Modifier.height(5.dp))
|
||||
}
|
||||
}
|
||||
VerticalScrollbar(
|
||||
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
|
||||
adapter = rememberScrollbarAdapter(
|
||||
scrollState = state
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TextBox(text: String = "Item") {
|
||||
Surface(
|
||||
color = Color(135, 135, 135, 40),
|
||||
shape = RoundedCornerShape(4.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.height(32.dp)
|
||||
.fillMaxWidth()
|
||||
.padding(start = 10.dp),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(text = text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.compose.intellij.platform.sample.plugin2</id>
|
||||
<vendor>Sample vendor</vendor>
|
||||
|
||||
<depends>org.jetbrains.compose.intellij.platform</depends>
|
||||
<depends>org.jetbrains.compose.intellij.platform.sample.base</depends>
|
||||
|
||||
<actions>
|
||||
<action id="org.jetbrains.compose.intellij.platform.sample.ComposeDemoAction2"
|
||||
class="org.jetbrains.compose.intellij.platform.sample.ComposeDemoAction2"
|
||||
text="Show Compose Dialog 2">
|
||||
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,12 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.compose.intellij.platform</id>
|
||||
<name>Compose for IDE Base</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
<description>
|
||||
<![CDATA[
|
||||
An Intellij platform plugin for developing Intellij plugins with Compose framework
|
||||
]]>
|
||||
</description>
|
||||
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1 @@
|
||||
<svg width="600" height="650" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M301.214 418.529c-.242.011-.484.027-.726.029a19.392 19.392 0 01-9.701-2.507L222.6 377.537a12.82 12.82 0 01-4.75-4.657 12.844 12.844 0 01-1.783-6.409l-.001-78.315c-.008-.836.027-1.666.106-2.483.205-2.133.737-4.17 1.535-6.071l-18.413-11.337-21.552-12.074c-2.023 4.236-3.008 9.042-2.958 14.028l.001 116.834a19.152 19.152 0 009.746 16.508l101.725 57.459a28.943 28.943 0 0014.473 3.74c.182-.002.363-.018.545-.022-.029-14.894-.057-25.504-.057-25.504l-.003-20.705z" fill="#4285F4"/><path d="M409.451 242.913l-96.811-54.68a28.945 28.945 0 00-28.957.278l-95.764 56.493c-4.606 2.721-7.989 6.612-10.169 11.169l-.008.018 21.553 12.074 18.412 11.337c.12-.285.215-.583.348-.861.183-.382.378-.757.586-1.124.415-.734.882-1.438 1.399-2.106a17.029 17.029 0 014.831-4.257l64.191-37.867a19.37 19.37 0 014.325-1.88 19.348 19.348 0 016.611-.787 19.41 19.41 0 018.475 2.481l64.893 36.652a21.997 21.997 0 015.768 4.712 21.087 21.087 0 011.513 1.966c.208.306.402.62.593.936l16.554-11.075 22.55-13.467-.031-.049c-2.766-4.077-6.546-7.522-10.862-9.963z" fill="#4285F4"/><path d="M381.24 277.467c.273.45.533.908.768 1.377.2.399.386.804.558 1.215.343.822.627 1.667.846 2.529.328 1.293.509 2.626.523 3.98l-.001 74.527a19.449 19.449 0 01-1.772 8.265c-.228.499-.469.99-.738 1.467a19.386 19.386 0 01-7.036 7.17l-64.191 37.874a19.336 19.336 0 01-8.983 2.658l.003 20.705s.028 10.61.057 25.504c4.829-.13 9.633-1.442 13.939-3.988l95.763-56.501a28.961 28.961 0 0014.24-25.216l.002-111.184c-.053-5.366-1.878-10.506-4.874-14.924l-22.55 13.467-16.554 11.075z" fill="#4285F4"/><path d="M177.75 256.173c2.18-4.557 5.563-8.448 10.169-11.169l95.764-56.493a28.942 28.942 0 0128.957-.278l96.811 54.68c4.316 2.44 8.096 5.886 10.862 9.963l.031.049 78.25-46.732c-4.565-6.73-10.804-12.417-17.928-16.446L320.864 99.49a47.772 47.772 0 00-47.798.46l-158.072 93.249c-7.603 4.492-13.187 10.913-16.785 18.435l79.533 44.557.008-.018zM301.274 464.738c-.182.004-.363.02-.545.022a28.946 28.946 0 01-14.473-3.74l-101.725-57.458a19.155 19.155 0 01-9.746-16.509l-.001-116.834c-.05-4.986.935-9.792 2.958-14.028l-79.533-44.556c-3.349 6.998-4.98 14.943-4.897 23.186l.002 192.85c.11 11.302 6.23 21.703 16.088 27.251l167.911 94.843a47.775 47.775 0 0023.89 6.173l.002-.135c.188-12.027.128-60.541.069-91.065z" stroke="#4285F4" stroke-width="10"/><path d="M498.594 206.194l-78.25 46.731c2.997 4.418 4.821 9.558 4.874 14.924l-.002 111.184a28.959 28.959 0 01-14.24 25.216l-95.763 56.502c-4.306 2.545-9.11 3.858-13.939 3.987.059 30.524.119 79.038-.069 91.064l-.002.136c8.272-.067 16.533-2.258 23.908-6.617l158.072-93.265a47.803 47.803 0 0023.505-41.623l.003-183.525c-.087-8.89-3.118-17.405-8.097-24.714z" stroke="#4285F4" stroke-width="10"/><path clip-rule="evenodd" d="M301.203 555.938a47.776 47.776 0 01-23.89-6.174l-167.911-94.843c-9.857-5.547-15.978-15.948-16.088-27.25l-.002-192.85c-.082-8.243 1.548-16.188 4.897-23.187 3.598-7.522 9.182-13.943 16.785-18.435l158.072-93.25a47.772 47.772 0 0147.798-.459l159.802 90.257c7.124 4.029 13.363 9.716 17.928 16.446 4.979 7.31 8.01 15.825 8.097 24.715l-.003 183.525a47.804 47.804 0 01-23.505 41.623L325.111 549.32c-7.375 4.36-15.636 6.551-23.908 6.618z" stroke="#4285F4" stroke-width="10"/></svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
BIN
tooling/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
tooling/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
tooling/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
tooling/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
tooling/gradlew
vendored
Executable file
185
tooling/gradlew
vendored
Executable file
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
tooling/gradlew.bat
vendored
Normal file
89
tooling/gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
12
tooling/settings.gradle.kts
Normal file
12
tooling/settings.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
include(":compose-intellij-platform")
|
||||
include(":compose-intellij-platform:sample:base")
|
||||
include(":compose-intellij-platform:sample:plugin-1")
|
||||
include(":compose-intellij-platform:sample:plugin-2")
|
||||
include(":compose-intellij-platform:sample:all-plugins")
|
||||
Reference in New Issue
Block a user