rules_jvm_external
rules_jvm_external copied to clipboard
Pinning a platform specific dependency doesn't work correctly
Take a JavaFX project with two lockfiles (one for windows and one for linux):
maven.install(
name = "windows",
artifacts = [
"org.openjfx:javafx-graphics:win:17",
"org.openjfx:javafx-controls:win:17",
"org.openjfx:javafx-fxml:win:17",
"org.openjfx:javafx-base:win:17",
],
lock_file = "//:windows_install.json",
fetch_sources = True,
)
maven.install(
name = "linux",
artifacts = [
"org.openjfx:javafx-graphics:linux:17",
"org.openjfx:javafx-controls:linux:17",
"org.openjfx:javafx-fxml:linux:17",
"org.openjfx:javafx-base:linux:17",
],
lock_file = "//:linux_install.json",
fetch_sources = True,
)
I would expect that running bazel run @unpinned_linux//:pin
on a windows machine will download the linux jars given the platform qualifier, but instead it downloads the windows jars. The reverse (pinning windows deps on a linux machine) will also have the same unintended effect.
Am I using rules_jvm_external wrong? If so, how should I go about this instead (or how would I go about creating fat jars)?
It looks like it will download both the one you ask for and the one for the architecture of your OS.
I tried
maven_install(
name = "linux",
artifacts = [
maven.artifact(
artifact = "javafx-base",
classifier = "linux",
group = "org.openjfx",
version = "17",
),
maven.artifact(
artifact = "javafx-controls",
classifier = "linux",
group = "org.openjfx",
version = "17",
),
maven.artifact(
artifact = "javafx-fxml",
classifier = "linux",
group = "org.openjfx",
version = "17",
),
maven.artifact(
artifact = "javafx-graphics",
classifier = "linux",
group = "org.openjfx",
version = "17",
),
],
maven_install_json = "//:linux_install.json",
fetch_sources = True,
repositories = [
"https://repo1.maven.org/maven2",
],
)
and linux_install.json
had artifacts for linux and the host os(mac-aarch64
in my case).
Is pulling both artifacts causing a problem?