From ae2d5f6ff541b09773509a2e54c74545393b04a8 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 15:46:46 +0800 Subject: [PATCH 01/21] layout gvfs-fuse project --- clients/gvfs-fuse/.cargo/config.toml | 20 +++++++++++ clients/gvfs-fuse/.gitignore | 1 + clients/gvfs-fuse/Cargo.toml | 30 ++++++++++++++++ clients/gvfs-fuse/build.gradle.kts | 52 ++++++++++++++++++++++++++++ clients/gvfs-fuse/check_rust_env.sh | 50 ++++++++++++++++++++++++++ clients/gvfs-fuse/src/main.rs | 30 ++++++++++++++++ clients/gvfs-fuse/tests/it.rs | 23 ++++++++++++ settings.gradle.kts | 3 +- 8 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 clients/gvfs-fuse/.cargo/config.toml create mode 100644 clients/gvfs-fuse/.gitignore create mode 100644 clients/gvfs-fuse/Cargo.toml create mode 100644 clients/gvfs-fuse/build.gradle.kts create mode 100755 clients/gvfs-fuse/check_rust_env.sh create mode 100644 clients/gvfs-fuse/src/main.rs create mode 100644 clients/gvfs-fuse/tests/it.rs diff --git a/clients/gvfs-fuse/.cargo/config.toml b/clients/gvfs-fuse/.cargo/config.toml new file mode 100644 index 00000000000..37751e880c3 --- /dev/null +++ b/clients/gvfs-fuse/.cargo/config.toml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build] +target-dir = "build" + diff --git a/clients/gvfs-fuse/.gitignore b/clients/gvfs-fuse/.gitignore new file mode 100644 index 00000000000..5a44eef09a5 --- /dev/null +++ b/clients/gvfs-fuse/.gitignore @@ -0,0 +1 @@ +/Cargo.lock diff --git a/clients/gvfs-fuse/Cargo.toml b/clients/gvfs-fuse/Cargo.toml new file mode 100644 index 00000000000..55a66a34782 --- /dev/null +++ b/clients/gvfs-fuse/Cargo.toml @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "gvfs-fuse" +version = "0.1.0" +edition = "2021" +rust-version = "1.75" + +[dependencies] +fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } +tokio = { version = "1.38.0", features = ["full"] } +futures-util = "0.3.30" +libc = "0.2.164" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +log = "0.4.22" diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/gvfs-fuse/build.gradle.kts new file mode 100644 index 00000000000..f0ba2ad1129 --- /dev/null +++ b/clients/gvfs-fuse/build.gradle.kts @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.gradle.api.tasks.Exec + +val checkRustEnvironment by tasks.registering(Exec::class) { + description = "Check if Rust environment is properly set up using an external script" + group = "verification" + commandLine("bash", "$projectDir/check_rust_env.sh") + isIgnoreExitValue = false +} + +val compileRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Compile the Rust submodule" + workingDir = file("$projectDir") + commandLine("cargo", "build", "--release") +} + +tasks.register("testRust", Exec::class) { + dependsOn(checkRustEnvironment) + description = "Run tests in the Rust submodule" + group = "verification" + workingDir = file("$projectDir") + commandLine("cargo", "test") + + standardOutput = System.out + errorOutput = System.err +} + +tasks.named("build") { + dependsOn(compileRust) +} +tasks.named("test") { + dependsOn("testRust") +} diff --git a/clients/gvfs-fuse/check_rust_env.sh b/clients/gvfs-fuse/check_rust_env.sh new file mode 100755 index 00000000000..c531cab3d4a --- /dev/null +++ b/clients/gvfs-fuse/check_rust_env.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +#!/bin/bash + +if ! command -v cargo &> /dev/null; then + echo "Rust is not installed. Installing Rust..." + + if command -v curl &> /dev/null; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + elif command -v wget &> /dev/null; then + wget -qO- https://sh.rustup.rs | sh -s -- -y + else + echo "Error: Neither curl nor wget is available. Please install one of them to proceed." + exit 1 + fi + + export PATH="$HOME/.cargo/bin:$PATH" + echo "Rust has been installed successfully." +else + echo "Rust is already installed: $(cargo --version)" +fi + +if command -v cargo &> /dev/null; then + echo "Rust environment is set up correctly." +else + echo "Error: Rust installation failed. Please check your setup." + exit 1 +fi + + +exit 1 diff --git a/clients/gvfs-fuse/src/main.rs b/clients/gvfs-fuse/src/main.rs new file mode 100644 index 00000000000..6e07ee50104 --- /dev/null +++ b/clients/gvfs-fuse/src/main.rs @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +use fuse3::Result; +use log::info; +use log::debug; + +#[tokio::main] +async fn main() -> Result<()> { + tracing_subscriber::fmt().with_env_filter("debug").init(); + info!("Starting filesystem..."); + debug!("Shutdown filesystem..."); + Ok(()) +} diff --git a/clients/gvfs-fuse/tests/it.rs b/clients/gvfs-fuse/tests/it.rs new file mode 100644 index 00000000000..989e5f9895e --- /dev/null +++ b/clients/gvfs-fuse/tests/it.rs @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#[test] +fn test_math_add() { + assert_eq!(1, 1); +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 2cde39c222b..ddb50d5991b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -47,7 +47,8 @@ include( "clients:filesystem-hadoop3", "clients:filesystem-hadoop3-runtime", "clients:client-python", - "clients:cli" + "clients:cli", + "clients:gvfs-fuse" ) include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server") From 5817280d30778ea87d23b74e38c90ac41ff44430 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 16:00:37 +0800 Subject: [PATCH 02/21] Update --- clients/gvfs-fuse/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/gvfs-fuse/build.gradle.kts index f0ba2ad1129..cb47f572a32 100644 --- a/clients/gvfs-fuse/build.gradle.kts +++ b/clients/gvfs-fuse/build.gradle.kts @@ -28,14 +28,14 @@ val checkRustEnvironment by tasks.registering(Exec::class) { val compileRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) - description = "Compile the Rust submodule" + description = "Compile the Rust project" workingDir = file("$projectDir") commandLine("cargo", "build", "--release") } tasks.register("testRust", Exec::class) { dependsOn(checkRustEnvironment) - description = "Run tests in the Rust submodule" + description = "Run tests in the Rust project" group = "verification" workingDir = file("$projectDir") commandLine("cargo", "test") From 20ee836d39137c23bd0a5e518a1efcdff6acb7f8 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 16:01:39 +0800 Subject: [PATCH 03/21] Update --- clients/gvfs-fuse/check_rust_env.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/clients/gvfs-fuse/check_rust_env.sh b/clients/gvfs-fuse/check_rust_env.sh index c531cab3d4a..6983be99b91 100755 --- a/clients/gvfs-fuse/check_rust_env.sh +++ b/clients/gvfs-fuse/check_rust_env.sh @@ -46,5 +46,3 @@ else exit 1 fi - -exit 1 From 72c5f7bd2f3c4d1ff7b3c2959f01ac487f93ad93 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 16:22:31 +0800 Subject: [PATCH 04/21] Update --- clients/gvfs-fuse/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/gvfs-fuse/build.gradle.kts index cb47f572a32..4dd07bd93b3 100644 --- a/clients/gvfs-fuse/build.gradle.kts +++ b/clients/gvfs-fuse/build.gradle.kts @@ -22,6 +22,7 @@ import org.gradle.api.tasks.Exec val checkRustEnvironment by tasks.registering(Exec::class) { description = "Check if Rust environment is properly set up using an external script" group = "verification" + environment("PATH", System.getenv("PATH") + ":" + System.getenv("HOME") + "/.cargo/bin") commandLine("bash", "$projectDir/check_rust_env.sh") isIgnoreExitValue = false } From c34dd345bb6e0cacc7180d952d2d6b7cf9586a00 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 16:36:27 +0800 Subject: [PATCH 05/21] Update --- clients/gvfs-fuse/build.gradle.kts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/gvfs-fuse/build.gradle.kts index 4dd07bd93b3..0065a1ac835 100644 --- a/clients/gvfs-fuse/build.gradle.kts +++ b/clients/gvfs-fuse/build.gradle.kts @@ -19,10 +19,11 @@ import org.gradle.api.tasks.Exec +val rustPath = System.getenv("PATH") + ":" + System.getenv("HOME") + "/.cargo/bin" + val checkRustEnvironment by tasks.registering(Exec::class) { description = "Check if Rust environment is properly set up using an external script" group = "verification" - environment("PATH", System.getenv("PATH") + ":" + System.getenv("HOME") + "/.cargo/bin") commandLine("bash", "$projectDir/check_rust_env.sh") isIgnoreExitValue = false } @@ -31,14 +32,16 @@ val compileRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") + environment("PATH", rustPath) commandLine("cargo", "build", "--release") } -tasks.register("testRust", Exec::class) { +val testRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Run tests in the Rust project" group = "verification" workingDir = file("$projectDir") + environment("PATH", rustPath) commandLine("cargo", "test") standardOutput = System.out From 6dce7e91126d57ccf5bb9926ff7414a99a3f2782 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 17:04:23 +0800 Subject: [PATCH 06/21] Update --- clients/gvfs-fuse/build.gradle.kts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/gvfs-fuse/build.gradle.kts index 0065a1ac835..554fe122fbf 100644 --- a/clients/gvfs-fuse/build.gradle.kts +++ b/clients/gvfs-fuse/build.gradle.kts @@ -19,8 +19,6 @@ import org.gradle.api.tasks.Exec -val rustPath = System.getenv("PATH") + ":" + System.getenv("HOME") + "/.cargo/bin" - val checkRustEnvironment by tasks.registering(Exec::class) { description = "Check if Rust environment is properly set up using an external script" group = "verification" @@ -32,8 +30,7 @@ val compileRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") - environment("PATH", rustPath) - commandLine("cargo", "build", "--release") + commandLine("bash", "-c", "cargo build --release") } val testRust by tasks.registering(Exec::class) { @@ -41,8 +38,7 @@ val testRust by tasks.registering(Exec::class) { description = "Run tests in the Rust project" group = "verification" workingDir = file("$projectDir") - environment("PATH", rustPath) - commandLine("cargo", "test") + commandLine("bash", "-c", "cargo test --release") standardOutput = System.out errorOutput = System.err From 82b30d3c13f6a8ee426fa567b4b108fa40290874 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 20 Nov 2024 17:36:36 +0800 Subject: [PATCH 07/21] Update --- .../.cargo/config.toml | 0 clients/{gvfs-fuse => filesystem-fuse}/.gitignore | 0 clients/{gvfs-fuse => filesystem-fuse}/Cargo.toml | 0 .../build.gradle.kts | 6 ++++-- .../check_rust_env.sh | 15 ++++++--------- .../{gvfs-fuse => filesystem-fuse}/src/main.rs | 0 .../{gvfs-fuse => filesystem-fuse}/tests/it.rs | 0 settings.gradle.kts | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) rename clients/{gvfs-fuse => filesystem-fuse}/.cargo/config.toml (100%) rename clients/{gvfs-fuse => filesystem-fuse}/.gitignore (100%) rename clients/{gvfs-fuse => filesystem-fuse}/Cargo.toml (100%) rename clients/{gvfs-fuse => filesystem-fuse}/build.gradle.kts (89%) rename clients/{gvfs-fuse => filesystem-fuse}/check_rust_env.sh (85%) rename clients/{gvfs-fuse => filesystem-fuse}/src/main.rs (100%) rename clients/{gvfs-fuse => filesystem-fuse}/tests/it.rs (100%) diff --git a/clients/gvfs-fuse/.cargo/config.toml b/clients/filesystem-fuse/.cargo/config.toml similarity index 100% rename from clients/gvfs-fuse/.cargo/config.toml rename to clients/filesystem-fuse/.cargo/config.toml diff --git a/clients/gvfs-fuse/.gitignore b/clients/filesystem-fuse/.gitignore similarity index 100% rename from clients/gvfs-fuse/.gitignore rename to clients/filesystem-fuse/.gitignore diff --git a/clients/gvfs-fuse/Cargo.toml b/clients/filesystem-fuse/Cargo.toml similarity index 100% rename from clients/gvfs-fuse/Cargo.toml rename to clients/filesystem-fuse/Cargo.toml diff --git a/clients/gvfs-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts similarity index 89% rename from clients/gvfs-fuse/build.gradle.kts rename to clients/filesystem-fuse/build.gradle.kts index 554fe122fbf..a1ef88d3780 100644 --- a/clients/gvfs-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -19,6 +19,8 @@ import org.gradle.api.tasks.Exec +val envFile = System.getenv("HOME") + "/.cargo/env" + val checkRustEnvironment by tasks.registering(Exec::class) { description = "Check if Rust environment is properly set up using an external script" group = "verification" @@ -30,7 +32,7 @@ val compileRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") - commandLine("bash", "-c", "cargo build --release") + commandLine("bash", "-c", ". $envFile && cargo build --release") } val testRust by tasks.registering(Exec::class) { @@ -38,7 +40,7 @@ val testRust by tasks.registering(Exec::class) { description = "Run tests in the Rust project" group = "verification" workingDir = file("$projectDir") - commandLine("bash", "-c", "cargo test --release") + commandLine("bash", "-c", ". $envFile && cargo test --release") standardOutput = System.out errorOutput = System.err diff --git a/clients/gvfs-fuse/check_rust_env.sh b/clients/filesystem-fuse/check_rust_env.sh similarity index 85% rename from clients/gvfs-fuse/check_rust_env.sh rename to clients/filesystem-fuse/check_rust_env.sh index 6983be99b91..6825d14f537 100755 --- a/clients/gvfs-fuse/check_rust_env.sh +++ b/clients/filesystem-fuse/check_rust_env.sh @@ -34,15 +34,12 @@ if ! command -v cargo &> /dev/null; then fi export PATH="$HOME/.cargo/bin:$PATH" - echo "Rust has been installed successfully." + if command -v cargo &> /dev/null; then + echo "Rust has been installed successfully." + else + echo "Error: Rust installation failed. Please check your setup." + exit 1 + fi else echo "Rust is already installed: $(cargo --version)" fi - -if command -v cargo &> /dev/null; then - echo "Rust environment is set up correctly." -else - echo "Error: Rust installation failed. Please check your setup." - exit 1 -fi - diff --git a/clients/gvfs-fuse/src/main.rs b/clients/filesystem-fuse/src/main.rs similarity index 100% rename from clients/gvfs-fuse/src/main.rs rename to clients/filesystem-fuse/src/main.rs diff --git a/clients/gvfs-fuse/tests/it.rs b/clients/filesystem-fuse/tests/it.rs similarity index 100% rename from clients/gvfs-fuse/tests/it.rs rename to clients/filesystem-fuse/tests/it.rs diff --git a/settings.gradle.kts b/settings.gradle.kts index ddb50d5991b..4db4e7aa791 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -48,7 +48,7 @@ include( "clients:filesystem-hadoop3-runtime", "clients:client-python", "clients:cli", - "clients:gvfs-fuse" + "clients:filesystem-fuse" ) include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server") From 46c48828b50d6c9671c1356fbcb5cfbacdef7fd9 Mon Sep 17 00:00:00 2001 From: yuhui Date: Thu, 21 Nov 2024 15:16:31 +0800 Subject: [PATCH 08/21] Update --- clients/filesystem-fuse/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index a1ef88d3780..053038ad048 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -50,5 +50,5 @@ tasks.named("build") { dependsOn(compileRust) } tasks.named("test") { - dependsOn("testRust") + dependsOn(testRust) } From f2fbc1aaa39a90c2325567d8fcd1739506d65aea Mon Sep 17 00:00:00 2001 From: yuhui Date: Thu, 21 Nov 2024 20:43:55 +0800 Subject: [PATCH 09/21] Update for review --- clients/filesystem-fuse/Cargo.toml | 8 ++++++-- clients/filesystem-fuse/check_rust_env.sh | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/clients/filesystem-fuse/Cargo.toml b/clients/filesystem-fuse/Cargo.toml index 55a66a34782..bafb7f8fd69 100644 --- a/clients/filesystem-fuse/Cargo.toml +++ b/clients/filesystem-fuse/Cargo.toml @@ -16,11 +16,15 @@ # under the License. [package] -name = "gvfs-fuse" -version = "0.1.0" +name = "filesystem-fuse" +version = "0.8.0-incubating-SNAPSHOT" edition = "2021" rust-version = "1.75" +[[bin]] +name = "gvfs-fuse" +path = "src/main.rs" + [dependencies] fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } tokio = { version = "1.38.0", features = ["full"] } diff --git a/clients/filesystem-fuse/check_rust_env.sh b/clients/filesystem-fuse/check_rust_env.sh index 6825d14f537..aef8e165cd8 100755 --- a/clients/filesystem-fuse/check_rust_env.sh +++ b/clients/filesystem-fuse/check_rust_env.sh @@ -19,8 +19,6 @@ set -e -#!/bin/bash - if ! command -v cargo &> /dev/null; then echo "Rust is not installed. Installing Rust..." From 273d20ead7a7c7f29409f08960f8f0d241a61e5b Mon Sep 17 00:00:00 2001 From: yuhui Date: Fri, 22 Nov 2024 14:35:03 +0800 Subject: [PATCH 10/21] Update --- clients/filesystem-fuse/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/filesystem-fuse/Cargo.toml b/clients/filesystem-fuse/Cargo.toml index bafb7f8fd69..ef32873b6cc 100644 --- a/clients/filesystem-fuse/Cargo.toml +++ b/clients/filesystem-fuse/Cargo.toml @@ -27,8 +27,8 @@ path = "src/main.rs" [dependencies] fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } -tokio = { version = "1.38.0", features = ["full"] } futures-util = "0.3.30" libc = "0.2.164" -tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } log = "0.4.22" +tokio = { version = "1.38.0", features = ["full"] } +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } \ No newline at end of file From 86d225a128ba85177aabd2c77850769abc35b6d6 Mon Sep 17 00:00:00 2001 From: yuhui Date: Mon, 25 Nov 2024 11:46:43 +0800 Subject: [PATCH 11/21] Update --- clients/filesystem-fuse/Cargo.toml | 1 - clients/filesystem-fuse/build.gradle.kts | 75 +++++++++++++++--------- clients/filesystem-fuse/src/main.rs | 8 +-- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/clients/filesystem-fuse/Cargo.toml b/clients/filesystem-fuse/Cargo.toml index ef32873b6cc..fc19d0c3f1b 100644 --- a/clients/filesystem-fuse/Cargo.toml +++ b/clients/filesystem-fuse/Cargo.toml @@ -26,7 +26,6 @@ name = "gvfs-fuse" path = "src/main.rs" [dependencies] -fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } futures-util = "0.3.30" libc = "0.2.164" log = "0.4.22" diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index 053038ad048..3abacdcd7bf 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -19,36 +19,57 @@ import org.gradle.api.tasks.Exec -val envFile = System.getenv("HOME") + "/.cargo/env" +val enablePgvfsFuse = project.hasProperty("enable_gvfs_fuse") -val checkRustEnvironment by tasks.registering(Exec::class) { - description = "Check if Rust environment is properly set up using an external script" - group = "verification" - commandLine("bash", "$projectDir/check_rust_env.sh") - isIgnoreExitValue = false -} +if (enablePgvfsFuse) { + val checkRustEnvironment by tasks.registering(Exec::class) { + description = "Check if Rust environment." + group = "verification" + commandLine("bash", "-c", "cargo --version") + standardOutput = System.out + errorOutput = System.err + isIgnoreExitValue = false + } -val compileRust by tasks.registering(Exec::class) { - dependsOn(checkRustEnvironment) - description = "Compile the Rust project" - workingDir = file("$projectDir") - commandLine("bash", "-c", ". $envFile && cargo build --release") -} + val compileRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Compile the Rust project" + workingDir = file("$projectDir") -val testRust by tasks.registering(Exec::class) { - dependsOn(checkRustEnvironment) - description = "Run tests in the Rust project" - group = "verification" - workingDir = file("$projectDir") - commandLine("bash", "-c", ". $envFile && cargo test --release") + commandLine( + "bash", + "-c", + """ + set -e + echo "Checking the code format" + cargo fmt --all -- --check - standardOutput = System.out - errorOutput = System.err -} + echo "Running clippy" + cargo clippy --all-targets --all-features --workspace -- -D warnings -tasks.named("build") { - dependsOn(compileRust) -} -tasks.named("test") { - dependsOn(testRust) + echo "Compiling Rust project" + cargo build --release + """.trimIndent() + ) + } + + val testRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Run tests in the Rust project" + group = "verification" + workingDir = file("$projectDir") + commandLine("bash", "-c", "cargo test --release") + + standardOutput = System.out + errorOutput = System.err + } + + tasks.named("build") { + dependsOn(compileRust) + } + tasks.named("test") { + dependsOn(testRust) + } +} else { + println("Skipping Gvfs-fuse tasks since -Penable_gvfs_fuse is not enabled.") } diff --git a/clients/filesystem-fuse/src/main.rs b/clients/filesystem-fuse/src/main.rs index 6e07ee50104..48b6ab5517e 100644 --- a/clients/filesystem-fuse/src/main.rs +++ b/clients/filesystem-fuse/src/main.rs @@ -17,14 +17,14 @@ * under the License. */ -use fuse3::Result; -use log::info; use log::debug; +use log::info; +use std::process::exit; #[tokio::main] -async fn main() -> Result<()> { +async fn main() { tracing_subscriber::fmt().with_env_filter("debug").init(); info!("Starting filesystem..."); debug!("Shutdown filesystem..."); - Ok(()) + exit(0); } From c7298e5d42e02629554bcf27ec53f61c9e2fc04b Mon Sep 17 00:00:00 2001 From: yuhui Date: Mon, 25 Nov 2024 18:04:13 +0800 Subject: [PATCH 12/21] Update --- clients/filesystem-fuse/Cargo.toml | 6 +- clients/filesystem-fuse/build.gradle.kts | 73 +++++++++++------------- settings.gradle.kts | 8 ++- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/clients/filesystem-fuse/Cargo.toml b/clients/filesystem-fuse/Cargo.toml index fc19d0c3f1b..1b186d61cb1 100644 --- a/clients/filesystem-fuse/Cargo.toml +++ b/clients/filesystem-fuse/Cargo.toml @@ -18,8 +18,12 @@ [package] name = "filesystem-fuse" version = "0.8.0-incubating-SNAPSHOT" -edition = "2021" rust-version = "1.75" +edition = "2021" + +homepage = "https://gravitino.apache.org" +license = "Apache-2.0" +repository = "https://github.com/apache/gravitino" [[bin]] name = "gvfs-fuse" diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index 3abacdcd7bf..d14745bfbc8 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -19,27 +19,24 @@ import org.gradle.api.tasks.Exec -val enablePgvfsFuse = project.hasProperty("enable_gvfs_fuse") - -if (enablePgvfsFuse) { - val checkRustEnvironment by tasks.registering(Exec::class) { - description = "Check if Rust environment." - group = "verification" - commandLine("bash", "-c", "cargo --version") - standardOutput = System.out - errorOutput = System.err - isIgnoreExitValue = false - } +val checkRustEnvironment by tasks.registering(Exec::class) { + description = "Check if Rust environment." + group = "verification" + commandLine("bash", "-c", "cargo --version") + standardOutput = System.out + errorOutput = System.err + isIgnoreExitValue = false +} - val compileRust by tasks.registering(Exec::class) { - dependsOn(checkRustEnvironment) - description = "Compile the Rust project" - workingDir = file("$projectDir") +val compileRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Compile the Rust project" + workingDir = file("$projectDir") - commandLine( - "bash", - "-c", - """ + commandLine( + "bash", + "-c", + """ set -e echo "Checking the code format" cargo fmt --all -- --check @@ -49,27 +46,25 @@ if (enablePgvfsFuse) { echo "Compiling Rust project" cargo build --release - """.trimIndent() - ) - } + """.trimIndent() + ) +} - val testRust by tasks.registering(Exec::class) { - dependsOn(checkRustEnvironment) - description = "Run tests in the Rust project" - group = "verification" - workingDir = file("$projectDir") - commandLine("bash", "-c", "cargo test --release") +val testRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Run tests in the Rust project" + group = "verification" + workingDir = file("$projectDir") + commandLine("bash", "-c", "cargo test --release") - standardOutput = System.out - errorOutput = System.err - } + standardOutput = System.out + errorOutput = System.err +} + +tasks.named("build") { + dependsOn(compileRust) +} - tasks.named("build") { - dependsOn(compileRust) - } - tasks.named("test") { - dependsOn(testRust) - } -} else { - println("Skipping Gvfs-fuse tasks since -Penable_gvfs_fuse is not enabled.") +tasks.named("test") { + dependsOn(testRust) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 4db4e7aa791..16360c5111f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -47,9 +47,13 @@ include( "clients:filesystem-hadoop3", "clients:filesystem-hadoop3-runtime", "clients:client-python", - "clients:cli", - "clients:filesystem-fuse" + "clients:cli" ) +if (gradle.startParameter.projectProperties.containsKey("enable_gvfs_fuse")) { + include("clients:filesystem-fuse") +} else { + println("Skipping Gvfs-fuse tasks since -Penable_gvfs_fuse is not enabled.") +} include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server") include("authorizations:authorization-ranger") From 784df21bbb70ca1dfa3c06ec82424b87e80eaba6 Mon Sep 17 00:00:00 2001 From: yuhui Date: Mon, 25 Nov 2024 19:22:10 +0800 Subject: [PATCH 13/21] Update --- settings.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 16360c5111f..72fb934d0b2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -49,10 +49,10 @@ include( "clients:client-python", "clients:cli" ) -if (gradle.startParameter.projectProperties.containsKey("enable_gvfs_fuse")) { +if (gradle.startParameter.projectProperties.containsKey("enableFuse")) { include("clients:filesystem-fuse") } else { - println("Skipping Gvfs-fuse tasks since -Penable_gvfs_fuse is not enabled.") + println("Skipping Gvfs-fuse tasks since -PenableFuse is not enabled.") } include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server") From e7c2c5146ab45dd7b46b6b447e18cad5214f60ea Mon Sep 17 00:00:00 2001 From: yuhui Date: Mon, 25 Nov 2024 19:31:09 +0800 Subject: [PATCH 14/21] Update --- gradle.properties | 3 +++ settings.gradle.kts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a5ada8fc5e5..cc1b9393018 100644 --- a/gradle.properties +++ b/gradle.properties @@ -41,3 +41,6 @@ pythonVersion = 3.8 # skipDockerTests is used to skip the tests that require Docker to be running. skipDockerTests = true + +# enableFuse is used to enable the fuse module in the build. +enableFuse = false diff --git a/settings.gradle.kts b/settings.gradle.kts index 72fb934d0b2..539839f1d53 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -49,7 +49,7 @@ include( "clients:client-python", "clients:cli" ) -if (gradle.startParameter.projectProperties.containsKey("enableFuse")) { +if (gradle.startParameter.projectProperties["enableFuse"]?.toBoolean() ?: false) { include("clients:filesystem-fuse") } else { println("Skipping Gvfs-fuse tasks since -PenableFuse is not enabled.") From 4b575274ef837232b8e80b56ab82f7c346475066 Mon Sep 17 00:00:00 2001 From: yuhui Date: Mon, 25 Nov 2024 19:32:30 +0800 Subject: [PATCH 15/21] Update comments --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 539839f1d53..4aa19b69e41 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -52,7 +52,7 @@ include( if (gradle.startParameter.projectProperties["enableFuse"]?.toBoolean() ?: false) { include("clients:filesystem-fuse") } else { - println("Skipping Gvfs-fuse tasks since -PenableFuse is not enabled.") + println("Skipping Gvfs-fuse tasks since -PenableFuse=true is not enabled.") } include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server") From 8d15ad3d91cc474ef2c3d692df9e9d5c707e84f8 Mon Sep 17 00:00:00 2001 From: yuhui Date: Tue, 26 Nov 2024 11:02:20 +0800 Subject: [PATCH 16/21] Add ignore license --- build.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 100b243b54d..1cfaf99b64e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -546,7 +546,8 @@ tasks.rat { "clients/client-python/tests/unittests/htmlcov/*", "clients/client-python/tests/integration/htmlcov/*", "clients/client-python/docs/build", - "clients/client-python/docs/source/generated" + "clients/client-python/docs/source/generated", + "clients/filesystem-fuse/Cargo.lock" ) // Add .gitignore excludes to the Apache Rat exclusion list. From 411f735dda99d8658574f8372470caecfd45c91e Mon Sep 17 00:00:00 2001 From: yuhui Date: Tue, 26 Nov 2024 15:08:42 +0800 Subject: [PATCH 17/21] Update --- clients/filesystem-fuse/build.gradle.kts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index d14745bfbc8..cef1e79e726 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -32,6 +32,13 @@ val compileRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") + commandLine("bash", "-c", "cargo build --release") +} + +val checkRust by tasks.registering(Exec::class) { + dependsOn(checkRustEnvironment) + description = "Check the Rust project" + workingDir = file("$projectDir") commandLine( "bash", @@ -43,9 +50,6 @@ val compileRust by tasks.registering(Exec::class) { echo "Running clippy" cargo clippy --all-targets --all-features --workspace -- -D warnings - - echo "Compiling Rust project" - cargo build --release """.trimIndent() ) } @@ -65,6 +69,10 @@ tasks.named("build") { dependsOn(compileRust) } +tasks.named("check") { + dependsOn(checkRust) +} + tasks.named("test") { dependsOn(testRust) } From e7eb3a2db6b6e9a65c768932a8f9540124d0810f Mon Sep 17 00:00:00 2001 From: yuhui Date: Tue, 26 Nov 2024 15:50:22 +0800 Subject: [PATCH 18/21] Update --- clients/filesystem-fuse/build.gradle.kts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index cef1e79e726..3347e8e8ea4 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -28,7 +28,7 @@ val checkRustEnvironment by tasks.registering(Exec::class) { isIgnoreExitValue = false } -val compileRust by tasks.registering(Exec::class) { +val buildRust by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") @@ -65,11 +65,21 @@ val testRust by tasks.registering(Exec::class) { errorOutput = System.err } +tasks.named("checkRust") +tasks.named("testRust") { + mustRunAfter("checkRust") +} +tasks.named("buildRust") { + mustRunAfter("testRust") +} + tasks.named("build") { - dependsOn(compileRust) + dependsOn(testRust) + dependsOn(buildRust) } tasks.named("check") { + dependsOn.clear() dependsOn(checkRust) } From cf8debb9087f91d1da7e7b8f3938ecc23aa33bbb Mon Sep 17 00:00:00 2001 From: yuhui Date: Tue, 26 Nov 2024 15:55:31 +0800 Subject: [PATCH 19/21] Update --- clients/filesystem-fuse/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index 3347e8e8ea4..14cca188c04 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -65,7 +65,6 @@ val testRust by tasks.registering(Exec::class) { errorOutput = System.err } -tasks.named("checkRust") tasks.named("testRust") { mustRunAfter("checkRust") } From 97a717da32a5a2a0fad9a9c0cca7a20f178c51f9 Mon Sep 17 00:00:00 2001 From: yuhui Date: Tue, 26 Nov 2024 16:01:14 +0800 Subject: [PATCH 20/21] Update --- clients/filesystem-fuse/build.gradle.kts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/clients/filesystem-fuse/build.gradle.kts b/clients/filesystem-fuse/build.gradle.kts index 14cca188c04..08693ddc5bd 100644 --- a/clients/filesystem-fuse/build.gradle.kts +++ b/clients/filesystem-fuse/build.gradle.kts @@ -28,14 +28,14 @@ val checkRustEnvironment by tasks.registering(Exec::class) { isIgnoreExitValue = false } -val buildRust by tasks.registering(Exec::class) { +val buildRustProject by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Compile the Rust project" workingDir = file("$projectDir") commandLine("bash", "-c", "cargo build --release") } -val checkRust by tasks.registering(Exec::class) { +val checkRustProject by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Check the Rust project" workingDir = file("$projectDir") @@ -54,7 +54,7 @@ val checkRust by tasks.registering(Exec::class) { ) } -val testRust by tasks.registering(Exec::class) { +val testRustProject by tasks.registering(Exec::class) { dependsOn(checkRustEnvironment) description = "Run tests in the Rust project" group = "verification" @@ -65,23 +65,23 @@ val testRust by tasks.registering(Exec::class) { errorOutput = System.err } -tasks.named("testRust") { - mustRunAfter("checkRust") +tasks.named("testRustProject") { + mustRunAfter("checkRustProject") } -tasks.named("buildRust") { - mustRunAfter("testRust") +tasks.named("buildRustProject") { + mustRunAfter("testRustProject") } tasks.named("build") { - dependsOn(testRust) - dependsOn(buildRust) + dependsOn(testRustProject) + dependsOn(buildRustProject) } tasks.named("check") { dependsOn.clear() - dependsOn(checkRust) + dependsOn(checkRustProject) } tasks.named("test") { - dependsOn(testRust) + dependsOn(testRustProject) } From 857a433473efc89d1c9bf8ee7f8bf38a41576a45 Mon Sep 17 00:00:00 2001 From: yuhui Date: Wed, 27 Nov 2024 10:04:23 +0800 Subject: [PATCH 21/21] Update --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 4aa19b69e41..a36fde93cd3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -52,7 +52,7 @@ include( if (gradle.startParameter.projectProperties["enableFuse"]?.toBoolean() ?: false) { include("clients:filesystem-fuse") } else { - println("Skipping Gvfs-fuse tasks since -PenableFuse=true is not enabled.") + println("Skipping filesystem-fuse module since enableFuse is set to false") } include("iceberg:iceberg-common") include("iceberg:iceberg-rest-server")