Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up ripgrep for compilation on non-unix, non-windows platforms #2787

Merged
merged 7 commits into from Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -189,6 +189,21 @@ jobs:
shell: bash
run: ${{ env.CARGO }} test --bin rg ${{ env.TARGET_FLAGS }} flags::defs::tests::available_shorts -- --nocapture

# Setup and compile on the wasm32-wasi target
wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Basic build
run: cargo build --verbose
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did running tests via wasmtime fail? If so this is fine, but if they worked, then we should just include them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, running tests via wasmtime does fail (but compilation works):

error[E0433]: failed to resolve: could not find `unix` in `os`
   --> tests/util.rs:197:22
    |
197 |         use std::os::unix::fs::symlink;
    |                      ^^^^ could not find `unix` in `os`
    |

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah fair enough. We can save that for another day.


rustfmt:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/src/hostname.rs
Expand Up @@ -25,10 +25,10 @@ pub fn hostname() -> io::Result<OsString> {
}
#[cfg(not(any(windows, unix)))]
{
io::Error::new(
Err(io::Error::new(
io::ErrorKind::Other,
"hostname could not be found on unsupported platform",
)
))
}
}

Expand Down
7 changes: 7 additions & 0 deletions crates/printer/src/hyperlink.rs
Expand Up @@ -811,6 +811,13 @@ impl HyperlinkPath {
Some(HyperlinkPath::encode(with_slash.as_bytes()))
}

/// For other platforms (not windows, not unix), return None and log a debug message.
#[cfg(not(any(windows, unix)))]
pub(crate) fn from_path(original_path: &Path) -> Option<HyperlinkPath> {
log::debug!("hyperlinks are not supported on this platform");
None
}

/// Percent-encodes a path.
///
/// The alphanumeric ASCII characters and "-", ".", "_", "~" are unreserved
Expand Down