-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild.gradle
116 lines (97 loc) · 3.59 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
apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
def intellij_libs = fileTree(dir: libraries_intellij + "lib/", include: '*.jar')
dependencies {
println 'Compiling classes, using intelliJ at ' + intellij_libs
compile intellij_libs
}
sourceSets {
main {
java {
srcDir 'src/java/main'
srcDir 'gen'
srcDir 'src/flex'
}
resources {
srcDir 'src/java/main/'
include '**/*.properties'
include '**/*.png'
}
}
test {
java {
srcDir 'src/java/test'
}
resources {
srcDir 'src/rust/test'
include '**/*.properties'
include '**/*.png'
}
}
}
// Build Lexer
task generateLexer(type: JavaExec) {
main = "JFlex.Main"
classpath = files(file("src/flex/JFlex.jar"))
args = ["-sliceandcharat", "--skel", "src/flex/idea-flex.skeleton", "src/flex/vektah/rust/RustLexer.flex"]
}
// Build grammar
task grammar(type: JavaExec, dependsOn: generateLexer) {
main = "org.intellij.grammar.Main"
classpath = intellij_libs.plus(files(file("grammar-kit.jar")))
args = ["gen", "src${File.separator}bnf${File.separator}RustGrammar.bnf"]
}
task cleanGrammar(type: Delete) {
delete 'gen/vektah.rust', 'src/flex/vektah/rust/RustLexer.java'
}
tasks.withType(Test) {
systemProperty 'rust.source', rust_source
systemProperty 'rust.binary', rust_binary
afterSuite { desc, result ->
if (!desc.parent) {
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
jar {
def buildNumber = System.env.BUILD_NUMBER?.toInteger()
from("META-INF") {
include 'plugin.xml' into "META-INF" filter { String line -> buildNumber != null ? line.replaceAll("<version>(.+)</version>", "<version>\$1-${String.format("%08d", buildNumber)}</version>") : line }
}
from "src/main/resources"
}
task copyIntoIdea(dependsOn: build, type: Copy) {
into "build/run/plugins/"
from jar.archivePath
}
task runIdea(type: JavaExec, dependsOn: copyIntoIdea) {
main = "com.intellij.idea.Main"
classpath = intellij_libs.plus(files("$System.env.JAVA_HOME/lib/tools.jar"))
systemProperty "idea.config.path", "build/run/config"
systemProperty "idea.system.path", "build/run/system"
systemProperty "idea.plugins.path", "build/run/plugins"
systemProperty "idea.launcher.port", "8998"
systemProperty "idea.launcher.bin.path", libraries_intellij + "bin/"
}
task debugIdea(type: JavaExec, dependsOn: copyIntoIdea) {
main = "com.intellij.idea.Main"
classpath = intellij_libs.plus(files("$System.env.JAVA_HOME/lib/tools.jar"))
systemProperty "idea.config.path", "build/run/config"
systemProperty "idea.system.path", "build/run/system"
systemProperty "idea.plugins.path", "build/run/plugins"
systemProperty "idea.launcher.port", "8998"
systemProperty "idea.launcher.bin.path", libraries_intellij + "bin/"
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
}
//For CI / publishing
task copyPluginVersion(type: Copy) {
def buildNumber = System.env.BUILD_NUMBER?.toInteger()
into("/var/www/html")
from("META-INF/plugin.xml")
filter { String line -> buildNumber != null ? line.replaceAll("<version>(.+)</version>", "<version>\$1-${String.format("%08d", buildNumber)}</version>") : line }
}
task copyArtifact(type: Copy, dependsOn: build) {
into("/var/www/html")
from jar.archivePath
}