Skip to content

Commit

Permalink
Configure issue/PR URLs in IntelliJ via Gradle (#229 / #262)
Browse files Browse the repository at this point in the history
Configure Gradle to configure IntelliJ to link issue and PR numbers
to GitHub. This is implemented with a build.gradle file because we
found it easier to manipulate XML with. A rewrite in Kotlin should
be evaluated in the future.

Closes: #229
PR: #262
  • Loading branch information
aepfli committed Jun 20, 2020
1 parent 5ed9f63 commit 687fab5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
jacoco
checkstyle
`maven-publish`
id("com.diffplug.gradle.spotless") version "3.27.1"
id("com.diffplug.gradle.spotless") version "4.0.0"
id("org.shipkit.java") version "2.3.1"
id("at.zierler.yamlvalidator") version "1.5.0"
id("org.sonarqube") version "2.8"
Expand Down
27 changes: 27 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import groovy.xml.XmlUtil

build {
doLast {
def ideaFolder = new File('.idea');
if(ideaFolder.exists() && ideaFolder.isDirectory()) {
def xmlFile = new File(".idea/vcs.xml")
def xml = new XmlSlurper().parse(xmlFile)
xml.component.find {it.@name == 'IssueNavigationConfiguration'}.replaceNode {}
xml.appendNode {
component(name: "IssueNavigationConfiguration") {
option(name: 'links') {
list {
IssueNavigationLink {
option(name: "issueRegexp", value: '#(\\d+)')
option(name: "linkRegexp", value: 'https://github.com/junit-pioneer/junit-pioneer/issues/$1')
}
}
}
}
}
xmlFile.withWriter {out->
XmlUtil.serialize(xml, out)
}
}
}
}

0 comments on commit 687fab5

Please sign in to comment.