Introduce JLink and move classes to correct package

This commit is contained in:
Marcel Schwarz 2021-11-03 23:17:35 +01:00
parent eacfcd0547
commit 4c49f939ee
16 changed files with 43 additions and 31 deletions

2
.idea/.name generated
View File

@ -1 +1 @@
UltimateTicTacToe ultimate-tictactoe

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run" type="Application" factoryName="Application"> <configuration default="false" name="Run" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="de.icaotix.ultimatetictactoe.Main" /> <option name="MAIN_CLASS_NAME" value="de.icaotix.ultimatetictactoe.Main" />
<module name="UltimateTicTacToe.main" /> <module name="ultimate-tictactoe.main" />
<extension name="coverage"> <extension name="coverage">
<pattern> <pattern>
<option name="PATTERN" value="de.icaotix.ultimatetictactoe.*" /> <option name="PATTERN" value="de.icaotix.ultimatetictactoe.*" />

View File

@ -1,5 +1,6 @@
plugins { plugins {
id 'java' id 'java'
id 'org.beryx.jlink' version '2.24.4'
} }
group 'de.icaotix.ultimatetictactoe' group 'de.icaotix.ultimatetictactoe'
@ -14,6 +15,16 @@ dependencies {
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
} }
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher{
name = 'Ultimate TicTacToe'
jvmArgs = ['-Dlog4j.configurationFile=./log4j2.xml']
noConsole = true
}
mainClass = "de.icaotix.ultimatetictactoe.Main"
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }

View File

@ -1,2 +1,2 @@
rootProject.name = 'UltimateTicTacToe' rootProject.name = 'ultimate-tictactoe'

View File

@ -1,20 +1,17 @@
package ultimatetictactoe; package de.icaotix.ultimatetictactoe;
import ultimatetictactoe.view.UltimateTicTacToeView; import de.icaotix.ultimatetictactoe.view.UltimateTicTacToeView;
import ultimatetictactoe.viewmodel.UltimateTicTacToePanelViewModel; import de.icaotix.ultimatetictactoe.viewmodel.UltimateTicTacToePanelViewModel;
import javax.swing.*; import javax.swing.*;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
final UltimateTicTacToePanelViewModel ultimateTicTacToePanelViewModel = new UltimateTicTacToePanelViewModel(); final UltimateTicTacToePanelViewModel ultimateTicTacToePanelViewModel = new UltimateTicTacToePanelViewModel();
new UltimateTicTacToeView(ultimateTicTacToePanelViewModel); new UltimateTicTacToeView(ultimateTicTacToePanelViewModel);
ultimateTicTacToePanelViewModel.prepareNextMove(); ultimateTicTacToePanelViewModel.prepareNextMove();
}); });
} }
} }

View File

@ -1,4 +1,4 @@
package ultimatetictactoe.model; package de.icaotix.ultimatetictactoe.model;
public enum CellState { public enum CellState {
X("X"), X("X"),

View File

@ -1,4 +1,4 @@
package ultimatetictactoe.model; package de.icaotix.ultimatetictactoe.model;
public enum GameState { public enum GameState {
X_WON("X won"), X_WON("X won"),

View File

@ -0,0 +1,6 @@
package de.icaotix.ultimatetictactoe.model;
public enum Player {
X,
O
}

View File

@ -1,4 +1,4 @@
package ultimatetictactoe.model; package de.icaotix.ultimatetictactoe.model;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,4 +1,4 @@
package ultimatetictactoe.model; package de.icaotix.ultimatetictactoe.model;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,6 +1,6 @@
package ultimatetictactoe.view; package de.icaotix.ultimatetictactoe.view;
import ultimatetictactoe.viewmodel.TicTacToePanelViewModel; import de.icaotix.ultimatetictactoe.viewmodel.TicTacToePanelViewModel;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

View File

@ -1,8 +1,8 @@
package ultimatetictactoe.view; package de.icaotix.ultimatetictactoe.view;
import ultimatetictactoe.model.Player; import de.icaotix.ultimatetictactoe.model.Player;
import ultimatetictactoe.viewmodel.TicTacToePanelViewModel; import de.icaotix.ultimatetictactoe.viewmodel.TicTacToePanelViewModel;
import ultimatetictactoe.viewmodel.UltimateTicTacToePanelViewModel; import de.icaotix.ultimatetictactoe.viewmodel.UltimateTicTacToePanelViewModel;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

View File

@ -1,4 +1,4 @@
package ultimatetictactoe.viewmodel; package de.icaotix.ultimatetictactoe.viewmodel;
import java.util.List; import java.util.List;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;

View File

@ -1,9 +1,10 @@
package ultimatetictactoe.viewmodel; package de.icaotix.ultimatetictactoe.viewmodel;
import ultimatetictactoe.model.GameState;
import ultimatetictactoe.model.Player; import de.icaotix.ultimatetictactoe.model.GameState;
import ultimatetictactoe.model.TicTacToeGame; import de.icaotix.ultimatetictactoe.model.Player;
import ultimatetictactoe.model.UltimateTicTacToe; import de.icaotix.ultimatetictactoe.model.TicTacToeGame;
import de.icaotix.ultimatetictactoe.model.UltimateTicTacToe;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;

View File

@ -0,0 +1,3 @@
module ultimate.tictactoe.main {
requires java.desktop;
}

View File

@ -1,6 +0,0 @@
package ultimatetictactoe.model;
public enum Player {
X,
O
}