Browse Source

Build process improvements.

- Separate out libraries by their purpose, so Netbeans doesn't have
  so much junk on the main classpath.

- Bundle a version of Ivy instead of downloading it.

- Have Ivy remove old versions of libraries instead of just adding
  new ones.

- Write the classpaths themselves to private.properties instead of
  an indirect private.classpath property which shows up weirdly in
  Netbeans.

Change-Id: I33b5fe34cc08d48d1b0e35ee93f21fa62bf8cfdb
Reviewed-on: http://gerrit.dmdirc.com/2705
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8rc1
Chris Smith 10 years ago
parent
commit
81eb5e02c2
14 changed files with 82 additions and 89 deletions
  1. 1
    1
      .gitignore
  2. 2
    2
      build-installer.xml
  3. 3
    15
      build-ivy.xml
  4. 20
    0
      build-paths.xml
  5. 2
    11
      build-plugins.xml
  6. 27
    15
      build-properties.xml
  7. 4
    16
      build-reports.xml
  8. 4
    7
      build-tests.xml
  9. 1
    1
      build-versioning.xml
  10. 6
    5
      build.xml
  11. 2
    1
      etc/ivy/ant-fikin/ivy.xml
  12. BIN
      etc/ivy/ivy-2.3.0.jar
  13. 10
    9
      ivy.xml
  14. 0
    6
      nbproject/project.properties

+ 1
- 1
.gitignore View File

@@ -32,7 +32,7 @@ __history
32 32
 /reports/report-fb.html
33 33
 /reports/report-pmd.*
34 34
 /reports/checkstyle.*
35
-/lib/clover.license
35
+/etc/clover.license
36 36
 /.clover
37 37
 /test_profile
