-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Ant build script and config for Travis
- Loading branch information
1 parent
2896df1
commit 84e0885
Showing
13 changed files
with
1,193 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
sudo: false | ||
branches: | ||
only: | ||
- master | ||
env: | ||
global: | ||
- secure: "EL+cB87KI7FTCTt8nLDYu1Quvl8qsQRjBl3OsD+/DTb846OGXreuwv77nd/pd3inabIIcZIe5HQpae67Nfyxgdl2/+qVOCCZf980I+pG4W7qpYc9epyGZI/BgPzLFPknm0cKweu0mB0/t6ubTb0knFGJE+D9ny4926x3d5H94/4=" | ||
- secure: "BA8Q3I1HiI0Tr0wEqWBpi5kXeOxE2OtDtNZUiIG3inJTedFAKTQ3d/g9au2mSqKiMIkPScQkO+mA4Fd16hFFtzFnec2AfoIhbTRwLgfC+/OjrNJK8AXw6XLorJiSV8yNI8qZYEHRyJtQ/W+09+UO7vtftUBPnNvf7fUmIqvwAzk=" | ||
script: | ||
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ant -lib lib/ant-salesforce.jar -Dsf.username=${SFUSER} -Dsf.password=${SFPWD} deploy || [ "${TRAVIS_PULL_REQUEST}" != "false" ]' | ||
- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] && ant -lib lib/ant-salesforce.jar -Dsf.username=${SFUSER} -Dsf.password=${SFPWD} deploy || [ "${TRAVIS_PULL_REQUEST}" = "false" ]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<project xmlns:sf="antlib:com.salesforce"> | ||
|
||
<!-- Downloaded from http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ --> | ||
<taskdef | ||
resource="net/sf/antcontrib/antlib.xml" | ||
classpath="${basedir}/lib/ant-contrib-1.0b3.jar"/> | ||
|
||
<macrodef name="installPackage" description="Installs the given managed package"> | ||
<attribute name="namespace" description="Namespace of managed package to install."/> | ||
<attribute name="version" description="Version of managed package to install."/> | ||
<attribute name="packagePassword" description="Password used to install the pacakge. Optional." default=""/> | ||
<attribute name="username" description="Salesforce user name."/> | ||
<attribute name="password" description="Salesforce password."/> | ||
<sequential> | ||
<!-- Generate optional <password> element? --> | ||
<if><equals arg1="@{packagePassword}" arg2=""/> | ||
<then><property name="passwordElement" value=""/></then> | ||
<else><property name="passwordElement" value="<password>@{packagePassword}</password>"/></else> | ||
</if> | ||
<!-- Generate working folder and metadata files representing the package to install --> | ||
<delete dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy/installedPackages"/> | ||
<echo file="${basedir}/installdeploy/package.xml"><![CDATA[<Package xmlns="http://soap.sforce.com/2006/04/metadata"><types><members>@{namespace}</members><name>InstalledPackage</name></types><version>28.0</version></Package>]]></echo> | ||
<echo file="${basedir}/installdeploy/installedPackages/@{namespace}.installedPackage"><![CDATA[<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata"><versionNumber>@{version}</versionNumber>${passwordElement}</InstalledPackage>]]></echo> | ||
<sf:deploy deployRoot="${basedir}/installdeploy" username="@{username}" password="@{password}"/> | ||
<delete dir="${basedir}/installdeploy"/> | ||
</sequential> | ||
</macrodef> | ||
|
||
<macrodef name="uninstallPackage" description="Uninstalls the given managed package"> | ||
<attribute name="namespace" description="Namespace of managed package to install."/> | ||
<attribute name="username" description="Salesforce user name."/> | ||
<attribute name="password" description="Salesforce password."/> | ||
<sequential> | ||
<!-- Generate working folder and metadata files representing the package to uninstall --> | ||
<delete dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy"/> | ||
<mkdir dir="${basedir}/installdeploy/installedPackages"/> | ||
<echo file="${basedir}/installdeploy/package.xml"><![CDATA[<Package xmlns="http://soap.sforce.com/2006/04/metadata"><version>28.0</version></Package>]]></echo> | ||
<echo file="${basedir}/installdeploy/destructiveChanges.xml"><![CDATA[<Package xmlns="http://soap.sforce.com/2006/04/metadata"><types><members>@{namespace}</members><name>InstalledPackage</name></types><version>28.0</version></Package>]]></echo> | ||
<echo file="${basedir}/installdeploy/installedPackages/@{namespace}.installedPackage"><![CDATA[<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata"><versionNumber>@{version}</versionNumber></InstalledPackage>]]></echo> | ||
<sf:deploy deployRoot="${basedir}/installdeploy" username="@{username}" password="@{password}"/> | ||
<delete dir="${basedir}/installdeploy"/> | ||
</sequential> | ||
</macrodef> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
* Copyright (c) 2012, FinancialForce.com, inc | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the FinancialForce.com, inc nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> | ||
<project name="ExecAnon"> | ||
|
||
<!-- Download from http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ --> | ||
<taskdef | ||
resource="net/sf/antcontrib/antlib.xml" | ||
classpath="${basedir}/lib/ant-contrib-1.0b3.jar"/> | ||
|
||
<!-- Download from https://code.google.com/p/missing-link/ --> | ||
<taskdef | ||
name="http" | ||
classname="org.missinglink.ant.task.http.HttpClientTask" | ||
classpath="${basedir}/lib/ml-ant-http-1.1.3.jar"/> | ||
|
||
<!-- Download from http://www.oopsconsultancy.com/software/xmltask/ --> | ||
<taskdef | ||
name="xmltask" | ||
classname="com.oopsconsultancy.xmltask.ant.XmlTask" | ||
classpath="${basedir}/lib/xmltask.jar"/> | ||
|
||
<target name="ExecAnon"> | ||
<executeApex username="${sf.username}" password="${sf.password}">${what}</executeApex> | ||
</target> | ||
|
||
<!-- Provides access to the Salesforce Tooling REST API ExecuteAnnoynmous resource --> | ||
<macrodef name="executeApex" description="Provides access to the Salesforce Tooling REST API ExecuteAnnoynmous resource"> | ||
<attribute name="username" description="Salesforce user name."/> | ||
<attribute name="password" description="Salesforce password."/> | ||
<attribute name="resultprefix" description="Property name prefix used for properties containing response data" default="executeAnonymousResponse"/> | ||
<attribute name="failonerror" description="If the execute fails then fail the Ant script" default="true"/> | ||
<text name="apexcode"/> | ||
<sequential> | ||
<!-- Login --> | ||
<login username="@{username}" password="@{password}" serverurl="serverUrl" sessionId="sessionId"/> | ||
<!-- Extract host/instance name from the serverUrl returned from the login response --> | ||
<propertyregex property="host" | ||
input="${serverUrl}" | ||
regexp="^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$" | ||
select="\3" | ||
casesensitive="false" /> | ||
<!-- Execute Apex via Tooling API /executeAnonymous resource --> | ||
<http url="https://${host}/services/data/v30.0/tooling/executeAnonymous" method="GET" entityProperty="executeAnonymousResponse" statusProperty="loginResponseStatus" printrequestheaders="false" printresponseheaders="false"> | ||
<headers> | ||
<header name="Authorization" value="Bearer ${sessionId}"/> | ||
</headers> | ||
<query> | ||
<parameter name="anonymousBody" value="@{apexcode}"/> | ||
</query> | ||
</http> | ||
<!-- Parse JSON response and set properites --> | ||
<script language="javascript"> | ||
var response = eval('('+project.getProperty('executeAnonymousResponse')+')'); | ||
for(field in response) | ||
project.setProperty('@{resultprefix}.' + field, response[field]); | ||
</script> | ||
<!-- Fail on error?--> | ||
<if> | ||
<and> | ||
<equals arg1="@{failonerror}" arg2="true"/> | ||
<equals arg1="${@{resultprefix}.success}" arg2="false"/> | ||
</and> | ||
<then> | ||
<if> | ||
<equals arg1="${@{resultprefix}.compiled}" arg2="false"/> | ||
<then> | ||
<fail message="${@{resultprefix}.line}:${@{resultprefix}.column} ${@{resultprefix}.compileProblem}"/> | ||
</then> | ||
<else> | ||
<fail message="${@{resultprefix}.exceptionMessage} ${@{resultprefix}.exceptionStackTrace}"/> | ||
</else> | ||
</if> | ||
</then> | ||
</if> | ||
</sequential> | ||
</macrodef> | ||
|
||
<!-- Login into Salesforce and return the session Id and serverUrl --> | ||
<macrodef name="login"> | ||
<attribute name="username" description="Salesforce user name."/> | ||
<attribute name="password" description="Salesforce password."/> | ||
<attribute name="serverurl" description="Server Url property."/> | ||
<attribute name="sessionId" description="Session Id property."/> | ||
<sequential> | ||
<!-- Obtain Session Id via Login SOAP service --> | ||
<http url="https://login.salesforce.com/services/Soap/c/30.0" method="POST" failonunexpected="false" entityProperty="loginResponse" statusProperty="loginResponseStatus"> | ||
<headers> | ||
<header name="Content-Type" value="text/xml"/> | ||
<header name="SOAPAction" value="login"/> | ||
</headers> | ||
<entity> | ||
<![CDATA[ | ||
<env:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> | ||
<env:Body> | ||
<sf:login xmlns:sf='urn:enterprise.soap.sforce.com'> | ||
<sf:username>@{username}</sf:username> | ||
<sf:password>@{password}</sf:password> | ||
</sf:login> | ||
</env:Body> | ||
</env:Envelope> | ||
]]> | ||
</entity> | ||
</http> | ||
<!-- Parse response --> | ||
<xmltask destbuffer="loginResponseBuffer"> | ||
<insert path="/">${loginResponse}</insert> | ||
</xmltask> | ||
<if> | ||
<!-- Success? --> | ||
<equals arg1="${loginResponseStatus}" arg2="200"/> | ||
<then> | ||
<!-- Parse sessionId and serverUrl --> | ||
<xmltask sourcebuffer="loginResponseBuffer" failWithoutMatch="true"> | ||
<copy path="/*[local-name()='Envelope']/*[local-name()='Body']/:loginResponse/:result/:sessionId/text()" property="@{sessionId}"/> | ||
<copy path="/*[local-name()='Envelope']/*[local-name()='Body']/:loginResponse/:result/:serverUrl/text()" property="@{serverUrl}"/> | ||
</xmltask> | ||
</then> | ||
<else> | ||
<!-- Parse login error message and fail build --> | ||
<xmltask sourcebuffer="loginResponseBuffer" failWithoutMatch="true"> | ||
<copy path="/*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='Fault']/*[local-name()='faultstring']/text()" property="faultString"/> | ||
</xmltask> | ||
<fail message="${faultString}"/> | ||
</else> | ||
</if> | ||
</sequential> | ||
</macrodef> | ||
|
||
<target name="ExecAnonScript"> | ||
<loadfile property="script" srcFile="${what}"/> | ||
<executeApex username="${sf.username}" password="${sf.password}">${script}</executeApex> | ||
</target> | ||
|
||
</project> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.