-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild-direct.xml
148 lines (123 loc) · 7.76 KB
/
build-direct.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
<project name="sfDirect">
<!-- DIRECT TARGETS: Execute top-level operations for use with a direct customer. -->
<!-- Dev -->
<target name="InitProduction"
description="Prepares a new, empty repository for a production org by retrieving and pruning metadata from
the org. Include repo_user property for the commit log." depends="setupConfig,retrieveUnpackaged,fixComponents,commit">
<echo level="info">Production is setup.</echo>
</target>
<target name="InitProductionExtension"
description="Follows the InitProduction build, and conforms metadata to reflect the latest versions of base packages. Requires home, sf_credentials. Optional: sf_prefix_list (to conform Apex metadata to the latest version of the specified packages)."
depends="checkOnlyUnpackagedServer,setupConfig,retrieveUnpackaged,fixComponents,versionForward,commit">
<echo level="info">Production is setup.</echo>
</target>
<target name="StartNewTask" depends="taskRequired,branch,deployPackage"
description="Starts a new task with metadata deployed into a package. Requires: home, sf_credentials. Optional: Set sf_fullName to the unmanaged or managed name (not the prefix). Develop is used as the default. When used locally,
this target can be a destructive operation, as any local checkout of the repository is replaced with a fresh clone.">
<echo level="info">Task org is ready to go.</echo>
</target>
<target name="StartNewTaskFlows" depends="taskRequired,fixFlowVersions,deployPackage"
description="Starts a new task with metadata deployed into a package with flow support. Requires: home, sf_credentials. Optional: Set sf_fullName to the unmanaged or managed name (not the prefix). Develop is used as the default.">
<echo level="info">Task org is ready to go.</echo>
</target>
<target name="ReadyToReview"
description="Create a pull request from changes made to a task org, if the tests pass. Requires: home, sf_credentials. Includes support for Flow Definitions and changes to the Admin profile. When used with a build server, do not select a client repository. (We clone our own.) When used locally, this target can be a destructive operawtion, as any local checkout of the repository is replaced with a fresh clone."
depends="taskRequired,checkOnlyServer,branch,retrievePackage,commit,postPullRequest">
<echo level="info">Task pull request is ready to review.</echo>
</target>
<target name="ReadyToReviewFixes"
description="Create a pull request from changes made to a task org, if the tests pass. Requires: home, sf_credentials. Includes support for Flow Definitions and changes to the Admin profile. When used with a build server, do not select a client repository. (We clone our own.) "
depends="taskRequired,checkOnlyServer,branch,retrievePackage,fixManifest,injectProfiles,injectFlowDefinitions,retrieveUnpackaged,fixProfiles,commit,postPullRequest">
<echo level="info">Task pull request is ready to review.</echo>
</target>
<!-- Ops -->
<target name="RetrieveFromOrg"
description="Updates the repository with metadata pulled from a specified org. Requires: home, sf_credentials. The target branch must be checked out. The branch (-Dbranch=staging) may be specified to override master. Convenience targets are also provided with common parameters already set, such as RetrieveFromStaging."
depends="checkOnlyUnpackagedServer,retrieveUnpackaged,fixComponents,commit">
<echo level="info">${branch} is refreshed from ${sf_username} org.</echo>
</target>
<target name="RetrieveFromDevelop"
description="Calls RetrieveFromOrg for the develop sandbox branch. Requires: home, sf_credentials. ">
<property name="sandbox" value="Develop"/>
<antcall target="RetrieveFromOrg"/>
</target>
<target name="RetrieveFromStaging"
description="Calls RetrieveFromOrg for the staging sandbox branch. Requires: home, sf_credentials. ">
<property name="sandbox" value="staging"/>
<antcall target="RetrieveFromOrg"/>
</target>
<target name="RetrieveFromProduction"
description="Calls RetrieveFromOrg for default master branch (production). Requires: home, sf_credentials.">
<antcall target="RetrieveFromOrg"/>
</target>
<target name="BackupStaging"
description="Updates a standing backup-staging branch with the production metadata. Requires: home, sf_credentials.">
<property name="sandbox" value="staging"/>
<property name="branch" value="backup-staging"/>
<antcall target="RetrieveFromOrg"/>
</target>
<target name="BackupProduction"
description="Updates a standing backup branch with the production metadata. Requires: home, sf_credentials.">
<property name="branch" value="backup"/>
<antcall target="RetrieveFromOrg"/>
</target>
<target name="CheckOnlyDevelopToProduction"
description="Validates develop against production without updating master. Requires home, sf_credentials (production).">
<property name="branch" value="develop"/>
<antcall target="checkOnly"/>
</target>
<target name="DeployToDevelop"
description="Calls deploy for develop. Requires: home, sf_credentials (for develop). Expects a develop sandbox.">
<property name="sandbox" value="develop"/>
<antcall target="deploy"/>
</target>
<target name="DeployToStaging" depends="BackupStaging"
description="Calls deploy for staging. Requires: home, sf_credentials (for staging). Expects a develop and staging branch, with staging checked out, and a staging sandbox.">
<property name="sandbox" value="staging"/>
<antcall target="deploy"/>
</target>
<target name="DeployToProduction" depends="BackupProduction"
description="Calls deploy for production. Requires: home, sf_credentials (for production). Expects a staging and master branch, with master checked out, and a staging sandbox.">
<property name="branch" value="master"/>
<antcall target="deploy"/>
</target>
<!-- Flows for the Win! -->
<target name="createFlowFolders" depends="initHome">
<mkdir dir="${homedir}/server"/>
<mkdir dir="${homedir}/server/flowDefinitions"/>
<mkdir dir="${homedir}/server/flows"/>
<echo file="${homedir}/server/package.xml" append="false"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>Flow</name>
</types>
<types>
<members>*</members>
<name>FlowDefinition</name>
</types>
<version>${sf_apiVersion}</version>
</Package>]]></echo>
</target>
<target name="retrieveFlows">
<property name="sf_retrieveTarget" value="${homedir}/server"/>
<property name="sf_unpackaged" value="${homedir}/server/package.xml"/>
<property name="sf_sourcedir" value="${homedir}/server"/>
<antcall target="retrieveUnpackaged"/>
</target>
<target name="removePriorFlows" depends="initHome">
<property name="serverdir" value="${homedir}/server"/>
<echo level="info">Executing removeFlowDefinitions using ...
"${tooldir}/sh/remove_flows"
serverdir="${serverdir}"
sf_sourcedir="${sf_sourcedir}"
</echo>
<!-- Do not fail on error, since there may be no prior flows to remove. -->
<exec executable="bash" failonerror="false">
<arg value="${tooldir}/sh/remove_prior_flows"/>
<env key="serverdir" value="${serverdir}"/>
<env key="sf_sourcedir" value="${sf_sourcedir}"/>
</exec>
</target>
<target name="fixFlowVersions" depends="createFlowFolders,retrieveFlows,removePriorFlows"/>
</project>