38 38
 /*.key

+ 2
- 2
build-installer.xml View File

@@ -5,13 +5,13 @@
5 5
     <target name="-init-installer" depends="init">
6 6
         <taskdef name="nsis" classname="com.danielreese.nsisant.Task">
7 7
             <classpath>
8
-                <fileset dir="lib" includes="*nsis*.jar"/>
8
+                <fileset dir="lib/build" includes="*nsis*.jar"/>
9 9
             </classpath>
10 10
         </taskdef>
11 11
 
12 12
         <taskdef name="git-describe" classname="org.mdonoughe.JGitDescribeTask">
13 13
             <classpath>
14
-                <fileset dir="lib" includes="*jgit*.jar"/>
14
+                <fileset dir="lib/build" includes="*jgit*.jar"/>
15 15
            </classpath>
16 16
         </taskdef>
17 17
     </target>

+ 3
- 15
build-ivy.xml View File

@@ -2,33 +2,21 @@
2 2
 <project name="DMDirc-ivy" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
3 3
     <description>Ivy utilities for DMDirc</description>
4 4
 
5
-    <property name="ivy.install.version" value="2.2.0"/>
6 5
     <property name="ivy.cache.ttl.default" value="7d"/>
7 6
 
8 7
     <target name="-init-ivy" depends="-init-lib-directory">
9 8
         <path id="ivy.classpath">
10
-           <fileset dir="lib" includes="*.jar"/>
9
+           <fileset dir="etc/ivy" includes="ivy*.jar"/>
11 10
         </path>
12 11
 
13 12
         <available classname="org.apache.ivy.ant.IvyConfigure"
14 13
               property="ivy.available" classpathref="ivy.classpath" />
15 14
     </target>
16 15
 
17
-    <target name="-download-ivy" depends="-init-ivy" unless="ivy.available">
18
-        <echo message="Retrieving Ivy"/>
19
-        <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
20
-             dest="lib/ivy-${ivy.install.version}.jar"/>
21
-    </target>
22
-
23
-    <target name="-init-dependencies" depends="-download-ivy" unless="ivy.done">
24
-        <!-- Regenerate the classpath as we may have just downloaded Ivy -->
25
-        <path id="ivy.classpath">
26
-            <fileset dir="lib" includes="*.jar"/>
27
-        </path>
28
-
16
+    <target name="-init-dependencies" depends="-init-ivy" unless="ivy.done">
29 17
         <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.classpath"/>
30 18
         <ivy:settings file="etc/ivy/ivysettings.xml"/>
31
-        <ivy:retrieve symlink="true" pattern="lib/[artifact]-[revision].[ext]" />
19
+        <ivy:retrieve symlink="true" pattern="lib/[conf]/[artifact].[ext]" sync="true" />
32 20
         <property name="ivy.done" value="true"/>
33 21
     </target>
34 22
 </project>

+ 20
- 0
build-paths.xml View File

@@ -0,0 +1,20 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project name="DMDirc-paths" default="default" basedir=".">
3
+
4
+    <path id="build-classpath">
5
+        <fileset dir="lib/build" includes="*.jar"/>
6
+    </path>
7
+
8
+    <path id="test-classpath">
9
+        <fileset dir="lib/test" includes="*.jar"/>
10
+    </path>
11
+
12
+    <path id="analyse-classpath">
13
+        <fileset dir="lib/analyse" includes="*.jar"/>
14
+    </path>
15
+
16
+    <path id="main-classpath">
17
+        <fileset dir="lib/main" includes="*.jar"/>
18
+    </path>
19
+
20
+</project>

+ 2
- 11
build-plugins.xml View File

@@ -1,20 +1,11 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project name="DMDirc-plugins" default="default" basedir=".">
3 3
 
4
-    <!-- Netbeans property files -->
5
-    <property file="nbproject/project.properties"/>
6
-    <property file="nbproject/private/private.properties"/>
7
-    <property file="${user.properties.file}"/>
8
-
9 4
     <import file="modules/plugins/build-pluginutils.xml"/>
10 5
 
11 6
     <target name="-init-plugins">
12
-        <path id="libclasspath">
13
-            <fileset dir="lib" includes="*.jar"/>
14
-        </path>
15
-
16
-        <taskdef resource="net/sf/fikin/ant/ant.properties" classpathref="libclasspath"/>
17
-        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="libclasspath"/>
7
+        <taskdef resource="net/sf/fikin/ant/ant.properties" classpathref="build-classpath"/>
8
+        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="build-classpath"/>
18 9
     </target>
19 10
 
20 11
     <target name="-init-default-build-target" unless="plugins.build.target">

+ 27
- 15
build-properties.xml View File

@@ -7,12 +7,8 @@
7 7
     </condition>
8 8
 
9 9
     <target name="-init-properties">
10
-        <path id="libclasspath">
11
-            <fileset dir="lib" includes="*.jar"/>
12
-        </path>
13
-
14
-        <taskdef resource="net/sf/fikin/ant/ant.properties" classpathref="libclasspath"/>
15
-        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="libclasspath"/>
10
+        <taskdef resource="net/sf/fikin/ant/ant.properties" classpathref="build-classpath"/>
11
+        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="build-classpath"/>
16 12
     </target>
17 13
 
18 14
     <target name="-create-private-properties" unless="private.properties.exists">
@@ -22,25 +18,41 @@
22 18
 
23 19
     <target name="-check-private-classpath">
24 20
         <loadfile property="private.properties.old" srcFile="nbproject/private/private.properties"/>
25
-        <condition property="private.properties.needsinsert">
21
+        <condition property="private.properties.needs.javac">
22
+            <not>
23
+                <matches string="${private.properties.old}" pattern="^javac.classpath=(.*)$" multiline="true" casesensitive="true"/>
24
+            </not>
25
+        </condition>
26
+        <condition property="private.properties.needs.javac.test">
26 27
             <not>
27
-                <matches string="${private.properties.old}" pattern="^private.classpath=(.*)$" multiline="true" casesensitive="true"/>
28
+                <matches string="${private.properties.old}" pattern="^javac.test.classpath=(.*)$" multiline="true" casesensitive="true"/>
28 29
             </not>
29 30
         </condition>
30 31
     </target>
31 32
 
32
-    <target name="-create-private-classpath" if="private.properties.needsinsert">
33
-        <echo append="true" file="nbproject/private/private.properties">${line.separator}private.classpath=${line.separator}</echo>
33
+    <target name="-create-private-classpath" if="private.properties.needs.javac">
34
+        <echo append="true" file="nbproject/private/private.properties">${line.separator}javac.classpath=${line.separator}</echo>
34 35
     </target>
35 36
 
36
-    <target name="-init-private-properties" depends="-init-properties,-create-private-properties,-check-private-classpath,-create-private-classpath">
37
-        <path id="all.libs">
37
+    <target name="-create-private-test-classpath" if="private.properties.needs.javac.test">
38
+        <echo append="true" file="nbproject/private/private.properties">${line.separator}javac.test.classpath=${line.separator}</echo>
39
+    </target>
40
+
41
+    <target name="-init-private-properties" depends="-init-properties,-create-private-properties,-check-private-classpath,-create-private-classpath,-create-private-test-classpath">
42
+        <path id="main-libs">
38 43
             <fileset dir="modules" includes="*/lib/*.jar"/>
39
-            <fileset dir="lib" includes="*.jar"/>
44
+            <fileset dir="lib/main" includes="*.jar"/>
40 45
         </path>
41 46
 
42
-        <propertyregex property="private.classpath.value" input="${toString:all.libs}" regexp="\\" replace="/" global="true" defaultValue="${toString:all.libs}"/>
43
-        <replaceregexp file="nbproject/private/private.properties" match="^private.classpath=(.*)$" flags="im" replace="private.classpath=${private.classpath.value}"/>
47
+        <path id="test-libs">
48
+            <fileset dir="lib/test" includes="*.jar"/>
49
+        </path>
50
+
51
+        <propertyregex property="javac.classpath.value" input="${toString:all.libs}" regexp="\\" replace="/" global="true" defaultValue="${toString:main-libs}"/>
52
+        <propertyregex property="javac.test.classpath.value" input="${toString:test.libs}" regexp="\\" replace="/" global="true" defaultValue="${toString:test-libs}"/>
53
+
54
+        <replaceregexp file="nbproject/private/private.properties" match="^javac.classpath=(.*)$" flags="im" replace="javac.classpath=${javac.classpath.value}"/>
55
+        <replaceregexp file="nbproject/private/private.properties" match="^javac.test.classpath=(.*)$" flags="im" replace="javac.test.classpath=${javac.test.classpath.value}:$${javac.classpath}:build/classes:modules/plugins/build/classes"/>
44 56
     </target>
45 57
 
46 58
 </project>

+ 4
- 16
build-reports.xml View File

@@ -13,31 +13,19 @@
13 13
     <target name="-mostreports" depends="cpd, pmd, checkstyle" /> 
14 14
 
15 15
     <target name="-init-checkstyle" depends="-init-dependencies">
16
-        <path id="libclasspath">
17
-            <fileset dir="lib" includes="*.jar"/>
18
-        </path>
19
-        <taskdef resource="checkstyletask.properties" classpathref="libclasspath"/>
16
+        <taskdef resource="checkstyletask.properties" classpathref="analyse-classpath"/>
20 17
     </target>
21 18
 
22 19
     <target name="-init-pmd" depends="-init-dependencies">
23
-        <path id="libclasspath">
24
-            <fileset dir="lib" includes="*.jar"/>
25
-        </path>
26
-        <taskdef name="pmd" classpathref="libclasspath" classname="net.sourceforge.pmd.ant.PMDTask" />
20
+        <taskdef name="pmd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.ant.PMDTask" />
27 21
     </target>
28 22
 
29 23
     <target name="-init-cpd" depends="-init-dependencies">
30
-        <path id="libclasspath">
31
-            <fileset dir="lib" includes="*.jar"/>
32
-        </path>
33
-        <taskdef name="cpd" classpathref="libclasspath" classname="net.sourceforge.pmd.cpd.CPDTask" />
24
+        <taskdef name="cpd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.cpd.CPDTask" />
34 25
     </target>
35 26
 
36 27
     <target name="-init-findbugs" depends="-init-dependencies">
37
-        <path id="libclasspath">
38
-            <fileset dir="lib" includes="*.jar"/>
39
-        </path>
40
-        <taskdef name="findbugs" classpathref="libclasspath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
28
+        <taskdef name="findbugs" classpathref="analyse-classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
41 29
     </target>
42 30
     
43 31
     <target name="checkstyle-all" depends="-init-checkstyle">

+ 4
- 7
build-tests.xml View File

@@ -3,18 +3,15 @@
3 3
     <description>Test-related tasks for DMDirc.</description>
4 4
 
5 5
     <target name="-init-clover" depends="-init-dependencies">
6
-        <path id="clover.classpath">
7
-            <fileset dir="lib" includes="*clover*.jar"/>
8
-        </path>
9
-
10
-        <taskdef resource="cloverlib.xml" classpathref="clover.classpath"/>
11
-        <taskdef resource="cloverjunitlib.xml" classpathref="clover.classpath"/>
6
+        <taskdef resource="cloverlib.xml" classpathref="test-classpath"/>
7
+        <taskdef resource="cloverjunitlib.xml" classpathref="test-classpath"/>
8
+        <property name="clover.license.path" location="etc/clover.license"/>
12 9
         <property name="clover.init.string" location=".clover/clover.db"/>
13 10
 
14 11
         <condition property="clover.installed">
15 12
             <and>
16 13
                 <available classname="com.cenqua.clover.CloverInstr"/>
17
-                <available file="lib/clover.license"/>
14
+                <available file="etc/clover.license"/>
18 15
             </and>
19 16
         </condition>
20 17
 

+ 1
- 1
build-versioning.xml View File

@@ -11,7 +11,7 @@
11 11
     <available file=".git" property="is.git"/>
12 12
 
13 13
     <target name="-init-version">
14
-        <taskdef name="git-describe" classname="org.mdonoughe.JGitDescribeTask" classpathref="libclasspath"/>
14
+        <taskdef name="git-describe" classname="org.mdonoughe.JGitDescribeTask" classpathref="build-classpath"/>
15 15
     </target>
16 16
 
17 17
     <target name="-write-version" depends="-init-version, -write-version-header, -add-version, -write-updater, -write-identities, -write-disable-updates"/>

+ 6
- 5
build.xml View File

@@ -4,6 +4,7 @@
4 4
 
5 5
     <import file="nbproject/build-impl.xml"/>
6 6
     <import file="build-installer.xml"/>
7
+    <import file="build-paths.xml"/>
7 8
     <import file="build-plugins.xml"/>
8 9
     <import file="build-reports.xml"/>
9 10
     <import file="build-tests.xml"/>
@@ -19,7 +20,7 @@
19 20
         <echo>Downloading private files, if this fails please pass username and</echo>
20 21
         <echo>password to ant using -Dusername=... -Dpassword=...</echo>
21 22
 
22
-        <get src="http://www.dmdirc.com/private/clover.license" dest="lib/clover.license" username="${username}" password="${password}"/>
23
+        <get src="http://www.dmdirc.com/private/clover.license" dest="etc/clover.license" username="${username}" password="${password}"/>
23 24
 
24 25
         <get dest="installer/signing/" username="${username}" password="${password}">
25 26
             <url url="http://www.dmdirc.com/private/DMDirc.cer"/>
@@ -33,7 +34,7 @@
33 34
         <condition property="clover.installed">
34 35
             <and>
35 36
                 <available classname="com.cenqua.clover.CloverInstr"/>
36
-                <available file="lib/clover.license"/>
37
+                <available file="etc/clover.license"/>
37 38
             </and>
38 39
         </condition>
39 40
     </target>
@@ -49,14 +50,14 @@
49 50
 
50 51
     <target name="-bundle-slf4j">
51 52
         <jar destfile="${dist.jar}" update="true">
52
-            <zipfileset src="lib/slf4j-api-1.6.6.jar" includes="org/slf4j/**/*"/>
53
+            <zipfileset src="lib/main/slf4j-api.jar" includes="org/slf4j/**/*"/>
53 54
         </jar>
