Skip to content

Commit

Permalink
Add Grape annotations to automate the download of the dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
h3xstream committed Jun 27, 2016
1 parent b6ecd97 commit 8f02d86
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import groovy.text.SimpleTemplateEngine
import groovy.xml.MarkupBuilder
import groovy.util.Node

@Grapes([
@Grab(group='com.google.code.findbugs' , module='findbugs', version='3.0.1'),
@Grab(group='com.mebigfatguy.fb-contrib', module='fb-contrib', version='6.6.1'),
@Grab(group='com.h3xstream.findsecbugs' , module='findsecbugs-plugin', version='1.4.6')]
)

//Includes all the bugs that are bundle with FindBugs by default
findBugsPatterns = ["XSS_REQUEST_PARAMETER_TO_SEND_ERROR",
Expand Down Expand Up @@ -144,15 +149,25 @@ def getSonarPriority(String type,String category, String description) {

//Plugin definition
class Plugin {
String file = ""
String groupId = ""
String artifactId = ""
String version = ""
private Node fbConfXml = null;

private String getFile() {
def homeDir = System.getProperty("user.home");
if(!(new File(homeDir+"/.groovy")).exists()) {
println "[WARN] Unable to find groovy cache directory. Expected \$home/.groovy";
}
homeDir + "/.groovy/grapes/"+groupId+"/"+artifactId+"/jars/"+artifactId+"-"+version+".jar"
}

InputStream getMessages() {
URL urlMsg1 = new URL("jar:file:deps/"+file+"!/messages.xml")
URL urlMsg1 = new URL("jar:file:"+getFile()+"!/messages.xml")
return urlMsg1.openStream()
}
InputStream getFindbugsConf() {
URL urlMsg1 = new URL("jar:file:deps/"+file+"!/findbugs.xml")
URL urlMsg1 = new URL("jar:file:"+getFile()+"!/findbugs.xml")
return urlMsg1.openStream()
}
String getCategory(String bugType) {
Expand All @@ -176,9 +191,9 @@ String getFindBugsCategory(List<Plugin> plugins, String bugType) {
return "EXPERIMENTAL"
}

FSB = new Plugin(file:"findsecbugs-plugin-1.4.6.jar")
FB = new Plugin(file:"findbugs-3.0.1.jar")
CONTRIB = new Plugin(file:"fb-contrib-6.6.1.jar")
FSB = new Plugin(groupId: 'com.h3xstream.findsecbugs' , artifactId: 'findsecbugs-plugin', version:'1.4.6')
FB = new Plugin(groupId: 'com.google.code.findbugs' , artifactId: 'findbugs', version:'3.0.1')
CONTRIB = new Plugin(groupId: 'com.mebigfatguy.fb-contrib' , artifactId: 'fb-contrib', version:'6.6.1')

/**
*
Expand Down
6 changes: 4 additions & 2 deletions generate_profiles/out_sonar/EMPTY_DIRECTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This directory contains the files generated for SonarQube plugin.
This directory contains the files generated for rules and profiles.

https://github.com/SonarQubeCommunity/sonar-findbugs
The rules are based on the plugin metadata descriptor (mainly messages.xml).

The files are then copied here : `sonar-findbugs/src/main/resources/org/sonar/plugins/findbugs`

0 comments on commit 8f02d86

Please sign in to comment.