Skip to content

Commit

Permalink
Merge pull request #244 from influxdata/crepererum/drop_procspawn
Browse files Browse the repository at this point in the history
chore: drop `procspawn`
  • Loading branch information
alamb authored Aug 5, 2024
2 parents 7b2c6d0 + a593e9e commit 329431a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 35 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ dotenvy = "0.15.1"
futures = "0.3"
j4rs = "0.20.0"
once_cell = "1.9"
procspawn = "1.0"
proptest = "1"
proptest-derive = "0.5"
rustls-pemfile = "2.0"
Expand Down
1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
version = 2
yanked = "deny"
ignore = [
{ id = "RUSTSEC-2020-0016", reason = "net2 still required for tests (procspawn -> ipc-channel 0.16 -> mio 0.6 -> net2 )"}
]
git-fetch-with-cli = true

Expand Down
56 changes: 23 additions & 33 deletions tests/java_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,39 +312,29 @@ pub async fn consume(

/// Lazy static that tracks if we already installed all JVM dependencies.
static JVM_SETUP: Lazy<()> = Lazy::new(|| {
// The way JVM is hooked up via JNI is kinda weird. We have process-wide VMs that are always cached. On first
// startup j4rs sets up the class path based on what's already installed. If we now run the installation VM in the
// same process as our tests, we can never consume the freshly installed libraries. So we use a subprocess to run
// the actual dependency installation and drop that process (including its VM) once its completed.
procspawn::init();

let handle = procspawn::spawn((), |_| {
let jvm_installation = JvmBuilder::new().build().expect("setup JVM");

for artifact_name in [
// Kafka client
// Note that j4rs does NOT pull dependencies, so we need to add compression libs (except for gzip, which is
// built into Java) manually.
"org.apache.kafka:kafka-clients:3.5.0",
// Helper used in `from_java_bytes`
"org.apache.commons:commons-lang3:3.12.0",
// LZ4 compression support
"org.lz4:lz4-java:1.8.0",
// snappy compression support
"org.xerial.snappy:snappy-java:1.1.10.2",
// zstd compression support
"com.github.luben:zstd-jni:1.5.5-5",
// logging from within java
"org.slf4j:slf4j-api:2.0.7",
] {
let artifact = MavenArtifact::from(artifact_name);
jvm_installation
.deploy_artifact(&artifact)
.unwrap_or_else(|_| panic!("Artifact deployment failed ({artifact_name})"));
}
});

handle.join().unwrap();
let jvm_installation = JvmBuilder::new().build().expect("setup JVM");

for artifact_name in [
// Kafka client
// Note that j4rs does NOT pull dependencies, so we need to add compression libs (except for gzip, which is
// built into Java) manually.
"org.apache.kafka:kafka-clients:3.5.0",
// Helper used in `from_java_bytes`
"org.apache.commons:commons-lang3:3.12.0",
// LZ4 compression support
"org.lz4:lz4-java:1.8.0",
// snappy compression support
"org.xerial.snappy:snappy-java:1.1.10.2",
// zstd compression support
"com.github.luben:zstd-jni:1.5.5-5",
// logging from within java
"org.slf4j:slf4j-api:2.0.7",
] {
let artifact = MavenArtifact::from(artifact_name);
jvm_installation
.deploy_artifact(&artifact)
.unwrap_or_else(|_| panic!("Artifact deployment failed ({artifact_name})"));
}
});

fn setup_jvm() -> Jvm {
Expand Down

0 comments on commit 329431a

Please sign in to comment.