54 55
     </target>
55 56
 
56 57
     <target name="-bundle-dagger">
57 58
         <jar destfile="${dist.jar}" update="true">
58
-            <zipfileset src="lib/dagger-1.1.0.jar" includes="dagger/**"/>
59
-            <zipfileset src="lib/javax.inject-1.jar" includes="javax/inject/*"/>
59
+            <zipfileset src="lib/main/dagger.jar" includes="dagger/**"/>
60
+            <zipfileset src="lib/main/javax.inject.jar" includes="javax/inject/*"/>
60 61
         </jar>
61 62
     </target>
62 63
 

+ 2
- 1
etc/ivy/ant-fikin/ivy.xml View File

@@ -1,6 +1,7 @@
1 1
 <ivy-module version="2.0">
2 2
     <info organisation="net.sourceforge.fikin-ant-tasks" module="ant-fikin"/>
3 3
     <dependencies>
4
-        <dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="default" />
4
+        <dependency org="commons-httpclient" name="commons-httpclient" rev="3.+" conf="default" />
5
+        <dependency org="xerces" name="xercesImpl" rev="2.+" conf="default"/>
5 6
     </dependencies>
6 7
 </ivy-module>

BIN
etc/ivy/ivy-2.3.0.jar View File


+ 10
- 9
ivy.xml View File

