You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To exclude specific source files or entire directories from a Scala CLI project, you can now use the `//> using exclude` directive in your `project.scala` file.
17
+
Alternatively, you can do the same from the command line with the `--exclude` option.
For example, to exclude all files in the `example/scala` directory, add the following directive to your `project.scala` file:
23
+
```scala
24
+
//>usingexclude"example/scala"
25
+
```
26
+
27
+
Added by [@lwronski](https://github.com/lwronski) in [#2053](https://github.com/VirtusLab/scala-cli/pull/2053).
28
+
29
+
### Directives with a Test Scope equivalent
30
+
31
+
Some directives now have a test scope equivalent, such as `using dep` and its test scope counterpart `using test.dep`. This allows you to declare dependencies that are only used in tests outside of test-specific sources.
32
+
33
+
For example, you can declare a dependency on `munit` in your `project.scala` file like this:
34
+
```scala
35
+
//>usingtest.dep"org.scalameta::munit::0.7.29"
36
+
```
37
+
The dependency will only be available in test sources.
38
+
39
+
Here's a list of directives with a test scope equivalent with example values:
Added by [@romanowski](https://github.com/romanowski) in [#2005](https://github.com/VirtusLab/scala-cli/pull/2005).
83
+
84
+
### Access the path of the script being run from its code
85
+
86
+
With the special `scriptPath` function, you can now easily access the path of the script being run from the script code itself.
87
+
Here's an example of how to use the `scriptPath` value:
88
+
89
+
```scala title=scripts/hello.sc
90
+
#!/usr/bin/env -S scala-cli shebang
91
+
92
+
println(scriptPath)
93
+
```
94
+
95
+
<ChainedSnippets>
96
+
97
+
```bash
98
+
chmod +x scripts/hello.sc
99
+
./scripts/hello.sc
100
+
```
101
+
102
+
```text
103
+
./scripts/hello.sc
104
+
```
105
+
106
+
</ChainedSnippets>
107
+
108
+
Added by [@lwronski](https://github.com/lwronski) in [#1990](https://github.com/VirtusLab/scala-cli/pull/1990)
109
+
110
+
### Explicit Handling of Paths in using-directives
111
+
112
+
The `${.}` pattern in directive values can now be replaced by the parent directory of the file containing the directive. This makes it possible to generate coverage output files relative to the source file location, for example:
113
+
114
+
```scala
115
+
//>usingoptions"-coverage-out:${.}"
116
+
```
117
+
118
+
Added by [@lwronski](https://github.com/lwronski) in [#2040](https://github.com/VirtusLab/scala-cli/pull/2040)
119
+
120
+
### Fix deadlocks in Script Wrappers
121
+
122
+
We have resolved an issue that caused deadlocks when threads were run from the static initializer of the wrapper object
123
+
([#532](https://github.com/VirtusLab/scala-cli/pull/532) and [#1933](https://github.com/VirtusLab/scala-cli/pull/1933)).
124
+
Based on the feedback from the community (Thanks [@dacr](https://github.com/dacr)), we found that encapsulating the script code
125
+
into a class wrapper fixes the issue. The wrapper is generated by the Scala CLI and is not visible to the user.
126
+
127
+
This change alters the behavior of scripts that use the `@main` annotation. The `@main` annotation is no longer supported in `.sc` files.
[warn] Annotation @main in .sc scripts is not supported, use .scala format instead
141
+
Compiling project (Scala 3.2.2, JVM)
142
+
[error] ./script.sc:1:1
143
+
[error] method main cannot be a main method since it cannot be accessed statically
144
+
[error] @main def main(args: String*): Unit = println("Hello")
145
+
[error] ^^^^^
146
+
Error compiling project (Scala 3.2.2, JVM)
147
+
Compilation failed
148
+
```
149
+
150
+
</ChainedSnippets>
151
+
152
+
Fixed by [@MaciejG604](https://github.com/MaciejG604) in [#2033](https://github.com/VirtusLab/scala-cli/pull/2033)
153
+
154
+
## Other changes
155
+
156
+
* Add first-class support for Typelevel and other toolkits by [@armanbilge](https://github.com/armanbilge) in [#2025](https://github.com/VirtusLab/scala-cli/pull/2025)
157
+
* Make shebang run not check dependency updates by [@MaciejG604](https://github.com/MaciejG604) in [#2022](https://github.com/VirtusLab/scala-cli/pull/2022)
158
+
* Make 'export --json' print to stdout by default by [@MaciejG604](https://github.com/MaciejG604) in [#2008](https://github.com/VirtusLab/scala-cli/pull/2008)
159
+
* Don't print the spread directives warning if there's only a single file per scope by [@Gedochao](https://github.com/Gedochao) in [#1988](https://github.com/VirtusLab/scala-cli/pull/1988)
160
+
* Add --as-jar option by [@alexarchambault](https://github.com/alexarchambault) in [#2028](https://github.com/VirtusLab/scala-cli/pull/2028)
161
+
* add newline to topWrapper by [@bishabosha](https://github.com/bishabosha) in [#1998](https://github.com/VirtusLab/scala-cli/pull/1998)
162
+
163
+
164
+
### Publishing changes
165
+
* React to secret key decryption error by [@MaciejG604](https://github.com/MaciejG604) in [#1993](https://github.com/VirtusLab/scala-cli/pull/1993)
166
+
* Use ASCII armored secret key by [@MaciejG604](https://github.com/MaciejG604) in [#1991](https://github.com/VirtusLab/scala-cli/pull/1991)
167
+
* Properly handle pgp keychains generated by Scala CLI by [@MaciejG604](https://github.com/MaciejG604) in [#1987](https://github.com/VirtusLab/scala-cli/pull/1987)
168
+
169
+
#### Fixes
170
+
171
+
* Fix `ExcludeTests` by [@Gedochao](https://github.com/Gedochao) in [#2082](https://github.com/VirtusLab/scala-cli/pull/2082)
172
+
* bugfix: Properly show unsupported binary version by [@tgodzik](https://github.com/tgodzik) in [#2081](https://github.com/VirtusLab/scala-cli/pull/2081)
173
+
* Allow BSP to start successfully even with unrecognised `using` directives by [@Gedochao](https://github.com/Gedochao) in [#2072](https://github.com/VirtusLab/scala-cli/pull/2072)
174
+
* Fix invalid `scala-cli-signing` artifact downloads by [@Gedochao](https://github.com/Gedochao) in [#2054](https://github.com/VirtusLab/scala-cli/pull/2054)
175
+
* Fix - package js without main method by [@lwronski](https://github.com/lwronski) in [#2038](https://github.com/VirtusLab/scala-cli/pull/2038)
176
+
* Fix completions by [@Gedochao](https://github.com/Gedochao) in [#2004](https://github.com/VirtusLab/scala-cli/pull/2004)
177
+
* Fix export failing on input duplicates [@Gedochao](https://github.com/Gedochao) in [#2098](https://github.com/VirtusLab/scala-cli/pull/2098)
178
+
* Clean up parsing repositories for publishing [@romanowski](https://github.com/romanowski) in [#2084](https://github.com/VirtusLab/scala-cli/pull/2084)
179
+
180
+
### Documentation changes
181
+
* Docs: Update build output folder in Internal docs by [@amaalali](https://github.com/amaalali) in [#2071](https://github.com/VirtusLab/scala-cli/pull/2071)
182
+
* Add docs for test scope directives by [@Gedochao](https://github.com/Gedochao) in [#2058](https://github.com/VirtusLab/scala-cli/pull/2058)
183
+
* Improve error messages for malformed `config` values by [@Gedochao](https://github.com/Gedochao) in [#2014](https://github.com/VirtusLab/scala-cli/pull/2014)
184
+
* Update export documentation by [@MaciejG604](https://github.com/MaciejG604) in [#2023](https://github.com/VirtusLab/scala-cli/pull/2023)
185
+
* Add weaver test framework instruction by @lenguyenthanh in [#2021](https://github.com/VirtusLab/scala-cli/pull/2021)
186
+
187
+
### Build and internal changes
188
+
* Download cs for aarch64 from coursier-m1 repo by [@lwronski](https://github.com/lwronski) in [#2085](https://github.com/VirtusLab/scala-cli/pull/2085)
189
+
* Pass `invokeData` all the way to pre-processing to give more meaningful error/warning messages by [@Gedochao](https://github.com/Gedochao) in [#2073](https://github.com/VirtusLab/scala-cli/pull/2073)
190
+
* Refactor `using` directives processing by [@Gedochao](https://github.com/Gedochao) in [#2066](https://github.com/VirtusLab/scala-cli/pull/2066)
191
+
* Remove the `examples` directory to fix `scala-steward` runs by [@Gedochao](https://github.com/Gedochao) in [#2067](https://github.com/VirtusLab/scala-cli/pull/2067)
192
+
* Remove some dead code in build by [@alexarchambault](https://github.com/alexarchambault) in [#2069](https://github.com/VirtusLab/scala-cli/pull/2069)
193
+
* NIT Remove dead `BuildDeps` by [@Gedochao](https://github.com/Gedochao) in [#2065](https://github.com/VirtusLab/scala-cli/pull/2065)
194
+
* Clean up build by [@romanowski](https://github.com/romanowski) in [#2017](https://github.com/VirtusLab/scala-cli/pull/2017)
195
+
* Developers reflect 5 active developers in the repo. by [@romanowski](https://github.com/romanowski) in [#2006](https://github.com/VirtusLab/scala-cli/pull/2006)
196
+
* Increase maximum memory allocation for JVM by [@lwronski](https://github.com/lwronski) in [#2012](https://github.com/VirtusLab/scala-cli/pull/2012)
197
+
* Use bloop-rifle module from scala-cli/bloop-core repo by [@alexarchambault](https://github.com/alexarchambault) in [#1989](https://github.com/VirtusLab/scala-cli/pull/1989)
198
+
* Add missing modules for which unit tests are now executed by [@lwronski](https://github.com/lwronski) in [#1992](https://github.com/VirtusLab/scala-cli/pull/1992)
199
+
* Remove dead code for ordering PreprocessedSources by [@MaciejG604](https://github.com/MaciejG604) in [#2103](https://github.com/VirtusLab/scala-cli/pull/2103)
200
+
201
+
### Updates and maintenance
202
+
* Downgrade GraalVM to `22.3.1` to fix M1 by [@Gedochao](https://github.com/Gedochao) in [#2099](https://github.com/VirtusLab/scala-cli/pull/2099)
203
+
* Update slf4j-nop to 2.0.7 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2095](https://github.com/VirtusLab/scala-cli/pull/2095)
204
+
* Update sbt to 1.6.2 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2093](https://github.com/VirtusLab/scala-cli/pull/2093)
205
+
* Update bsp4j to 2.1.0-M4 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2086](https://github.com/VirtusLab/scala-cli/pull/2086)
206
+
* Bump `coursier` to `2.1.3` by [@Gedochao](https://github.com/Gedochao) in [#2077](https://github.com/VirtusLab/scala-cli/pull/2077)
207
+
* Update core_2.13 to 3.8.15 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2087](https://github.com/VirtusLab/scala-cli/pull/2087)
208
+
* Update file-tree-views to 2.1.10 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2088](https://github.com/VirtusLab/scala-cli/pull/2088)
209
+
* Bump `graalvm` to `22.3.2` by [@Gedochao](https://github.com/Gedochao) in [#2078](https://github.com/VirtusLab/scala-cli/pull/2078)
210
+
* Update asm to 9.5 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2092](https://github.com/VirtusLab/scala-cli/pull/2092)
211
+
* Bump coursier/setup-action from 1.3.2 to 1.3.3 by [@dependabot](https://github.com/dependabot) in [#2070](https://github.com/VirtusLab/scala-cli/pull/2070)
212
+
* Bump `jsoniter`, `scalameta`, `os-lib` and `scala-collection-compat` by [@Gedochao](https://github.com/Gedochao) in [#2064](https://github.com/VirtusLab/scala-cli/pull/2064)
213
+
* Bump `coursier` to `2.1.2` by [@Gedochao](https://github.com/Gedochao) in [#2063](https://github.com/VirtusLab/scala-cli/pull/2063)
214
+
* Bump `ammonite` to `2.5.8` by [@Gedochao](https://github.com/Gedochao) in [#2057](https://github.com/VirtusLab/scala-cli/pull/2057)
215
+
* Bump Scala.js to `1.13.1` by [@Gedochao](https://github.com/Gedochao) in [#2062](https://github.com/VirtusLab/scala-cli/pull/2062)
216
+
* Bump coursier/setup-action from 1.3.1 to 1.3.2 by [@dependabot](https://github.com/dependabot) in [#2055](https://github.com/VirtusLab/scala-cli/pull/2055)
217
+
* Bump coursier/setup-action from 1.3.0 to 1.3.1 by [@dependabot](https://github.com/dependabot) in [#2042](https://github.com/VirtusLab/scala-cli/pull/2042)
218
+
* Dump bloop core to 1.5.6-sc-8 by [@lwronski](https://github.com/lwronski) in [#2013](https://github.com/VirtusLab/scala-cli/pull/2013)
219
+
* Fix snapshot versions calculation when the current version ends with `-RC.` by [@Gedochao](https://github.com/Gedochao) in [#2002](https://github.com/VirtusLab/scala-cli/pull/2002)
220
+
* Update scala-cli.sh launcher for 1.0.0-RC1 by [@github-actions](https://github.com/github-actions) in [#1995](https://github.com/VirtusLab/scala-cli/pull/1995)
221
+
* Update scalafmt-cli_2.13, scalafmt-core to 3.7.3 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#2094](https://github.com/VirtusLab/scala-cli/pull/2094)
0 commit comments