This repository has been archived by the owner on Mar 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
150 lines (124 loc) · 4.17 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
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
maven { url 'https://www.myget.org/F/rd-snapshots/maven/' }
mavenCentral()
}
dependencies {
classpath("com.jetbrains.rd:rd-gen:0.192.2")
}
}
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
id 'org.jetbrains.intellij' version '0.4.9'
}
ext {
isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
rdLibDirectory = new File(rootDir, "build/riderRD-${ProductVersion}/lib/rd")
}
repositories {
maven { url 'https://cache-redirector.jetbrains.com/intellij-repository/snapshots' }
maven { url 'https://cache-redirector.jetbrains.com/maven-central' }
flatDir { dirs rdLibDirectory.absolutePath }
}
wrapper {
gradleVersion = '4.9'
distributionType = Wrapper.DistributionType.ALL
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
version = ext.PluginVersion
if (ext.has("username")) intellij.publish.username = ext.username
if (ext.has("password")) intellij.publish.password = ext.password
sourceSets {
main {
java.srcDir 'src/rider/main/kotlin'
resources.srcDir 'src/rider/main/resources'
}
}
compileKotlin {
kotlinOptions { jvmTarget = "1.8" }
}
task compileDotNet {
doLast {
exec {
executable "dotnet"
args "msbuild","/t:Restore;Rebuild","${DotnetSolution}","/p:Configuration=${BuildConfiguration}"
workingDir rootDir
}
}
}
buildPlugin {
outputs.upToDateWhen { false }
doLast {
copy {
from "${buildDir}/distributions/${rootProject.name}-${version}.zip"
into "${rootDir}/output"
}
def changelogText = file("${rootDir}/CHANGELOG.md").text
def changelogMatches = changelogText =~ /(?s)(-.+?)(?=##|$)/
def changeNotes = changelogMatches.collect {
it[1].replaceAll(/(?s)- /, "\u2022 ").replaceAll(/`/, "").replaceAll(/,/, "%2C")
}.take(1).join("")
exec {
executable "dotnet"
args "msbuild","/t:Pack","${DotnetSolution}","/p:Configuration=${BuildConfiguration}","/p:PackageOutputPath=${rootDir}/output","/p:PackageReleaseNotes=${changeNotes}","/p:PackageVersion=${version}"
}
}
}
intellij {
type = 'RD'
version = "${ProductVersion}"
downloadSources = false
instrumentCode = false
}
apply plugin: 'com.jetbrains.rdgen'
rdgen {
def modelDir = new File(rootDir, "protocol/src/main/kotlin/model")
def csOutput = new File(rootDir, "src/dotnet/${DotnetPluginId}/Rider")
def ktOutput = new File(rootDir, "src/rider/main/kotlin/com/jetbrains/rider/plugins/${RiderPluginId.replace('.','/').toLowerCase()}")
verbose = true
classpath "${rdLibDirectory}/rider-model.jar"
sources "${modelDir}/rider"
hashFolder = "${buildDir}"
packages = "model.rider"
generator {
language = "kotlin"
transform = "asis"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "com.jetbrains.rider.model"
directory = "$ktOutput"
}
generator {
language = "csharp"
transform = "reversed"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "JetBrains.Rider.Model"
directory = "$csOutput"
}
}
patchPluginXml {
def changelogText = file("${rootDir}/CHANGELOG.md").text
def changelogMatches = changelogText =~ /(?s)(-.+?)(?=##|$)/
changeNotes = changelogMatches.collect {
it[1].replaceAll(/(?s)\r?\n/, "<br />\n")
}.take(1).join('')
}
prepareSandbox {
dependsOn compileDotNet
def outputFolder = "${rootDir}/src/dotnet/${DotnetPluginId}/bin/${DotnetPluginId}.Rider/${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")
})
}
}