Skip to content

Commit f85bbdd

Browse files
committed
Move socket to separate module
1 parent 9111035 commit f85bbdd

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

modules/main/build.gradle

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ dependencies {
99
compileOnlyApi project(":ownlang-core")
1010

1111
implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}"
12-
implementation ("io.socket:socket.io-client:${versions.socket}") {
13-
exclude group: 'org.json', module: 'json'
14-
}
1512
implementation "org.json:json:${versions.json}"
1613
implementation "org.yaml:snakeyaml:${versions.snakeyaml}"
1714

modules/socket/build.gradle

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
plugins {
2+
id 'java-library'
3+
id 'com.github.johnrengelman.shadow' version '8.1.1'
4+
}
5+
6+
group = 'com.annimon.module'
7+
version = '1.0.0'
8+
9+
dependencies {
10+
compileOnlyApi project(":ownlang-core")
11+
12+
implementation ("io.socket:socket.io-client:${versions.socket}") {
13+
exclude group: 'org.json', module: 'json'
14+
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
15+
}
16+
compileOnly "com.squareup.okhttp3:okhttp:${versions.okhttp}"
17+
compileOnly "org.json:json:${versions.json}"
18+
19+
testImplementation platform("org.junit:junit-bom:${versions.junit}")
20+
testImplementation 'org.junit.jupiter:junit-jupiter'
21+
}
22+
23+
test {
24+
useJUnitPlatform()
25+
}

modules/main/src/main/java/com/annimon/ownlang/modules/socket/socket.java renamed to modules/socket/src/main/java/com/annimon/ownlang/modules/socket/socket.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.socket.client.Socket;
88
import java.net.URISyntaxException;
99
import java.util.Map;
10+
import static com.annimon.ownlang.lib.ValueUtils.getNumber;
1011

1112
/**
1213
* socket.io module.
@@ -180,9 +181,4 @@ private static IO.Options parseOptions(MapValue map) {
180181
});
181182
return result;
182183
}
183-
184-
private static Number getNumber(Value value) {
185-
if (value.type() != Types.NUMBER) return value.asInt();
186-
return ((NumberValue) value).raw();
187-
}
188184
}

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include 'ownlang-desktop'
66
include 'ownlang-utils'
77
include 'docs'
88

9-
final def modules = ['main', 'canvasfx', 'jdbc', 'server']
9+
final def modules = ['main', 'canvasfx', 'jdbc', 'server', 'socket']
1010

1111
for (final def module in modules) {
1212
include "modules:$module"

0 commit comments

Comments
 (0)