4 Commits

Author SHA1 Message Date
JailDoctor bdb56768be Versió 2.0.2:
- [NEW] Ara es guarda un arxivet que especifica per a quin target se va compilar per última vegada. Si no coincideix, se fa un rebuild all.
2026-05-13 12:11:54 +02:00
JailDoctor 8bcd70a943 - [NEW] Scripts de publicació 2026-05-04 18:12:10 +02:00
JailDoctor 6103225969 - [NEW] Nombre de versió 2026-05-04 12:48:47 +02:00
JailDoctor fb8d977958 - [FIX] Conversió explícita de std::filesystem::path a std::string per a que no es queixe Windows 2026-05-04 12:47:12 +02:00
5 changed files with 137 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
@echo off
REM Comprobar parámetro
IF "%1"=="" (
echo Uso: build_windows.bat ^<PARAMETRO^>
exit /b 1
)
set PARAM=%1
echo Compilando windows...
g++ main.cpp -O3 -o lagueirto.exe || exit /b 1
echo Creando paquetes...
REM Crear ZIP release con mini.exe + DLLs
tar -a -c -f lagueirto_%PARAM%_win32-x64.zip lagueirto.exe || exit /b 1
echo Paquetes generados:
echo lagueirto_%PARAM%_win32-x64.zip
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
set -e
#if [ -z "$1" ]; then
# echo "Uso: $0 <PARAMETRO>"
# exit 1
#fi
# Leer versión desde version.h
VERSION=$(grep '#define LAGUEIRTO_VERSION' version.h | sed 's/.*"\(.*\)".*/\1/')
echo "Versión detectada: $VERSION"
#PARAM=$1
# Datos Windows
WIN_USER="raimon"
WIN_HOST="192.168.1.53"
WIN_PATH_SSH="C:\Users\raimon\dev\lagueirto"
WIN_PATH_SCP="C:/Users/Raimon/dev/lagueirto"
echo "=== Compilando Linux ==="
g++ main.cpp -O3 -o lagueirto
echo "=== Empaquetando Linux ==="
tar -czf lagueirto_v${VERSION}_linux.tar.gz lagueirto
echo "=== Ejecutando build remoto Windows ==="
ssh ${WIN_USER}@${WIN_HOST} "cd ${WIN_PATH_SSH} && do_release.bat v${VERSION}"
echo "=== Copiando ZIPs desde Windows ==="
scp ${WIN_USER}@${WIN_HOST}:"${WIN_PATH_SCP}/lagueirto_v${VERSION}_win32-x64.zip" .
echo "=== Build completado correctamente ==="
echo "Generados:"
echo " lagueirto_v${VERSION}_linux.tar.gz"
echo " lagueirto_v${VERSION}_win32-x64.zip"
+23 -3
View File
@@ -8,6 +8,8 @@
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
#include "version.h"
std::string libs = ""; std::string libs = "";
std::string cppflags = ""; std::string cppflags = "";
std::string executable = "out"; std::string executable = "out";
@@ -19,6 +21,7 @@ std::string folder_char = "\\";
#else #else
std::string folder_char = "/"; std::string folder_char = "/";
#endif #endif
std::string loaded_section = "";
std::vector<std::string> exclude; std::vector<std::string> exclude;
std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"}; std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"};
@@ -172,7 +175,7 @@ bool loadLagueirtoFile(const std::string &section_to_load)
if (rest == "default") found_default = true; if (rest == "default") found_default = true;
if (section_to_load.empty() && rest == "default") active = true; if (section_to_load.empty() && rest == "default") active = true;
else active = (current_section == section_to_load); else active = (current_section == section_to_load);
if (active) loaded_section = current_section;
continue; continue;
} }
@@ -379,7 +382,7 @@ void process_includes(int index, std::string& file, bool is_cpp = false)
void process_cpp(std::string& file) void process_cpp(std::string& file)
{ {
std::string absolute_path = std::filesystem::weakly_canonical(file); std::string absolute_path = std::filesystem::weakly_canonical(file).string();
//std::cout << absolute_path << std::endl; //std::cout << absolute_path << std::endl;
int index = add_cpp(absolute_path); int index = add_cpp(absolute_path);
@@ -428,6 +431,8 @@ void processCommand(std::string arg) {
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
std::cout << "Lagueirto v" << LAGUEIRTO_VERSION << std::endl;
std::string configuration_to_use; std::string configuration_to_use;
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
@@ -441,14 +446,29 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
std::string last_config_file = build_path + folder_char + "last_config";
if (!std::filesystem::exists(last_config_file)) {
must_recompile_all = true;
} else {
std::ifstream in(last_config_file);
if (in) {
std::string word;
in >> word;
if (word != loaded_section) must_recompile_all = true;
}
}
if (must_recompile_all) { if (must_recompile_all) {
std::cout << "remove: '" << build_path << "'" << std::endl; std::cout << "remove: '" << build_path << "'" << std::endl;
std::filesystem::remove_all(build_path); std::filesystem::remove_all(build_path);
} }
if (!std::filesystem::is_directory(build_path)) std::filesystem::create_directory(build_path);
std::ofstream out(last_config_file);
if (out) out << loaded_section;
std::chrono::steady_clock::time_point begin_all = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point begin_all = std::chrono::steady_clock::now();
if (!std::filesystem::is_directory(build_path)) std::filesystem::create_directory(build_path);
source_paths = split(source_path); source_paths = split(source_path);
// Recopilem tots els arxius cpp i capçaleres // Recopilem tots els arxius cpp i capçaleres
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
set -e
#if [ -z "$1" ]; then
# echo "Uso: $0 <PARAMETRO>"
# exit 1
#fi
GITEA_TOKEN="eb44d9c0142f5038c61c5afd17f5a41177bfaedc"
if [ -z "$GITEA_TOKEN" ]; then
echo "ERROR: Debes exportar GITEA_TOKEN"
exit 1
fi
# Leer versión desde version.h
VERSION=$(grep '#define LAGUEIRTO_VERSION' version.h | sed 's/.*"\(.*\)".*/\1/')
echo "Versión detectada: $VERSION"
#PARAM=$1
API="https://gitea.sustancia.synology.me/api/v1"
REPO="JailDoctor/lagueirto"
echo "=== Creando release ${VERSION} en Gitea ==="
RELEASE_ID=$(curl -s -X POST "${API}/repos/${REPO}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"${VERSION}\",
\"name\": \"Release ${VERSION}\",
\"draft\": false,
\"prerelease\": false
}" | jq -r '.id')
if [ "$RELEASE_ID" = "null" ]; then
echo "ERROR: No se pudo crear el release"
exit 1
fi
echo "Release creado con ID: $RELEASE_ID"
echo "=== Subiendo artefactos ==="
for f in lagueirto_v${VERSION}_linux.tar.gz \
lagueirto_v${VERSION}_win32-x64.zip \
do
echo "Subiendo $f..."
curl -s -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${f}" \
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets" > /dev/null
done
echo "=== Publicación completada ==="
+3
View File
@@ -0,0 +1,3 @@
#pragma once
#define LAGUEIRTO_VERSION "2.0.2"