-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (130 loc) · 5.53 KB
/
Copy pathbuild.gradle
File metadata and controls
165 lines (130 loc) · 5.53 KB
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
plugins {
id 'java'
id "org.jetbrains.intellij" version "1.5.3"
id "org.jetbrains.grammarkit" version "2021.2.1"
}
sourceCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
implementation 'org.scala-lang:scala-library:2.13.4'
//testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation "org.scala-lang:scala-library:2.13.4"
// https://mvnrepository.com/artifact/org.scala-lang/scala-compiler
implementation group: 'org.scala-lang', name: 'scala-compiler', version: '2.13.4'
// https://mvnrepository.com/artifact/org.scala-lang/scala-library
implementation group: 'org.scala-lang', name: 'scala-library', version: '2.13.4'
// https://mvnrepository.com/artifact/org.scala-lang.modules/scala-parser-combinators
implementation group: 'org.scala-lang.modules', name: 'scala-parser-combinators_2.13', version: '1.2.0-M1'
// https://mvnrepository.com/artifact/org.scala-lang/scala-reflect
implementation group: 'org.scala-lang', name: 'scala-reflect', version: '2.13.4'
//compile files('lib/scala-reflect.jar')
implementation files('lib/forms_rt.jar')
// https://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml
implementation group: 'org.scala-lang.modules', name: 'scala-xml_2.13', version: '2.0.0-M3'
// compile files(fileTree(dir: 'lib', includes: ['*.jar']))
// compile files("mmt.jar") // For debugging purposes only!
}
apply plugin: 'org.jetbrains.intellij'
intellij {
version = '2022.2'
pluginName = 'MMT'
plugins = ['org.intellij.scala:2022.1.13','java']
}
group 'info.kwarc.mmt.intellij'
version '22.0.0.7'
patchPluginXml {
changeNotes = """
<ul>
<li>Support for IntelliJ 2022.2</li>
</ul>
"""
// See [1-2] for what the numbers encode and esp. [2] to get the actual numbers
//
// [1]: https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
// [2]: https://www.jetbrains.com/idea/download/other.html
//sinceBuild "203"
//untilBuild "204"
}
apply plugin: 'scala'
sourceSets {
main {
java { // Explicitly set to empty list! Im particular,
// - do NOT include sources in src/main/java
// - do NOT include sources in src/main/gen
// since both sources refer to Scala sources in src/main/scala.
// Hence, the Scala compiler must take care of compiling both.
srcDirs = []
}
scala {
// Even though we later 'src/main/gen' as a "generated sources dir"
// in this Gradle file, we need to first add it here to make the former
// work!
// Related: https://discuss.gradle.org/t/how-do-i-get-intellij-to-recognize-gradle-generated-sources-dir/16847/5
srcDirs = ['src/main/scala', 'src/main/java', 'src/main/gen']
}
}
}
apply plugin: 'idea'
idea {
module {
generatedSourceDirs += file('src/main/gen')
}
}
def publishCredentialsPropertiesFile = file("gradle.properties")
if(publishCredentialsPropertiesFile.exists()) {
apply from: publishCredentialsPropertiesFile.path
publishPlugin {
// channels 'devel'
token = intellijPublishToken
}
} else {
logger.warn(publishCredentialsPropertiesFile.path + " does not exist, publishPlugin task will not be created! Copy gradle.properties.template in the same folder to gradle.properties and configure its contents. See file contents for more info.")
}
/*
Non-working automation of grammar creation
===========================================
apply plugin: 'org.jetbrains.grammarkit'
// import is optional to make task creation easier
// Even though IntelliJ marks this import as useless, it is not!
import org.jetbrains.grammarkit.tasks.*
grammarKit {
// see https://bintray.com/jetbrains/intellij-third-party-dependencies/jflex for latest version
jflexRelease = '1.7.0-2'
grammarKitRelease = '2020.1'
}
task generateMMTLexer(type: GenerateLexer) {
// source flex file
source = "src/main/scala/info/kwarc/mmt/intellij/language/psi/mmt.flex"
// target directory for lexer
targetDir = "src/main/gen/info/kwarc/mmt/intellij/language/"
// target classname, target file will be targetDir/targetClass.java
targetClass = "MMTLexer"
purgeOldFiles = true
}
task generateMMTParser(type: GenerateParser) {
// source bnf file
source = "src/main/scala/info/kwarc/mmt/intellij/language/psi/mmt.bnf"
// optional, task-specific root for the generated files. Default: none
targetRoot = 'src/main/gen'
// path to a parser file, relative to the targetRoot
pathToParser = '/info/kwarc/mmt/intellij/language/MMTParser.java'
// path to a directory with generated psi files, relative to the targetRoot
pathToPsiRoot = '/info/kwarc/mmt/intellij/language/psi'
// if set, plugin will remove a parser output file and psi output directory before generating new ones. Default: false
purgeOldFiles = true
}
tasks.register("_regenerateParserLExer") {
group = 'intellij'
description = 'Regenerates parser and lexer code for the MMT language; execute before the task runIde'
generateMMTLexer.mustRunAfter(generateMMTParser)
dependsOn([generateMMTParser, generateMMTLexer])
doLast {
String mmtLexerFilename = 'src/main/gen/info/kwarc/mmt/intellij/language/MMTLexer.java'
String fileContents = new File(mmtLexerFilename).getText('UTF-8')
// add missing import somehow:
fileContents.replace("import...")
println fileContents
}
}*/