Compare commits
No commits in common. "d8c53c500e603bdd50712f65964cdeb68f92ff9d" and "2414da59a7d1a919f99323a3c8220e34c4ce1e2d" have entirely different histories.
d8c53c500e
...
2414da59a7
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2026 Sergey S. Chernov real.sergeych@gmail.com
|
# Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -19,15 +19,13 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
archive=./lyng/build/distributions/lyng-jvm.zip
|
root=./lyng/build/install/lyng-jvm/
|
||||||
install_root="$HOME/bin/jlyng-jvm"
|
|
||||||
launcher="$install_root/lyng-jvm/bin/lyng"
|
|
||||||
|
|
||||||
./gradlew :lyng:jvmDistZip
|
./gradlew :lyng:installJvmDist
|
||||||
mkdir -p ./distributables
|
#strip $file
|
||||||
cp "$archive" ./distributables/lyng-jvm.zip
|
#upx $file
|
||||||
rm -rf "$install_root" || true
|
rm -rf ~/bin/jlyng-jvm || true
|
||||||
rm "$HOME/bin/jlyng" 2>/dev/null || true
|
rm ~/bin/jlyng 2>/dev/null || true
|
||||||
mkdir -p "$install_root"
|
mkdir -p ~/bin/jlyng-jvm
|
||||||
unzip -q ./distributables/lyng-jvm.zip -d "$install_root"
|
cp -R $root ~/bin/jlyng-jvm
|
||||||
ln -s "$launcher" "$HOME/bin/jlyng"
|
ln -s ~/bin/jlyng-jvm/lyng-jvm/bin/lyng ~/bin/jlyng
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
## Lync CLI tool
|
## Lync CLI tool
|
||||||
|
|
||||||
- [lyng-linuxX64.zip](/distributables/lyng-linuxX64.zip) CLI tool for linuxX64: nodependencies, small monolith executable binary.
|
- [lyng-linuxX64.zip](/distributables/lyng-linuxX64.zip) CLI tool for linuxX64: nodependencies, small monolith executable binary.
|
||||||
- [lyng-jvm.zip](/distributables/lyng-jvm.zip) JVM CLI distribution: download, unpack, and run `lyng-jvm/bin/lyng`.
|
|
||||||
|
|
||||||
## IDE plugins
|
## IDE plugins
|
||||||
|
|
||||||
|
|||||||
@ -40,16 +40,15 @@ What this does:
|
|||||||
|
|
||||||
##### Option B: JVM distribution (`jlyng` launcher)
|
##### Option B: JVM distribution (`jlyng` launcher)
|
||||||
|
|
||||||
This creates a JVM distribution with a launcher script, packages it as a downloadable zip, and links it to `~/bin/jlyng`.
|
This creates a JVM distribution with a launcher script and links it to `~/bin/jlyng`.
|
||||||
|
|
||||||
```
|
```
|
||||||
bin/local_jrelease
|
bin/local_jrelease
|
||||||
```
|
```
|
||||||
|
|
||||||
What this does:
|
What this does:
|
||||||
- Runs `./gradlew :lyng:jvmDistZip` to build the JVM app distribution archive at `lyng/build/distributions/lyng-jvm.zip`.
|
- Runs `./gradlew :lyng:installJvmDist` to build the JVM app distribution to `lyng/build/install/lyng-jvm`.
|
||||||
- Copies the archive to `distributables/lyng-jvm.zip`.
|
- Copies the distribution under `~/bin/jlyng-jvm`.
|
||||||
- Unpacks that distribution under `~/bin/jlyng-jvm`.
|
|
||||||
- Creates a symlink `~/bin/jlyng` pointing to the launcher script.
|
- Creates a symlink `~/bin/jlyng` pointing to the launcher script.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -939,11 +939,11 @@ class Script(
|
|||||||
)
|
)
|
||||||
it.addVoidFnDoc(
|
it.addVoidFnDoc(
|
||||||
"delay",
|
"delay",
|
||||||
doc = "Suspend for the given time. Accepts Duration, Int milliseconds, or Real seconds."
|
doc = "Suspend for the given time. Accepts Duration, Int seconds, or Real seconds."
|
||||||
) {
|
) {
|
||||||
val a = args.firstAndOnly()
|
val a = args.firstAndOnly()
|
||||||
when (a) {
|
when (a) {
|
||||||
is ObjInt -> delay(a.value)
|
is ObjInt -> delay(a.value * 1000)
|
||||||
is ObjReal -> delay((a.value * 1000).roundToLong())
|
is ObjReal -> delay((a.value * 1000).roundToLong())
|
||||||
is ObjDuration -> delay(a.duration)
|
is ObjDuration -> delay(a.duration)
|
||||||
else -> raiseIllegalArgument("Expected Duration, Int or Real, got ${inspect(a)}")
|
else -> raiseIllegalArgument("Expected Duration, Int or Real, got ${inspect(a)}")
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2026 Sergey S. Chernov real.sergeych@gmail.com
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import kotlinx.coroutines.withTimeout
|
|
||||||
import net.sergeych.lyng.Script
|
|
||||||
import net.sergeych.lyng.obj.ObjInt
|
|
||||||
import kotlin.test.Test
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class ImportTimeDelayJvmTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun importingTimeKeepsIntDelayInMilliseconds() = runBlocking {
|
|
||||||
val result = withTimeout(1_000) {
|
|
||||||
Script.newScope().eval(
|
|
||||||
"""
|
|
||||||
import lyng.time
|
|
||||||
|
|
||||||
var completed = 0
|
|
||||||
|
|
||||||
(1..3).map {
|
|
||||||
launch {
|
|
||||||
delay(50)
|
|
||||||
}
|
|
||||||
}.forEach {
|
|
||||||
(it as Deferred).await()
|
|
||||||
completed += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
completed
|
|
||||||
""".trimIndent()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
assertEquals(3L, (result as ObjInt).value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user