-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.xml
83 lines (62 loc) · 2.95 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Salesforce Metadata Backup" basedir="." xmlns:sf="antlib:com.salesforce" xmlns:if="ant:if" xmlns:unless="ant:unless">
<!-- The version of the antlib jar in lib -->
<property name="salesforce.antlib.version" value="59.0" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.classes.dir" value="${build.dir}/classes" />
<property name="build.metadata.dir" value="${build.dir}/metadata" />
<import file="ant-includes/setup-target.xml" />
<include file="ant-includes/salesforce-tasks.xml" />
<include file="ant-includes/groovy-tasks.xml" />
<taskdef name="xmlmerge" classname="ch.elca.el4j.services.xmlmerge.anttask.XmlMergeTask" classpath="lib/module-xml_merge-common-3.1.jar;lib/jdom-1.1.3.jar;lib/jaxen-1.1.1.jar;lib/slf4j-api-1.7.7.jar" />
<target name="compileSrc" depends="clean,-setUp">
<mkdir dir="${build.classes.dir}" />
<groovyc srcdir="." destdir="${build.classes.dir}" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="-initSalesforceSession" depends="compileSrc">
<metadataBackupTool>
properties['sf.sessionId'] = metadataBackupTool.getSalesforceSessionId()
</metadataBackupTool>
</target>
<target name="generatePackageXmlAndBuildXml" depends="-initSalesforceSession">
<metadataBackupTool>
metadataBackupTool.generateMetadataRetrievalManifests()
</metadataBackupTool>
</target>
<target name="bulkRetrievable" depends="generatePackageXmlAndBuildXml, -setUpMetadataDir">
<ant antfile="${build.dir}/bulk-retrievable-target.xml" />
</target>
<target name="bulkRetrieveFolders" depends="generatePackageXmlAndBuildXml">
<ant antfile="${build.dir}/folders-build.xml" />
</target>
<target name="retrieveMiscMetadata" depends="generatePackageXmlAndBuildXml,-setUpMetadataDir">
<sfRetrieve unpackaged="${build.dir}/misc-package.xml" />
<ant antfile="${build.dir}/profile-packages-target.xml" />
<xmlMergeProfilesAndPermissions />
</target>
<target
name="backupMetadata"
depends="clean,bulkRetrievable,bulkRetrieveFolders,retrieveMiscMetadata"
description="Retrieve metadata from Salesforce for backups"
/>
<macrodef name="xmlMergeProfilesAndPermissions">
<sequential>
<metadataBackupTool>
metadataBackupTool.generateXmlMergeTarget()
</metadataBackupTool>
<ant antfile="${build.dir}/profile-packages-merge-target.xml" />
</sequential>
</macrodef>
<macrodef name="metadataBackupTool" description="Execute metadata backup helper script">
<text name="script" optional="false" description="Groovy script to execute with the metadataBackupTool instance in scope" />
<sequential>
<groovy classpath="${build.classes.dir}"><![CDATA[
def metadataBackupTool = new MetadataBackupTool(Configuration.fromAntProject(project))
@{script}
]]></groovy>
</sequential>
</macrodef>
</project>