Skip to content

Commit fe675e7

Browse files
committed
Remove cargo-script
It is no longer supported and doesn't build anymore. Will possibly replace this in the future with cargo's native scripting ability.
1 parent 5e96f36 commit fe675e7

8 files changed

+8
-34
lines changed

cargo_build.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CargoExecCommand(sublime_plugin.WindowCommand):
3838
settings = None
3939
# Directory where to run the command.
4040
working_dir = None
41-
# Path used for the settings key. This is typically `working_dir` except
42-
# for `cargo script`, in which case it is the path to the .rs source file.
41+
# Path used for the settings key. This is typically `working_dir`
42+
# (previously was used for script paths, now unused).
4343
settings_path = None
4444

4545
def run(self, command=None, command_info=None, settings=None):
@@ -135,7 +135,7 @@ def _determine_working_path(self, on_done):
135135
cmd.run(functools.partial(self._on_manifest_choice, on_done))
136136
else:
137137
# For now, assume you need a Rust file if not needing a manifest
138-
# (for `cargo script`).
138+
# (previously used for `cargo script`, now unused).
139139
view = self.window.active_view()
140140
if util.active_view_is_rust(view=view):
141141
self.settings_path = view.file_name()

ci/install-rust.sh

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ rustup update --no-self-update $TOOLCHAIN
2626
rustup default $TOOLCHAIN
2727
rustup component add clippy
2828
rustup component add rust-src
29-
cargo install cargo-script
3029
rustup -V
3130
rustc -Vv
3231
cargo -V

docs/src/build/custom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ Setting Name | Default | Description
2323
`allows_json` | False | If True, allows `--message-format=json` flag.
2424
`json_stop_pattern` | None | A regular expression matched against Cargo's output to detect when it should stop looking for JSON messages (used by `cargo run` to stop looking for JSON messages once compilation is finished).
2525
`requires_manifest` | True | If True, the command must be run in a directory with a `Cargo.toml` manifest.
26-
`requires_view_path` | False | If True, then the active view must be a Rust source file, and the path to that file will be passed into Cargo (used mainly by `cargo script`).
26+
`requires_view_path` | False | If True, then the active view must be a Rust source file, and the path to that file will be passed into Cargo (previously used by `cargo script`, now unused).
2727
`wants_run_args` | False | If True, it will ask for extra args to pass to the executable (after the `--` flag separator).

docs/src/build/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Bench | <code>cargo&nbsp;bench</code> | Runs benchmarks.
4242
Clean | <code>cargo&nbsp;clean</code> | Removes all built files.
4343
Document | <code>cargo&nbsp;doc</code> | Builds package documentation.
4444
Clippy | <code>cargo&nbsp;clippy</code> | Runs [Clippy](https://github.com/Manishearth/rust-clippy). Clippy must be installed, and currently requires the nightly toolchain.
45-
Script | <code>cargo&nbsp;script&nbsp;$path</code> | Runs [Cargo Script](https://github.com/DanielKeep/cargo-script). Cargo Script must be installed. This is an addon that allows you to run a Rust source file like a script (without a Cargo.toml manifest).
4645

4746
You can add custom build variants, see [Custom Build Variants](custom.md) for more.
4847

docs/src/build/settings.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ Key | Description
3838
`"variants"` | Settings per build variant.
3939
`"defaults"` | Default settings used if not set per target or variant.
4040

41-
Paths should be an absolute path to the directory of a Cargo package, or the
42-
path to a Rust source file (when used with `cargo script`).
41+
Paths should be an absolute path to the directory of a Cargo package.
4342

4443
`"paths"` is an object of path keys mapping to an object with the keys:
4544

@@ -107,7 +106,7 @@ Setting Name | Description
107106
`extra_run_args` | String of extra arguments passed to Cargo (after the `--` flags separator).
108107
`env` | Object of environment variables to add when running Cargo.
109108
`working_dir` | The directory where to run Cargo. If not specified, uses the value from `default_path`, otherwise attempts to detect from the active view, or displays a panel to choose a Cargo package.
110-
`script_path` | Path to a `.rs` script, used by `cargo script` if you want to hard-code a specific script to run.
109+
`script_path` | Path to a `.rs` script (previously used by `cargo script`, now unused).
111110
`no_default_features` | If True, sets the `--no-default-features` flag.
112111

113112
The extra args settings support standard Sublime variable expansion (see [Build System Variables](https://www.sublimetext.com/docs/build_systems.html)).

rust/cargo_settings.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,6 @@
9999
'allows_features': True,
100100
'allows_json': True,
101101
},
102-
'script': {
103-
'name': 'Script',
104-
'command': 'script',
105-
'allows_target': False,
106-
'allows_target_triple': False,
107-
'allows_release': False,
108-
'allows_features': False,
109-
'allows_json': False,
110-
'requires_view_path': True,
111-
'requires_manifest': False,
112-
},
113102
}
114103

115104

@@ -357,7 +346,7 @@ def get_command(self, cmd_name, cmd_info,
357346
:param cmd_info: Dictionary from `CARGO_COMMANDS` with rules on how to
358347
construct the command.
359348
:param settings_path: The absolute path to the Cargo project root
360-
directory or script.
349+
directory.
361350
:param working_dir: The directory where Cargo is to be run (typically
362351
the project root).
363352
:keyword initial_settings: Initial settings to inject which override
@@ -425,7 +414,7 @@ def get_computed(key, default=None):
425414
result.append('--features')
426415
result.append(v)
427416

428-
# Add path from current active view (mainly for "cargo script").
417+
# Add path from current active view (mainly for "cargo script", now unused).
429418
if cmd_info.get('requires_view_path', False):
430419
script_path = get_computed('script_path')
431420
if not script_path:

tests/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ You also need the following installed and in your PATH:
77
- Rust, Cargo, and Rustup
88
- `nightly` Rust toolchain.
99
- Clippy (https://github.com/Manishearth/rust-clippy)
10-
- Cargo Script (https://github.com/DanielKeep/cargo-script)
1110

1211
It also assumes you have not made any changes to the default RustEnhanced
1312
settings.

tests/test_cargo_build.py

-11
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,6 @@ def _check_added_message(self, window, filename, pattern):
385385
else:
386386
raise AssertionError('Failed to find %r' % pattern)
387387

388-
def test_script(self):
389-
"""Test "Script" variant."""
390-
self._with_open_file('tests/multi-targets/mystery.rs',
391-
self._test_script)
392-
393-
def _test_script(self, view):
394-
window = view.window()
395-
self._run_build_wait('script')
396-
output = self._get_build_output(window)
397-
self.assertRegex(output, '(?m)^Hello Mystery$')
398-
399388
def test_features(self):
400389
"""Test feature selection."""
401390
self._with_open_file('tests/multi-targets/src/bin/feats.rs',

0 commit comments

Comments
 (0)