@@ -3,9 +3,9 @@
3 3
 
4 4
     <configurations>
5 5
         <conf name="build" description="Everything needed to support the build process"/>
6
-        <conf name="compile" description="Everything needed to compile DMDirc separately"/>
6
+        <conf name="main" description="Everything needed to compile DMDirc separately"/>
7 7
         <conf name="test" description="Everything needed to test DMDirc"/>
8
-        <conf name="default" extends="build,compile,test"/>
8
+        <conf name="analyse" description="Everything needed to run analysis on DMDirc"/>
9 9
     </configurations>
10 10
 
11 11
     <dependencies>
@@ -14,20 +14,21 @@
14 14
         <dependency org="com.github.shanemcc" name="jgit-describe" rev="0.3" conf="build->default" />
15 15
         <dependency org="net.sourceforge.fikin-ant-tasks" name="ant-fikin" rev="1.7.3" conf="build->default" />
16 16
 
17
-        <dependency org="org.slf4j" name="slf4j-api" rev="1.6.6" conf="compile->default" />
17
+        <dependency org="org.slf4j" name="slf4j-api" rev="1.+" conf="main->default" />
18 18
         <dependency org="ch.qos.logback" name="logback-classic" rev="1.+" conf="test->default" />
19 19
 
20
-        <dependency org="com.github.peichhorn" name="lombok-pg" rev="latest.release" conf="compile->default" />
20
+        <dependency org="com.github.peichhorn" name="lombok-pg" rev="latest.release" conf="main->default" />
21 21
 
