[SalesForce] How to do incremental builds in Jenkins using ANT Migration Tool

I am able to run ANT build in Jenkins , how can I configure Jenkins to only build recent revisions or to skip commits which were build in previous run.

By build , I mean to deploy changes to other env.

Currently we are not using branch model in git and build file has target-

<sf:deploy 
    username="${sf.username}" 
    password="${sf.password}" 
    serverurl="${sf.serverurl}" 
    maxPoll="${sf.maxPoll}" 
    deployRoot="src" 
    rollbackOnError="true" 
    runAllTests="false" 
    logType="Debugonly" 
    checkOnly="true" />

Since deploy root is src, it will always pick up whole code base and try to deploy as jenkins checkout the whole repository.

How can we align ANT with Jenkins so that it only builds current revisions?

What are our options to make it work?

Any pointers will be appreciated.

Best Answer

you can try to use gradle and this scripts https://github.com/SergeyTrusov/sf-build-scripts