forked from asciidoctor/asciidoctor-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
154 lines (134 loc) · 4.66 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
buildscript {
repositories {
jcenter()
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
}
}
plugins {
id "org.jetbrains.intellij" version "0.4.8"
id "org.jetbrains.grammarkit" version "2018.2.2"
id "checkstyle"
id 'org.asciidoctor.jvm.convert' version '2.2.0'
// once windows classpaths get too long, use this dependency to make them shorter again
// id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
id 'net.ltgt.errorprone' version '0.8.1' apply false
}
checkstyle {
toolVersion '8.20'
}
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'org.jetbrains.grammarkit'
apply plugin: 'java'
apply plugin: 'net.ltgt.errorprone'
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jsoup.Jsoup
allprojects {
repositories {
jcenter()
}
}
intellij {
// we support IC-2017.2, but PsiViewer is not available for the older version, therefore se IC-2018.1 to run it
version 'IC-2018.1'
pluginName 'asciidoctor'
updateSinceUntilBuild false
plugins = [
'PsiViewer:2018.1.2', // used for debugging
'PlantUML integration:2.12.1' // used to test highlighting of plantuml diagrams
]
}
asciidoctor {
sourceDir file('.')
sources {
include 'CHANGELOG.adoc'
}
outputDir file('build/docs')
}
patchPluginXml {
dependsOn asciidoctor
version System.getenv('TRAVIS_TAG')
changeNotes = {
Jsoup.parse(file('build/docs/CHANGELOG.html').getText('UTF-8'))
.select("#releasenotes").get(0).nextElementSibling().children()
.subList(0, 20)
.stream().map { e ->
e.html()
.replaceAll('\\(preview, available from Github releases\\)', '')
.replaceAll('#([0-9]+)', '<a href="https://github.com/asciidoctor/asciidoctor-intellij-plugin/issues/$1">#$1</a>')
// regex for GitHub user names from https://github.com/shinnn/github-username-regex
.replaceAll('@([a-z\\d](?:[a-z\\d]|-(?=[a-z\\d])){0,38})', '<a href="https://github.com/$1">@$1</a>')
}
.collect().join("\n")
}
pluginDescription "${file('src/main/resources/META-INF/description.html').getText('UTF-8')}"
}
runIde {
jvmArgs = ['-Xmx1024m']
}
publishPlugin {
username 'ahus1'
token System.getenv('PLUGIN_REPO_TOKEN')
channels 'eap'
}
test {
testLogging {
// this show the full exception on failed tests on travis
exceptionFormat = 'full'
}
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
compile 'org.asciidoctor:asciidoctorj-diagram:1.5.18'
compile 'org.asciidoctor:asciidoctorj-pdf:1.5.0-beta.6'
compile 'org.jruby:jruby:9.2.8.0' // TODO: remove JRuby dependency once asciidoctorj has upgraded
/* snakeyaml is s used by asciidoctorj-pdf, but is actually provided within jruby-stdlib
* a snakeyaml version in the classpath takes precedence, but IntelliJ includes a version that is too old
* therefore this plugin includes the same version of snakeyaml that is already included in jruby-stdlib
* to prevent loading the older version from IntelliJ.
* When a different version than jruby-stdlib 9.2.7.0 is used after upgrading asciidoctorj,
* double check the snakeyaml version.
* https://github.com/asciidoctor/asciidoctorj-pdf/issues/25
*/
compile 'org.yaml:snakeyaml:1.23'
compile 'org.asciidoctor:asciidoctorj:2.1.0'
compile 'commons-io:commons-io:2.4'
compile 'nl.jworks.markdown_to_asciidoc:markdown_to_asciidoc:1.1'
compile 'org.apache.commons:commons-text:1.8'
testCompile 'junit:junit:4.12'
testCompile 'com.tngtech.archunit:archunit-junit4:0.10.2'
}
def genRoot = file('gen')
sourceSets {
main {
java.srcDirs project.files(genRoot)
resources {
exclude('META-INF/description.html')
}
}
}
grammarKit {
// version of IntelliJ patched JFlex (see bintray link below), Default is 1.7.0-1
jflexRelease = '1.7.0-1'
// tag or short commit hash of Grammar-Kit to use (see link below). Default is 2017.1.6
grammarKitRelease = '6452fde524'
}
task generateAsciidocLexer(type: GenerateLexer) {
source = "src/main/java/org/asciidoc/intellij/lexer/asciidoc.flex"
targetDir = "gen/org/asciidoc/intellij/lexer"
targetClass = "_AsciiDocLexer"
purgeOldFiles = true
}
compileJava {
options.errorprone.excludedPaths = '.*_AsciiDocLexer.*'
options.errorprone.error('StreamResourceLeak') // enforce errors where there would be warning in the standard only
dependsOn generateAsciidocLexer
}
task checkUpdates(type: DependencyUpdatesTask) {
description = "check denpendency updates"
group = "check"
}