22
-        <dependency org="com.squareup.dagger" name="dagger" rev="1.1.+" conf="compile->default" />
23
-        <dependency org="com.squareup.dagger" name="dagger-compiler" rev="1.1.+" conf="compile->default" />
22
+        <dependency org="com.squareup.dagger" name="dagger" rev="1.1.+" conf="main->default" />
23
+        <dependency org="com.squareup.dagger" name="dagger-compiler" rev="1.1.+" conf="main->default" />
24 24
 
25
-        <dependency org="pmd" name="pmd" rev="4.+" conf="test->default" />
26 25
         <dependency org="junit" name="junit" rev="4.+" conf="test->default" />
27 26
         <dependency org="org.mockito" name="mockito-all" rev="1.+" conf="test->default" />
28 27
         <dependency org="com.cenqua.clover" name="clover" rev="3.+" conf="test->default" />
29
-        <dependency org="com.puppycrawl.tools" name="checkstyle" rev="5.+" conf="test->default" />
30
-        <dependency org="net.sourceforge.findbugs" name="findbugs-ant" rev="1.+" conf="test->default" />
28
+
29
+        <dependency org="pmd" name="pmd" rev="4.+" conf="analyse->default" />
30
+        <dependency org="com.puppycrawl.tools" name="checkstyle" rev="5.+" conf="analyse->default" />
31
+        <dependency org="net.sourceforge.findbugs" name="findbugs-ant" rev="1.+" conf="analyse->default" />
31 32
 
32 33
         <exclude org="ant" module="ant"/>
33 34
     </dependencies>

+ 0
- 6
nbproject/project.properties View File

@@ -80,12 +80,6 @@ util.test.dir=modules/util/test
80 80
 # However netbeans fails miserably at understanding this in the IDE, so we
81 81
 # have the private.classpath variable that will be updated in dynamic.propeties
82 82
 # automatically by ant.
83
-javac.classpath=\
84
-    ${private.classpath}
85
-javac.test.classpath=\
86
-    ${javac.classpath}:\
87
-    ${build.classes.dir}:\
88
-    modules/plugins/build/classes
89 83
 run.classpath=\
90 84
     ${javac.classpath}:\
91 85
     ${build.classes.dir}

Loading…
Cancel
Save