-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
120 lines (99 loc) · 4.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="build" default="build" basedir=".">
<property name="temp-dir" value="temp" />
<property name="build-dir" value="build" />
<property name="extension-dir" value="chrome-extension" />
<property name="vendor-dir" value="vendor/vault" />
<property name="version-file-path" value="version" />
<property name="changelog-path" value="Changelog" />
<loadfile property="project-version" srcFile="${version-file-path}" />
<loadfile property="old-changes" srcFile="${changelog-path}" />
<property name="project-name" value="password-generator" />
<property name="folder-to-zip" value="${project-name}-${project-version}" />
<property name="folder-to-zip-ff" value="ff-${project-name}-${project-version}" />
<property name="manifest-path" value="${extension-dir}/manifest.json" />
<!-- @todo add target to check tests before creating release -->
<target name="clean">
<delete dir="${temp-dir}" />
</target>
<target name="setversion">
<replaceregexp file="${extension-dir}/manifest.json" match='"version": "(.*)",' replace='"version": "${project-version}",' byline="true" />
</target>
<target name="setffincognito">
<replaceregexp file="${extension-dir}/manifest.json" match='"incognito": "(.*)",' replace='"incognito": "split",' byline="true" />
</target>
<target name="update-changelog">
<exec executable="git" outputProperty="last-tag">
<arg value="describe" />
<arg value="--tags" />
<arg value="--abbrev=0" />
</exec>
<exec executable="git" outputProperty="recent-changes">
<arg value="log" />
<arg value="${last-tag}..HEAD" />
<arg value="--oneline" />
</exec>
<echo file="${changelog-path}">${project-version}
${recent-changes}
${old-changes}
</echo>
</target>
<target name="updategit">
<exec executable="git">
<arg value="commit" />
<arg value="${manifest-path}" />
<arg value="${version-file-path}" />
<arg value="${changelog-path}" />
<arg value="-m" />
<arg value="version bump for manifest" />
</exec>
<exec executable="git">
<arg value="push" />
<arg value="origin" />
<arg value="master" />
</exec>
<exec executable="git">
<arg value="tag" />
<arg value="v${project-version}" />
</exec>
<exec executable="git">
<arg value="push" />
<arg value="origin" />
<arg value="v${project-version}" />
</exec>
</target>
<target name="prepare" depends="clean, create-temp, check-key, copy-key, setversion">
<copy todir="${temp-dir}/${folder-to-zip}">
<fileset dir="${extension-dir}" />
</copy>
</target>
<target name="check-key">
<available file="src/key.pem" property="key.present"/>
</target>
<target name="create-temp">
<mkdir dir="${temp-dir}" />
<mkdir dir="${temp-dir}/${folder-to-zip}" />
</target>
<target name="copy-key" if="key.present">
<copy file="src/key.pem" todir="${temp-dir}/${folder-to-zip}/" />
</target>
<target name="zip" depends="prepare">
<zip destfile="${build-dir}/${project-name}-${project-version}.zip" basedir="${temp-dir}/${folder-to-zip}" />
</target>
<target name="get-vendor">
<get src="https://raw.githubusercontent.com/bgrande/vault/master/lib/vault.js" dest="chrome-extension/lib/vault.js" />
<get src="https://raw.githubusercontent.com/jcoglan/vault-cipher/master/lib/crypto-js.js" dest="chrome-extension/lib/crypto-js.js" />
</target>
<target name="build" depends="update-changelog, updategit, zip" />
<target name="build-info">
<echo message="build dir: ${build-dir}" />
<echo message="extension dir: ${extension-dir}" />
<echo message="changelog file: ${changelog-path}" />
<echo message="vendor dir: ${vendor-dir}" />
<echo message="project name: ${project-name}" />
<echo message="version: ${project-version}" />
<echo message="folder to zip: ${folder-to-zip}" />
<echo message="files to commit: ${manifest-path}, ${version-file-path}" />
<echo message="git tag to be created: v${project-version}" />
</target>
</project>