Moved tools into backend dependencies and old tools into tools:old

Moved gdx-backend-lwjgl dependency from impl to testImpl in :core
Created backend tool libraries for headless, lwjgl, lwjgl3
This commit is contained in:
Collin Smith 2021-11-27 23:42:18 -08:00
parent b040835ddb
commit 0cf617b55a
37 changed files with 165 additions and 44 deletions

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="AnimationTool" type="Application" factoryName="Application" folderName="tools" singleton="true">
<option name="MAIN_CLASS_NAME" value="com.riiablo.AnimationTool" />
<module name="riiablo.tools.main" />
<module name="riiablo.tools.old.main" />
<option name="PROGRAM_PARAMETERS" value="&quot;C:\Program Files (x86)\Steam\steamapps\common\Diablo II&quot;" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/assets" />

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BinGenerationTool" type="Application" factoryName="Application" folderName="tools" singleton="true">
<option name="MAIN_CLASS_NAME" value="com.riiablo.codec.excel.BinGenerationTool" />
<module name="riiablo.tools.main" />
<module name="riiablo.tools.old.main" />
<option name="PROGRAM_PARAMETERS" value="com.riiablo.codec.excel data/global/excel &quot;C:\Program Files (x86)\Steam\steamapps\common\Diablo II&quot;" />
<option name="VM_PARAMETERS" value="-ea" />
<method v="2">

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="COF Finder" type="Application" factoryName="Application" folderName="tools" singleton="true">
<option name="MAIN_CLASS_NAME" value="com.riiablo.codec.CofFinder" />
<module name="riiablo.tools.main" />
<module name="riiablo.tools.old.main" />
<option name="PROGRAM_PARAMETERS" value="&quot;C:\Program Files (x86)\Steam\steamapps\common\Diablo II&quot; SKDT1HS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/assets" />

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="D2 Finder" type="Application" factoryName="Application" folderName="tools" singleton="true">
<option name="MAIN_CLASS_NAME" value="com.riiablo.codec.D2Finder" />
<module name="riiablo.tools.main" />
<option name="PROGRAM_PARAMETERS" value="&quot;C:\Program Files (x86)\Steam\steamapps\common\Diablo II&quot; SOSC1HS" />
<module name="riiablo.tools.old.main" />
<option name="PROGRAM_PARAMETERS" value="&quot;C:\Program Files (x86)\Diablo II&quot; SOSC1HS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/assets" />
<method v="2">

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ExcelGenerationTool" type="Application" factoryName="Application" folderName="tools" singleton="true">
<option name="MAIN_CLASS_NAME" value="com.riiablo.codec.excel.ExcelGenerationTool" />
<module name="riiablo.tools.main" />
<module name="riiablo.tools.old.main" />
<option name="PROGRAM_PARAMETERS" value="com.riiablo.codec.excel.MonStats" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/assets" />

View File

