From 39a823aa66a74aaa64422bbc8ff8747b96af3ae5 Mon Sep 17 00:00:00 2001
From: Amaury Vanoorenberghe <amaury.vanoorenberghe.etu@univ-lille.fr>
Date: Wed, 29 Sep 2021 09:18:50 +0200
Subject: [PATCH] =?UTF-8?q?SETUP=20-=20Ajout=20des=20scripts=20de=20compil?=
 =?UTF-8?q?ation/ex=C3=A9cution=20r=C3=A9alis=C3=A9s=20au=20tp2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitignore |  2 ++
 build.cmd  |  9 +++++++++
 build.sh   |  5 +++++
 run.cmd    | 20 ++++++++++++++++++++
 run.sh     |  5 +++++
 5 files changed, 41 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 build.cmd
 create mode 100644 build.sh
 create mode 100644 run.cmd
 create mode 100644 run.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d9265cf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+[Bb]uild/
+.class
\ No newline at end of file
diff --git a/build.cmd b/build.cmd
new file mode 100644
index 0000000..e5cf844
--- /dev/null
+++ b/build.cmd
@@ -0,0 +1,9 @@
+@ECHO OFF
+
+PUSHD %~dp0
+
+MKDIR build > NUL
+
+javac -d build/ src/*.java
+
+POPD
\ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..0854f9f
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+mkdir build > /dev/null
+
+javac -d build/ src/*.java
\ No newline at end of file
diff --git a/run.cmd b/run.cmd
new file mode 100644
index 0000000..00509c6
--- /dev/null
+++ b/run.cmd
@@ -0,0 +1,20 @@
+@ECHO OFF
+SETLOCAL enabledelayedexpansion enableextensions
+
+PUSHD %~dp0
+
+SET LIBS=
+FOR %%F IN (%CD%\lib\*.jar) DO SET LIBS=!LIBS!;%%F
+SET LIBS=%LIBS:~1%
+
+SET CLASSES=
+FOR %%F IN (%CD%\build\*.class) DO SET CLASSES=!CLASSES!;%%F
+SET CLASSES=%CLASSES:~1%
+
+SET CLASSPATH=%CD%\build;%CD%\lib;%LIBS%;%CLASSES%
+
+java "%1"
+
+POPD
+
+ENDLOCAL
\ No newline at end of file
diff --git a/run.sh b/run.sh
new file mode 100644
index 0000000..e58dd25
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+LIBS=$(ls -R lib/*.jar | tr "\n" ":").
+
+java -cp "${LIBS}":./build "$1"
\ No newline at end of file
-- 
GitLab