forked from leinardi/pylint-pycharm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
143 lines (127 loc) · 4.7 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
/*
* Copyright 2018 Roberto Leinardi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.commonmark.node.Node
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
buildscript {
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
classpath 'com.atlassian.commonmark:commonmark:0.11.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'org.jetbrains.intellij' version '0.3.11'
id 'net.ltgt.errorprone' version '0.0.16'
id 'idea'
id 'java'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.20.0'
id 'se.bjurr.violations.violation-comments-to-github-gradle-plugin' version '1.49'
}
checkstyle {
ignoreFailures = false // Whether this task will ignore failures and continue running the build.
configFile rootProject.file('config/checkstyle/checkstyle.xml')
// The Checkstyle configuration file to use.
toolVersion = '8.12' // The version of Checkstyle you want to be used
}
def hasPyCharm = project.hasProperty('pycharmPath')
def hasPythonPlugin = project.hasProperty('pythonPlugin')
def props = new Properties()
rootProject.file('src/main/resources/com/leinardi/pycharm/pylint/PylintBundle.properties')
.withInputStream {
props.load(it)
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
}
group 'com.leinardi.pycharm'
version version
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
intellij {
version ideaVersion
pluginName props.getProperty('plugin.name').toLowerCase().replace(' ', '-')
downloadSources Boolean.valueOf(downloadIdeaSources)
updateSinceUntilBuild = true
if (hasPyCharm) {
alternativeIdePath pycharmPath
} else if (hasPythonPlugin) {
plugins += [pythonPlugin]
} else {
throw new StopActionException('Define either pycharmPath or pythonPlugin in your gradle.properties')
}
}
patchPluginXml {
version project.property('version')
sinceBuild project.property('sinceBuild')
untilBuild project.property('untilBuild')
pluginDescription props.getProperty('plugin.Pylint-PyCharm.description')
changeNotes getChangelogHtml()
}
publishPlugin {
def publishPassword = project.hasProperty('jetbrainsPublishPassword') ? jetbrainsPublishPassword : ""
username publishUsername
password publishPassword
channels publishChannels
}
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
if (hasPyCharm) {
flatDir {
dirs "$pycharmPath/lib"
}
}
}
dependencies {
if (hasPyCharm) {
compileOnly name: 'pycharm'
}
compile 'com.squareup.moshi:moshi:1.7.0'
errorprone 'com.google.errorprone:error_prone_core:2.3.1'
}
def getChangelogHtml() {
Parser parser = Parser.builder().build()
Node document = parser.parseReader(rootProject.file('CHANGELOG.md').newReader())
HtmlRenderer renderer = HtmlRenderer.builder().build()
renderer.render(document.firstChild.next)
}
check.dependsOn(verifyPlugin)
task violationCommentsToGitHub(type: se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubTask) {
repositoryOwner = "leinardi"
repositoryName = "pylint-pycharm"
pullRequestId = System.properties['GITHUB_PULLREQUESTID']
oAuth2Token = System.properties['GITHUB_OAUTH2TOKEN']
gitHubUrl = "https://api.github.com/"
createCommentWithAllSingleFileComments = false
createSingleFileComments = true
commentOnlyChangedContent = true
violations = [
["FINDBUGS", ".", ".*/reports/findbugs/.*\\.xml\$", "Findbugs"],
["CHECKSTYLE", ".", ".*/reports/checkstyle/.*debug\\.xml\$", "Checkstyle"],
["ANDROIDLINT", ".", ".*/reports/lint-results.*\\.xml\$", "Android Lint"],
["GOOGLEERRORPRONE", ".", ".*/build.log\$", "Error Prone"]
]
}