@@ -11,11 +11,18 @@ import scala.collection.mutable
11
11
object AttributedClasspathTasks {
12
12
13
13
import Artifacts .*
14
- import Modules .*
15
14
16
15
private val INTELLIJ_SDK_ARTIFACT_NAME = " INTELLIJ-SDK"
17
16
private val INTELLIJ_SDK_TEST_ARTIFACT_NAME : String = " INTELLIJ-SDK-TEST"
18
17
18
+ // These special classifiers have a special handling logic in Scala plugin and DevKit plugin
19
+ // See org.jetbrains.sbt.project.SbtProjectResolver.IJ_SDK_CLASSIFIERS
20
+ // See https://youtrack.jetbrains.com/issue/SCL-17415 (though it doesn't have many details)
21
+ // NOTE: it seems like it's some legacy and DevKit doesn't actually need this, but it's not 100%
22
+ // same classifier is used for both main and test jars
23
+ private val IJ_SDK_CLASSIFIER = " IJ-SDK"
24
+ private val IJ_PLUGIN_CLASSIFIER = " IJ-PLUGIN"
25
+
19
26
object Artifacts {
20
27
private val intellijMainJarsHashToArtifactSuffix = mutable.Map [Int , String ]()
21
28
@@ -24,6 +31,9 @@ object AttributedClasspathTasks {
24
31
* (it better shouldn't be so, but it might occur accidentally, e.g., due to misconfiguration)<br>
25
32
* In this case, we want to create different libraries.<br>
26
33
* For this we need unique names
34
+ *
35
+ * @return 1. empty string in the simplest case, when all modules depend on the same set of jars from the platform<br>
36
+ * 2. jars hash code otherwise
27
37
*/
28
38
private def getUniqueArtifactSuffix (jars : Seq [File ], cache : mutable.Map [Int , String ]): String =
29
39
cache.synchronized {
@@ -36,29 +46,34 @@ object AttributedClasspathTasks {
36
46
}
37
47
38
48
def ideaMainJarsArtifact (intellijMainJarsValue : Seq [File ]): Artifact = {
49
+ // should be empty in simple cases
39
50
val artifactSuffix = getUniqueArtifactSuffix(intellijMainJarsValue, intellijMainJarsHashToArtifactSuffix)
40
- Artifact (INTELLIJ_SDK_ARTIFACT_NAME , s " IJ-SDK $ artifactSuffix" )
51
+ Artifact (name = INTELLIJ_SDK_ARTIFACT_NAME + artifactSuffix, classifier = IJ_SDK_CLASSIFIER )
41
52
}
42
53
43
54
val ideaTestArtifact : Artifact =
44
- Artifact (INTELLIJ_SDK_TEST_ARTIFACT_NAME , " IJ-SDK-TEST " )
55
+ Artifact (name = INTELLIJ_SDK_TEST_ARTIFACT_NAME , classifier = IJ_SDK_CLASSIFIER )
45
56
46
57
val ideaSourcesArtifact : Artifact =
47
- Artifact (INTELLIJ_SDK_ARTIFACT_NAME , Artifact .SourceType , " zip" , " IJ-SDK" )
58
+ Artifact (name = INTELLIJ_SDK_ARTIFACT_NAME , `type` = Artifact .SourceType , extension = " zip" , classifier = IJ_SDK_CLASSIFIER )
59
+
60
+ val ideaTestSourcesArtifact : Artifact =
61
+ Artifact (name = INTELLIJ_SDK_TEST_ARTIFACT_NAME , `type` = Artifact .SourceType , extension = " zip" , classifier = IJ_SDK_CLASSIFIER )
62
+
48
63
49
64
def pluginArtifact (descriptor : PluginDescriptor ): Artifact =
50
- Artifact (s " IJ-PLUGIN[ ${descriptor.id}] " , " IJ-PLUGIN " )
65
+ Artifact (name = s " IJ-PLUGIN[ ${descriptor.id}] " , classifier = IJ_PLUGIN_CLASSIFIER )
51
66
52
67
def pluginSourcesArtifact (pluginName : String ): Artifact =
53
- Artifact (pluginName, Artifact .SourceType , " zip" , Artifact . SourceClassifier )
68
+ Artifact (name = pluginName, `type` = Artifact .SourceType , extension = " zip" , classifier = IJ_PLUGIN_CLASSIFIER )
54
69
}
55
70
56
71
object Modules {
57
72
def getIntellijSdkModule (buildNumber : String ): ModuleID =
58
73
" org.jetbrains" % INTELLIJ_SDK_ARTIFACT_NAME % buildNumber withSources()
59
74
60
75
def getIntellijSdkTestModule (buildNumber : String ): ModuleID =
61
- " org.jetbrains" % INTELLIJ_SDK_TEST_ARTIFACT_NAME % buildNumber % Test
76
+ " org.jetbrains" % INTELLIJ_SDK_TEST_ARTIFACT_NAME % buildNumber % Test withSources()
62
77
}
63
78
64
79
// ======= ATTRIBUTED CLASSPATH =======
@@ -79,7 +94,7 @@ object AttributedClasspathTasks {
79
94
buildNumber : String
80
95
): Classpath = {
81
96
val artifact = ideaMainJarsArtifact(jars)
82
- val module = getIntellijSdkModule(buildNumber)
97
+ val module = Modules . getIntellijSdkModule(buildNumber)
83
98
buildAttributedClasspath(jars)(artifact, module, Compile )
84
99
}
85
100
@@ -88,7 +103,7 @@ object AttributedClasspathTasks {
88
103
buildNumber : String
89
104
): Classpath = {
90
105
val artifact = ideaTestArtifact
91
- val module = getIntellijSdkTestModule(buildNumber)
106
+ val module = Modules . getIntellijSdkTestModule(buildNumber)
92
107
buildAttributedClasspath(jars)(artifact, module, Test )
93
108
}
94
109
0 commit comments