forked from ForNeVeR/AvaloniaRider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (141 loc) · 4.38 KB
/
build.gradle
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
buildscript {
repositories {
maven { setUrl("https://cache-redirector.jetbrains.com/www.myget.org/F/rd-snapshots/maven") }
mavenCentral()
}
// https://www.myget.org/feed/rd-snapshots/package/maven/com.jetbrains.rd/rd-gen
dependencies { classpath "com.jetbrains.rd:rd-gen:0.201.78" }
}
plugins {
id 'java'
id 'me.filippov.gradle.jvm.wrapper' version '0.9.3'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'org.jetbrains.intellij' version '0.4.16'
}
dependencies {
implementation 'de.undercouch:bson4jackson:2.9.2'
testImplementation 'org.testng:testng:6.14.3'
}
ext {
pluginVersionBase = '1.0.0'
sdkVersion = '2020.3-SNAPSHOT'
rdLibDirectory = {
new File(intellij.ideaDependency.classes, "lib/rd")
}
dotNetDir = new File(projectDir, "src/dotnet")
dotNetPluginId = "AvaloniaRider.Plugin"
}
repositories {
mavenCentral()
}
wrapper {
gradleVersion = '6.1.1'
distributionType = Wrapper.DistributionType.ALL
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
jvmWrapper {
// https://confluence.jetbrains.com/display/JBR/Release+notes
linuxJvmUrl = 'https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_6-linux-x64-b765.15.tar.gz'
macJvmUrl = 'https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_6-osx-x64-b765.15.tar.gz'
windowsJvmUrl = 'https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_6-windows-x64-b765.15.tar.gz'
}
if (!ext.has("BuildConfiguration"))
ext.BuildConfiguration = "Debug"
if (ext.has('buildNumber'))
ext.version = "$ext.pluginVersionBase.$ext.buildNumber"
else
ext.version = "$ext.pluginVersionBase.0"
if (ext.has("username"))
intellij.publish.username = ext.username
if (ext.has("password"))
intellij.publish.password = ext.password
version ext.version
sourceSets {
main {
java.srcDir 'src/rider/main/kotlin'
resources.srcDir 'src/rider/main/resources'
}
}
compileKotlin {
dependsOn 'rdgen'
kotlinOptions { jvmTarget = "1.8" }
}
task compileDotNet {
dependsOn 'rdgen'
doLast {
exec {
executable "dotnet"
args "build", "-c", BuildConfiguration
}
}
}
buildPlugin {
dependsOn compileDotNet
}
intellij {
type = 'RD'
version = "$sdkVersion"
downloadSources = false
}
runIde {
jvmArgs '-Xmx1500m'
}
test {
useTestNG()
}
apply plugin: 'com.jetbrains.rdgen'
rdgen {
def modelDir = new File(projectDir, "protocol/src/main/kotlin/model")
def csOutput = new File(projectDir, "src/dotnet/AvaloniaRider.Plugin/Model")
def ktOutput = new File(projectDir, "src/rider/main/kotlin/model")
verbose = true
classpath {
"${rdLibDirectory()}/rider-model.jar"
}
sources "$modelDir/rider"
hashFolder = "$rootDir/build/rdgen/rider"
packages = "model.rider"
generator {
language = "kotlin"
transform = "asis"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "me.fornever.avaloniarider.model"
directory = "$ktOutput"
}
generator {
language = "csharp"
transform = "reversed"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "AvaloniaRider.Model"
directory = "$csOutput"
}
}
patchPluginXml {
sinceBuild = '203.4818' // 2020.3 EAP4
untilBuild = null
def changelogText = file("$projectDir/CHANGELOG.md").text
def changelogMatches = changelogText =~ /(?s)##(.+?)(.+?)(?=##|$)/
changeNotes = changelogMatches.collect {
def versionTitle = it[1]
def versionText = it[2].replaceAll(/(?s)\r?\n/, "<br />\n")
"<b>$versionTitle</b>$versionText"
}.take(10).join('')
}
prepareSandbox {
def outputFolder = "$dotNetDir/$dotNetPluginId/bin/${dotNetPluginId}/$BuildConfiguration"
def dllFiles = [
"$outputFolder/${dotNetPluginId}.dll",
"$outputFolder/${dotNetPluginId}.pdb"
]
dllFiles.forEach({ f ->
def file = file(f)
from(file, { into "$intellij.pluginName/dotnet" })
})
doLast {
dllFiles.forEach({ f ->
def file = file(f)
if (!file.exists()) throw new RuntimeException("File $file does not exist")
})
}
}
buildSearchableOptions.enabled = false