-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
182 lines (159 loc) · 6.78 KB
/
build.xml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<project name="lastpass-confluence-saml" default="all" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>LastPass SAML Confluence integration</description>
<property environment="env" />
<property name="version" value="0.2.0"/>
<property name="classes.dir" value="classes"/>
<property name="source.dir" value="src"/>
<property name="output.dir" value="out"/>
<property name="conf.dir" value="conf"/>
<property name="output.jar" value="lastpass-confluence-saml-${version}.jar"/>
<property name="confluence.home.dir" value="/opt/atlassian/confluence"/>
<property name="DESTDIR" value=""/>
<property name="pkgtype" value="deb"/>
<property name="fpm.excludes" value=""/>
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<path id="build.compile.classpath">
<fileset dir="lib" includes="*.jar"/>
<!-- needed for atlassian classes -->
<pathelement location="${confluence.home.dir}/confluence/WEB-INF/classes"/>
<fileset dir="${confluence.home.dir}/confluence/WEB-INF/lib" includes="*.jar"/>
</path>
<target name="all">
<antcall target="tar"/>
</target>
<target name="deps" depends="init-ivy,resolve" />
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac
srcdir="${source.dir}"
destdir="${classes.dir}"
debug="true"
includeantruntime="false"
classpathref="build.compile.classpath" >
<compilerarg line="-Xlint:unchecked -Xlint:finally -Xlint:fallthrough" />
</javac>
</target>
<target name="jar" depends="deps,compile">
<mkdir dir="${output.dir}" />
<jar destfile="${output.dir}/${output.jar}">
<fileset dir="${classes.dir}"/>
<zipfileset includes="**/*.class" src="lib/lastpass-saml-sdk-0.3.0.jar"/>
</jar>
</target>
<target name="fpm">
<antcall target="__install">
<param name="DESTDIR" value="pkg-stage"/>
</antcall>
<exec executable="fpm">
<arg value="-s"/>
<arg value="dir"/>
<arg value="-t"/>
<arg value="${pkgtype}"/>
<arg value="--config-files"/>
<arg value="opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml"/>
<arg value="--config-files"/>
<arg value="opt/atlassian/confluence/idp-metadata.xml.sample"/>
<arg value="--config-files"/>
<arg value="opt/atlassian/confluence/sp-metadata.xml.sample"/>
<arg value="--after-install"/>
<arg value="scripts/post-pkg-install.sh"/>
<arg value="-C"/>
<arg value="pkg-stage"/>
<arg value="-v"/>
<arg value="${version}"/>
<arg value="-n"/>
<arg value="${ant.project.name}"/>
<arg line="${fpm.excludes}"/>
<arg value="."/>
</exec>
</target>
<target name="deb">
<antcall target="fpm">
<param name="fpm.excludes" value="-x install.sh"/>
<param name="pkgtype" value="deb"/>
</antcall>
</target>
<target name="rpm">
<antcall target="fpm">
<param name="fpm.excludes" value="-x install.sh"/>
<param name="pkgtype" value="rpm"/>
</antcall>
</target>
<target name="tar">
<antcall target="__install">
<param name="DESTDIR" value="${output.dir}/${ant.project.name}-${version}/"/>
</antcall>
<exec executable="tar">
<arg value="czvf"/>
<arg value="${output.dir}/${ant.project.name}-${version}.tar.gz"/>
<arg value="-C"/>
<arg value="${output.dir}"/>
<arg value="${ant.project.name}-${version}/"/>
</exec>
</target>
<target name="install">
<exec executable="./install.sh" dir="${output.dir}/${ant.project.name}-${version}"/>
</target>
<target name="__install" depends="jar">
<mkdir dir="${DESTDIR}${confluence.home.dir}/confluence/WEB-INF/classes"/>
<mkdir dir="${DESTDIR}${confluence.home.dir}/confluence/WEB-INF/lib"/>
<mkdir dir="${DESTDIR}${confluence.home.dir}/lib"/>
<copy todir="${DESTDIR}${confluence.home.dir}/">
<fileset dir="conf" includes="*.sample"/>
</copy>
<copy todir="${DESTDIR}${confluence.home.dir}/confluence/">
<fileset dir="web" includes="*.jsp"/>
</copy>
<exec executable="sed" output="${DESTDIR}/install.sh">
<arg value="-e" />
<arg value="s,^defroot=.*,defroot=${confluence.home.dir}," />
<arg value="scripts/install.sh" />
</exec>
<exec executable="chmod">
<arg value="775" />
<arg value="${DESTDIR}/install.sh" />
</exec>
<copy todir="${DESTDIR}${confluence.home.dir}/confluence/WEB-INF/lib/"
file="${output.dir}/${output.jar}"/>
<copy todir="${DESTDIR}${confluence.home.dir}/confluence/WEB-INF/classes/"
file="${conf.dir}/seraph-config.xml"/>
<copy todir="${DESTDIR}${confluence.home.dir}/confluence/WEB-INF/lib/">
<fileset dir="lib">
<include name="opensaml-2.6.1.jar"/>
<include name="xmltooling-1.4.1.jar"/>
<include name="xmlsec-*.jar"/>
<include name="openws-1.5.1.jar"/>
<include name="joda-time-2.3.jar"/>
<include name="esapi-2.0.1.jar"/>
<include name="slf4j-api-1.7.5.jar"/>
<include name="jul-to-slf4j-1.7.5.jar"/>
<include name="jcl-over-slf4j-1.7.5.jar"/>
<include name="log4j-over-slf4j-1.7.5.jar"/>
</fileset>
</copy>
</target>
<!-- bootstrap ivy -->
<property name="ivy.install.version" value="2.2.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<!-- end ivy setup -->
</project>