-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
126 lines (109 loc) · 3.07 KB
/
build.gradle.kts
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
import com.jetbrains.plugin.structure.base.utils.isFile
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.changelog.exceptions.MissingVersionException
import org.jetbrains.intellij.platform.gradle.Constants
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import kotlin.io.path.absolute
import kotlin.io.path.isDirectory
plugins {
alias(libs.plugins.changelog)
alias(libs.plugins.gradleIntelliJPlatform)
alias(libs.plugins.gradleJvmWrapper)
alias(libs.plugins.kotlinJvm)
id("java")
}
allprojects {
repositories {
mavenCentral()
}
}
repositories {
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
val pluginVersion: String by project
val riderSdkVersion: String by project
val untilBuildVersion: String by project
val buildConfiguration: String by project
version = pluginVersion
val riderSdkPath by lazy {
val path = intellijPlatform.platformPath.resolve("lib/DotNetSdkForRdPlugins").absolute()
if (!path.isDirectory()) error("$path does not exist or not a directory")
println("Rider SDK path: $path")
return@lazy path
}
dependencies {
intellijPlatform {
rider(riderSdkVersion)
jetbrainsRuntime()
instrumentationTools()
testFramework(TestFrameworkType.Platform.Bundled)
}
testImplementation(libs.openTest4J)
}
kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
sourceSets {
main {
kotlin.srcDir("src/rider/generated/kotlin")
kotlin.srcDir("src/rider/main/kotlin")
resources.srcDir("src/rider/main/resources")
}
}
tasks {
patchPluginXml {
untilBuild.set(untilBuildVersion)
val latestChangelog = try {
changelog.getUnreleased()
} catch (_: MissingVersionException) {
changelog.getLatest()
}
changeNotes.set(provider {
changelog.renderItem(
latestChangelog
.withHeader(false)
.withEmptySections(false),
org.jetbrains.changelog.Changelog.OutputType.HTML
)
})
}
runIde {
jvmArgs("-Xmx1500m")
}
test {
useTestNG()
testLogging {
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
environment["LOCAL_ENV_RUN"] = "true"
}
}
val riderModel: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}
artifacts {
add(riderModel.name, provider {
intellijPlatform.platformPath.resolve("lib/rd/rider-model.jar").also {
check(it.isFile) {
"rider-model.jar is not found at $riderModel"
}
}
}) {
builtBy(Constants.Tasks.INITIALIZE_INTELLIJ_PLATFORM_PLUGIN)
}
}
fun File.writeTextIfChanged(content: String) {
val bytes = content.toByteArray()
if (!exists() || !readBytes().contentEquals(bytes)) {
println("Writing $path")
parentFile.mkdirs()
writeBytes(bytes)
}
}