@ -34,7 +34,6 @@ dependencies {
// LibGDX
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$gdxAiVersion"
api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
}
@ -112,6 +111,7 @@ dependencies {
testImplementation platform('org.junit:junit-bom:5.7.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}

View File

@ -20,7 +20,10 @@ include 'server:mcp'
include 'server:d2gs'
include 'server:netty'
include 'tools'
include 'tools:backends:backend-core'
include 'tools:backends:backend-headless'
include 'tools:backends:backend-lwjgl'
include 'tools:backends:backend-lwjgl3'
include 'tools:mpq-viewer'
include 'tools:map-viewer'
include 'tools:font-metrics'
@ -32,5 +35,6 @@ include 'tools:video-player'
include 'tools:physics'
include 'tools:excel-serializer-generator'
include 'tools:map-debugger'
include 'tools:old'
include 'tester' // deprecated

View File

@ -0,0 +1,11 @@
apply plugin: 'application'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
api project(':core')
api "commons-cli:commons-cli:$cliVersion"
}

View File

@ -0,0 +1,5 @@
dependencies {
api project(':tools:backends:backend-core')
api "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}

View File

@ -0,0 +1,6 @@
dependencies {
api project(':tools:backends:backend-core')
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.kotcrab.vis:vis-ui:$visuiVersion"
}

View File

@ -0,0 +1,6 @@
dependencies {
api project(':tools:backends:backend-core')
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.kotcrab.vis:vis-ui:$visuiVersion"
}

View File

@ -0,0 +1,92 @@
package com.riiablo.tool;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
/**
* must replace all lwjgl tools with this tool
*/
public class Lwjgl3Tool extends AbstractTool<Lwjgl3Application> {
public static <T extends Tool>
Lwjgl3ToolBuilder<T> create(
Class<T> toolClass,
String cmd,
String[] args
) {
return create(toolClass, cmd, args, new Lwjgl3ApplicationConfiguration()).defaults();
}
public static <T extends Tool>
Lwjgl3ToolBuilder<T> create(
Class<T> toolClass,
String cmd,
String[] args,
Lwjgl3ApplicationConfiguration config
) {
return new Lwjgl3ToolBuilder<>(toolClass, cmd, args, config);
}
public static final class Lwjgl3ToolBuilder<T extends Tool>
extends ToolBuilder<
Lwjgl3Application,
T,
Lwjgl3ApplicationConfiguration,
Lwjgl3ToolBuilder<T>
>
{
Lwjgl3ToolBuilder(
Class<T> toolClass,
String cmd,
String[] args,
Lwjgl3ApplicationConfiguration config
) {
super(toolClass, cmd, args, config);
}
@Override
public Lwjgl3Application newInstance(
T toolInstance,
Lwjgl3ApplicationConfiguration config
) {
return new Lwjgl3Application(toolInstance, config);
}
@Override
public Lwjgl3ToolBuilder<T> defaults() {
config.setTitle(toolClass.getSimpleName());
config.setWindowedMode(800, 600);
config.setResizable(true);
config.setForegroundFPS(300);
config.setIdleFPS(300);
config.useVsync(false);
config.setWindowIcon(
"ic_launcher_16.png",
"ic_launcher_32.png",
"ic_launcher_128.png"
);
return this;
}
public Lwjgl3ToolBuilder<T> title(String title) {
config.setTitle(title);
return this;
}
public Lwjgl3ToolBuilder<T> size(int width, int height) {
return size(width, height, true);
}
public Lwjgl3ToolBuilder<T> size(int width, int height, boolean resizable) {
config.setWindowedMode(width, height);
config.setResizable(resizable);
return this;
}
}
public interface Lwjgl3ToolConfigurator
extends ToolConfigurator<Lwjgl3ApplicationConfiguration>
{
@Override
void config(Lwjgl3ApplicationConfiguration config);
}
}

View File

@ -1,42 +1,13 @@
apply plugin: 'java'
project.ext.visuiVersion = '1.4.2'
dependencies {
implementation project(':core')
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
implementation "commons-cli:commons-cli:$cliVersion"
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
}
dependencies {
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
}
subprojects {
apply plugin: 'java'
apply plugin: 'application'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
dependencies {
implementation project(':core')
implementation project(':tools')
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "commons-cli:commons-cli:$cliVersion"
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
}
dependencies {
testImplementation 'junit:junit:4.12'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
run {

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'Debugs isometric camera functionality.'
application.mainClass = 'com.riiablo.camera.CameraTool'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-headless') }
description = 'Deserializes and debugs D2S files.'
application.mainClass = 'com.riiablo.save.D2SReaderTool'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'Debugs entity direction controls.'
application.mainClass = 'com.riiablo.engine.DirectionTool'

View File

@ -1,3 +1,4 @@
dependencies { implementation project(':tools:backends:backend-headless') }
description = 'Generates serializer sources for excel tables schemas.'
application.mainClass = 'com.riiablo.excel.SerializerGeneratorTool'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'Configures font metrics for D2 font files.'
application.mainClass = 'com.riiablo.FontMetricsTool'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'Debugs map generation.'
application.mainClass = 'com.riiablo.MapDebugger'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'View and generate maps.'
application.mainClass = 'com.riiablo.map.MapViewer'

View File

@ -1,2 +1,3 @@
dependencies { implementation project(':tools:backends:backend-lwjgl3') }
description = 'View and debug MPQ archive contents.'
application.mainClass = 'com.riiablo.mpq.MPQViewer'

View File

@ -100,7 +100,7 @@ import com.riiablo.map2.Dt1Info;
import com.riiablo.mpq.widget.CollapsibleVisTable;
import com.riiablo.mpq.widget.DirectionActor;
import com.riiablo.mpq.widget.TabbedPane;
import com.riiablo.tool.LwjglTool;
import com.riiablo.tool.Lwjgl3Tool;
import com.riiablo.tool.Tool;
public class MPQViewer {
@ -111,7 +111,7 @@ public class MPQViewer {
private static final String EXCEL_PATH = "C:\\Program Files (x86)\\OpenOffice\\program\\scalc.exe";
public static void main(String[] args) {
LwjglTool.create(Client.class, "mpq-viewer", args)
Lwjgl3Tool.create(Client.class, "mpq-viewer", args)
.title(TITLE)
.size(1700, 960, true)
.start();

17
tools/old/build.gradle Normal file
View File

@ -0,0 +1,17 @@
project.ext.visuiVersion = '1.4.2'
dependencies {
implementation project(':core')
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
implementation "commons-cli:commons-cli:$cliVersion"
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
}
dependencies {
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
}

View File

@ -1,5 +1,7 @@
package com.riiablo;
import java.util.Arrays;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
@ -7,8 +9,6 @@ import com.badlogic.gdx.backends.headless.HeadlessApplication;
import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration;
import com.badlogic.gdx.math.MathUtils;
import java.util.Arrays;
public class BreakpointsTool extends ApplicationAdapter {
private static final String TAG = "BreakpointsTool";

View File

@ -1,3 +1,4 @@
dependencies { implementation project(':tools:backends:backend-lwjgl') }
description = 'Play videos from MPQ archives.'
application.mainClass = 'com.riiablo.video.VideoPlayerTool'