This contributor guide explains how to make and test changes to Durable Functions in Java. Thank you for taking the time to contribute to the DurableTask Java SDK!
- Relevant Docs
- Prerequisites
- Pull Request Change Flow
- Testing with a Durable Functions app
- Debugging .NET packages from a Durable Functions Java app
- Visual Studio Code
- Azure Functions Core Tools
- Apache Maven 3.8.1 or higher (Note: the instructions in this doc were validated using Apache Maven 3.9.9)
- Gradle 7.4
- Java 8 or higher (Note: the instructions in this doc were validated using Java 17)
The general flow for making a change to the library is:
- 🍴 Fork the repo (add the fork via
git remote add me <clone url here>) - 🌳 Create a branch for your change (generally branch from dev) (
git checkout -b my-change) - 🛠 Make your change
- ✔️ Test your change
- ⬆️ Push your changes to your fork (
git push me my-change) - 💌 Open a PR to the dev branch
- 📢 Address feedback and make sure tests pass (yes even if it's an "unrelated" test failure)
- 📦 Rebase your changes into meaningful commits (
git rebase -i HEAD~NwhereNis commits you want to squash)
Rebase and merge (This will be done for you if you don't have contributor access)- ✂️ Delete your branch (optional)
The following instructions explain how to test durabletask-java changes in a Durable Functions Java app.
- After making changes in durabletask-java, you will need to increment the version number in build.gradle. For example, if you make a change in the azurefunctions directory, then you would update the version in
azurefunctions/build.gradle. - In the durabletask-java repo, from the root of the project, run
./gradlew clean build. This will create the .jar files with the updated version that you specified. - To get the .jar file that was created, go to the
build/libsdirectory. For example, if you made a change in azurefunctions, then go todurabletask-java/azurefunctions/build/libs. If you made a change to client, then go todurabletask-java/client/build/libs. Add the .jar files that you are testing to a local directory. - Create a Durable Functions Java app if you haven't done so already.
- In the Durable Functions Java app, run the following command to install the local .jar files that were created in step 2:
mvn install:install-file -Dfile="<path to .jar file that was created in step 2>" -DgroupId="com.microsoft" -DartifactId="<name of .jar file>" -Dversion="<version>" -Dpackaging="jar" -DlocalRepositoryPath="<path to Durable Functions Java app>".
For example, if you created custom durabletask-client and durabletask-azure-functions packages with version 1.6.0 in step 2, then you would run the following commands:
mvn install:install-file -Dfile="C:/Temp/durabletask-client-1.6.0.jar" -DgroupId="com.microsoft" -DartifactId="durabletask-client" -Dversion="1.6.0" -Dpackaging="jar" -DlocalRepositoryPath="C:/df-java-sample-app"
mvn install:install-file -Dfile="C:/Temp/durabletask-azure-functions-1.6.0.jar" -DgroupId="com.microsoft" -DartifactId="durabletask-azure-functions" -Dversion="1.6.0" -Dpackaging="jar" -DlocalRepositoryPath="C:/df-java-sample-app"
- Run
mvn clean packagefrom the Durable Functions app root folder. - Run
mvn azure-functions:runfrom the Durable Functions app root folder.
If you want to debug into the Durable Task or any of the .NET bits, follow the instructions below:
- If you would like to debug a custom local WebJobs extension package then create the custom package, place it in a local directory, and then run
func extensions install --package Microsoft.Azure.WebJobs.Extensions.DurableTask --version <VERSION>. If you update the version while debugging and the new version doesn't get picked up, then try runningfunc extensions installto get the new changes. - Make sure the Durable Functions Java debugging is set up already and the debugger has started the
funcprocess. - In the VSCode editor for DurableTask, click Debug -> .NET Core Attach Process, search for
func host startprocess and attach to it. - Add a breakpoint in both editors and continue debugging.