Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/aquaproj/aqua/main/json-schema/registry.json
packages:
- type: github_release
repo_owner: facebook
repo_name: ktfmt
description: A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions
asset: ktfmt-{{trimV .Version}}-with-dependencies.jar
format: raw
complete_windows_ext: false
4 changes: 4 additions & 0 deletions registry/ktfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
backends = ["aqua:facebook/ktfmt"]
depends = ["java"]
description = "A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions"
test = { cmd = "ktfmt --version", expected = "ktfmt version {{version}}" }
19 changes: 18 additions & 1 deletion src/backend/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::{env, file, github, minisign};
use async_trait::async_trait;
use eyre::{ContextCompat, Result, bail, eyre};
use indexmap::IndexSet;
use indoc::formatdoc;
use itertools::Itertools;
use regex::Regex;
use std::borrow::Cow;
Expand Down Expand Up @@ -1605,7 +1606,23 @@ impl AquaBackend {
make_executable = true;
} else if format == "raw" {
file::create_dir_all(&install_path)?;
file::copy(&tarball_path, first_bin_path)?;
if filename.ends_with(".jar") {
// JAR files cannot be executed directly; store the jar alongside
// the bin and create a small shell wrapper that invokes java -jar.
let jar_path = first_bin_path.with_extension("jar");
Comment thread
greptile-apps[bot] marked this conversation as resolved.
file::copy(&tarball_path, &jar_path)?;
let wrapper = formatdoc! {r#"
#!/bin/sh
if [ -n "$JAVA_HOME" ]; then
exec "$JAVA_HOME/bin/java" -jar "{jar_path}" "$@"
else
exec java -jar "{jar_path}" "$@"
fi
"#, jar_path = jar_path.display()};
file::write(first_bin_path, &wrapper)?;
} else {
file::copy(&tarball_path, first_bin_path)?;
}
make_executable = true;
Comment thread
greptile-apps[bot] marked this conversation as resolved.
} else if format.starts_with("tar") {
file::untar(&tarball_path, &install_path, &tar_opts)?;
Expand Down
Loading