Skip to content

Instantly share code, notes, and snippets.

@azriel91
Last active June 2, 2023 01:15
Show Gist options
  • Save azriel91/8ef2697f604ecbdde0d04e6798db4440 to your computer and use it in GitHub Desktop.
Save azriel91/8ef2697f604ecbdde0d04e6798db4440 to your computer and use it in GitHub Desktop.
Sublime Text Gradle build system
{
// Put this script in:
//
// ```text
// ~/.config/sublime-text-3/Packages/User/gradle.sublime-build
// ```
//
// 1. Install Java: `sudo apt install -y openjdk-19-jdk`.
// 2. Install gradle.
// 3. Set `GRADLE_HOME` in `~/.profile`.
// 4. Set `JAVA_HOME` in `~/.profile`.
// 5. Install the ANSIescape package.
// 6. Install the LSP package.
// 7. Install the LSP-jdtls package.
"shell_cmd": "gradle build | sd -s '' ''",
"selector": "source.java",
"cancel": { "kill": true },
"working_dir": "${project_path:${folder:${file_path}}}",
"file_regex": "^([a-zA-Z0-9_ ./]+[.]java):([0-9]*):([0-9]*) ([^\\n]+)",
"target": "ansi_color_build",
"syntax": "Packages/ANSIescape/ANSI.sublime-syntax",
"variants": [
{
"name": "Test",
// Gradle outputs some ANSI control characters, which SublimeANSI doesn't parse:
// <https://github.com/aziz/SublimeANSI/issues/58>
//
// `` is "erase to end of line":
// <https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797>
"shell_cmd": "gradle test --rerun-tasks | sd -s '' ''",
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment