Move socket to separate module

This commit is contained in:
aNNiMON 2024-03-03 15:17:58 +02:00
parent 9111035a37
commit f85bbdddca
4 changed files with 27 additions and 9 deletions

View File

@ -9,9 +9,6 @@ dependencies {
compileOnlyApi project(":ownlang-core")
implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}"
implementation ("io.socket:socket.io-client:${versions.socket}") {
exclude group: 'org.json', module: 'json'
}
implementation "org.json:json:${versions.json}"
implementation "org.yaml:snakeyaml:${versions.snakeyaml}"

View File

@ -0,0 +1,25 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group = 'com.annimon.module'
version = '1.0.0'
dependencies {
compileOnlyApi project(":ownlang-core")
implementation ("io.socket:socket.io-client:${versions.socket}") {
exclude group: 'org.json', module: 'json'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compileOnly "com.squareup.okhttp3:okhttp:${versions.okhttp}"
compileOnly "org.json:json:${versions.json}"
testImplementation platform("org.junit:junit-bom:${versions.junit}")
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}

View File

@ -7,6 +7,7 @@ import io.socket.client.IO;
import io.socket.client.Socket;
import java.net.URISyntaxException;
import java.util.Map;
import static com.annimon.ownlang.lib.ValueUtils.getNumber;
/**
* socket.io module.
@ -180,9 +181,4 @@ public final class socket implements Module {
});
return result;
}
private static Number getNumber(Value value) {
if (value.type() != Types.NUMBER) return value.asInt();
return ((NumberValue) value).raw();
}
}

View File

@ -6,7 +6,7 @@ include 'ownlang-desktop'
include 'ownlang-utils'
include 'docs'
final def modules = ['main', 'canvasfx', 'jdbc', 'server']
final def modules = ['main', 'canvasfx', 'jdbc', 'server', 'socket']
for (final def module in modules) {
include "modules:$module"