Skip to content

Commit

Permalink
Move clientserver code into a subproject
Browse files Browse the repository at this point in the history
Left behind was `ConnectionFactory` as it is really a MapTool-specific tool for building connections and servers rather
than a part of the general client-server logic itself. Also pulled in was `Handshake` and `HandshakeObserver` since they
are used in the client-server and are an important part of the process (the implementations were left behind though).

Dependencies specific to clientserver were moved out of the root project into the new subproject.
  • Loading branch information
kwvanderlinde committed Apr 7, 2024
1 parent 41d5956 commit 20c9ce1
Show file tree
Hide file tree
Showing 26 changed files with 64 additions and 18 deletions.
15 changes: 2 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ repositories {
dependencies {
forms group: 'com.jetbrains.intellij.java', name: 'java-compiler-ant-tasks', version: '233.14475.56'

implementation project(':clientserver')

implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.22.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.22.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.20.0' // Bridges v1 to v2 for other code in other libs
Expand Down Expand Up @@ -492,16 +494,6 @@ dependencies {
// Noise Generator
implementation 'com.github.cwisniew:NoiseLib:1.0.0' // The most recent version, 1.0.0 is build for a later java version: major version 55 is newer than 54, the highest major version supported by this compiler

// webrtc
implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.6'
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0'
if (osdetector.os.is('windows'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:windows-x86_64'
else if (osdetector.os.is('osx'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:macos-x86_64'
else if (osdetector.os.is('linux'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:linux-x86_64'

// protobuf
implementation "io.grpc:grpc-protobuf:1.61.1"
implementation "com.google.protobuf:protobuf-java-util:3.25.2"
Expand All @@ -516,9 +508,6 @@ dependencies {
implementation 'org.jsoup:jsoup:1.17.2'
// eventbus
implementation 'com.google.guava:guava:33.0.0-jre'
// compression of messages between client and server
implementation 'org.apache.commons:commons-compress:1.26.0'
implementation 'com.github.luben:zstd-jni:1.5.5-11'
// intellij forms runtime
implementation 'com.jetbrains.intellij.java:java-gui-forms-rt:241.12019'
// layout for forms created in code
Expand Down
50 changes: 50 additions & 0 deletions clientserver/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}

plugins {
id "base"
id "java-library"
}

// In this section you declare where to find the dependencies of your project
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://maptool.craigs-stuff.net/repo/' }
maven { url = 'https://jitpack.io' }
maven { url "https://www.jetbrains.com/intellij-repository/releases" }
maven { url "https://cache-redirector.jetbrains.com/intellij-dependencies" }
}


// In this section you declare the dependencies for your production and test code
dependencies {
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.22.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.22.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.20.0' // Bridges v1 to v2 for other code in other libs
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.12'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.3.0'

// Better JSON functions...
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' // https://mvnrepository.com/artifact/com.google.code.gson/gson

// webrtc
implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.6'
// Needs to be API since WebRTCConnection implements PeerConnectionObserver and RTCDataChannelObserver.
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0'
if (osdetector.os.is('windows'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:windows-x86_64'
else if (osdetector.os.is('osx'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:macos-x86_64'
else if (osdetector.os.is('linux'))
implementation 'dev.onvoid.webrtc:webrtc-java:0.8.0:linux-x86_64'

// compression of messages between client and server
implementation 'org.apache.commons:commons-compress:1.26.0'
implementation 'com.github.luben:zstd-jni:1.5.5-11'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* <http://www.gnu.org/licenses/> and specifically the Affero license
* text at <http://www.gnu.org/licenses/agpl.html>.
*/
package net.rptools.maptool.server;
package net.rptools.clientserver.simple;

import java.util.concurrent.ExecutionException;
import net.rptools.clientserver.simple.connection.Connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* <http://www.gnu.org/licenses/> and specifically the Affero license
* text at <http://www.gnu.org/licenses/agpl.html>.
*/
package net.rptools.maptool.server;
package net.rptools.clientserver.simple;

public interface HandshakeObserver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import java.util.*;
import java.util.concurrent.ExecutionException;
import net.rptools.clientserver.simple.DisconnectHandler;
import net.rptools.clientserver.simple.Handshake;
import net.rptools.clientserver.simple.HandshakeObserver;
import net.rptools.clientserver.simple.MessageHandler;
import net.rptools.clientserver.simple.connection.Connection;
import net.rptools.maptool.server.Handshake;
import net.rptools.maptool.server.HandshakeObserver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
package net.rptools.clientserver.simple.server;

import net.rptools.clientserver.simple.Handshake;
import net.rptools.clientserver.simple.connection.Connection;
import net.rptools.maptool.server.Handshake;

public interface HandshakeProvider {
Handshake getConnectionHandshake(Connection conn);
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ include 'services:webservice'
*/

rootProject.name = 'MapTool'
include ':clientserver'
2 changes: 2 additions & 0 deletions src/main/java/net/rptools/maptool/server/ClientHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.swing.*;
import net.rptools.clientserver.simple.Handshake;
import net.rptools.clientserver.simple.HandshakeObserver;
import net.rptools.clientserver.simple.MessageHandler;
import net.rptools.clientserver.simple.connection.Connection;
import net.rptools.lib.MD5Key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.rptools.clientserver.ConnectionFactory;
import net.rptools.clientserver.simple.Handshake;
import net.rptools.clientserver.simple.HandshakeObserver;
import net.rptools.clientserver.simple.connection.Connection;
import net.rptools.clientserver.simple.server.HandshakeProvider;
import net.rptools.clientserver.simple.server.Server;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/rptools/maptool/server/ServerHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.swing.SwingUtilities;
import net.rptools.clientserver.simple.Handshake;
import net.rptools.clientserver.simple.HandshakeObserver;
import net.rptools.clientserver.simple.MessageHandler;
import net.rptools.clientserver.simple.connection.Connection;
import net.rptools.lib.MD5Key;
Expand Down

0 comments on commit 20c9ce1

Please sign in to comment.