Skip to content

Commit 0e633a1

Browse files
committed
do not assume that the build happens in git repo or archived git repo
fixes #712
1 parent 9113978 commit 0e633a1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

build.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
208208
<property name="git" value="git"/>
209209

210210
<!-- Get the id of the changeset we're building from using a
211-
Mercurial command.
211+
git command.
212212
-->
213213
<target name="-get-changeset-from-command"
214214
depends="-check-is-git-repo" if="build.from.repo">
@@ -226,14 +226,19 @@ Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
226226
<target name="-check-is-git-repo">
227227
<available property="build.from.repo" file=".git" type="dir"/>
228228
</target>
229+
<target name="-check-is-archived-git-repo">
230+
<available property="build.from.archived.repo"
231+
file=".git_archival.txt"
232+
type="file"/>
233+
</target>
229234

230235
<!-- Get the id of the changeset we're building from by reading
231236
.git_archival.txt file created by git archive. This will only
232237
be used when we're not building from a checked out copy of
233238
the repository, for example the source distribution.
234239
-->
235240
<target name="-get-changeset-from-file"
236-
depends="-check-is-git-repo" unless="build.from.repo">
241+
depends="-check-is-archived-git-repo" if="build.from.archived.repo">
237242
<tempfile property="git.archival.temp" deleteonexit="true"/>
238243
<copy file=".git_archival.txt" tofile="${git.archival.temp}"/>
239244
<replaceregexp file="${git.archival.temp}" flags="s"
@@ -242,16 +247,20 @@ Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
242247
<loadfile srcFile="${git.archival.temp}" property="changeset"/>
243248
</target>
244249

250+
<target name="-set-changeset" unless="changeset">
251+
<property name="changeset" value="unknown"/>
252+
</target>
253+
245254
<target name="-update-build-info"
246-
depends="-get-changeset-from-command,-get-changeset-from-file">
255+
depends="-get-changeset-from-command,-get-changeset-from-file,-set-changeset">
247256
<mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
248257
<propertyfile
249258
file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
250259
<entry key="version" value="${version}"/>
251260
<entry key="changeset" value="${changeset}"/>
252261
</propertyfile>
253262
</target>
254-
263+
255264
<property name="coverage.dir" value="${basedir}/coverage"/>
256265
<target name="-pre-compile" depends="jrcs,jflex,download-lucene"/>
257266
<target name="eclipse" depends="-pre-compile"

0 commit comments

Comments
 (0)