scala / scala-dev

Scala 2 team issues. Not for user-facing bugs or directly actionable user-facing improvements. For build/test/infra and for longer-term planning and idea tracking. Our bug tracker is at https://github.com/scala/bug/issues
Apache License 2.0
130 stars 14 forks source link

Fix regex to find AdoptOpenJDK from SDKMAN list #723

Closed eed3si9n closed 4 years ago

eed3si9n commented 4 years ago

Since 11.0.8.hs came out the existing regex to pick JDK 8 ends up picking non-existing 8.hs-adpt. The fixed regex should select 8.0.265.hs-adpt etc correctly.

lrytz commented 4 years ago

The regex starts with a whitespace

grep -o " $ADOPTOPENJDK\.[0-9\.]*hs-adpt"

I don't think it matches 11.0.8.hs? In my local test, the current regex seems to work fine

luc@luclin:~$ sdk list java
...
               |     | 11.0.8.hs    | adpt    |            | 11.0.8.hs-adpt
...
               |     | 8.0.265.hs   | adpt    |            | 8.0.265.hs-adpt
...

luc@luclin:~$ sdk list java | grep -o " 8\.[0-9\.]*hs-adpt"
 8.0.265.hs-adpt

luc@luclin:~$ sdk list java | grep -o " 11\.[0-9\.]*hs-adpt"
 11.0.8.hs-adpt
 11.0.3.hs-adpt

I assume you were running into an issue somewhere? What was it?

Jasper-M commented 4 years ago

Note that this other PR #718 claims to have fixed the same thing already.

eed3si9n commented 4 years ago

I was running into the issue elsewhere using the original regex, and didn't realize it's been fixed by whitespace thing.

lrytz commented 4 years ago

👍 thanks!