Skip to content
Snippets Groups Projects
Commit 64c3380f authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

updated gradle config with shadow for jar

parent 91d04b03
Branches
No related tags found
No related merge requests found
Showing
with 56 additions and 36 deletions
plugins { plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id 'application' id 'application'
id "org.openjfx.javafxplugin" version "0.0.14" id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1' id "org.openjfx.javafxplugin" version "0.1.0"
} }
javafx { javafx {
version = "21" version = "21"
modules = [ 'javafx.controls', 'javafx.fxml' ] modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.graphics']
} }
...@@ -29,13 +30,11 @@ test { ...@@ -29,13 +30,11 @@ test {
} }
application { application {
mainClass.set("FirefighterApplication") mainClass.set("firefighter.app.SimulatorMain")
} }
jar { tasks {
manifest { shadowJar {
attributes("Implementation-Title": project.name, exclude("module-info.class")
"Implementation-Version": version,
"Main-Class": application.mainClass)
} }
} }
rootProject.name = 'firefighter' rootProject.name = 'firefighter'
include 'src:main:aapp'
findProject(':src:main:aapp')?.name = 'aapp'
import controller.Controller; package firefighter.app;
import javafx.application.Application;
import firefighter.controller.Controller;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
...@@ -9,8 +10,8 @@ import javafx.stage.Stage; ...@@ -9,8 +10,8 @@ import javafx.stage.Stage;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
public class FirefighterApplication extends Application { public class SimulatorApplication extends javafx.application.Application {
private static final String VIEW_RESOURCE_PATH = "/view/view.fxml"; private static final String VIEW_RESOURCE_PATH = "/firefighter/view/view.fxml";
private static final String APP_NAME = "Firefighter simulator"; private static final String APP_NAME = "Firefighter simulator";
private static final int ROW_COUNT = 20; private static final int ROW_COUNT = 20;
private static final int COLUMN_COUNT = 20; private static final int COLUMN_COUNT = 20;
...@@ -38,7 +39,7 @@ public class FirefighterApplication extends Application { ...@@ -38,7 +39,7 @@ public class FirefighterApplication extends Application {
private void initializeView() throws IOException { private void initializeView() throws IOException {
FXMLLoader loader = new FXMLLoader(); FXMLLoader loader = new FXMLLoader();
URL location = FirefighterApplication.class.getResource(VIEW_RESOURCE_PATH); URL location = SimulatorApplication.class.getResource(VIEW_RESOURCE_PATH);
loader.setLocation(location); loader.setLocation(location);
view = loader.load(); view = loader.load();
Controller controller = loader.getController(); Controller controller = loader.getController();
...@@ -51,4 +52,8 @@ public class FirefighterApplication extends Application { ...@@ -51,4 +52,8 @@ public class FirefighterApplication extends Application {
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
} }
public static void main(String[] args) {
launch(args);
}
} }
package firefighter.app;
public class SimulatorMain {
public static void main(String[] args){
SimulatorApplication.main(args);
}
}
package controller; package firefighter.controller;
import javafx.animation.Animation; import javafx.animation.Animation;
import javafx.animation.KeyFrame; import javafx.animation.KeyFrame;
...@@ -11,12 +11,12 @@ import javafx.scene.control.ToggleButton; ...@@ -11,12 +11,12 @@ import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToggleGroup;
import javafx.util.Duration; import javafx.util.Duration;
import javafx.util.Pair; import javafx.util.Pair;
import model.Board; import firefighter.model.Board;
import model.ModelElement; import firefighter.model.ModelElement;
import model.FirefighterBoard; import firefighter.model.FirefighterBoard;
import model.Position; import firefighter.model.Position;
import view.FirefighterGrid; import firefighter.view.FirefighterGrid;
import view.ViewElement; import firefighter.view.ViewElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -52,7 +52,7 @@ public class Controller { ...@@ -52,7 +52,7 @@ public class Controller {
} }
private void setModel(FirefighterBoard firefighterBoard) { private void setModel(FirefighterBoard firefighterBoard) {
this.board = requireNonNull(firefighterBoard, "model is null"); this.board = requireNonNull(firefighterBoard, "firefighter.model is null");
} }
private void updateBoard(){ private void updateBoard(){
......
package controller; package firefighter.controller;
import javafx.collections.ListChangeListener.Change; import javafx.collections.ListChangeListener.Change;
import javafx.scene.control.Toggle; import javafx.scene.control.Toggle;
......
package model; package firefighter.model;
import java.util.List; import java.util.List;
......
package model; package firefighter.model;
import java.util.*; import java.util.*;
......
package model; package firefighter.model;
public enum ModelElement { public enum ModelElement {
FIREFIGHTER, FIRE FIREFIGHTER, FIRE
......
package model; package firefighter.model;
public record Position(int row, int column) { public record Position(int row, int column) {
......
package view; package firefighter.view;
import javafx.scene.canvas.Canvas; import javafx.scene.canvas.Canvas;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.util.Pair; import javafx.util.Pair;
import model.Position; import firefighter.model.Position;
import java.util.List; import java.util.List;
......
package view; package firefighter.view;
import javafx.scene.paint.Color;
import javafx.util.Pair; import javafx.util.Pair;
import model.Position; import firefighter.model.Position;
import java.util.List; import java.util.List;
......
package view; package firefighter.view;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
......
module firefighter {
requires javafx.controls;
requires javafx.fxml;
requires javafx.graphics;
opens firefighter.controller to javafx.fxml;
exports firefighter.app;
opens firefighter.app to javafx.fxml;
}
\ No newline at end of file
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import view.FirefighterGrid?> <?import firefighter.view.FirefighterGrid?>
<?import javafx.scene.control.ToggleButton?> <?import javafx.scene.control.ToggleButton?>
<HBox styleClass="background" stylesheets="@DarkTheme.css" <HBox styleClass="background" stylesheets="@DarkTheme.css"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="controller.Controller"> fx:controller="firefighter.controller.Controller">
<VBox> <VBox>
<Button fx:id="restartButton" maxHeight="-Infinity" maxWidth="-Infinity" <Button fx:id="restartButton" maxHeight="-Infinity" maxWidth="-Infinity"
mnemonicParsing="false" onAction="#restartButtonAction" prefHeight="24.0" prefWidth="200.0" mnemonicParsing="false" onAction="#restartButtonAction" prefHeight="24.0" prefWidth="200.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment