forked from chocolatey/choco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzip.build
81 lines (70 loc) · 4.83 KB
/
zip.build
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
<?xml version="1.0" encoding="utf-8" ?>
<project name="BuildZipper" default="go">
<!-- Project UppercuT - http://projectuppercut.org -->
<!-- DO NOT EDIT THIS FILE - This creates a zip of all project output - find out more at http://uppercut.pbwiki.com -->
<property name="build.config.settings" value="__NONE__" overwrite="false" />
<include buildfile="${build.config.settings}" if="${file::exists(build.config.settings)}" />
<property name="path.separator" value="${string::trim(path::combine(' ', ' '))}" />
<property name="dirs.current.file" value="${directory::get-parent-directory(project::get-buildfile-path())}" />
<include buildfile="${dirs.current.file}${path.separator}default.build.settings" />
<property name="build.step.name" value="${project::get-name()}" />
<property name="build.step.path" value="${project::get-buildfile-path()}" />
<!-- build step customizations below this -->
<property name="zip.file" value="${dirs.drop}${path.separator}${project.name}.zip" />
<target name="go" depends="load_uppercut_assemblies, run_tasks" />
<!-- run_normal_tasks is called from run_tasks unless replace extension exists-->
<target name="run_normal_tasks"
depends="error_check, get_version, zip"
description="Zipping assemblies." />
<target name="prepare">
<echo level="Warning" message="Deleting any existing zip files in '${dirs.drop}'."/>
<delete>
<fileset basedir="${dirs.drop}" >
<include name="*.zip" />
</fileset>
</delete>
</target>
<target name="error_check">
<fail message="You must provide arguments to the command line like this zip.build -D:project.name='SOLUTION_NAME_WITHOUT_EXTENSION' or pass the build configuration settings file zip.build -D:build.config.settings='Settings${path.separator}Uppercut.config"
if="${project.name=='__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__'}" />
</target>
<target name="get_version">
<call target="get_revision" />
<call target="shorten_hash" />
<call target="get_build_number" />
<property name="assembly.version.full" value="${version.major}.${version.minor}.${version.build}.${version.hash}" />
<property name="assembly.version.full" value="${version.major}.${version.minor}.${version.patch}-${version.hash}" if="${version.use_semanticversioning}" />
<property name="zip.file" value="${dirs.drop}${path.separator}${project.name}.v${assembly.version.full}.zip" />
</target>
<target name="get_revision">
<nant buildfile="${dirs.current.file}${path.separator}versioners${path.separator}svn.step" inheritall="true" if="${source_control_type=='svn'}" />
<nant buildfile="${dirs.current.file}${path.separator}versioners${path.separator}tfs.step" inheritall="true" if="${source_control_type=='tfs'}" />
<nant buildfile="${dirs.current.file}${path.separator}versioners${path.separator}git.step" inheritall="true" if="${source_control_type=='git'}" />
<nant buildfile="${dirs.current.file}${path.separator}versioners${path.separator}hg.step" inheritall="true" if="${source_control_type=='hg'}" failonerror="false" />
<property name="version.revision" value="${environment::get-variable('uc.app.revision')}" if="${environment::variable-exists('uc.app.revision')}" />
<property name="version.revision" value="${environment::get-variable('BUILD_VCS_NUMBER')}" if="${version.revision == '0' and environment::variable-exists('BUILD_VCS_NUMBER')}" />
<property name="version.hash" value="${environment::get-variable('uc.app.revision.hash')}" if="${environment::variable-exists('uc.app.revision.hash')}" />
<property name="version.hash" value="${version.revision}" if="${version.hash == '0'}" />
<echo level="Warning" message="Using revision number: ${version.revision} and hash: ${version.hash}." />
</target>
<target name="shorten_hash">
<echo level="Warning" message="Shortening the length of the version hash '${version.hash}' to 8 digits." />
<property name="version.hash" value="${string::substring(version.hash,0,8)}" if="${string::get-length(version.hash) > 8}" />
<echo level="Warning" message="The hash is now: ${version.hash}." />
</target>
<target name="get_build_number">
<property name="version.build" value="${environment::get-variable('CCNetNumericLabel')}" if="${environment::variable-exists('CCNetNumericLabel')}" />
<property name="version.build" value="${environment::get-variable('BUILD_NUMBER')}" if="${environment::variable-exists('BUILD_NUMBER')}" />
<echo level="Warning" message="Using build number ${version.build}." />
</target>
<target name="zip">
<echo level="Warning" message="Attempting to zip up binaries to ${zip.file}." />
<zip zipfile="${zip.file}">
<fileset basedir="${dirs.drop}">
<exclude name="gems/**" />
<exclude name="nuget/**" />
<include name="**/*" />
</fileset>
</zip>
</target>
</project>