From ab3a006e659c2a4c56b421a34476920d9a547c1c Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Wed, 13 Sep 2023 11:45:29 +0200
Subject: [PATCH] ci: Add windows script.

---
 .gitlab-ci.yml                | 48 +++++++++++++++++----------------
 packages/make-windows-dir.bat | 50 +++++++++++++++++++++++++++++++++++
 packages/make-windows-exe.bat | 20 ++++++++++++++
 3 files changed, 95 insertions(+), 23 deletions(-)
 create mode 100644 packages/make-windows-dir.bat
 create mode 100644 packages/make-windows-exe.bat

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index be7064eb..12411288 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -155,29 +155,31 @@ build-windows:
     # Create directory
     - mkdir pamhyr
     - dir
-    # Copy Pamhyr
-    - copy /y dist\pamhyr pamhyr\
-    # Copy Pamhyr info
-    - copy /y ..\LICENSE pamhyr\pamhyr\
-    - copy /y ..\AUTHORS pamhyr\pamhyr\
-    - copy /y ..\VERSION pamhyr\pamhyr\
-    # Copy mage
-    - mkdir pamhyr\mage
-    - copy /y ..\mage-windows\* pamhyr\mage\
-    # Copy Pamhyr resources
-    - mkdir pamhyr\pamhyr\View
-    - mkdir pamhyr\pamhyr\View\ui
-    - mkdir pamhyr\pamhyr\View\ui\Widgets
-    - copy /y ..\src\View\ui\*.ui pamhyr\pamhyr\View\ui\
-    - copy /y ..\src\View\ui\ressources\ pamhyr\pamhyr\View\ui
-    - copy /y ..\src\View\ui\Widgets\*.ui pamhyr\pamhyr\View\ui\Widgets
-    # Copy lang
-    - mkdir pamhyr\pamhyr\lang
-    - copy /y ..\src\lang\*.qm pamhyr\pamhyr\lang
-    # Copy tests cases
-    - mkdir pamhyr\tests_cases\
-    - mkdir pamhyr\tests_cases\Saar
-    - copy ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
+    - copy /y ../packages/make-windows-dir.bat
+    - .\make-windows-dir.bat
+    # # Copy Pamhyr
+    # - copy /y dist\pamhyr pamhyr\
+    # # Copy Pamhyr info
+    # - copy /y ..\LICENSE pamhyr\pamhyr\
+    # - copy /y ..\AUTHORS pamhyr\pamhyr\
+    # - copy /y ..\VERSION pamhyr\pamhyr\
+    # # Copy mage
+    # - mkdir pamhyr\mage
+    # - copy /y ..\mage-windows\* pamhyr\mage\
+    # # Copy Pamhyr resources
+    # - mkdir pamhyr\pamhyr\View
+    # - mkdir pamhyr\pamhyr\View\ui
+    # - mkdir pamhyr\pamhyr\View\ui\Widgets
+    # - copy /y ..\src\View\ui\*.ui pamhyr\pamhyr\View\ui\
+    # - copy /y ..\src\View\ui\ressources\ pamhyr\pamhyr\View\ui
+    # - copy /y ..\src\View\ui\Widgets\*.ui pamhyr\pamhyr\View\ui\Widgets
+    # # Copy lang
+    # - mkdir pamhyr\pamhyr\lang
+    # - copy /y ..\src\lang\*.qm pamhyr\pamhyr\lang
+    # # Copy tests cases
+    # - mkdir pamhyr\tests_cases\
+    # - mkdir pamhyr\tests_cases\Saar
+    # - copy ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
   artifacts:
     paths:
       - windows/pamhyr
diff --git a/packages/make-windows-dir.bat b/packages/make-windows-dir.bat
new file mode 100644
index 00000000..7774e682
--- /dev/null
+++ b/packages/make-windows-dir.bat
@@ -0,0 +1,50 @@
+rem windows.bat -- Pamhyr Windows batch for windows version building
+rem Copyright (C) 2023  INRAE
+rem
+rem This program is free software: you can redistribute it and/or modify
+rem it under the terms of the GNU General Public License as published by
+rem the Free Software Foundation, either version 3 of the License, or
+rem (at your option) any later version.
+rem
+rem This program is distributed in the hope that it will be useful,
+rem but WITHOUT ANY WARRANTY; without even the implied warranty of
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+rem GNU General Public License for more details.
+rem
+rem You should have received a copy of the GNU General Public License
+rem along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+@ECHO ON
+
+copy /y dist\pamhyr pamhyr\
+
+rem Copy data
+mkdir pamhyr\View\ui\ressources
+mkdir pamhyr\View\ui\Widgets
+
+rem UI
+copy /y ..\src\View\ui\ressources\ pamhyr\View\ui\ressources
+copy /y ..\src\View\ui\Widgets\*.ui pamhyr\View\ui\Widgets
+copy /y ..\src\View\ui\*.ui pamhyr\View\ui\
+
+rem Lang
+copy /y ..\src\lang\*.qm pamhyr\lang\
+
+rem Information
+copy /y ..\VERSION pamhyr\
+copy /y ..\AUTHORS pamhyr\
+copy /y ..\LICENSE pamhyr\
+
+rem MAGE
+mkdir pamhyr\mage
+copy /y ..\mage\mage.exe pamhyr\mage\
+copy /y ..\mage\mage_extraire.exe pamhyr\mage\
+copy /y ..\mage\mailleurPF.exe pamhyr\mage\
+
+rem Copy tests_cases
+mkdir pamhyr\tests_cases
+mkdir pamhyr\tests_cases\Saar
+copy /y ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
+
+rem Make installer
+"C:\Program Files (x86)\NSIS\makensis.exe" pamhyr.nsi
diff --git a/packages/make-windows-exe.bat b/packages/make-windows-exe.bat
new file mode 100644
index 00000000..161b3e83
--- /dev/null
+++ b/packages/make-windows-exe.bat
@@ -0,0 +1,20 @@
+rem windows.bat -- Pamhyr Windows batch for windows version building
+rem Copyright (C) 2023  INRAE
+rem
+rem This program is free software: you can redistribute it and/or modify
+rem it under the terms of the GNU General Public License as published by
+rem the Free Software Foundation, either version 3 of the License, or
+rem (at your option) any later version.
+rem
+rem This program is distributed in the hope that it will be useful,
+rem but WITHOUT ANY WARRANTY; without even the implied warranty of
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+rem GNU General Public License for more details.
+rem
+rem You should have received a copy of the GNU General Public License
+rem along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+@ECHO ON
+
+rem Make installer
+"C:\Program Files (x86)\NSIS\makensis.exe" pamhyr.nsi
-- 
GitLab