Selaa lähdekoodia

On unix building will automatically substitute the correct SVN Revision :D

(On windows it will just leave it as the default, so we should probably change this to something like -1 or so to make it obvious)
Nightly Build no longer tries to substitue RELEASE_DATE


git-svn-id: http://svn.dmdirc.com/trunk@3611 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 vuotta sitten
vanhempi
commit
f083a9c1b0
3 muutettua tiedostoa jossa 62 lisäystä ja 5 poistoa
  1. 26
    0
      AddSVN.sh
  2. 5
    4
      BuildAll.sh
  3. 31
    1
      build.xml

+ 26
- 0
AddSVN.sh Näytä tiedosto

@@ -0,0 +1,26 @@
1
+#!/bin/sh
2
+
3
+SVN=`which svn`
4
+
5
+SVNREV=`$SVN info | grep Revision`
6
+SVNREV=${SVNREV##*: }
7
+
8
+PRE='int SVN_REVISION = '
9
+POST='int SVN_REVISION = '${SVNREV}'; \/\/ '
10
+
11
+OLD=""
12
+
13
+if [ "${1}" = "--pre" ]; then
14
+	# Substitute the version string
15
+	OLD=${PRE}
16
+	NEW=${POST}
17
+elif [ "${1}" = "--post" ]; then
18
+	# Unsubstitute the version string
19
+	OLD=${POST}
20
+	NEW=${PRE}
21
+fi;
22
+
23
+if [ "" != "${OLD}" ]; then
24
+	awk '{gsub(/'"${OLD}"'/,"'"${NEW}"'");print}' ${PWD}/src/com/dmdirc/Main.java > ${PWD}/src/com/dmdirc/Main.java.tmp 2>/dev/null
25
+	mv ${PWD}/src/com/dmdirc/Main.java.tmp ${PWD}/src/com/dmdirc/Main.java
26
+fi;

+ 5
- 4
BuildAll.sh Näytä tiedosto

@@ -27,16 +27,17 @@ SVNREV=`$SVN info | grep Revision`
27 27
 SVNREV=${SVNREV##*: }
28 28
 
29 29
 # Substitute the version string
30
-awk '{gsub(/String VERSION = "SVN"/,"String VERSION = \"Nightly - SVN Rev: '${SVNREV}'\"");print}' ${MYDIR}/src/com/dmdirc/Main.java > ${MYDIR}/src/com/dmdirc/Main.java.tmp
30
+awk '{gsub(/String VERSION = "SVN ("+SVN_REVISION+")"/,"String VERSION = \"Nightly - SVN Rev: '${SVNREV}'\"");print}' ${MYDIR}/src/com/dmdirc/Main.java > ${MYDIR}/src/com/dmdirc/Main.java.tmp
31 31
 mv ${MYDIR}/src/com/dmdirc/Main.java.tmp ${MYDIR}/src/com/dmdirc/Main.java
32 32
 
33 33
 # Substitute the update channel
34 34
 awk '{gsub(/UpdateChannel UPDATE_CHANNEL = UpdateChannel.NONE/,"UpdateChannel UPDATE_CHANNEL = UpdateChannel.NIGHTLY");print}' ${MYDIR}/src/com/dmdirc/Main.java > ${MYDIR}/src/com/dmdirc/Main.java.tmp
35 35
 mv ${MYDIR}/src/com/dmdirc/Main.java.tmp ${MYDIR}/src/com/dmdirc/Main.java
36 36
 
37
-# Substitue the release date
38
-awk '{gsub(/int RELEASE_DATE = 0/,"int RELEASE_DATE = '`date +%Y%m%d`'");print}' ${MYDIR}/src/com/dmdirc/Main.java > ${MYDIR}/src/com/dmdirc/Main.java.tmp
39
-mv ${MYDIR}/src/com/dmdirc/Main.java.tmp ${MYDIR}/src/com/dmdirc/Main.java
37
+# This no longer exists
38
+## Substitue the release date
39
+#awk '{gsub(/int RELEASE_DATE = 0/,"int RELEASE_DATE = '`date +%Y%m%d`'");print}' ${MYDIR}/src/com/dmdirc/Main.java > ${MYDIR}/src/com/dmdirc/Main.java.tmp
40
+#mv ${MYDIR}/src/com/dmdirc/Main.java.tmp ${MYDIR}/src/com/dmdirc/Main.java
40 41
 
41 42
 # Archive old nightlies
42 43
 if [ `date +%d` = "01" ]; then

+ 31
- 1
build.xml Näytä tiedosto

@@ -71,10 +71,40 @@
71 71
             <fileset dir="${build.classes.dir}"/>
72 72
         </jar>
73 73
     -->
74
-    <target name="-post-compile" depends="build-plugins"/>
75 74
 
76 75
     <available file="/bin/bash" property="has.bash"/>	
77 76
 
77
+    <!--
78
+        This will revert the svn revision in Main.java to prevent commiting the
79
+        change everyt time someone builds and causing conflicts.
80
+      -->
81
+    <target name="unsvn" depends="unsvn_nobash, unsvn_bash"/>
82
+    <target name="unsvn_bash" if="has.bash">
83
+        <exec executable="/bin/bash">
84
+            <arg value="AddSVN.sh"/>
85
+            <arg value="--post"/>
86
+        </exec>
87
+    </target>
88
+    <target name="unsvn_nobash" unless="has.bash">
89
+        <echo message="This task only works on linux"/>
90
+    </target>
91
+    <target name="-post-compile" depends="unsvn, build-plugins"/>
92
+
93
+    <!--
94
+        This will add the svn revision to Main.java
95
+      -->
96
+    <target name="addsvn" depends="addsvn_nobash, addsvn_bash"/>
97
+    <target name="addsvn_bash" if="has.bash">
98
+        <exec executable="/bin/bash">
99
+            <arg value="AddSVN.sh"/>
100
+            <arg value="--pre"/>
101
+        </exec>
102
+    </target>
103
+    <target name="addsvn_nobash" unless="has.bash">
104
+        <echo message="This task only works on linux"/>
105
+    </target>
106
+    <target name="-pre-compile" depends="addsvn"/>
107
+
78 108
     <target name="installer" depends="installer-nobuild, installer-build"/>
79 109
     
80 110
     <target name="installer-build" if="has.bash">

Loading…
Peruuta
Tallenna