diff --git a/README.md b/README.md index 68271758..be11177b 100644 --- a/README.md +++ b/README.md @@ -2973,10 +2973,6 @@ the value of `set shell`. The body of the recipe is evaluated, written to disk in the temporary directory, and run by passing its path as an argument to `COMMAND`. -The `[script(…)]` attribute is unstable, so you'll need to use `set unstable`, -set the `JUST_UNSTABLE` environment variable, or pass `--unstable` on the -command line. - ### Script and Shebang Recipe Temporary Files Both script and shebang recipes write the recipe body to a temporary file for diff --git a/src/analyzer.rs b/src/analyzer.rs index bc6cbd56..79d5681d 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -158,17 +158,6 @@ impl<'run, 'src> Analyzer<'run, 'src> { aliases.insert(Self::resolve_alias(&self.modules, &recipes, alias)?); } - for recipe in recipes.values() { - if recipe.attributes.contains(AttributeDiscriminant::Script) { - unstable_features.insert(UnstableFeature::ScriptAttribute); - break; - } - } - - if settings.script_interpreter.is_some() { - unstable_features.insert(UnstableFeature::ScriptInterpreterSetting); - } - let source = root.to_owned(); let root = paths.get(root).unwrap(); diff --git a/src/compile_error.rs b/src/compile_error.rs index 50b2c6c6..d37c5b1e 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -241,10 +241,6 @@ impl Display for CompileError<'_> { ) } } - ShebangAndScriptAttribute { recipe } => write!( - f, - "Recipe `{recipe}` has both shebang line and `[script]` attribute" - ), ShellExpansion { err } => write!(f, "Shell expansion failed: {err}"), RequiredParameterFollowsDefaultParameter { parameter } => write!( f, diff --git a/src/compile_error_kind.rs b/src/compile_error_kind.rs index 81b1a67a..640c15bb 100644 --- a/src/compile_error_kind.rs +++ b/src/compile_error_kind.rs @@ -103,9 +103,6 @@ pub(crate) enum CompileErrorKind<'src> { RequiredParameterFollowsDefaultParameter { parameter: &'src str, }, - ShebangAndScriptAttribute { - recipe: &'src str, - }, ShellExpansion { err: shellexpand::LookupError, }, diff --git a/src/parser.rs b/src/parser.rs index d4aa8236..21ab965c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1089,12 +1089,6 @@ impl<'run, 'src> Parser<'run, 'src> { let shebang = body.first().is_some_and(Line::is_shebang); let script = attributes.contains(AttributeDiscriminant::Script); - if shebang && script { - return Err(name.error(CompileErrorKind::ShebangAndScriptAttribute { - recipe: name.lexeme(), - })); - } - if attributes.contains(AttributeDiscriminant::WorkingDirectory) && attributes.contains(AttributeDiscriminant::NoCd) { diff --git a/src/unstable_feature.rs b/src/unstable_feature.rs index daa2270b..e18eb2c4 100644 --- a/src/unstable_feature.rs +++ b/src/unstable_feature.rs @@ -4,8 +4,6 @@ use super::*; pub(crate) enum UnstableFeature { FormatSubcommand, LogicalOperators, - ScriptAttribute, - ScriptInterpreterSetting, WhichFunction, } @@ -17,10 +15,6 @@ impl Display for UnstableFeature { f, "The logical operators `&&` and `||` are currently unstable." ), - Self::ScriptAttribute => write!(f, "The `[script]` attribute is currently unstable."), - Self::ScriptInterpreterSetting => { - write!(f, "The `script-interpreter` setting is currently unstable.") - } Self::WhichFunction => write!(f, "The `which()` function is currently unstable."), } } diff --git a/tests/script.rs b/tests/script.rs index d5d0e2cb..1050d03d 100644 --- a/tests/script.rs +++ b/tests/script.rs @@ -1,36 +1,10 @@ use super::*; -#[test] -fn unstable() { - Test::new() - .justfile( - " - [script('sh', '-u')] - foo: - echo FOO - ", - ) - .stderr_regex(r"error: The `\[script\]` attribute is currently unstable\..*") - .status(EXIT_FAILURE) - .run(); -} - -#[test] -fn script_interpreter_setting_is_unstable() { - Test::new() - .justfile("set script-interpreter := ['sh']") - .status(EXIT_FAILURE) - .stderr_regex(r"error: The `script-interpreter` setting is currently unstable\..*") - .run(); -} - #[test] fn runs_with_command() { Test::new() .justfile( " - set unstable - [script('cat')] foo: FOO @@ -40,8 +14,6 @@ fn runs_with_command() { " - - FOO ", ) @@ -53,8 +25,6 @@ fn no_arguments() { Test::new() .justfile( " - set unstable - [script('sh')] foo: echo foo @@ -69,8 +39,6 @@ fn with_arguments() { Test::new() .justfile( " - set unstable - [script('sh', '-x')] foo: echo foo @@ -82,28 +50,22 @@ fn with_arguments() { } #[test] -fn not_allowed_with_shebang() { +fn allowed_with_shebang() { Test::new() .justfile( " - set unstable - - [script('sh', '-u')] + [script('cat')] foo: #!/bin/sh - ", ) - .stderr( + .stdout( " - error: Recipe `foo` has both shebang line and `[script]` attribute - ——▶ justfile:4:1 - │ - 4 │ foo: - │ ^^^ + + + #!/bin/sh ", ) - .status(EXIT_FAILURE) .run(); } @@ -112,8 +74,6 @@ fn script_line_numbers() { Test::new() .justfile( " - set unstable - [script('cat')] foo: FOO @@ -125,8 +85,6 @@ fn script_line_numbers() { " - - FOO BAR @@ -140,8 +98,6 @@ fn script_line_numbers_with_multi_line_recipe_signature() { Test::new() .justfile( r" - set unstable - [script('cat')] foo bar='baz' \ : @@ -161,8 +117,6 @@ fn script_line_numbers_with_multi_line_recipe_signature() { - - FOO BAR @@ -325,8 +279,6 @@ fn no_arguments_with_default_script_interpreter() { Test::new() .justfile( " - set unstable - [script] foo: case $- in @@ -352,8 +304,6 @@ fn no_arguments_with_non_default_script_interpreter() { Test::new() .justfile( " - set unstable - set script-interpreter := ['sh'] [script]