Developer Notes - aplpolaris/promptfx GitHub Wiki
Building PromptFx
PromptFx uses the Java module system, which has some advantages but can complicate the build process. Some common issues and fixes are described below.
IntelliJ
IntelliJ run/debug configurations (in the Run/Edit Configurations... dialog) may need to be modified to run/debug PromptFx. Add the following VM options to explicitly open modules for use with TornadoFx:
--add-reads kotlin.stdlib=kotlinx.coroutines.core
Notes on Prior Versions
Due to a bug, prior versions needed additional VM options: --add-opens javafx.graphics/javafx.scene=tornadofx,javafx.graphics/javafx.scene=tornadofx
--add-opens javafx.graphics/javafx.scene=tornadofx--add-opens javafx.controls/javafx.scene.control.skin=tornadofx
Running Tests
When running tests within IntelliJ, you may need to add an --add-reads kotlin.stdlib=kotlinx.coroutines.core:
In some cases, use of test jars may cause tests to fail (e.g. MultimodalChatTestKt class not found exceptions). To fix this in IntelliJ:
- Open
Edit Configurations...dialog - At the left, click the blue link that says
Edit configuration templates... - Select JUnit, then click the blue link that says
Modify options - Make sure the
Do not use --module-path optionis enabled
PromptFx uses JUnit5 Tags to customize test execution. In IntelliJ, you can selectively execute integration tests using the Tags configuration option in the Run/Debug Configurations dialog:
By default, tests tagged with gemini and openai are excluded when running mvn test from the command-line. (Working on ways to run groups individually from the command-line but for no swap out the <excludedGroups> portion of the maven-surefire-plugin in the promptkt pom file.)
Platform-Specific Builds
The distribution project (promptfx-distribution) builds distribution zips for PromptFx using Gradle.
Use the platform-specific release profiles windows macos mac64 linux to create platform-specific jars and executables, e.g.
mvn package -Plinux -DskipTests
Before performing a platform-specific build, make sure you've set the right version in
build.gradle.kts.
Performing Releases
Performing Releases for Maven Central
- Ensure all pull requests and code changes are complete, and all tests functional.
- Build and release meta-projects in order
promptkt,promptex,promptrt,promptfx. (If patching specific libraries, okay to release a subset of these, but major.minor versions should match.) For each of these folders, do:
mvn release:prepare
mvn release:perform -Pwindows
- Navigate to https://central.sonatype.com/ and login, then https://central.sonatype.com/publishing and publish the validated artifacts.
- After a half hour or so they should be available at https://central.sonatype.com/namespace/com.googlecode.blaisemath, e.g. https://central.sonatype.com/artifact/com.googlecode.blaisemath/promptfx
Creating Platform-Specific Artifacts
The promptfx sub-module has platform-specific release profiles, allowing for custom executable jars to be built using maven. To prepare these:
- Checkout the promptfx tag created during release (e.g.
git checkout promptfx-meta-0.12.0) -- or find this tag in thetarget/checkout/folder after performing the release. - Navigate to the
promptfx/module folder and run platform-specific packaging:
for PLATFORM in windows macos mac64 linux; do
mvn install -P$PLATFORM,release -DskipTests;
done
This installs the artifacts
promptfx-0.12.0-windows.jar, etc. to your local maven repository. We'd like to modify this to deploy platform-specific jars to maven central in the future.
Then, in the distribution folder, construct the distribution zips (locally):
- Change the versions in
build.gradle.ktsto match the artifacts just created. - Run the distribution script:
cd distribution
./gradlew zipAll