-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
189 lines (160 loc) · 5.83 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
//
//lintOptions {
// abortOnError false
//}
plugins {
id "org.jetbrains.intellij" version "$ijpVersion"
id "org.jetbrains.grammarkit" version "$grammarKitVersion"
}
//compileOptions {
// sourceCompatibility JavaVersion.VERSION_11
// targetCompatibility JavaVersion.VERSION_11
//}
group 'lang.plugin.idea'
version "$pluginVersion"
apply plugin: 'java'
//def sinceBuildVersion = "${sinceBuildVersion}"
//def untilBuildVersion = "${untilBuildVersion}"
//repositories {
// mavenLocal()
// maven {
// url "http://maven.aliyun.com/nexus/content/groups/public"
// }
// mavenCentral()
//}
dependencies {
implementation 'org.jetbrains:annotations:24.0.0'
implementation 'com.googlecode.aviator:aviator:5.3.3'
// testCompile group: 'junit', name: 'junit', version: '4.12'
// compile group: 'com.googlecode.aviator', name: 'aviator', version: aviatorVersion
// compile group: 'org.jetbrains', name: 'annotations', version: '24.0.0'
}
processResources {
include('**')
setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
}
sourceSets {
main {
java {
srcDir 'src/main/gen'
srcDir 'src/main/java'
// srcDir 'src/main/gen-bnf'
srcDir 'src/main/gen-flex'
}
resources {
srcDir 'src/main/resources'
}
}
test {
java {
srcDir 'src/test/java'
}
resources {
srcDir 'src/test/resources'
}
}
}
apply plugin: 'idea'
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version = ideaVersion
plugins = ['java']
//不更新,强制指定,避免误更新版本号
updateSinceUntilBuild = false
}
//plugins {
// id "org.jetbrains.grammarkit" version "2022.3.1"
//}
// import is optional to make task creation easier
import org.jetbrains.grammarkit.tasks.*
//https://github.com/JetBrains/gradle-grammar-kit-plugin
grammarKit {
// version of IntelliJ patched JFlex (see bintray link below), Default is 1.7.0-1
// https://github.com/JetBrains/intellij-deps-jflex/releases
jflexRelease = '1.9.0'
// tag or short commit hash of Grammar-Kit to use (see link below). Default is 2020.1
grammarKitRelease = '2022.3.1'
intellijRelease = "2023.1"
}
//dependencies {
// implementation 'org.jetbrains:annotations:24.0.0'
//// testCompile group: 'junit', name: 'junit', version: '4.12'
// compile group: 'com.googlecode.aviator', name: 'aviator', version: aviatorVersion
//}
// 文档:https://plugins.jetbrains.com/docs/intellij/tools-gradle-grammar-kit-plugin.html#tasks
task generateBnf() {
generateLexer() {
// source flex file
source = "src/main/my/grammar/_MyLanguageLexer.flex"
// target directory for lexer
targetDir = "src/main/gen-flex/my/lang/parser"
// target classname, target file will be targetDir/targetClass.java
targetClass = "_MyLanguageLexer"
// optional, path to the task-specific skeleton file. Default: none
skeleton.set(new File('src/main/my/flex/idea-flex.skeleton'))
// if set, plugin will remove a lexer output file before generating new one. Default: false
purgeOldFiles = true
}
}
task generateJflex() {
generateParser() {
// source bnf file
source = "src/main/my/grammar/my.bnf"
// optional, task-specific root for the generated files. Default: none
targetRoot = 'src/main/gen-bnf'
// path to a parser file, relative to the targetRoot
pathToParser = 'my/lang/parser/MyLanguageParser.java'
// path to a directory with generated psi files, relative to the targetRoot
pathToPsiRoot = 'my/lang/psi'
// if set, plugin will remove a parser output file and psi output directory before generating new ones. Default: false
purgeOldFiles = true
}
}
task generateLangAndRunIde() {
dependsOn generateBnf, generateJflex, runIde
}
//task myBuildPlugin {
// dependsOn buildPlugin
//}
//apply plugin: 'java'
task myRun(type: JavaExec, dependsOn: 'classes') {
classpath sourceSets.main.runtimeClasspath
mainClass = "my.lang.action.RunCodeAction"
args "arg1"
}
//patchPluginXml {
// sinceBuild "${sinceBuildVersion}"
// untilBuild "${untilBuildVersion}"
//
// changeNotes """
// <br/>
//
// AviatorScript update list:<br/>
// <br/>
//
// <ul>
// <li>5.3.3-2023.03.20, update AviatorScript to 5.3.3</li>
// <li>5.2.2, Fixed Expression#getVariableNames() returns wrong result, added Feature.StaticMethods, Feature.StaticFields etc.</li>
// <li>5.2.1, Fixed memory leak in reflector, supports calling static method directly etc.</li>
// <li>5.2.0, supports overload function, variadic function,use statement and more sequence/math functions.</li>
// <li>5.1.4, fixed compiling string interpolation lexeme without caching(may cause FGC) etc.</li>
// <li>5.1.3, supports exponent operator ** and EnvProcessor hooks etc.</li>
// <li>5.1.2, don't override __exp__ to user passed-in env.</li>
// <li>5.1.1, fixed == and != operator working with variable syntax sugar such as a.b.c may return wrong result, it's recommended to upgrade.</li>
// </ul>
// <br/>
//
// AviatorScript IDEA plugin update list:<br/>
// <br/>
//
// <ul>
// <li>5.3.3-2023.03.20, update AviatorScript to 5.3.3</li>
// <li>5.2.2-2021.01.14, update AviatorScript to 5.2.2</li>
// <li>203-5.2.1-2020.12.19, support IDEA-202.3 and update AviatorScript to 5.2.1</li>
// <li>5.2.0-2020.11.20, update AviatorScript to 5.2.0</li>
// <li>2020.11.07, support AviatorScript comment</li>
// <li>2020.11.03, support AviatorScript highlight, grammar check and execute</li>
// </ul>
//
// """
//}