Skip to content

Commit

Permalink
Better caching (#2)
Browse files Browse the repository at this point in the history
* Remove cache dependency

* Add DocumentCacheBuilder and tests

* Fix compile error and rename function in cache.rs

* update post create command

* Update sysinfo, add url library

* Implement get_cache_path in DocumentCache

* Using the cache in the scanner, code cleanup

* Refactor config loading and tests

* Better error printing in main loop, faster ctrl+c handling

* Fix issue when cache dir is set as prefix

* Add dependabot
  • Loading branch information
kekonn authored Nov 3, 2022
1 parent e72980f commit 5d78538
Show file tree
Hide file tree
Showing 17 changed files with 419 additions and 637 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/rust/.devcontainer/base.Dockerfile

# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
ARG VARIANT="buster"
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}

# [Optional] Uncomment this section to install additional packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y upgrade

RUN rustup update && rustup update stable
60 changes: 60 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/rust
{
"name": "Rust",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye
// Use bullseye when on local on arm64/Apple Silicon.
"VARIANT": "buster"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],

"containerEnv": {
"XDG_CONFIG_HOME": "${containerWorkspaceFolder}/.config/",
"XDG_RUNTIME_DIR": "${containerWorkspaceFolder}/.run/"
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.executable": "/usr/bin/lldb",
// VS Code don't watch files under ./target
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.checkOnSave.command": "clippy"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vadimcn.vscode-lldb",
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "rustup update && rustup update stable",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"git": "os-provided"
}
}
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
9 changes: 6 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "lldb",
"request": "launch",
Expand All @@ -23,7 +24,8 @@
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"XDG_CONFIG_HOME": "${workspaceFolder}/.config"
"XDG_CONFIG_HOME": "${workspaceFolder}/.config",
"XDG_RUNTIME_DIR": "${workspaceFolder}/.run"
}
},
{
Expand All @@ -45,8 +47,9 @@
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "full",
"XDG_CONFIG_HOME": "${workspaceFolder}/.config"
"RUST_BACKTRACE": "1",
"XDG_CONFIG_HOME": "${workspaceFolder}/.config",
"XDG_RUNTIME_DIR": "${workspaceFolder}/.run"
}
}
]
Expand Down
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "test",
"env": {
"RUST_BACKTRACE": "1"
},
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "test",
"isDefault": true
},
"label": "rust: cargo test"
}
]
}
Loading

0 comments on commit 5d78538

Please sign in to comment.