Browse Source

Basic project structure

master
Chris Smith 12 years ago
commit
c5b743a3a4
6 changed files with 136 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 40
    0
      build-ivy.xml
  3. 38
    0
      build.xml
  4. 25
    0
      etc/ivy/ivysettings.xml
  5. 6
    0
      etc/ivy/jgit-describe/ivy.xml
  6. 24
    0
      ivy.xml

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
1
+/lib
2
+/build
3
+/dist

+ 40
- 0
build-ivy.xml View File

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

+ 38
- 0
build.xml View File

@@ -0,0 +1,38 @@
1
+<project name="com.dmdirc.updater" default="dist" basedir=".">
2
+  <description>Generic updater system used by DMDirc</description>
3
+
4
+  <import file="build-ivy.xml"/>
5
+
6
+  <property name="src" location="src"/>
7
+  <property name="build" location="build"/>
8
+  <property name="dist"  location="dist"/>
9
+
10
+  <target name="init" depends="-init-dependencies">
11
+    <mkdir dir="${build}"/>
12
+  </target>
13
+
14
+  <target name="compile" depends="init" description="compile the source">
15
+    <javac srcdir="${src}" destdir="${build}" includeantruntime="false"/>
16
+  </target>
17
+
18
+  <target name="-init-version">
19
+    <path id="jgit-classpath">
20
+      <fileset dir="lib">
21
+        <include name="**/*.jar"/>
22
+      </fileset>
23
+    </path>
24
+    <taskdef name="git-describe" classname="org.mdonoughe.JGitDescribeTask" classpathref="jgit-classpath"/>
25
+  </target>
26
+
27
+  <target name="dist" depends="compile,-init-version" description="generate the distribution">
28
+    <mkdir dir="${dist}"/>
29
+
30
+    <git-describe dir=".git" property="version" />
31
+    <jar jarfile="${dist}/updater-${version}.jar" basedir="${build}"/>
32
+  </target>
33
+
34
+  <target name="clean" description="clean up">
35
+    <delete dir="${build}"/>
36
+    <delete dir="${dist}"/>
37
+  </target>
38
+</project>

+ 25
- 0
etc/ivy/ivysettings.xml View File

@@ -0,0 +1,25 @@
1
+<ivysettings>
2
+    <settings defaultResolver="default"/>
3
+    <resolvers>
4
+        <ibiblio name="default" m2compatible="true"/>
5
+
6
+        <ibiblio name="jgit" root="http://download.eclipse.org/jgit/maven" m2compatible="true"/>
7
+
8
+        <ibiblio name="sonatype" root="https://oss.sonatype.org/content/repositories/snapshots/" m2compatible="true"/>
9
+
10
+        <url name="jgit-describe">
11
+            <ivy pattern="file:///${basedir}/etc/ivy/[module]/ivy.xml"/>
12
+            <artifact pattern="http://shanemcc.github.com/jgit-describe/releases/jgit-describe-[revision].jar"/>
13
+        </url>
14
+
15
+        <packager name="packager" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache" preserveBuildDirectories="true">
16
+            <ivy pattern="file:///${basedir}/etc/ivy/[module]/ivy.xml"/>
17
+            <artifact pattern="file:///${basedir}/etc/ivy/[module]/packager.xml"/>
18
+        </packager>
19
+    </resolvers>
20
+    <modules>
21
+        <module organisation="com.github.shanemcc" name="jgit-describe" resolver="jgit-describe"/>
22
+        <module organisation="org.eclipse.jgit" name="*" resolver="jgit"/>
23
+        <module organisation="com.github.peichhorn" name="*" resolver="sonatype"/>
24
+    </modules>
25
+</ivysettings>

+ 6
- 0
etc/ivy/jgit-describe/ivy.xml View File

@@ -0,0 +1,6 @@
1
+<ivy-module version="2.0">
2
+    <info organisation="com.github.shanemcc" module="jgit-describe"/>
3
+    <dependencies>
4
+        <dependency org="org.eclipse.jgit" name="org.eclipse.jgit" rev="latest.integration" conf="default" />
5
+    </dependencies>
6
+</ivy-module>

+ 24
- 0
ivy.xml View File

@@ -0,0 +1,24 @@
1
+<ivy-module version="2.0">
2
+    <info organisation="com.dmdirc" module="updater"/>
3
+
4
+    <configurations>
5
+        <conf name="build" description="Everything needed to support the build process"/>
6
+        <conf name="compile" description="Everything needed to compile the project separately"/>
7
+        <conf name="test" description="Everything needed to test the project"/>
8
+        <conf name="default" extends="build,compile,test"/>
9
+    </configurations>
10
+
11
+    <dependencies>
12
+        <dependency org="com.github.shanemcc" name="jgit-describe" rev="0.1" conf="build->default" />
13
+
14
+        <dependency org="org.slf4j" name="slf4j-api" rev="1.6.+" conf="compile->default" />
15
+        <dependency org="ch.qos.logback" name="logback-classic" rev="1.+" conf="test->default" />
16
+
17
+        <dependency org="com.github.peichhorn" name="lombok-pg" rev="0.10.8-SNAPSHOT" conf="compile->default" />
18
+
19
+        <dependency org="junit" name="junit" rev="4.+" conf="test->default" />
20
+        <dependency org="org.mockito" name="mockito-all" rev="1.+" conf="test->default" />
21
+
22
+        <exclude org="ant" module="ant"/>
23
+    </dependencies>
24
+</ivy-module>

Loading…
Cancel
Save