Skip to content

Commit ec41d76

Browse files
James Ableyheadius
James Abley
authored andcommitted
JRUBY-2292: Initial draft of Ivy and FindBugs integration
1 parent c222583 commit ec41d76

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ gem/pkg
2626
*.orig
2727
*.rej
2828
tool/nailgun/ng
29+
jruby-findbugs.html

build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
</patternset>
4747

4848
<import file="netbeans-ant.xml" optional="true"/>
49+
<import file="ivy/build.xml" />
4950

5051
<!-- Initializes the build -->
5152
<target name="init">

findbugs.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FindBugsFilter>
3+
<Match>
4+
<Package name="~org\.jruby\.*" />
5+
<Bug code="Nm" />
6+
</Match>
7+
</FindBugsFilter>

ivy/build.xml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<project xmlns:ivy="antlib:org.apache.ivy.ant">
2+
3+
<property name="ivy.install.version" value="2.0.0" />
4+
<property name="ivy.jar.dir" value="${user.home}/.ivy2" />
5+
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
6+
<property name="jsch.install.version" value="0.1.29" />
7+
<property name="jsch.jar.file" value="${ivy.jar.dir}/jsch-${jsch.install.version}.jar" />
8+
9+
<!--
10+
download ivy from the web site so that it can be used without being
11+
installed. if the file has already been downloaded, we use a rename
12+
trick to avoid hitting the website again. (that would be annoying
13+
when building offline.)
14+
-->
15+
<target name="download-ivy" unless="skip.download">
16+
<mkdir dir="${ivy.jar.dir}" />
17+
<condition property="ivy.url" value="file:${ivy.jar.file}">
18+
<available file="${ivy.jar.file}" />
19+
</condition>
20+
<property name="ivy.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" />
21+
<get src="${ivy.url}" dest="${ivy.jar.file}.download" usetimestamp="true" />
22+
<move file="${ivy.jar.file}.download" tofile="${ivy.jar.file}" />
23+
24+
<condition property="jsch.url" value="file:${jsch.jar.file}">
25+
<available file="${jsch.jar.file}" />
26+
</condition>
27+
<property name="jsch.url" value="http://repo1.maven.org/maven2/jsch/jsch/${jsch.install.version}/jsch-${jsch.install.version}.jar" />
28+
<get src="${jsch.url}" dest="${jsch.jar.file}.download" usetimestamp="true" />
29+
<move file="${jsch.jar.file}.download" tofile="${jsch.jar.file}" />
30+
</target>
31+
32+
<!-- import ivy's ant tasks -->
33+
<target name="install-ivy" depends="download-ivy">
34+
<path id="ivy.lib.path">
35+
<fileset dir="${ivy.jar.dir}" includes="ivy-${ivy.install.version}.jar" />
36+
</path>
37+
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
38+
</target>
39+
40+
<!-- where to look for the ivy config -->
41+
<property name="ivy.dep.file" value="${basedir}/ivy/ivy.xml" />
42+
<property name="ivy.settings.file" value="${basedir}/ivy/ivysettings.xml" />
43+
44+
<target name="findbugs" depends="install-ivy" description="Run Findbugs on JRuby source">
45+
46+
<!--
47+
TODO move this out into a target that can be dependended on, and introduce code coverage,
48+
cyclomatic complexity and any other metrics that you want to include.
49+
-->
50+
<ivy:resolve conf="check" />
51+
<ivy:cachepath pathid="check.path" conf="check" />
52+
53+
<taskdef name="findbugs" classpathref="check.path" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
54+
55+
<findbugs classpathref="check.path" pluginList="" output="html" outputfile="${basedir}/jruby-findbugs.html"
56+
excludefilter="${basedir}/findbugs.xml">
57+
<sourcepath path="${basedir}/source" />
58+
<class location="${jruby.classes.dir}" />
59+
<auxclasspath>
60+
<path refid="build.classpath" />
61+
</auxclasspath>
62+
</findbugs>
63+
</target>
64+
65+
</project>

ivy/ivy.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<ivy-module version="2.0">
2+
<info organisation="org.jruby" module="jruby" revision="1.3-SNAPSHOT" />
3+
<configurations>
4+
<conf name="default" description="normal build" />
5+
<conf name="test" visibility="private" description="build and run tests" />
6+
<conf name="check" visibility="private" description="run analysis tools on the source" />
7+
</configurations>
8+
<publications>
9+
<artifact />
10+
<artifact name="jruby-sources" />
11+
</publications>
12+
<dependencies>
13+
<dependency org="com.google.code.findbugs" name="findbugs" rev="1.3.8" conf="check->*" />
14+
</dependencies>
15+
</ivy-module>

ivy/ivysettings.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ivysettings>
2+
<settings defaultResolver="chain-repos" />
3+
<resolvers>
4+
<chain name="chain-repos">
5+
<!-- Disable consistency checking due to invalid poms for Findbugs -->
6+
<ibiblio name="maven2" m2compatible="true" checkconsistency="false" />
7+
</chain>
8+
<filesystem name="local" m2compatible="true" transactional="false">
9+
<artifact pattern="${basedir}/dist/repo/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
10+
</filesystem>
11+
</resolvers>
12+
</ivysettings>

0 commit comments

Comments
 (0)