How to execute shell command? source or dot doesn't work with exec

yeah… but those source values are only available within that subprocess… for example

$ sh -c ‘source $ROOT/buildlocalBuildPorts’ $ echo $FINAL_LOCALTEST_TOMCAT_HTTP_PORT

$ bash -c ‘source $ROOT/buildlocalBuildPorts’ $ echo $FINAL_LOCALTEST_TOMCAT_HTTP_PORT

$ zsh -c ‘source $ROOT/buildlocalBuildPorts’ $ echo $FINAL_LOCALTEST_TOMCAT_HTTP_PORT

$ source $ROOT/buildlocalBuildPorts $ echo $FINAL_LOCALTEST_TOMCAT_HTTP_PORT 9090

the source values is not available outside. So even If I try it with

exec {
     executable "sh"
    args "-c","source ${root}/etc/localBuildPorts"
     }
 println System.getenv()['FINAL_LOCALTEST_TOMCAT_HTTP_PORT']

the sourced variables wont be available to gradle. Correct me If I am wrong.