Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Added cargo-about auto-install and CI steps

Mikayla Maki0f0d5d5726ca
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7072a3fe94c..fce5717ca9a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -41,16 +41,19 @@ jobs:
with:
clean: false
submodules: 'recursive'
-
+
- name: Run tests
run: cargo test --workspace --no-fail-fast
-
+
- name: Build collab
run: cargo build -p collab
- name: Build other binaries
run: cargo build --workspace --bins --all-features
+ - name: Generate license file
+ run: script/generate-licenses
+
bundle:
name: Bundle app
runs-on:
@@ -109,6 +112,9 @@ jobs:
exit 1
fi
+ - name: Generate license file
+ run: script/generate-licenses
+
- name: Create app bundle
run: script/bundle
diff --git a/.gitignore b/.gitignore
index 356f4d97cde..8bca2eafacb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
/assets/themes/*.json
/assets/themes/Internal/*.json
/assets/themes/Experiments/*.json
+/assets/licenses.md
**/venv
.build
Packages
diff --git a/assets/licenses.md b/assets/licenses.md
deleted file mode 100644
index 5d70eab88b9..00000000000
--- a/assets/licenses.md
+++ /dev/null
@@ -1 +0,0 @@
-Place holder
\ No newline at end of file
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index 30f5bef53ba..53bc9d5abce 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -35,7 +35,7 @@ use search::{BufferSearchBar, ProjectSearchBar};
use serde::Deserialize;
use serde_json::to_string_pretty;
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
-use std::{env, path::Path, str, sync::Arc};
+use std::{borrow::Cow, env, path::Path, str, sync::Arc};
use system_specs::SystemSpecs;
use util::{channel::ReleaseChannel, paths, ResultExt};
pub use workspace;
@@ -684,7 +684,9 @@ fn open_bundled_file(
.with_local_workspace(&app_state, cx, |workspace, cx| {
let project = workspace.project().clone();
let buffer = project.update(cx, |project, cx| {
- let text = Assets::get(asset_path).unwrap().data;
+ let text = Assets::get(asset_path)
+ .map(|f| f.data)
+ .unwrap_or_else(|| Cow::Borrowed(b"File not found"));
let text = str::from_utf8(text.as_ref()).unwrap();
project
.create_buffer(text, project.languages().get_language(language), cx)
diff --git a/script/generate-licenses b/script/generate-licenses
index 31febf263f3..e1a917292c9 100755
--- a/script/generate-licenses
+++ b/script/generate-licenses
@@ -1,5 +1,10 @@
#!/bin/bash
-cargo about generate --workspace -o assets/licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
+
+set -e
+
+[[ "$(cargo about --version)" == "cargo-about 0.5.2" ]] || cargo install cargo-about --locked --git https://github.com/zed-industries/cargo-about --branch error-code-on-warn
+
+cargo about generate --fail-on-missing-license -o assets/licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
# cargo about automatically html-escapes all output, so we need to undo it here:
sed -i '' 's/"/"/g' assets/licenses.md
@@ -7,4 +12,4 @@ sed -i '' 's/'/'\''/g' assets/licenses.md # `'\''` ends the string, appends
sed -i '' 's/=/=/g' assets/licenses.md
sed -i '' 's/`/`/g' assets/licenses.md
sed -i '' 's/&lt;/</g' assets/licenses.md
-sed -i '' 's/&gt;/>/g' assets/licenses.md
+sed -i '' 's/&gt;/>/g' assets/licenses.md
\ No newline at end of file
diff --git a/script/licenses/zed-licenses.toml b/script/licenses/zed-licenses.toml
index 2e294878d79..d338e7ab0b9 100644
--- a/script/licenses/zed-licenses.toml
+++ b/script/licenses/zed-licenses.toml
@@ -34,4 +34,4 @@ checksum = '5b698ca13897be3afdb7174256fa1574f8c6892b8bea1a66dd6469d3fe27885a'
license = "BSD-3-Clause"
[[fuchsia-cprng.clarify.files]]
path = 'LICENSE'
-checksum = '03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b'
\ No newline at end of file
+checksum = '03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b'