Skip to content

Releases: jbangdev/jbang

v0.93.0

30 Apr 23:47
Compare
Choose a tag to compare

Changelog

Mainly small fixes.

JBang no longer uses @file for large classpath/command lines with JShell. This should allow it run for more things; but can also give problems with large dependency sets on Windows. Recommend to use powershell or a linux-like terminal on Windows to avoid problems.

Export now is possible for projects without a main, i.e. for building libraries.

Also //FILES will now tell you what file pattern failed to be resolved. Making it easier to debug.

🚀 Features

🐛 Fixes

🧰 Tasks

  • e7391c1 add explicit cast
  • 0750e62 switch code coverage to informational only
  • 7d6b632 fix typo in StrictParameterPreprocessor.java (#1333)

🛠 Build

  • d2b246d add a test with a version range
  • 7856810 added docker compose file for testing proxy (#1339)

📝 Documentation


Contributors

We'd like to thank the following people for their contributions:
Andrea Peruffo, Tako Schotanus, George Gastaldi, Ikko Ashimine, Jeremie Bresson, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, allcontributors[bot]

v0.92.2

20 Mar 19:11
Compare
Choose a tag to compare

Changelog

Fixed a bug that caused (Quarkus) external Integration to fail on Java 16+.

🐛 Fixes

  • e61fcb4 upgrade gson to avoid breaking quarkus integration (#1317)

🛠 Build

  • 3bb37cc force ext integration
  • 07b49e6 run only itests when feasible
  • 4936280 fail-fast off
  • 0a7b798 proper external ci test
  • 7c48421 dont enable gradle cache when not building with cache
  • 421a978 add java 17 and 18 runs
  • eb98460 add java 17 and 18 runs

  • bc68aca [patch] release
  • 662a75a Revert "Revert "fall back to TTY when asking for input on Linux/Mac (#1312)""
  • 211f020 Update copyright year to 2022 (#1315)

Contributors

We'd like to thank the following people for their contributions:
Claus Ibsen, Max Rydahl Andersen, GitHub

v0.92.1

19 Mar 00:30
Compare
Choose a tag to compare

Changelog

Had to revert zero install changes to avoid app install bug.

  • 048a68b [patch] release
  • ef580a7 Revert ""zero" install now lives up to its name (#1219)"
  • 9397a94 Revert "fall back to TTY when asking for input on Linux/Mac (#1312)"

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

v0.92.0

18 Mar 23:53
Compare
Choose a tag to compare

Changelog

This time with a mixed bag of features/improvements:

Console trust and "zero" install

Running using curl will now download jbang to a temporary location if no local .jbang jar found. This ensures if you run curl install it will use the latest available.

Also When installing or running jbang using curl osx and linux will now use /dev/tty to
allow using console to approve/trust scripts. Windows will still use the UI based approach if necessary.

We also now don't ask to trust a script you already downloaded and not running with --fresh.

This should all make the installation of jbang and running of scripts simpler and more reliable.

Integrations can run externally

Today when using jbang integrations (i.q. Quarkus integration) it runs in the same jvm/classloader
as jbang itself. This works normally great, but if you are targeting a Java higher than the Java you are running JBang with (i.e. uses --java 17 when running with Java 11) you can get errors about mismatched Java versions.

In this release JBang now will run the integration in an external process when Java versions does not match.

This also enables a future possible improvement of making jbang a native binary.

Allow aliases for //SOURCES

You can now use aliases in //SOURCES. This is mainly interesting when running jshell based scripts. For example in a .jsh file you can use //SOURCES faker@jbangdev and you get the faker script included.

Enjoy!

🚀 Features

🐛 Fixes

🧰 Tasks

  • b259d74 make codecov less critical

📝 Documentation

  • 8a67177 Minor updates to installation pre-instructions (#1286)

Contributors

We'd like to thank the following people for their contributions:
Manik Magar, Tako Schotanus, Max Rydahl Andersen, GitHub

v0.91.0

10 Mar 00:19
Compare
Choose a tag to compare

Changelog

Buckle up - this is a fun release enabling some long-awaited mythical features!

  • Aliases for sources: cat logs.txt | jbang -s prelude@maxandersen -c '$$(l -> l.s(2))'
  • Websites as implicit catalog jbang tree@xam.dk
  • Custom JDK Install: j! jdk install 18 $(sdk home java 18-open)

Details below:

Use of aliases for sources

You can now use an alias to load additional sources, i.e. jbang -s myscript@mycatalog ... - all thanks to @quintesse super refactoring!.

At first, that might not look that interesting but combining it with the previous release where we added support
for running snippets with jbang -c you can now load in a custom source that fetches dependencies and add
use case-specific top-level methods and classes.

As an example I'll use Edoardo Vacchi's idea about implementing AWK in JBang using a script called Prelude.jsh.

Imagine you have a logs.txt with the following content:

GET /robots.txt HTTP/1.1
HEAD /README.md HTTP/1.1
GET /wp-admin/ HTTP/1.0

And you want to print out all the paths in that log.

There is a ton of ways to do that but if you use raw java it might be quite verbose.

Now with aliases we can cut this down to:

cat logs.txt | jbang -s prelude@evacchi -c '$$(l -> l.s(2))'

This will load the script behind prelude@evacchi which provides a method named $$
which iterates all input and give you a Line instance where there are various methods to extract
content, i.e. l.s(2) gives you the second column.

You can load multiple scripts from anywhere making it possible for everyone to make
interesting toplevel methods available to do useful things like the AWK example above; or maybe
just to make it fun/easier to try out your framework/api.

Looking forward to see what crazy ways you find to use this.

Websites as implicit catalog

Until now jbang's implicit catalogs allow you to have a jbang-catalog repository, i.e. @maxandersen was shorthand for catalog found in https://github.com/maxandersen/jbang-catalog. Very useful to have short and recognizable names.

Thus now if there is a '.' in the name jbang will lookup a website with that name first.

For example: jbang tree@xam.dk will use the catalog available at https://xam.dk/jbang-catalog.json.

There are more ways this can be used and expanded - those are covered in the docs.

Install of custom JDK's

We've had many requests on having jbang utilize existing Java installs on your machine rather
than download Java separately. i.e. use sdkman's jdk installs.

We don't do that for various reasons (mainly portability), but with @nandorholozsnyak's great contribution you
can now install custom JDK's using: jbang jdk install <version> <pathtojdk>.

Example:

Lets say you use sdkman and you want to try out Java 18 with JBang - something that today will fail
unless you have Java 18 installed as default jdk.

You can then run:

j! jdk install 18 `sdk home java 18-open`

which setup the path printed by sdk home java 18-open to be what what JBang treat as Java 18.

Then you can run:

j! --java 18 -c 'println(javax.lang.model.SourceVersion.RELEASE_18)'

🚀 Features

🐛 Fixes

♻️ Changes

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, Nándor Holozsnyák

v0.90.2

03 Mar 10:36
Compare
Choose a tag to compare

Changelog

Critical fix to avoid untrusted code to run and not auto-install vscode.

Plus if you have a M1 based machine jbang will no longer fail on first run.
jbang will now download Java 17 by default as Java 11 is not yet available from Adoptium.

🐛 Fixes

📝 Documentation


Contributors

We'd like to thank the following people for their contributions:
Chromico Rek, Max Rydahl Andersen, GitHub, Jérémie Bresson

v0.90.1

20 Feb 10:58
Compare
Choose a tag to compare

Changelog

Bug fix + add lines(String) top-level method to read a file into lines.

🚀 Features

  • 8a25fcf add lines(String) toplevel to read path into stream

🐛 Fixes

  • c80c910 showing proper error when using -c without code (#1247)

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub

v0.90.0

18 Feb 08:58
Compare
Choose a tag to compare

Changelog

Small changes this time with a big impact.

-i for interactive without sources

You always could to jbang --interactive <your.java|jsh|jar|gav> to have jbang start up your application/script within the jshell interpreter. Which is great but what if you just wanted to try out some API's without having to bother making a file to get started?

Now you can - just use jbang --interactive or jbang -i for short and you have a jshell. Of course that in itself is not interesting, but when you combine it with --deps it does become interesting. i.e. below is an example of starting jbang in interactive mode with access to h2 and jandex libraries.

jbang --deps com.h2database:h2:LATEST,org.jboss:jandex:2.4.2.Final -i
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
|  Welcome to JShell -- Version 17
|  For an introduction type: /help intro

jshell> import org.jboss.jandex.*;

jshell> Index.of(org.h2.Driver.class);
$2 ==> org.jboss.jandex.Index@9f48198

-c for code snippet execution

jbang now can execute java code directly allowing you to process standard input to make great one-liners like:

$ echo "hello world" | jbang -c 'lines().forEach(s->println(s.substring(6)))`
world

or this check for how many 5 letter words contains Man's best friend?

$ cat 5letterwords.txt | jbang -c 'lines().filter(s->s.contains("dog")).forEach(p->println(p))'
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
bedog
dogal
dogey
doges
doggy
doggo
dogie
dogly
dogma
dogra
undog

In the last example you will notice a few things:

  1. -c enables that the first argument is treated as code instead of a script
  2. a top-level method called 'lines()' is available to read lines from System.in
  3. println top-level method is available to easily print.

We got more ideas on adding some top-level methods to enable using java on
the command line.

And of course you can combine -c with --interactive and --deps and even
-s myscripts.jsh to load your own top-level methods.

Enjoy and Stay tuned :)

🚀 Features


Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub

v0.89.1

11 Feb 23:50
Compare
Choose a tag to compare

Changelog

0.89 fixes long-standing issue in how jshell was setup with dependencies. Turns out that to have execution AND content-assist working you must specify the classpath twice. Quite bad UX when using 3rd party dependencies but now jbang have it fully working :)

Imagine you have a file named deps.jsh that uses the Faker library:

///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS https://github.com/blocoio/faker/tree/1.2.8

import io.bloco.faker.Faker;

Faker fake = new Faker("da-DK");

Then you can run it directly using ./deps.jsh or jbang deps.jsh but you can also use jbang --interactive deps.jsh to have some fun with Faker.

2022-02-12_00-42-26.mp4

Compare that to what you would need to write out using raw jshell:

jshell --execution=local -J--add-modules=ALL-SYSTEM --class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar -J--class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar --startup=DEFAULT --startup=/var/folders/yb/sytszfld4sg8vwr1h0w20jlw0000gn/T/jbang_arguments_12529495078878297375deps.jsh /Users/max/code/personal/jbangdev/jbang/itests/deps.jsh

Simplicity FTW :)

Also include fix (#1232) so jbang init actually will honor default properties for a template.

Thanks to @nandorholozsnyak and @quintesse!

Full Changelog: v0.88.0...v0.89.1

v0.88.0

04 Feb 00:13
Compare
Choose a tag to compare

Changelog

New JBang release with a bunch of quality of life improvements.

Graphical UI when needed to confirm trust

To simplify install/setup running in a environment where there is no terminal to ask for input, i.e. if using curl for install
we now show a graphical dialog when needing to confirm trusted URLs or choosing an editor. This was not
an easy decision but it enables to have just one command install, like: curl -Ls https://sh.jbang.dev | bash -s - app install quarkus@quarkusio

2022-02-04_00-56-32

Note: this will only show up if needed and AWT/Swing is available, if not the text based info is used instead.

Edit knowing about common editors

When using jbang edit by default we offered to install and run vscodium - now we also scan PATH for common IDE's like eclipse, code, idea` etc. Giving you a choice to use your already installed IDE more easily.

2022-02-04_01-01-39

Setting JDK Release

JBang uses foojay.io to download Java Development Kit's normally getting Adoptium major releases.
If you want to try out another distribution and even earlyaccess versions you can now tweak these using environment variables

JBANG_JDK_VENDOR vendor name, ie. `temurin`, `aoj`, `azul`, `debian`, `microsoft`, `openjdk`, `oracle`, `oracle_open_jdk` or `redhat`
JBANG_JDK_RELEASE `ga` or `ea`

You can set these in your environment or use them directly when calling jbang, i.e.:

JBANG_JDK_VENDOR=oracle JBANG_JDK_RELEASE=ea jbang --java 18 otp.java

This will get latest Java 18 early access release of Oracle JDK.

//SOURCES now supported in .jsh

When using .jsh (jshell) //SOURCES are now supported allowing you to include
other .jsh files.

Catalog can now document its properties

@nandorholozsnyak in his first contribution enabled Catalogs to document its properties
and will be included in jbang catalog list.

Below are the full list of changes and fixes:

🚀 Features

🐛 Fixes

📝 Documentation

  • 3adca1b add happyherp as a contributor for doc (#1222)
  • 51f1619 add jmini as a contributor for doc (#1213)
  • 106be11 Documentation for -P and --property option in template add cli command

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Carlos Freund, allcontributors[bot], Nándor Holozsnyák