-
Notifications
You must be signed in to change notification settings - Fork 270
/
IntelliJPlatformType.kt
144 lines (136 loc) · 4.62 KB
/
IntelliJPlatformType.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.platform.gradle
import org.jetbrains.intellij.platform.gradle.models.Coordinates
// TODO any changes must be synchronized with
// IntelliJPlatformDependenciesExtension
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-types.html#IntelliJPlatformType
// IJ:
// - org.jetbrains.idea.devkit.projectRoots.IntelliJPlatformProduct
// - community/plugins/devkit/intellij.devkit/resources/META-INF/plugin.xml
/**
* Describes all IntelliJ Platform types available to be used for plugin development, dependency resolution, and plugin verification.
*
* Each entry is composed of a product code name and coordinates used for dependency and binary release resolution.
*/
enum class IntelliJPlatformType(
val code: String,
val maven: Coordinates?,
val binary: Coordinates?,
) {
AndroidStudio(
code = "AI",
maven = null,
binary = Coordinates("com.google.android.studio", "android-studio"),
),
Aqua(
code = "QA",
maven = null,
binary = Coordinates("aqua", "aqua"),
),
CLion(
code = "CL",
maven = Coordinates("com.jetbrains.intellij.clion", "clion"),
binary = Coordinates("cpp", "CLion"),
),
DataGrip(
code = "DB",
maven = null,
binary = Coordinates("datagrip", "datagrip"),
),
DataSpell(
code = "DS",
maven = null,
binary = Coordinates("python", "dataspell"),
),
FleetBackend(
code = "FLIJ",
maven = Coordinates("com.jetbrains.intellij.fleetBackend", "fleetBackend"),
binary = null,
),
Gateway(
code = "GW",
maven = Coordinates("com.jetbrains.intellij.gateway", "gateway"),
binary = Coordinates("idea/gateway", "JetBrainsGateway"),
),
GoLand(
code = "GO",
maven = Coordinates("com.jetbrains.intellij.goland", "goland"),
binary = Coordinates("go", "goland"),
),
IntellijIdeaCommunity(
code = "IC",
maven = Coordinates("com.jetbrains.intellij.idea", "ideaIC"),
binary = Coordinates("idea", "ideaIC"),
),
IntellijIdeaUltimate(
code = "IU",
maven = Coordinates("com.jetbrains.intellij.idea", "ideaIU"),
binary = Coordinates("idea", "ideaIU"),
),
MPS(
code = "MPS",
maven = null,
binary = Coordinates("mps", "MPS"),
),
PhpStorm(
code = "PS",
maven = Coordinates("com.jetbrains.intellij.phpstorm", "phpstorm"),
binary = Coordinates("webide", "PhpStorm"),
),
PyCharmProfessional(
code = "PY",
maven = Coordinates("com.jetbrains.intellij.pycharm", "pycharmPY"),
binary = Coordinates("python", "pycharm-professional"),
),
PyCharmCommunity(
code = "PC",
maven = Coordinates("com.jetbrains.intellij.pycharm", "pycharmPC"),
binary = Coordinates("python", "pycharm-community"),
),
Rider(
code = "RD",
maven = Coordinates("com.jetbrains.intellij.rider", "riderRD"),
binary = Coordinates("rider", "JetBrains.Rider"),
),
RubyMine(
code = "RM",
maven = null,
binary = Coordinates("ruby", "RubyMine"),
),
RustRover(
code = "RR",
maven = Coordinates("com.jetbrains.intellij.rustrover", "RustRover"),
binary = Coordinates("rustrover", "RustRover"),
),
WebStorm(
code = "WS",
maven = Coordinates("com.jetbrains.intellij.webstorm", "webstorm"),
binary = Coordinates("webstorm", "WebStorm"),
),
Writerside(
code = "WRS",
maven = Coordinates("com.jetbrains.intellij.idea", "writerside"),
binary = Coordinates("writerside", "writerside"),
),
;
companion object {
private val map = values().associateBy(IntelliJPlatformType::code)
/**
* @throws IllegalArgumentException
*/
@Throws(IllegalArgumentException::class)
fun fromCode(code: String) = requireNotNull(map[code]) {
"Specified type '$code' is unknown. Supported values: ${values().joinToString()}"
}
}
override fun toString() = code
}
/**
* @throws IllegalArgumentException
*/
@Throws(IllegalArgumentException::class)
internal fun Any.toIntelliJPlatformType() = when (this) {
is IntelliJPlatformType -> this
is String -> IntelliJPlatformType.fromCode(this)
else -> throw IllegalArgumentException("Invalid argument type: '$javaClass'. Supported types: String or ${IntelliJPlatformType::class.java}")
}