-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommonBuild.xml
More file actions
117 lines (101 loc) · 5.43 KB
/
commonBuild.xml
File metadata and controls
117 lines (101 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="post" name="Common ScriptEase Build">
<description>
Common targets exist in this build file. Some of them are complex to use - see their
in-line comments for details on what is expected.
</description>
<!-- ==== START INIT COMMANDS ==== -->
<property file="mailingLists.properties" />
<!-- Script account's web docs directory. -->
<property name="webdocs" value="/compsci/webdocs/script/web_docs" />
<!--LinuxMachine just needs to be any department machine that we can ssh into-->
<property name="linuxMachine" value="peers.cs.ualberta.ca" />
<property name="buildDirectory" value="build" />
<property name="jarDirectory" location="jar" />
<property name="seSrcDirectory" location="scriptease2" />
<property name="resourcesDirectory" location="${seSrcDirectory}/scriptease/resources/" />
<property name="translatorsDirectory" location="${seSrcDirectory}/translators" />
<property name="jarFile" value="${ant.project.name}.jar" />
<property name="zipFile" value="${ant.project.name}.zip" />
<!-- Versioning is 'major.minor.head'. See build file documentation for details.
The minor version is defined either on update, or just before use. We can't
redefine properties. We find out the head revision with linux magic and
exec. Also, I'd define the seVersion here, but it needs to be defined right
where we use it, because we can't reassign properties.-->
<property name="majorVersion" value="2" />
<property name="buildNumberLocation" value="/cshome/script/development/buildNumber.properties" />
<exec executable="sh" outputproperty="git.hash">
<arg value="-c" />
<arg value="git log -1 | grep "commit" | awk -F " " '{print $2}'" />
</exec>
<!-- ==== END INIT COMMANDS ==== -->
<!-- ==== TARGETS ==== -->
<!--Based off of jtduncan's original script, which:
1. generated a jar
2. copied the fresh jar to the script webspace and appended a timestamp
3. creates a UNIX file link that points to the file copied in step 2. -->
<!-- Depends on the following properties to be set:
dest.dir - the directory to post to
src.file - the file to be posting to dest.dir
link.location - the location of the symbolic link to be made
expected.web.location - parent web address of the expected download location.
-->
<target name="post" description="Posts a particular file to the script account's web space. See commenting for this target in build file for detailed list of the required properties.">
<!-- Save a timestamp -->
<tstamp>
<format property="build.time" pattern="yyyy-MMM-dd-HH:mm:ss" />
</tstamp>
<!--
This section of the script requires the user give the script password
twice, which sucks. It's stupid, but it's the only way I could get it to
not mysteriously lose the version number in the manifest file of the jar.
That's what happened when I included a 'cp' as part of what is now the
linking step. Sigh.
- remiller
-->
<property name="dest.file.path" value="${dest.dir}/${build.time}_${src.file}" />
<echo>Posting Jar built from local code to the web space (${dest.file.path}). </echo>
<echo>Please enter the script account password at the prompt.</echo>
<exec executable="scp" failonerror="true">
<arg value="${src.file}" />
<arg value="script@${linuxMachine}:${dest.file.path}" />
</exec>
<echo>Transmission complete.</echo>
<echo>Generating symbolic link...</echo>
<exec executable="ssh" failonerror="true">
<arg value="script@${linuxMachine}" />
<arg value="ln -sf "${dest.file.path}" ${link.location}/${src.file}; chmod 755 "${dest.file.path}"" />
</exec>
<echo>Linking complete.</echo>
<echo message="Jar should be accessible at: ${expected.web.location}/${zipFile}" />
<antcall target="mail" />
</target>
<target name="defineUserName">
<exec executable="sh" outputproperty="user.name.full">
<arg value="-c" />
<arg value="finger ${user.name} | grep "Name" | awk -F"Name: " '{print $2}'" />
</exec>
</target>
<!-- depends on the following properties to be set:
=========
mail.body - the message body
mail.title - the message title
mail.list - the list of email addresses to send to
=========
and only mails if 'noMail' is NOT set
-->
<target name="mail" unless="noMail" depends="defineUserName" description="Mails the team with the message stored in the 'mail.body' property unless the property 'noMail' is set or 'mail.body' is not set.">
<!-- Tell the people -->
<echo>Mailing the following list about the new release... ${mail.list}</echo>
<echo>Mail may take a while to arrive.</echo>
<!-- It sends a mail status report to the caller of the ant script.
If you don't want it to do this, remove the 'v' flag from the call to 'mail',
but keep in mind this is a common file so it would change for everyone on commit.
- remiller -->
<exec executable="sh" failonerror="true">
<arg value="-c" />
<arg value="echo "This is an important message from the ScriptEase 2 Build Process sent on behalf of ${user.name.full} (${user.name}). ${mail.body} \n\nMuch love, \n\nScriptEase 2 Build Process" | mail -Evs "${mail.title}" ${mail.list}" />
</exec>
<echo>Done. And there was much rejoicing!</echo>
</target>
</project>