metadidomi-builder 1.4.201125 → 1.6.2812251812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1032 -572
  2. package/build_tools/backup-manager.js +3 -0
  3. package/build_tools/build_apk.js +3 -0
  4. package/build_tools/builder.js +2 -2
  5. package/build_tools/certs/cert-1a25871e.key +1 -0
  6. package/build_tools/certs/cert-1a25871e.pfx +0 -0
  7. package/build_tools/check-apk.js +211 -0
  8. package/build_tools/create-example-app.js +73 -0
  9. package/build_tools/decrypt_pfx_password.js +1 -26
  10. package/build_tools/diagnose-apk.js +61 -0
  11. package/build_tools/generate-icons.js +3 -0
  12. package/build_tools/generate-resources.js +3 -0
  13. package/build_tools/manage-dependencies.js +3 -0
  14. package/build_tools/process-dependencies.js +203 -0
  15. package/build_tools/resolve-transitive-deps.js +3 -0
  16. package/build_tools/restore-resources.js +3 -0
  17. package/build_tools/setup-androidx.js +131 -0
  18. package/build_tools/templates/bootstrap.template.js +27 -0
  19. package/build_tools/verify-apk-dependencies.js +261 -0
  20. package/build_tools_py/build_nsis_installer.py +1054 -19
  21. package/build_tools_py/builder.py +3 -3
  22. package/build_tools_py/compile_launcher_with_entry.py +19 -271
  23. package/build_tools_py/launcher_integration.py +19 -189
  24. package/build_tools_py/pyMetadidomi/README.md +98 -0
  25. package/build_tools_py/pyMetadidomi/__pycache__/pyMetadidomi.cpython-311.pyc +0 -0
  26. package/build_tools_py/pyMetadidomi/pyMetadidomi.py +16 -1675
  27. package/create-app.bat +31 -0
  28. package/create-app.ps1 +27 -0
  29. package/package.json +8 -2
  30. package/build_tools/certs/cert-65198130.key +0 -1
  31. package/build_tools/certs/cert-65198130.pfx +0 -0
  32. package/build_tools/certs/cert-f1fad9b5.key +0 -1
  33. package/build_tools/certs/cert-f1fad9b5.pfx +0 -0
  34. package/build_tools_py/pyMetadidomi/pyMetadidomi-obf.py +0 -19
package/README.md CHANGED
@@ -6,7 +6,6 @@
6
6
  [![Sponsor Lygos](https://img.shields.io/badge/Sponsor-Lygos-blue?style=for-the-badge)](https://pay.lygosapp.com/$etsmeta)
7
7
  ![Version](https://img.shields.io/badge/version-1.1.171125-blue)
8
8
  ![License](https://img.shields.io/badge/license-MIT-green)
9
- ![Keywords](https://img.shields.io/badge/keywords-electron_python_js_html_css_c_code_installer_protection_obfuscation-blue)
10
9
 
11
10
  ---
12
11
 
@@ -14,20 +13,23 @@
14
13
 
15
14
  1. **[À Propos](#-à-propos)** - Présentation générale
16
15
  2. **[Installation](#-installation)** - Mise en place
17
- 3. **[Afficher les Commandes Disponibles](#afficher-toutes-les-commandes-disponibles)** - Liste interactive des commandes
18
- 4. **[Démarrage Rapide Electron](#-démarrage-rapide---applications-electron)** - Premiers pas Electron
19
- 5. **[Modes de Construction](#-modes-de-construction)** - Options de build Electron
20
- 6. **[Protection du Code](#-système-de-protection-avancé)** - Sécurité (Electron et Python)
21
- 7. **[Packaging Python](#-packaging-dapplications-python)** - Applications Python
22
- 8. **[Comparaison vs electron-builder](#-comparaison-avec-electron-builder)** - Différences et choix
23
- 9. **[Roadmap](#-roadmap-vision-multi-plateforme)** - Futures versions
24
- 10. **[Support](#-support)** - Aide et contact
16
+ 3. **[Démarrage Rapide](#-démarrage-rapide)** - Premiers pas
17
+ 4. **[Configuration](#-configuration)** - Personnalisation
18
+ 5. **[Modes de Construction](#-modes-de-construction)** - Options de build
19
+ 6. **[Gestion des Dépendances](#-gestion-des-dépendances)** - Electron et Python
20
+ 7. **[Protection du Code](#-système-de-protection-avancé)** - Sécurité
21
+ 8. **[Utilisation de jsMetadidomi](#-utilisation-de-jsmetadidomi)** - Protection JavaScript
22
+ 9. **[Packaging Python](#-packaging-dapplications-python)** - Applications Python
23
+ 10. **[Packaging Android](#-packaging-dapplications-android)** - Applications Android APK
24
+ 11. **[Comparaison](#-comparaison-avec-electron-builder)** - vs electron-builder
25
+ 12. **[Roadmap](#-roadmap)** - Futures versions
26
+ 13. **[Support](#-support-et-contribution)** - Aide et contact
25
27
 
26
28
  ---
27
29
 
28
30
  ## 💝 À Propos
29
31
 
30
- Constructeur **professionnel** pour applications Electron et Python exigeant :
32
+ Constructeur **professionnel** pour applications Electron et Python, Android exigeant :
31
33
  - ✅ **Sécurité maximale** - Chiffrement AES-256, bytecode, obfuscation
32
34
  - ✅ **Builds reproductibles** - 100% déterministe et offline
33
35
  - ✅ **Customisation totale** - Contrôle complet du processus
@@ -47,134 +49,32 @@ Votre soutien permet de :
47
49
 
48
50
  ## 🚀 Installation
49
51
 
50
- ### Installation via npm (Recommandée)
52
+ ### Dépendances Minimales
51
53
 
52
54
  **Pour le développement :** Seuls `electron@^39.1.1` et Python 3.11+ sont requis.
53
- [![](https://img.shields.io/badge/info-Commandes%20disponibles-blue)]
54
55
 
55
- ### Afficher toutes les commandes disponibles
56
-
57
- > **Important :** Avant d'utiliser ces commandes, ajoutez les scripts suivants dans la section `scripts` de votre `package.json` :
58
- >
59
- > ```json
60
- > "help": "node node_modules/metadidomi-builder/build_tools/commands-help.js",
61
- > "help:electron": "node node_modules/metadidomi-builder/build_tools/commands-help.js --type=electron",
62
- > "help:python": "node node_modules/metadidomi-builder/build_tools/commands-help.js --type=python",
63
- > "help:all": "node node_modules/metadidomi-builder/build_tools/commands-help.js --all"
64
- > ```
65
-
66
- Pour voir toutes les commandes adaptées à votre projet (Electron ou Python), utilisez la commande d'aide interactive :
67
-
68
- ```powershell
69
- npm run help # Affiche toutes les commandes disponibles
70
- npm run help:electron # Affiche uniquement les commandes Electron
71
- npm run help:python # Affiche uniquement les commandes Python
72
- npm run help:all # Affiche tout (mode universel)
73
- ```
74
-
75
- **Exemple d'affichage** :
76
- ```
77
- > npm run help
78
-
79
- ─────────────────────────────
80
- METADIDOMI BUILDER - COMMANDES DISPONIBLES
81
- ─────────────────────────────
82
-
83
- 1. BUILD
84
- Crée un installateur Windows NSIS professionnel
85
- Commande: npm run build
86
- Alternatives: npx metadidomi-builder
87
- Sortie: ./dist/MonApp-Setup-1.0.0.exe
88
-
89
- 2. BUILD:PYTHON
90
- Build d'application Python en mode console
91
- Commande: npm run build:python
92
- Alternatives: npx metadidomi-builder-python
93
- Sortie: ./dist/MonApp-Setup-1.0.0.exe
94
-
95
- ...etc
96
- ```
97
-
98
- La commande détecte automatiquement le type de projet et affiche les commandes adaptées, avec explications et exemples.
99
-
100
- Pour plus d'exemples, consultez la section "Exemples Pratiques" plus bas.
101
-
102
- #### Option 1 : Installation dans votre projet
103
-
104
- ```powershell
105
- # Installez le builder comme dépendance de développement
106
- npm install --save-dev metadidomi-builder
107
-
108
- # Ajoutez des scripts dans votre package.json
109
- # "scripts": {
110
- # "build": "metadidomi-builder",
111
- # "build:lite": "set LITE_BUILD=true && metadidomi-builder",
112
- # "build:portable": "set CREATE_PORTABLE_EXE=true && metadidomi-builder",
113
- # "build:python": "node node_modules/metadidomi-builder/build_tools_py/builder.py",
114
- # "build:python:gui": "node node_modules/metadidomi-builder/build_tools_py/builder.py --gui"
115
- # }
116
-
117
- # Puis lancez avec :
118
- npm run build # Build Electron standard
119
- # ou
120
- npm run build:lite # Build Electron optimisé
121
- npm run build:portable # Exécutable portable
122
- npm run build:python # Build Python (console)
123
- npm run build:python:gui # Build Python (GUI)
124
- ```
125
-
126
- #### Option 2 : Utilisation directe avec npx
127
-
128
- ```powershell
129
- # Lancez directement sans installation
130
- npx metadidomi-builder
131
- ```
132
-
133
- #### Option 3 : Installation Globale
134
-
135
- ```powershell
136
- # Installez globalement
137
- npm install -g metadidomi-builder
138
-
139
- # Lancez depuis n'importe où
140
- metadidomi-builder
141
- ```
142
-
143
- ### Installation Manuelle (Avancé)
144
-
145
- Si vous préférez installer manuellement :
146
-
147
- 1. **Clonez le repository**
148
- ```powershell
149
- git clone https://github.com/METADIDOMIOFFICIEL/Metadidomi-Builder.git
150
- cd metadidomi-builder
151
- ```
152
-
153
- 2. **Installez les dépendances**
154
56
  ```powershell
155
57
  npm install
156
58
  ```
59
+ # � INSTALLATION DES DÉPENDANCES VENDOR
157
60
 
158
- 3. **Téléchargez les modules vendor** (si absent)
159
- - Téléchargez `vendor.zip` depuis :
160
- https://github.com/METADIDOMIOFFICIEL/Metadidomi-Builder/releases/download/1.3.171125/vendor.zip
161
- - Extrayez dans `build_tools/vendor/`
61
+ Si lors de l'installation le dossier `build_tools/vendor` n'est pas présent, suivez ces instructions :
162
62
 
163
- 4. **Lancez le builder**
164
- ```powershell
165
- # Depuis le dossier d'installation
166
- node build_tools/builder.js
63
+ . Téléchargez le fichier `vendor.zip` depuis :
64
+ https://github.com/METADIDOMIOFFICIEL/Metadidomi-Builder/releases/download/1.3.171125/vendor.zi
167
65
 
168
- # Ou depuis votre app (en spécifiant le chemin)
169
- node "C:\chemin-vers\metadidomi-builder\build_tools\builder.js"
170
- ```
66
+ En suite télécharger le kit Android:
67
+ https://github.com/METADIDOMIOFFICIEL/Metadidomi-Builder/releases/download/Android.zip/android.zip
68
+
69
+ 💡 **Suite** :
70
+ Vous pouvez aussi extraire manuellement le contenu de `vendor.zip` dans le dossier `build_tools/vendor`.
171
71
 
172
72
  ### Modules Embarqués - 100% Offline
173
73
 
174
- Toutes les dépendances essentielles sont incluses dans `node_modules/metadidomi-builder/build_tools/vendor/` (installation npm) ou `build_tools/vendor/` (installation manuelle) :
74
+ Toutes les dépendances essentielles sont incluses dans `build_tools/vendor/` :
175
75
 
176
76
  ```
177
- build_tools/vendor/ (ou node_modules/metadidomi-builder/build_tools/vendor/)
77
+ build_tools/vendor/
178
78
  ├── asar/ # Packaging et archivage
179
79
  ├── bytenode/ # Compilation JavaScript → bytecode V8
180
80
  ├── electron-asar/ # ASAR officiel Electron
@@ -202,26 +102,22 @@ Le builder intègre un **système automatique de signature** avec deux modes :
202
102
 
203
103
  #### Mode 1 : Auto-signé (Défaut - Développement)
204
104
  - ✅ Généré automatiquement lors du premier build
205
- - 📁 Stocké dans `node_modules/metadidomi-builder/build_tools/certs/cert-[hash].pfx` (npm) ou `build_tools/certs/cert-[hash].pfx` (manuel)
206
- - 🔑 Mot de passe dans `cert-[hash].key`
105
+ - 📁 Stocké dans `build_tools/certs/cert-[hash].pfx`
106
+ - 🔑 Mot de passe dans `build_tools/certs/cert-[hash].key`
207
107
  - ⚡ Aucune configuration requise
208
108
 
209
109
  #### Mode 2 : Certificat Personnalisé (Production)
210
110
 
211
111
  ```powershell
212
112
  # Option 1 : Fichier dans le dossier par défaut
213
- # Npm: Placer dans node_modules/metadidomi-builder/build_tools/certs/signing.pfx
214
- # Manuel: Placer dans build_tools/certs/signing.pfx
113
+ # Placer: build_tools/certs/signing.pfx
215
114
 
216
115
  # Option 2 : Variables d'environnement
217
116
  $env:PFX_PATH="chemin/vers/certificat.pfx"
218
117
  $env:PFX_PASS="mot-de-passe-certificat"
219
118
 
220
- # Lancer le build avec npm
221
- npm run build
222
-
223
- # Ou avec npx
224
- npx metadidomi-builder
119
+ # Lancer le build
120
+ node build_tools/builder.js
225
121
  ```
226
122
 
227
123
  **Priorité de signature :**
@@ -232,46 +128,16 @@ npx metadidomi-builder
232
128
 
233
129
  ---
234
130
 
235
- [⬆️ Retour en haut](#-multi-builder-premium)
236
-
237
131
  ## ⚡ Démarrage Rapide
238
132
 
239
- ### Pour les Pressés (< 5 min) - Installation npm
240
-
241
- ```powershell
242
- # 1. Installez le builder
243
- npm i metadidomi-builder
244
-
245
- # 2. Lancez le builder
246
- npm run build
247
-
248
- # 3. C'est tout ! ✅
249
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
250
- ```
251
-
252
- **OU directement avec npx :**
253
-
254
- ```powershell
255
- # 1. Allez dans votre dossier d'application
256
- cd D:\mon-app
257
-
258
- # 2. Lancez le builder directement
259
- npx metadidomi-builder
260
-
261
- > **À savoir :**
262
-
263
- # 3. C'est tout ! ✅
264
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
265
- ```
266
-
267
- ### Alternative : Installation Manuelle
133
+ ### Pour les Pressés (< 5 min)
268
134
 
269
135
  ```powershell
270
136
  # 1. Allez dans votre dossier d'application
271
137
  cd D:\mon-app
272
138
 
273
- # 2. Lancez le builder manuellement
274
- node "C:\chemin-vers\metadidomi-builder\build_tools\builder.js"
139
+ # 2. Lancez le builder
140
+ node D:\chemin-vers\metadidomi-builder\build_tools\builder.js
275
141
 
276
142
  # 3. C'est tout ! ✅
277
143
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe
@@ -288,94 +154,6 @@ mon-app/
288
154
 
289
155
  **Si aucun fichier n'existe, le builder génère une application de démo complète et fonctionnelle !** 🎉
290
156
 
291
- ### ⚠️ Éviter les Boucles Infinies de Build
292
-
293
- **IMPORTANT :** Configurez correctement votre `package.json` pour éviter que le builder relance indéfiniment des builds.
294
-
295
- #### ❌ MAUVAIS - Créé une boucle infinie
296
-
297
- ```json
298
- {
299
- "name": "mon-app",
300
- "version": "1.0.0",
301
- "scripts": {
302
- "start": "npm run build",
303
- "build": "metadidomi-builder"
304
- }
305
- }
306
- ```
307
-
308
- **Problème :** `npm run build` → `metadidomi-builder` → (re)crée `package.json` → retrigger scripts → boucle infinie ❌
309
-
310
- #### ✅ BON - Structure Correcte
311
-
312
- ```json
313
- {
314
- "name": "mon-app",
315
- "version": "1.0.0",
316
- "main": "main.js",
317
- "scripts": {
318
- "start": "electron .",
319
- "dev": "electron .",
320
- "build": "metadidomi-builder",
321
- "build:lite": "set LITE_BUILD=true && metadidomi-builder",
322
- "build:portable": "set CREATE_PORTABLE_EXE=true && metadidomi-builder"
323
- },
324
- "dependencies": {
325
- "electron": "^31.0.0"
326
- }
327
- }
328
- ```
329
-
330
- **Points clés :**
331
- - ✅ `"start"` lance **Electron**, pas le builder
332
- - ✅ `"build"` lance **SEULEMENT** le builder
333
- - ✅ Les scripts ne s'appellent pas mutuellement
334
- - ✅ Pas de hook `prestart` ou `postinstall` qui relancerait build
335
- - ✅ Le builder ne modifie PAS le package.json existant
336
-
337
- #### 🛡️ Règles de Sécurité pour npm scripts
338
-
339
- | Script | Doit faire | Doit PAS faire |
340
- |--------|-----------|---|
341
- | `start` | Lancer Electron ou l'app | Lancer le builder |
342
- | `build` | Lancer le builder | Lancer d'autres scripts |
343
- | `dev` | Mode développement Electron | Lancer le builder |
344
- | `test` | Exécuter les tests | Lancer le builder |
345
-
346
- #### 🔒 Protéger votre package.json
347
-
348
- **Ne pas ajouter ces hooks dangereux :**
349
-
350
- ```json
351
- {
352
- "scripts": {
353
- "prestart": "npm run build", // ❌ DANGER: boucle
354
- "postinstall": "npm run build", // ❌ DANGER: boucle
355
- "prepare": "npm run build" // ❌ DANGER: boucle
356
- }
357
- }
358
- ```
359
-
360
- #### ✅ Alternative Sûre : Scripts Séparés
361
-
362
- Si vous voulez build ET lancer, créez deux scripts distincts :
363
-
364
- ```json
365
- {
366
- "scripts": {
367
- "build": "metadidomi-builder",
368
- "start": "electron .",
369
- "build-and-run": "npm run build && npm start"
370
- }
371
- }
372
- ```
373
-
374
- **Utilisation :**
375
- ```powershell
376
- npm run build-and-run # ✅ Build PUIS lance l'app (une fois seulement)
377
- ```
378
-
379
157
  ---
380
158
 
381
159
  ## 📦 Gestion des Dépendances - Installation et Utilisation
@@ -511,11 +289,7 @@ axios.get('https://api.example.com/data')
511
289
 
512
290
  ### 2. Tester Localement Avant de Packager
513
291
  ```powershell
514
- # Python - Installation npm
515
- .\node_modules\metadidomi-builder\build_tools\vendor\python_embeddable\python.exe -m pip install -r requirements.txt
516
- python __main__.py
517
-
518
- # Python - Installation manuelle
292
+ # Python
519
293
  .\build_tools\vendor\python_embeddable\python.exe -m pip install -r requirements.txt
520
294
  python __main__.py
521
295
 
@@ -551,19 +325,6 @@ import numpy as np
551
325
 
552
326
  ### Python
553
327
 
554
- **Installation npm :**
555
- ```powershell
556
- # Voir les dépendances qui peuvent être mises à jour
557
- .\node_modules\metadidomi-builder\build_tools\vendor\python_embeddable\python.exe -m pip list --outdated
558
-
559
- # Mettre à jour une dépendance
560
- .\node_modules\metadidomi-builder\build_tools\vendor\python_embeddable\python.exe -m pip install --upgrade requests
561
-
562
- # Mettre à jour tous les packages
563
- .\node_modules\metadidomi-builder\build_tools\vendor\python_embeddable\python.exe -m pip install --upgrade -r requirements.txt
564
- ```
565
-
566
- **Installation manuelle :**
567
328
  ```powershell
568
329
  # Voir les dépendances qui peuvent être mises à jour
569
330
  .\build_tools\vendor\python_embeddable\python.exe -m pip list --outdated
@@ -596,21 +357,8 @@ npm update
596
357
 
597
358
  #### ⭐ Standard (Défaut) - Installateur NSIS
598
359
 
599
- **Avec npm :**
600
- ```powershell
601
- npm run build
602
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
603
- ```
604
-
605
- **Avec npx :**
606
- ```powershell
607
- npx metadidomi-builder
608
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
609
- ```
610
-
611
- **Manuel :**
612
360
  ```powershell
613
- node node_modules/metadidomi-builder/build_tools/builder.js
361
+ node build_tools/builder.js
614
362
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe
615
363
  ```
616
364
 
@@ -618,15 +366,9 @@ Crée un **installateur professionnel** avec options d'installation, raccourcis,
618
366
 
619
367
  #### 💾 Portable - Exécutable Autonome
620
368
 
621
- **Avec npm :**
622
- ```powershell
623
- $env:CREATE_PORTABLE_EXE="true"; npm run build
624
- # Résultat: ./dist/MonApp.exe (portable, ~130MB)
625
- ```
626
-
627
- **Avec npx :**
628
369
  ```powershell
629
- $env:CREATE_PORTABLE_EXE="true"; npx metadidomi-builder
370
+ $env:CREATE_PORTABLE_EXE="true"
371
+ node build_tools/builder.js
630
372
  # Résultat: ./dist/MonApp.exe (portable, ~130MB)
631
373
  ```
632
374
 
@@ -634,9 +376,9 @@ Exécutable indépendant sans installation requise.
634
376
 
635
377
  #### ⚡ LITE - Mode Optimisé
636
378
 
637
- **Avec npm :**
638
379
  ```powershell
639
- $env:LITE_BUILD="true"; npm run build
380
+ $env:LITE_BUILD="true"
381
+ node build_tools/builder.js
640
382
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe (optimisé)
641
383
  # Rapport: electron-lite-deps-report.txt
642
384
  ```
@@ -645,52 +387,46 @@ Analyse et exclut automatiquement les modules inutiles. Génère un rapport dét
645
387
 
646
388
  #### 🚫 Sans Installateur
647
389
 
648
- **Avec npm :**
649
390
  ```powershell
650
- $env:SKIP_INSTALLER="true"; npm run build
391
+ $env:SKIP_INSTALLER="true"
392
+ node build_tools/builder.js
651
393
  # Résultat: Ressources de base seulement
652
394
  ```
653
395
 
654
396
  #### 🔐 Avec Chiffrement
655
397
 
656
- **Avec npm :**
657
- ```powershell
658
- $env:KEY="votre-clé-secrète"; npm run build
659
- ```
660
-
661
- **Avec npx :**
662
398
  ```powershell
663
- $env:KEY="votre-clé-secrète"; npx metadidomi-builder
399
+ $env:KEY="votre-clé-secrète"
400
+ node build_tools/builder.js
664
401
  ```
665
402
 
666
403
  #### ⚙️ Compression UPX (Optionnelle)
667
404
 
668
- **Mode rapide (recommandé) :**
669
405
  ```powershell
670
- $env:USE_UPX="true"; npm run build
671
- ```
406
+ # Mode rapide (recommandé)
407
+ $env:USE_UPX="true"
408
+ node build_tools/builder.js
672
409
 
673
- **Mode ultra-brute (très lent, gain maximal) :**
674
- ```powershell
675
- $env:USE_UPX="true"; $env:UPX_ULTRA_BRUTE="true"; npm run build
410
+ # Mode ultra-brute (très lent, gain maximal)
411
+ $env:USE_UPX="true"
412
+ $env:UPX_ULTRA_BRUTE="true"
413
+ node build_tools/builder.js
676
414
  ```
677
415
 
678
416
  #### 🔗 Combinaisons Utiles
679
417
 
680
- **Portable + LITE + Chiffrement :**
681
418
  ```powershell
419
+ # Portable + LITE + Chiffrement
682
420
  $env:CREATE_PORTABLE_EXE="true"
683
421
  $env:LITE_BUILD="true"
684
422
  $env:KEY="clé-secrète"
685
- npm run build
686
- ```
423
+ node build_tools/builder.js
687
424
 
688
- **Avec UPX + Signature personnalisée :**
689
- ```powershell
425
+ # Avec UPX + Signature personnalisée
690
426
  $env:USE_UPX="true"
691
427
  $env:PFX_PATH="cert.pfx"
692
428
  $env:PFX_PASS="mot-de-passe"
693
- npm run build
429
+ node build_tools/builder.js
694
430
  ```
695
431
 
696
432
  ### Paramètres Avancés
@@ -781,25 +517,89 @@ mon-app/
781
517
 
782
518
  Le builder intègre un **système complet de protection du code** avec obfuscation intelligente, chiffrement multi-couches, et anti-analyse.
783
519
 
520
+ ### Deux Modes de Protection
521
+
522
+ **Mode Interactif** - Questions guidées pour chaque protection
523
+ ```powershell
524
+ cd metadidomi-builder/build_tools_py/pyMetadidomi
525
+ python pyMetadidomi.py
526
+ ```
527
+
528
+ **Mode CLI** - Automatisé avec arguments
529
+ ```powershell
530
+ # Presets rapides
531
+ python pyMetadidomi.py script.py --light-protection # Léger
532
+ python pyMetadidomi.py script.py --medium-protection # Moyen
533
+ python pyMetadidomi.py script.py --heavy-protection # Maximal
534
+
535
+ # Options individuelles
536
+ python pyMetadidomi.py script.py --carbon # Obfuscation
537
+ python pyMetadidomi.py script.py --junk # Code parasite
538
+ python pyMetadidomi.py script.py --anti-vm # Anti-VM
539
+ python pyMetadidomi.py script.py --multi-encrypt # Chiffrement multi-couches
540
+ ```
541
+
784
542
  ### Protection pour Electron
785
543
 
786
- **Avec npm :**
787
544
  ```powershell
788
- npm run build -- --light-protection
789
- npm run build -- --medium-protection
790
- npm run build -- --heavy-protection
545
+ node build_tools/builder.js --light-protection
546
+ node build_tools/builder.js --medium-protection
547
+ node build_tools/builder.js --heavy-protection
548
+ ```
549
+
550
+ 👉 **[📖 Documentation complète des protections →](build_tools_py/PROTECTION_COMMANDS.md)**
551
+
552
+ ---
553
+
554
+ ## 🚀 Utilisation de jsMetadidomi
555
+
556
+ **jsMetadidomi** est l'outil de protection JavaScript/HTML du builder. Il obfusque et chiffre votre code avec des couches de sécurité avancées.
557
+
558
+ ### Démarrage Rapide
559
+
560
+ #### Protéger un Fichier Individuel
561
+ ```powershell
562
+ # Protéger un fichier JavaScript
563
+ node node_modules/metadidomi-builder/build_tools/jsMetadidomi/protect.js mon-script.js dossier-sortie light
564
+
565
+ # Protéger un fichier HTML
566
+ node node_modules/metadidomi-builder/build_tools/jsMetadidomi/protect.js page.html dossier-sortie light
791
567
  ```
792
568
 
793
- **Avec npx :**
569
+ #### Protéger un Dossier Complet
794
570
  ```powershell
795
- npx metadidomi-builder --light-protection
796
- npx metadidomi-builder --medium-protection
797
- npx metadidomi-builder --heavy-protection
571
+ # Protéger tous les fichiers d'un dossier
572
+ node node_modules/metadidomi-builder/build_tools/jsMetadidomi/protect.js src protected-output medium
798
573
  ```
799
574
 
800
- **Remarque :** Pour les projets Python, voir la section [Protection du Code Python](#niveaux-de-protection-du-code-python).
575
+ ### Niveaux de Protection
576
+
577
+ | Niveau | Description | Cas d'usage |
578
+ |--------|-------------|-----------|
579
+ | **light** | Obfuscation basique + loader | Développement, tests rapides |
580
+ | **medium** | Obfuscation + anti-debug + dead code | Production standard |
801
581
 
802
- 👉 **[📖 Documentation complète des protections →](node_modules/metadidomi-builder/build_tools_py/PROTECTION_COMMANDS.md)**
582
+ ### Résultat de la Protection
583
+
584
+ Une fois la protection complétée, vous obtenez :
585
+ - 📄 **Fichiers protégés** - Code obfusqué et chiffré
586
+ - 🔑 **jsloader.js** - Loader de déchiffrement (généré automatiquement)
587
+
588
+ **⚠️ Important** : Distribuez le `jsloader.js` généré avec vos fichiers protégés. Le loader contient les clés et le bytecode nécessaires au déchiffrement.
589
+
590
+ ### Utilisation Programmatique
591
+
592
+ ```javascript
593
+ const { obfuscateFile, obfuscateApp } = require('metadidomi-builder/build_tools/jsMetadidomi/jsMetadidomi.js');
594
+
595
+ // Protéger un fichier
596
+ obfuscateFile('mon-script.js', 'dossier-sortie', 'light', true);
597
+
598
+ // Protéger un dossier
599
+ obfuscateApp('src', 'protected-output', 'medium', true);
600
+ ```
601
+
602
+ ---
803
603
 
804
604
  ## Construction LITE (optimisation)
805
605
  ```powershell
@@ -811,22 +611,20 @@ Génère un rapport `electron-lite-deps-report.txt` avec les modules analysés.
811
611
  ## Clé de Chiffrement Personnalisée
812
612
  ```powershell
813
613
  $env:KEY="votre-clé-secrète"
814
- npm run build
614
+ node build_tools/builder.js
815
615
  ```
816
616
  Si non défini, une clé est générée automatiquement.
817
617
 
818
618
  ## Compression UPX
819
- **Mode rapide (défaut) :**
820
619
  ```powershell
620
+ # Mode rapide (défaut)
821
621
  $env:USE_UPX="true"
822
- npm run build
823
- ```
622
+ node build_tools/builder.js
824
623
 
825
- **Mode ultra-brute (très lent) :**
826
- ```powershell
624
+ # Mode ultra-brute (très lent)
827
625
  $env:USE_UPX="true"
828
626
  $env:UPX_ULTRA_BRUTE="true"
829
- npm run build
627
+ node build_tools/builder.js
830
628
  ```
831
629
 
832
630
  ---
@@ -871,83 +669,19 @@ Builder (compile, chiffre, empaque, signe)
871
669
 
872
670
  ## 📝 Exemples Pratiques
873
671
 
874
- ### Installation npm + Utilisation - Electron
875
-
876
- **Exemple 1 : Setup complet avec tous les scripts npm**
877
-
878
- ```powershell
879
- # Installez le builder
880
- npm i metadidomi-builder
881
-
882
- # Ajoutez les scripts à votre package.json:
883
- # "scripts": {
884
- # "start": "electron .",
885
- # "dev": "electron .",
886
- # "build": "metadidomi-builder",
887
- # "build:lite": "set LITE_BUILD=true && metadidomi-builder",
888
- # "build:portable": "set CREATE_PORTABLE_EXE=true && metadidomi-builder",
889
- # "build:encrypted": "set KEY=ma-cle-secrete && metadidomi-builder",
890
- # "build-and-run": "npm run build && echo Build complete!"
891
- # }
892
-
893
- # Puis lancez avec :
894
- npm run build # Build standard → ./dist/MonApp-Setup-1.0.0.exe
895
- npm run build:lite # Build optimisé → ./dist/MonApp-Setup-1.0.0.exe
896
- npm run build:portable # Exécutable portable → ./dist/MonApp.exe
897
- npm run build:encrypted # Avec clé → ./dist/MonApp-Setup-1.0.0.exe (chiffré)
898
- npm run build-and-run # Build puis message
899
- ```
900
-
901
- **Exemple 2 : Avec options avancées dans package.json**
902
-
903
- ```json
904
- {
905
- "name": "mon-app-electron",
906
- "version": "1.0.0",
907
- "main": "main.js",
908
- "scripts": {
909
- "start": "electron .",
910
- "dev": "electron .",
911
- "build": "metadidomi-builder",
912
- "build:lite": "set LITE_BUILD=true && metadidomi-builder",
913
- "build:portable": "set CREATE_PORTABLE_EXE=true && metadidomi-builder",
914
- "build:upx": "set USE_UPX=true && metadidomi-builder",
915
- "build:full": "set CREATE_PORTABLE_EXE=true && set LITE_BUILD=true && set USE_UPX=true && metadidomi-builder",
916
- "build:protected": "set LITE_BUILD=true && metadidomi-builder --medium-protection"
917
- },
918
- "dependencies": {
919
- "electron": "^31.0.0"
920
- }
921
- }
922
- ```
923
-
924
- **Exemple 3 : Avec npx (sans installation)**
925
-
926
672
  ```powershell
927
- npx metadidomi-builder # Build standard
928
- npx metadidomi-builder --light-protection # Build avec protection légère
929
- npx metadidomi-builder --medium-protection # Build avec protection moyenne
930
- ```
931
-
932
- npm run build
933
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
934
- ```
673
+ # Mode simple (depuis votre app)
674
+ cd D:\MonApp
675
+ node C:\metadidomi-builder\build_tools\builder.js
935
676
 
936
- **Exemple 2 : Avec npx (sans installation)**
937
- ```powershell
938
- npx metadidomi-builder
939
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
940
- ```
677
+ # Avec source et sortie personnalisées
678
+ node build_tools/builder.js --app-src D:\mon-app --output D:\dist
941
679
 
942
- **Exemple 3 : Avec options personnalisées**
943
- ```powershell
944
- npm run build -- --light-protection
945
- # Ou
946
- $env:KEY="ma-clé-secrète"; npm run build
947
- ```
680
+ # Avec chiffrement
681
+ $env:KEY="ma-clé-secrète"
682
+ node build_tools/builder.js --app-src C:\MonApp
948
683
 
949
- **Exemple 4 : Portable + LITE + UPX**
950
- ```powershell
684
+ # Portable + LITE + UPX
951
685
  $env:CREATE_PORTABLE_EXE="true"
952
686
  $env:LITE_BUILD="true"
953
687
  $env:USE_UPX="true"
@@ -1014,6 +748,11 @@ L'injection ajoute automatiquement :
1014
748
 
1015
749
  ---
1016
750
 
751
+ ## 📊 Comparaison avec electron-builder
752
+ - Options d'obfuscation sûres et compatibles
753
+ - Pas de transformation agressive du code
754
+ - Préserve la stabilité de l'application
755
+
1017
756
  ### 📊 Protection multiniveau
1018
757
  Cette approche assure :
1019
758
  - ✅ **Sécurité maximale** : Protection forte contre l'analyse statique
@@ -1402,105 +1141,43 @@ L'empaquetage récursif est optimisé pour :
1402
1141
  | **Chiffrement ressources** | ✅ AES-256 intégré | ❌ Addon requis |
1403
1142
  | **Bytecode protection** | ✅ bytenode natif | ❌ Non |
1404
1143
  | **Mode LITE** | ✅ Analyse dépendances | ❌ Non |
1405
- | **Build reproducible** | ✅ 100% déterministe | ⚠️ Partiel |
1406
- | **Packaging Python** | ✅ Oui (NSIS + obfuscation) | ❌ Non |
1407
- | **Protection code Python** | ✅ pyMetadidomi (light/medium/heavy) | ❌ Non |
1408
- | **Multi-plateforme** | ⏳ Q1-2026 (macOS/Linux) | ✅ Windows/macOS/Linux |
1409
- | **Communauté** | 🆕 En croissance | ✅ Très large |
1410
- | **Support commercial** | ✅ Direct (ETS METADIDOMI) | ✅ Communauté + sponsors |
1411
-
1412
- ### 🎯 Tableau Récapitulatif
1413
-
1414
- **metadidomi-builder** :
1415
- - ✅ **Sécurité maximale** - AES-256, bytecode, obfuscation pyMetadidomi
1416
- - ✅ **100% offline** - Zéro dépendance externe, tous les outils embarqués
1417
- - ✅ **Builds reproductibles** - Déterministe et versionnable
1418
- - ✅ **Python support** - Applications Python complètes avec installateurs NSIS
1419
- - ⏳ **Multi-plateforme** - Windows maintenant, macOS/Linux 2026
1420
-
1421
- **electron-builder** :
1422
- - ✅ **Multi-plateforme établi** - Windows, macOS, Linux, AppImage, Snap
1423
- - ✅ **Configuration simple** - Template facile à adapter
1424
- - ✅ **Communauté large** - Nombreuses extensions et plugins
1425
- - ⚠️ **Dépendances réseau** - Nécessite téléchargements externe
1426
- - ❌ **Python non supporté** - Electron uniquement
1427
-
1428
- ### 💡 Comment Choisir?
1429
-
1430
- **Utilisez metadidomi-builder si vous avez besoin de :**
1431
- - 🔐 Sécurité critique (finance, santé, militaire)
1432
- - 📦 Packaging Python standalone avec installateur professionnel
1433
- - 🔒 Obfuscation et protection du code (anti-reverse engineering)
1434
- - 🚫 Environnement complètement offline
1435
- - ⚙️ Contrôle total sur le processus de build
1436
-
1437
- **Utilisez electron-builder si vous avez besoin de :**
1438
- - 🖥️ Multi-plateforme stable et mature
1439
- - 🚀 Setup rapide et facile (peu de configuration)
1440
- - 👥 Accès à une large communauté et d'extensions
1441
- - 📱 Support macOS/Linux dès maintenant
1442
- - 🔄 Updates automatiques intégrées
1144
+ | **Build reproducible** | ✅ Oui | ⚠️ Partiel |
1443
1145
 
1444
- ---
1146
+ **metadidomi-builder** : Optimal pour sécurité maximale, 100% offline, protection bytecode
1147
+ **electron-builder** : Optimal pour multi-plateforme, configuration simple, communauté large
1148
+
1149
+ 👉 **Choisir metadidomi-builder si** : sécurité critique, environnement offline, control total
1150
+ 👉 **Choisir electron-builder si** : multi-plateforme, setup simple, app standard
1445
1151
 
1446
- [⬆️ Retour en haut](#-multi-builder-premium)
1152
+ ---
1447
1153
 
1448
1154
  ## � Packaging d'Applications Python
1449
1155
 
1450
1156
  Le builder inclut aussi un **système complet de packaging Python** via `builder.py` pour créer des applications Windows standalone avec installateurs NSIS professionnels.
1451
1157
 
1452
-
1453
1158
  ### 🚀 Démarrage Rapide - Applications Python
1454
1159
 
1455
- **Option 1 : Via npm (Recommandée)**
1160
+ **Le plus simple** - Exécutez le builder Python depuis votre dossier d'application :
1456
1161
 
1457
1162
  ```powershell
1458
- # Installez le builder
1459
- npm i metadidomi-builder
1460
-
1461
- # Ajoutez des scripts dans votre package.json
1462
- # "scripts": {
1463
- # "build:python": "python node_modules\\metadidomi-builder\\build_tools_py\\builder.py --app-src ./src",
1464
- # "build:python:gui": "python node_modules\\metadidomi-builder\\build_tools_py\\builder.py --gui --app-src ./src"
1465
- # }
1466
-
1467
- # Puis lancez avec :
1468
- npm run build:python # Mode console (par défaut)
1469
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1470
-
1471
- # OU
1472
- npm run build:python:gui # Mode GUI (sans console)
1473
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1474
- ```
1475
-
1476
- > **Astuce :** Placez toujours vos sources Python dans un dossier `src/` et ajoutez l’option `--app-src ./src` à vos scripts dans le `package.json`. Cela évite les erreurs de scan des dossiers `node_modules` et `vendor` (chemins trop longs ou fichiers manquants).
1477
- > Placez vos fichiers sources Python (`config.py`, `__main__.py`, etc.) dans un dossier séparé (ex : `src/`).
1478
- > Puis lancez le build en précisant le chemin source :
1479
- > ```powershell
1480
- > npm run build:python -- --app-src ./src
1481
- > ```
1482
- > Cela évite que le builder scanne le dossier `node_modules` et les vendors, et prévient les erreurs de chemin trop long ou manquant.
1483
-
1484
- **Option 2 : Avec npx (sans installation)**
1163
+ # Depuis votre répertoire d'application Python
1164
+ cd D:\mon-app-python
1165
+ python D:\chemin-vers\metadidomi-builder\build_tools_py\builder.py
1485
1166
 
1486
- ```powershell
1487
- npx metadidomi-builder-python
1488
1167
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1489
1168
  ```
1490
1169
 
1491
- **Option 3 : Installation Manuelle**
1170
+ **Ou avec options personnalisées :**
1492
1171
 
1493
1172
  ```powershell
1494
- # Mode console simple
1495
- node "C:\chemin-vers\metadidomi-builder\build_tools_py\builder.py"
1496
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1173
+ # Source et sortie personnalisées
1174
+ python builder.py --app-src D:\mon-app --output D:\dist
1497
1175
 
1498
1176
  # Mode GUI (sans fenêtre console)
1499
- node "C:\chemin-vers\metadidomi-builder\build_tools_py\builder.py" --gui
1500
- # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1177
+ python builder.py --gui
1501
1178
 
1502
- # Avec source et sortie personnalisées
1503
- node "C:\chemin-vers\metadidomi-builder\build_tools_py\builder.py" --app-src D:\mon-app --output D:\dist --gui
1179
+ # Combiné
1180
+ python builder.py --app-src D:\mon-app --output D:\dist --gui
1504
1181
  ```
1505
1182
 
1506
1183
  ### 📋 Structure Minimale d'une Application Python
@@ -1540,6 +1217,31 @@ AUTHOR = "Votre Entreprise"
1540
1217
  ENTRY = "__main__"
1541
1218
  ```
1542
1219
 
1220
+ ### ⚠️ Point d'Entrée Unique (IMPORTANT)
1221
+
1222
+ Le builder utilise **un seul point d'entrée**, celui défini dans la clé `ENTRY` de `config.py`.
1223
+
1224
+ - ✅ **Seul le fichier défini dans `ENTRY`** sera utilisé comme point d'entrée principal
1225
+ - ❌ Les autres fichiers d'entrée potentiels (`main.py`, `app.py`, etc.) seront **ignorés et non embarqués** dans le launcher
1226
+ - 🔒 Cela garantit qu'il n'y a **aucune ambiguïté** sur le point d'entrée réel
1227
+
1228
+ **Exemple :**
1229
+ ```python
1230
+ # Si vous définissez dans config.py:
1231
+ ENTRY = "app_launcher"
1232
+
1233
+ # Alors SEUL app_launcher.py sera utilisé comme point d'entrée
1234
+ # Les fichiers main.py, __main__.py, app.py seront complètement ignorés
1235
+ ```
1236
+
1237
+ **Comportement du builder :**
1238
+ 1. Lit la clé `ENTRY` dans `config.py`
1239
+ 2. Cherche le fichier correspondant (ex: `app_launcher.py`)
1240
+ 3. L'embarque dans le launcher compilé
1241
+ 4. **Exclut tous les autres fichiers Python d'entrée** du payload
1242
+
1243
+ Cela évite les conflits et les comportements imprévisibles dus à plusieurs points d'entrée.
1244
+
1543
1245
  ### 📝 Exemple : __main__.py Minimal
1544
1246
 
1545
1247
  ```python
@@ -1647,15 +1349,52 @@ python builder.py --gui
1647
1349
  | `--gui` | Compiler en mode GUI (pas de console) | `--gui` |
1648
1350
  | `--no-pyc` | Ne pas compiler les .py en .pyc | `--no-pyc` |
1649
1351
  | `--key <clé>` | Clé de chiffrement personnalisée | `--key ma-clé` |
1352
+ | `--python-embed <chemin>` | Python embeddable personnalisé | `--python-embed D:\python-embed-amd64` |
1650
1353
 
1651
- ### 💾 Architecture du Packaging Python
1354
+ ### 🐍 Utilisation d'un Python Embeddable Personnalisé
1652
1355
 
1653
- Le builder Python utilise une approche **4 étapes** pour protéger et packager votre application :
1356
+ Le paramètre `--python-embed` permet d'utiliser votre propre distribution Python embeddable au lieu de celle par défaut. Cela est utile pour :
1357
+ - ✅ Utiliser une version Python différente
1358
+ - ✅ Utiliser un Python pré-configuré avec vos dépendances
1359
+ - ✅ Optimiser la taille du package final
1360
+ - ✅ Builds reproductibles avec un Python maîtrisé
1654
1361
 
1655
- ```
1656
- ÉTAPE 1: Archive ZIP Récursive
1657
- ├─ Collecte TOUS les fichiers de l'app
1658
- ├─ À TOUS les niveaux de profondeur
1362
+ **Utilisation :**
1363
+
1364
+ ```powershell
1365
+ # Utiliser un Python embeddable personnalisé
1366
+ python builder.py --python-embed D:\python-embed-amd64
1367
+
1368
+ # Combiné avec d'autres paramètres
1369
+ python builder.py --app-src D:\mon-app --output D:\dist --python-embed D:\python-embed-amd64 --gui
1370
+
1371
+ # Via variable d'environnement
1372
+ $env:PYTHON_EMBED = "D:\python-embed-amd64"
1373
+ python builder.py
1374
+ ```
1375
+
1376
+ **Structure attendue du dossier Python embeddable :**
1377
+
1378
+ ```
1379
+ python-embed-amd64/
1380
+ ├── python.exe ← Exécutable Python principal
1381
+ ├── python311.dll ← Librairie Python
1382
+ ├── Lib/ ← Librairies standard Python
1383
+ ├── DLLs/ ← DLLs compilées
1384
+ ├── Scripts/ ← Scripts exécutables
1385
+ └── site-packages/ ← Packages tiers installés
1386
+ ```
1387
+
1388
+ **Important :** Assurez-vous que votre dossier Python embeddable contient tous les fichiers standards et que les dépendances requises sont installées dans `site-packages/`.
1389
+
1390
+ ### 💾 Architecture du Packaging Python
1391
+
1392
+ Le builder Python utilise une approche **4 étapes** pour protéger et packager votre application :
1393
+
1394
+ ```
1395
+ ÉTAPE 1: Archive ZIP Récursive
1396
+ ├─ Collecte TOUS les fichiers de l'app
1397
+ ├─ À TOUS les niveaux de profondeur
1659
1398
  └─ Crée une archive ZIP chiffrée
1660
1399
 
1661
1400
  ÉTAPE 2: Chiffrement + HMAC
@@ -1720,9 +1459,7 @@ Le builder utilise **Python Embeddable** pour les utilisateurs finaux :
1720
1459
  - ✅ Distribution portable
1721
1460
  - ✅ Inclus dans l'installateur NSIS
1722
1461
 
1723
- **Localisation :**
1724
- - Installation npm : `node_modules/metadidomi-builder/build_tools/vendor/python_embeddable/`
1725
- - Installation manuelle : `build_tools/vendor/python_embeddable/`
1462
+ **Localisation :** `build_tools/vendor/python_embeddable/`
1726
1463
 
1727
1464
  ### 🔐 Protection du Code Python
1728
1465
 
@@ -1745,24 +1482,6 @@ Le builder utilise **Python Embeddable** pour les utilisateurs finaux :
1745
1482
  - Code Python injecté dynamiquement
1746
1483
  - Exécution directe sans interpréteur externe
1747
1484
 
1748
- #### Niveaux de protection du code Python
1749
-
1750
- Vous pouvez protéger votre code Python lors du build avec différents niveaux de protection :
1751
-
1752
- ```powershell
1753
- npm run build:python -- --app-src ./src --light-protection
1754
- npm run build:python:gui -- --app-src ./src --medium-protection
1755
- npm run build:python -- --app-src ./src --heavy-protection
1756
- ```
1757
-
1758
- **Options de protection :**
1759
-
1760
- - `--light-protection` : Obfuscation légère (carbon + junk)
1761
- - `--medium-protection` : Obfuscation moyenne (carbon + junk + bugs + dead-code)
1762
- - `--heavy-protection` : Protection maximale (toutes les options)
1763
-
1764
- **Remarque :** Ces options ne concernent que les projets Python. Pour Electron, voir la section correspondante.
1765
-
1766
1485
  ### 📊 Fichiers Générés
1767
1486
 
1768
1487
  ```
@@ -1781,59 +1500,54 @@ dist/
1781
1500
 
1782
1501
  #### Exemple 1 : Application Console Simple
1783
1502
 
1784
- **Avec npm :**
1785
1503
  ```powershell
1786
1504
  # Structure
1787
1505
  mon-app/
1788
- src/
1789
- config.py
1790
- __main__.py
1506
+ config.py
1507
+ __main__.py
1791
1508
 
1792
1509
  # Build
1793
1510
  cd mon-app
1794
- npm run build:python -- --app-src ./src
1511
+ python ..\builder.py
1795
1512
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe
1796
1513
  ```
1797
1514
 
1798
1515
  #### Exemple 2 : Application Tkinter GUI
1799
1516
 
1800
- **Avec npm :**
1801
1517
  ```powershell
1802
1518
  # Structure
1803
1519
  mon-app-gui/
1804
- src/
1805
- config.py
1806
- __main__.py ← Interface Tkinter
1807
- assets/
1808
- icon.ico
1520
+ config.py
1521
+ __main__.py ← Interface Tkinter
1522
+ assets/
1523
+ icon.ico
1809
1524
 
1810
1525
  # Build (mode GUI pour éviter console)
1811
- npm run build:python:gui -- --app-src ./src
1526
+ cd mon-app-gui
1527
+ python ..\..\builder.py --gui
1812
1528
  # Résultat: ./dist/MonApp-Setup-1.0.0.exe (pas de console)
1813
1529
  ```
1814
1530
 
1815
1531
  #### Exemple 3 : Application Complexe Multi-Fichiers
1816
1532
 
1817
- **Avec npm :**
1818
1533
  ```powershell
1819
1534
  # Structure complexe
1820
1535
  mon-app/
1821
- src/
1822
- config.py
1823
- __main__.py
1824
- utils/
1825
- helpers.py
1826
- validators.py
1827
- lib/
1828
- core.py
1829
- handlers/
1830
- events.py
1831
- assets/
1832
- icon.ico
1833
- data.json
1536
+ config.py
1537
+ __main__.py
1538
+ utils/
1539
+ helpers.py
1540
+ validators.py
1541
+ lib/
1542
+ core.py
1543
+ handlers/
1544
+ events.py
1545
+ assets/
1546
+ icon.ico
1547
+ data.json
1834
1548
 
1835
- # Build
1836
- npm run build:python -- --app-src ./src
1549
+ # Build avec sortie personnalisée
1550
+ python builder.py --app-src D:\mon-app --output D:\dist
1837
1551
  # TOUS les fichiers récursivement inclus ✅
1838
1552
  ```
1839
1553
 
@@ -1841,52 +1555,30 @@ npm run build:python -- --app-src ./src
1841
1555
 
1842
1556
  #### Avec Clé de Chiffrement Personnalisée
1843
1557
 
1844
- **Avec npm :**
1845
- ```powershell
1846
- # Via variable d'environnement
1847
- $env:KEY = "ma-clé-secrète-32-caractères"
1848
- npm run build:python -- --app-src ./src
1849
- ```
1850
-
1851
- **Manuel :**
1852
1558
  ```powershell
1853
1559
  # Option 1: Via argument
1854
- node build_tools_py/builder.py --app-src ./src --key "ma-clé-secrète-32-caractères"
1560
+ python builder.py --key "ma-clé-secrète-32-caractères"
1855
1561
 
1856
1562
  # Option 2: Via variable d'environnement
1857
1563
  $env:KEY = "ma-clé-secrète-32-caractères"
1858
- node build_tools_py/builder.py --app-src ./src
1564
+ python builder.py
1859
1565
  ```
1860
1566
 
1861
1567
  #### Sans Compilation .pyc
1862
1568
 
1863
- **Avec npm :**
1864
-
1865
1569
  ```powershell
1866
- npm run build:python -- --no-pyc --app-src ./src
1867
- ```
1868
-
1869
- **Manuel :**
1870
- ```powershell
1871
- node build_tools_py/builder.py --app-src ./src --no-pyc
1570
+ python builder.py --no-pyc
1872
1571
  # Les .py restent non compilés (plus rapide au build)
1873
1572
  ```
1874
1573
 
1875
1574
  #### Combinaisons
1876
1575
 
1877
- **Avec npm :**
1878
- ```powershell
1879
- # GUI + clé custom
1880
- $env:KEY = "clé-secrète"; npm run build:python:gui -- --app-src ./src
1881
- ```
1882
-
1883
- **Manuel :**
1884
1576
  ```powershell
1885
- # GUI + clé custom
1886
- node build_tools_py/builder.py --app-src ./src --gui --key "clé-secrète"
1577
+ # GUI + sortie personnalisée + clé custom
1578
+ python builder.py --gui --output D:\dist --key "clé-secrète"
1887
1579
 
1888
1580
  # Source custom + GUI + sans .pyc
1889
- node build_tools_py/builder.py --app-src D:\mon-app --gui --no-pyc
1581
+ python builder.py --app-src D:\mon-app --gui --no-pyc
1890
1582
  ```
1891
1583
 
1892
1584
  ### 🔍 Dépistage et Débogage
@@ -1980,6 +1672,776 @@ Python Embeddable distribution not found
1980
1672
  ```
1981
1673
  **✅ SOLUTION:** Vérifiez le dossier `build_tools/vendor/python_embeddable/`
1982
1674
 
1675
+ ---
1676
+ # Metadidomi Crone - Générateur d'APK Android
1677
+
1678
+ Une solution complète et automatisée pour créer des applications Android (APK) sans besoin de connaissances avancées en Android Studio.
1679
+
1680
+ <a id="top"></a>
1681
+
1682
+ ## 📋 Table des matières
1683
+
1684
+ - [Installation rapide](#installation-rapide)
1685
+ - [Structure d'un projet](#structure-dun-projet)
1686
+ - [Créer une nouvelle application](#créer-une-nouvelle-application)
1687
+ - [Configuration de l'application](#configuration-de-lapplication)
1688
+ - [Générer l'APK](#générer-lapk)
1689
+ - [Exemples](#exemples)
1690
+ - [Dépannage](#dépannage)
1691
+ - [Options avancées](#options-avancées)
1692
+
1693
+ ---
1694
+
1695
+ ## Installation rapide
1696
+
1697
+ 🔝 [Retour en haut](#top)
1698
+
1699
+ ### Prérequis
1700
+
1701
+ - **Node.js** (v14 ou supérieur) - [Télécharger](https://nodejs.org)
1702
+ - **PowerShell** (Windows) ou **Bash** (Mac/Linux)
1703
+ - **Python 3** (pour la génération d'icônes) - [Télécharger](https://www.python.org)
1704
+ - **Pillow** (PIL) pour Python : `pip install Pillow`
1705
+
1706
+ ### Vérifier l'installation
1707
+
1708
+ ```powershell
1709
+ node --version
1710
+ python --version
1711
+ npm --version
1712
+ ```
1713
+
1714
+ ### Installation via npm (Recommandé)
1715
+
1716
+ Installez metadidomi-builder comme dépendance locale dans votre projet :
1717
+
1718
+ ```powershell
1719
+
1720
+ npm install metadidomi-builder
1721
+ ```
1722
+
1723
+ Créez un `package.json` à la racine de votre projet :
1724
+
1725
+ ```json
1726
+ {
1727
+ "name": "mon-app-android",
1728
+ "version": "1.0.0",
1729
+ "scripts": {
1730
+ "build": "node node_modules/metadidomi-builder/build_tools/build_apk.js .",
1731
+ "build-debug": "node node_modules/metadidomi-builder/build_tools/build_apk.js . --fail-on-missing",
1732
+ "build-restore": "node node_modules/metadidomi-builder/build_tools/build_apk.js . --restore",
1733
+ "build-icons": "node node_modules/metadidomi-builder/build_tools/generate-icons.js ."
1734
+ },
1735
+ "keywords": [
1736
+ "android",
1737
+ "apk",
1738
+ "builder"
1739
+ ],
1740
+ "author": "Metadidomi",
1741
+ "license": "MIT",
1742
+ "dependencies": {
1743
+ "metadidomi-builder": "file:../metadidomi-builder",
1744
+ "sharp": "^0.32.0"
1745
+ }
1746
+ }
1747
+ ```
1748
+
1749
+ Puis installez et lancez le build :
1750
+
1751
+ ```powershell
1752
+ npm install
1753
+ npm run build
1754
+ ```
1755
+
1756
+ ---
1757
+
1758
+ ## Structure d'un projet
1759
+
1760
+ 🔝 [Retour en haut](#top)
1761
+
1762
+ Chaque application Android doit suivre cette structure :
1763
+
1764
+ ```
1765
+ MonApp/
1766
+ ├── app-config.json # Configuration de l'app
1767
+ ├── AndroidManifest.xml # Déclaration Android (généré automatiquement)
1768
+ ├── src/
1769
+ │ └── com/example/monapp/
1770
+ │ └── MainActivity.java # Code Java principal
1771
+ ├── res/
1772
+ │ ├── layout/
1773
+ │ │ └── activity_main.xml # Interface utilisateur
1774
+ │ ├── values/
1775
+ │ │ ├── strings.xml # Textes et traductions
1776
+ │ │ ├── colors.xml # Couleurs
1777
+ │ │ └── styles.xml # Styles et thèmes
1778
+ │ ├── mipmap-hdpi/
1779
+ │ │ └── ic_launcher.png # Icône de l'app (auto-générée)
1780
+ │ └── drawable/ # Images supplémentaires (optionnel)
1781
+ └── build/ # Généré automatiquement (à ignorer)
1782
+ ```
1783
+
1784
+ ---
1785
+
1786
+ ## Créer une nouvelle application
1787
+
1788
+ ### Étape 1 : Créer la structure des dossiers
1789
+
1790
+ 🔝 [Retour en haut](#top)
1791
+
1792
+ ```powershell
1793
+ mkdir MonApp\src\com\example\monapp
1794
+ mkdir MonApp\res\layout
1795
+ mkdir MonApp\res\values
1796
+ mkdir MonApp\res\mipmap-hdpi
1797
+ ```
1798
+
1799
+ ### Étape 2 : Créer `app-config.json`
1800
+
1801
+ Ce fichier contient toutes les informations de votre application.
1802
+
1803
+ ```json
1804
+ {
1805
+ "appName": "MonApp",
1806
+ "appVersion": "1.0.0",
1807
+ "appDescription": "Ma première application Android",
1808
+ "packageName": "com.example.monapp",
1809
+ "minSdkVersion": 21,
1810
+ "targetSdkVersion": 34,
1811
+ "colors": {
1812
+ "primary": "#2196F3",
1813
+ "primaryDark": "#1976D2",
1814
+ "accent": "#FF5722"
1815
+ }
1816
+ }
1817
+ ```
1818
+
1819
+ **Explications des paramètres :**
1820
+ - `appName` : Nom affiché de l'application
1821
+ - `appVersion` : Version sémantique (majeur.mineur.patch)
1822
+ - `packageName` : Identifiant unique (format domaine inversé)
1823
+ - `minSdkVersion` : Version Android minimale (21 = Android 5.0)
1824
+ - `targetSdkVersion` : Version Android ciblée (34 = Android 14)
1825
+ - `colors` : Couleurs principales (format hexadécimal)
1826
+
1827
+ ### Étape 3 : Créer l'interface (`activity_main.xml`)
1828
+
1829
+ Fichier : `res/layout/activity_main.xml`
1830
+
1831
+ ```xml
1832
+ <?xml version="1.0" encoding="utf-8"?>
1833
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
1834
+ android:orientation="vertical"
1835
+ android:layout_width="match_parent"
1836
+ android:layout_height="match_parent"
1837
+ android:gravity="center"
1838
+ android:padding="16dp">
1839
+
1840
+ <TextView
1841
+ android:id="@+id/titleText"
1842
+ android:layout_width="wrap_content"
1843
+ android:layout_height="wrap_content"
1844
+ android:text="Bienvenue dans MonApp"
1845
+ android:textSize="24sp"
1846
+ android:textStyle="bold" />
1847
+
1848
+ <Button
1849
+ android:id="@+id/myButton"
1850
+ android:layout_width="wrap_content"
1851
+ android:layout_height="wrap_content"
1852
+ android:text="Appuyez-moi"
1853
+ android:layout_marginTop="16dp" />
1854
+
1855
+ </LinearLayout>
1856
+ ```
1857
+
1858
+ ### Étape 4 : Créer les textes (`strings.xml`)
1859
+
1860
+ Fichier : `res/values/strings.xml`
1861
+
1862
+ ```xml
1863
+ <resources>
1864
+ <string name="app_name">MonApp</string>
1865
+ <string name="app_version">1.0.0</string>
1866
+ <string name="app_description">Ma première application</string>
1867
+ <string name="hello_world">Bienvenue</string>
1868
+ <string name="action_settings">Paramètres</string>
1869
+ <string name="back">Retour</string>
1870
+ <string name="forward">Suivant</string>
1871
+ <string name="reload">Recharger</string>
1872
+ </resources>
1873
+ ```
1874
+
1875
+ ### Étape 5 : Créer le code Java (`MainActivity.java`)
1876
+
1877
+ Fichier : `src/com/example/monapp/MainActivity.java`
1878
+
1879
+ ```java
1880
+ package com.example.monapp;
1881
+
1882
+ import android.app.Activity;
1883
+ import android.os.Bundle;
1884
+ import android.widget.Button;
1885
+ import android.widget.Toast;
1886
+ import android.view.View;
1887
+ import android.util.Log;
1888
+
1889
+ public class MainActivity extends Activity {
1890
+ private static final String TAG = "MonApp";
1891
+
1892
+ @Override
1893
+ protected void onCreate(Bundle savedInstanceState) {
1894
+ super.onCreate(savedInstanceState);
1895
+ setContentView(R.layout.activity_main);
1896
+ Log.d(TAG, "MainActivity créée");
1897
+
1898
+ Button myButton = (Button) findViewById(R.id.myButton);
1899
+ myButton.setOnClickListener(new View.OnClickListener() {
1900
+ @Override
1901
+ public void onClick(View v) {
1902
+ Toast.makeText(MainActivity.this, "Bouton cliqué!", Toast.LENGTH_SHORT).show();
1903
+ Log.d(TAG, "Bouton cliqué");
1904
+ }
1905
+ });
1906
+ }
1907
+ }
1908
+ ```
1909
+
1910
+ ### Étape 6 : Ajouter une icône
1911
+
1912
+ Placez une image PNG (96x96 pixels) dans `res/mipmap/`.
1913
+
1914
+ **Le système générera automatiquement les variantes pour tous les écrans.**
1915
+
1916
+ ---
1917
+
1918
+ ## Configuration de l'application
1919
+
1920
+ 🔝 [Retour en haut](#top)
1921
+
1922
+ ### `app-config.json` complet
1923
+
1924
+ ```json
1925
+ {
1926
+ "appName": "MonApp",
1927
+ "appVersion": "1.0.0",
1928
+ "appDescription": "Ma première application Android",
1929
+ "packageName": "com.example.monapp",
1930
+ "minSdkVersion": 21,
1931
+ "targetSdkVersion": 34,
1932
+ "colors": {
1933
+ "primary": "#2196F3",
1934
+ "primaryDark": "#1976D2",
1935
+ "accent": "#FF5722"
1936
+ },
1937
+ "minimalRequiredFiles": [
1938
+ "AndroidManifest.xml",
1939
+ "res/values/strings.xml",
1940
+ "res/values/styles.xml",
1941
+ "res/layout/activity_main.xml"
1942
+ ]
1943
+ }
1944
+ ```
1945
+
1946
+ ---
1947
+
1948
+ ## Générer l'APK
1949
+
1950
+ 🔝 [Retour en haut](#top)
1951
+
1952
+ ### Avec npm
1953
+
1954
+ ```powershell
1955
+ # Build standard
1956
+ npm run build
1957
+
1958
+ # Build avec vérification stricte
1959
+ npm run build-debug
1960
+
1961
+ # Générer les icônes
1962
+ npm run build-icons
1963
+ ```
1964
+
1965
+ ### Sans sauvegarde
1966
+
1967
+ ```powershell
1968
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp" --no-backup
1969
+ ```
1970
+
1971
+ ### Restaurer depuis une sauvegarde
1972
+
1973
+ ```powershell
1974
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp" --restore
1975
+ ```
1976
+
1977
+ ### Résultat
1978
+
1979
+ Après une génération réussie, vous trouverez :
1980
+
1981
+ ```
1982
+ MonApp/
1983
+ └── MonApp.apk ← Votre application, prête à installer!
1984
+ ```
1985
+
1986
+ Fichier de sortie : `MonApp/MonApp.apk`
1987
+
1988
+ **Taille typique :** 2-5 MB
1989
+
1990
+ ---
1991
+
1992
+ ## Exemples
1993
+
1994
+ 🔝 [Retour en haut](#top)
1995
+
1996
+ ### Exemple 1 : Application Compteur
1997
+
1998
+ Voir le dossier `CounterApp/` pour un exemple complet d'une application de compteur avec :
1999
+ - Boutons d'incrémentation/décrémentation
2000
+ - Affichage d'un compteur
2001
+ - Interface colorée
2002
+
2003
+ ### Exemple 2 : Application Simple
2004
+
2005
+ Consultez `MyApp/` pour une application de base.
2006
+
2007
+ ### Exemple 3 : Application Avancée
2008
+
2009
+ `MyApp_Advanced/` contient des fonctionnalités plus complexes.
2010
+
2011
+ ---
2012
+
2013
+ ## Dépannage
2014
+
2015
+ 🔝 [Retour en haut](#top)
2016
+
2017
+ ### Erreur : "Aucun fichier Java trouvé"
2018
+
2019
+ **Cause** : Le dossier `src/` est vide ou mal structuré.
2020
+
2021
+ **Solution** :
2022
+ 1. Vérifiez que `MainActivity.java` existe dans `src/com/example/monapp/`
2023
+ 2. Vérifiez le nom du package (doit correspondre à `packageName` dans `app-config.json`)
2024
+
2025
+ ```
2026
+ src/
2027
+ └── com/example/monapp/
2028
+ └── MainActivity.java ✓ Correct
2029
+ ```
2030
+
2031
+ ### Erreur : "resource string/... not found"
2032
+
2033
+ **Cause** : Une chaîne de caractères référencée n'existe pas dans `strings.xml`.
2034
+
2035
+ **Solution** :
2036
+ 1. Ouvrez `res/values/strings.xml`
2037
+ 2. Ajoutez la chaîne manquante avec son ID correct :
2038
+ ```xml
2039
+ <string name="fragment1">Fragments</string>
2040
+ <string name="action_click">Cliquez ici</string>
2041
+ ```
2042
+ 3. **Assurez-vous que le nom correspond exactement** à celui utilisé dans votre layout XML
2043
+
2044
+ **Exemple d'erreur rencontrée (CounterApp) :**
2045
+ ```
2046
+ error: resource string/fragment1 not found
2047
+ ```
2048
+ **Correction appliquée :**
2049
+ ```xml
2050
+ <!-- res/values/strings.xml -->
2051
+ <resources>
2052
+ <string name="app_name">CounterApp</string>
2053
+ <string name="fragment1">Compteur</string>
2054
+ <string name="increment">Incrémenter</string>
2055
+ <string name="decrement">Décrémenter</string>
2056
+ <string name="reset">Réinitialiser</string>
2057
+ </resources>
2058
+ ```
2059
+
2060
+ ### Erreur : "cannot find symbol: variable R"
2061
+
2062
+ **Cause** : Les ressources n'ont pas été compilées correctement.
2063
+
2064
+ **Solution** :
2065
+ 1. Supprimez le dossier `build/`
2066
+ 2. Vérifiez que `res/values/strings.xml` est valide (XML bien formé, pas d'accents mal encodés)
2067
+ 3. Relancez la génération complète
2068
+
2069
+ ### Erreur : "D8 compilation failed" avec "NullPointerException"
2070
+
2071
+ **Cause** : Classes anonymes mal générées lors de la compilation DEX.
2072
+
2073
+ **Symptômes** :
2074
+ ```
2075
+ java.lang.NullPointerException: Cannot invoke "String.length()"
2076
+ Exception in thread "main" java.lang.NullPointerException
2077
+ ```
2078
+
2079
+ **Solution - Utilisez `implements View.OnClickListener` au lieu de classes anonymes** :
2080
+
2081
+ ❌ **INCORRECT (cause l'erreur D8)** :
2082
+ ```java
2083
+ button.setOnClickListener(new View.OnClickListener() {
2084
+ @Override
2085
+ public void onClick(View v) {
2086
+ counter++;
2087
+ updateDisplay();
2088
+ }
2089
+ });
2090
+ ```
2091
+
2092
+ ✅ **CORRECT** :
2093
+ ```java
2094
+ public class MainActivity extends Activity implements View.OnClickListener {
2095
+ private Button incrementBtn, decrementBtn;
2096
+
2097
+ @Override
2098
+ public void onClick(View v) {
2099
+ int id = v.getId();
2100
+ if (id == R.id.incrementBtn) counter++;
2101
+ else if (id == R.id.decrementBtn) counter--;
2102
+ }
2103
+ }
2104
+ ```
2105
+
2106
+ **Pourquoi** : D8 (compilateur DEX) a des problèmes avec les classes anonymes imbriquées. Les interfaces nommées sont plus fiables.
2107
+
2108
+ ### Erreur : "cannot find symbol: variable helloText" ou autre ID de ressource
2109
+
2110
+ **Cause** : Le code Java référence un ID qui n'existe pas dans le layout XML.
2111
+
2112
+ **Symptôme** :
2113
+ ```
2114
+ error: cannot find symbol
2115
+ symbol: variable helloText
2116
+ location: class MainActivity
2117
+ ```
2118
+
2119
+ **Solution** :
2120
+ 1. Vérifiez que l'ID existe dans `res/layout/activity_main.xml` :
2121
+ ```xml
2122
+ <TextView
2123
+ android:id="@+id/helloText"
2124
+ ...
2125
+ />
2126
+ ```
2127
+ 2. Vérifiez que vous utilisez le bon nom en Java :
2128
+ ```java
2129
+ TextView helloText = (TextView) findViewById(R.id.helloText);
2130
+ ```
2131
+ 3. Assurez-vous que l'ID correspond EXACTEMENT (majuscules/minuscules)
2132
+
2133
+ **Exemple de correction (CounterApp)** :
2134
+ ```xml
2135
+ <!-- res/layout/activity_main.xml -->
2136
+ <LinearLayout ...>
2137
+ <TextView
2138
+ android:id="@+id/counterDisplay"
2139
+ android:layout_width="match_parent"
2140
+ android:layout_height="wrap_content"
2141
+ android:text="0"
2142
+ android:textSize="72sp" />
2143
+
2144
+ <Button
2145
+ android:id="@+id/incrementBtn"
2146
+ android:text="Incrémenter" />
2147
+ </LinearLayout>
2148
+ ```
2149
+
2150
+ ### Erreur : "AndroidManifest.xml not found"
2151
+
2152
+ **Cause** : Fichier de configuration critique manquant ou mal généré.
2153
+
2154
+ **Solution** :
2155
+ 1. Vérifiez que `app-config.json` existe à la racine du projet
2156
+ 2. Assurez-vous que le JSON est valide (syntaxe correcte, pas de virgules manquantes)
2157
+ 3. Relancez le build avec l'option `--fail-on-missing` pour diagnostiquer :
2158
+ ```powershell
2159
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp" --fail-on-missing
2160
+ ```
2161
+
2162
+ ### Erreur : "Fichiers minimums manquants"
2163
+
2164
+ **Cause** : Des fichiers essentiels n'existent pas.
2165
+
2166
+ **Files requises minimales** :
2167
+ - `app-config.json` → Configuration de l'app
2168
+ - `AndroidManifest.xml` → Descripteur (généré automatiquement)
2169
+ - `res/values/strings.xml` → Textes
2170
+ - `res/values/styles.xml` → Styles (généré automatiquement)
2171
+ - `res/layout/activity_main.xml` → Interface utilisateur
2172
+ - `src/com/example/monapp/MainActivity.java` → Code principal
2173
+
2174
+ **Solution** :
2175
+ ```powershell
2176
+ # Mode diagnostique - affiche les fichiers manquants sans échouer
2177
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp"
2178
+
2179
+ # Mode strict - échoue si des fichiers manquent
2180
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp" --fail-on-missing
2181
+ ```
2182
+
2183
+ ### L'APK n'est pas généré
2184
+
2185
+ **Cause** : Erreur lors de la signature ou de l'assemblage final.
2186
+
2187
+ **Solution** :
2188
+ 1. Supprimez le fichier `.keystore` dans le dossier du projet :
2189
+ ```powershell
2190
+ rm "MonApp\.keystore"
2191
+ ```
2192
+ 2. Relancez la génération (un nouveau keystore sera créé) :
2193
+ ```powershell
2194
+ node "metadidomi-builder\build_tools\build_apk.js" "MonApp"
2195
+ ```
2196
+
2197
+ ### Erreur : "Invalid app-config.json"
2198
+
2199
+ **Cause** : Fichier de configuration mal formé.
2200
+
2201
+ **Vérifiez** :
2202
+ ```json
2203
+ {
2204
+ "appName": "MonApp", // ✓ String valide
2205
+ "appVersion": "1.0.0", // ✓ Format sémantique (majeur.mineur.patch)
2206
+ "packageName": "com.example.monapp", // ✓ Format domaine inversé
2207
+ "minSdkVersion": 21, // ✓ Nombre entier >= 21
2208
+ "targetSdkVersion": 34, // ✓ Nombre entier
2209
+ "colors": {
2210
+ "primary": "#2196F3", // ✓ Couleur hexadécimale valide
2211
+ "primaryDark": "#1976D2",
2212
+ "accent": "#FF5722"
2213
+ }
2214
+ }
2215
+ ```
2216
+
2217
+ ### Erreur : "Layout XML invalide"
2218
+
2219
+ **Cause** : Syntaxe XML incorrecte dans `activity_main.xml`.
2220
+
2221
+ **Vérifiez** :
2222
+ - Les balises ouvrantes et fermantes correspondent (`<LinearLayout>` ... `</LinearLayout>`)
2223
+ - Les attributs android: sont valides
2224
+ - Les IDs sont uniques et bien formatés (`android:id="@+id/monId"`)
2225
+ - Les textes spéciaux sont échappés (`&amp;`, `&lt;`, `&gt;`)
2226
+
2227
+ **Exemple correct** :
2228
+ ```xml
2229
+ <?xml version="1.0" encoding="utf-8"?>
2230
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2231
+ android:orientation="vertical"
2232
+ android:layout_width="match_parent"
2233
+ android:layout_height="match_parent">
2234
+
2235
+ <Button
2236
+ android:id="@+id/myButton"
2237
+ android:layout_width="wrap_content"
2238
+ android:layout_height="wrap_content"
2239
+ android:text="Cliquez-moi" />
2240
+
2241
+ </LinearLayout>
2242
+ ```
2243
+
2244
+ ### Erreur : "Icônes manquantes"
2245
+
2246
+ **Cause** : L'icône n'a pas été générée ou redimensionnée correctement.
2247
+
2248
+ **Solution** :
2249
+ 1. Placez une image PNG (96x96 pixels minimum) dans `res/drawable/` ou `res/mipmap/`
2250
+ 2. Exécutez le générateur d'icônes :
2251
+ ```powershell
2252
+ node "metadidomi-builder\build_tools\generate-icons.js" "MonApp"
2253
+ ```
2254
+ 3. Vérifiez que tous les dossiers mipmap ont été créés :
2255
+ ```
2256
+ res/mipmap-mdpi/ic_launcher.png (48x48)
2257
+ res/mipmap-hdpi/ic_launcher.png (72x72)
2258
+ res/mipmap-xhdpi/ic_launcher.png (96x96)
2259
+ res/mipmap-xxhdpi/ic_launcher.png (144x144)
2260
+ res/mipmap-xxxhdpi/ic_launcher.png (192x192)
2261
+ ```
2262
+
2263
+ ### Erreur : "Package name already exists"
2264
+
2265
+ **Cause** : Un package Android avec le même nom est déjà installé.
2266
+
2267
+ **Solution** :
2268
+ 1. Changez le `packageName` dans `app-config.json` :
2269
+ ```json
2270
+ "packageName": "com.example.monapp.v2"
2271
+ ```
2272
+ 2. Régénérez l'APK
2273
+ 3. Ou : désinstallez l'ancienne app avant d'installer la nouvelle
2274
+
2275
+ ---
2276
+
2277
+ ## Options avancées
2278
+
2279
+ 🔝 [Retour en haut](#top)
2280
+
2281
+ ### Personnaliser les ressources générées automatiquement
2282
+
2283
+ Par défaut, le système génère :
2284
+ - `AndroidManifest.xml` (descripteur de l'app)
2285
+ - `res/values/colors.xml` (couleurs)
2286
+ - `res/values/styles.xml` (thèmes)
2287
+
2288
+ Ces fichiers sont générés à chaque build. Pour les personnaliser, créez-les manuellement et le système les préservera.
2289
+
2290
+ ### Ajouter des ressources personnalisées
2291
+
2292
+ ```
2293
+ res/
2294
+ ├── drawable/ # Images 1x (160 DPI)
2295
+ ├── drawable-hdpi/ # Images 1.5x (240 DPI)
2296
+ ├── drawable-xhdpi/ # Images 2x (320 DPI)
2297
+ ├── drawable-xxhdpi/ # Images 3x (480 DPI)
2298
+ ├── drawable-xxxhdpi/ # Images 4x (640 DPI)
2299
+ ├── font/ # Polices personnalisées
2300
+ ├── menu/ # Menus
2301
+ ├── raw/ # Fichiers non compressés
2302
+ └── anim/ # Animations
2303
+ ```
2304
+
2305
+ ### Générer les icônes automatiquement
2306
+
2307
+ Placez une image source dans `res/drawable/` ou `res/mipmap/` :
2308
+
2309
+ ```powershell
2310
+ node "metadidomi-builder\build_tools\generate-icons.js" "MonApp"
2311
+ ```
2312
+
2313
+ Le système créera automatiquement les variantes pour tous les écrans :
2314
+ - `mipmap-mdpi` (48×48)
2315
+ - `mipmap-hdpi` (72×72)
2316
+ - `mipmap-xhdpi` (96×96)
2317
+ - `mipmap-xxhdpi` (144×144)
2318
+ - `mipmap-xxxhdpi` (192×192)
2319
+
2320
+ ### Utiliser des variables d'environnement
2321
+
2322
+ ```powershell
2323
+ $env:PROJECT_PATH = "C:\MonApp"
2324
+ node "metadidomi-builder\build_tools\build_apk.js"
2325
+ ```
2326
+
2327
+ ---
2328
+
2329
+ ## Architecture du système
2330
+
2331
+ 🔝 [Retour en haut](#top)
2332
+
2333
+ ```
2334
+ metadidomi-builder/
2335
+ ├── build_tools/
2336
+ │ ├── build_apk.js # Orchestration principale
2337
+ │ ├── generate-resources.js # Génération des ressources XML
2338
+ │ ├── generate-icons.js # Redimensionnement des icônes
2339
+ │ ├── backup-manager.js # Gestion des sauvegardes
2340
+ │ └── vendor/ # SDK Android et JDK (inclus)
2341
+ └── build_tools_py/ # Outils Python avancés (optionnel)
2342
+ ```
2343
+
2344
+ ---
2345
+
2346
+ ## Étapes du build expliquées
2347
+
2348
+ 🔝 [Retour en haut](#top)
2349
+
2350
+ 1. **Génération des ressources** : Crée `AndroidManifest.xml`, couleurs, styles
2351
+ 2. **Génération des icônes** : Redimensionne l'icône pour toutes les densités
2352
+ 3. **Vérification des fichiers** : Contrôle la présence des fichiers minimums
2353
+ 4. **Compilation des ressources** : AAPT2 compile XML et images
2354
+ 5. **Liaison des ressources** : Génération de `R.java` avec les IDs de ressources
2355
+ 6. **Compilation Java** : Javac compile le code Java
2356
+ 7. **Création du JAR** : Empaquetage des classes Java
2357
+ 8. **Conversion DEX** : D8 convertit en format Android (DEX)
2358
+ 9. **Assemblage APK** : Création de la structure APK
2359
+ 10. **Alignement** : Zipalign optimise la structure APK
2360
+ 11. **Signature** : Signature numérique de l'APK
2361
+ 12. **Résultat** : APK prête à être installée
2362
+
2363
+ ---
2364
+
2365
+ ## Installation de l'APK sur un téléphone
2366
+
2367
+ 🔝 [Retour en haut](#top)
2368
+
2369
+ ### Via USB
2370
+
2371
+ ```powershell
2372
+ adb install -r "MonApp\MonApp.apk"
2373
+ ```
2374
+
2375
+ ### Via partage de fichier
2376
+
2377
+ 1. Transférez le fichier `.apk` sur votre téléphone
2378
+ 2. Ouvrez l'explorateur de fichiers
2379
+ 3. Appuyez sur le fichier `.apk`
2380
+ 4. Confirmez l'installation
2381
+
2382
+ ---
2383
+
2384
+ ## Conseils et bonnes pratiques
2385
+
2386
+ 🔝 [Retour en haut](#top)
2387
+
2388
+ ✅ **À faire :**
2389
+ - Tester l'app fréquemment
2390
+ - Utiliser des noms de ressources explicites
2391
+ - Commenter le code Java
2392
+ - Utiliser `Log.d()` pour déboguer
2393
+ - Versionner votre code (Git)
2394
+
2395
+ ❌ **À éviter :**
2396
+ - Charger des images trop volumineuses
2397
+ - Utiliser des classes anonymes complexes
2398
+ - Modifier les fichiers générés automatiquement
2399
+ - Laisser des ressources inutilisées
2400
+
2401
+ ---
2402
+
2403
+ ## Foire aux questions
2404
+
2405
+ 🔝 [Retour en haut](#top)
2406
+
2407
+ **Q : Puis-je créer plusieurs activités ?**
2408
+ A : Oui, ajoutez des classes Java dans `src/` et déclarez-les dans `AndroidManifest.xml`.
2409
+
2410
+ **Q : Comment ajouter des dépendances externes ?**
2411
+ A : Actuellement, seules les APIs Android intégrées sont supportées.
2412
+
2413
+ **Q : L'APK fonctionne-t-il sur tous les téléphones ?**
2414
+ A : Oui, tant qu'ils sont Android 5.0 (API 21) ou supérieur.
2415
+
2416
+ **Q : Puis-je mettre à jour l'APK ?**
2417
+ A : Oui, augmentez `appVersion` dans `app-config.json` et régénérez.
2418
+
2419
+ **Q : Les APK sont-elles vraiment signées ?**
2420
+ A : Oui, automatiquement avec une clé de développement auto-générée.
2421
+
2422
+ ---
2423
+
2424
+ ## Support
2425
+
2426
+ 🔝 [Retour en haut](#top)
2427
+
2428
+ Pour des problèmes ou des questions :
2429
+
2430
+ 1. Consultez le dossier `CounterApp/` pour un exemple complet
2431
+ 2. Vérifiez les logs du build pour les erreurs
2432
+ 3. Assurez-vous que tous les fichiers requis existent
2433
+
2434
+ ---
2435
+
2436
+ ## Version
2437
+
2438
+ - **Metadidomi Crone** : v1.0.0
2439
+ - **Android SDK** : 34 (Android 14)
2440
+ - **Build Tools** : 34.0.0
2441
+ - **Dernière mise à jour** : Novembre 2025
2442
+
2443
+ ---
2444
+
1983
2445
  ### 📞 Support
1984
2446
 
1985
2447
  Pour les questions sur le packaging Python :
@@ -1989,9 +2451,7 @@ Pour les questions sur le packaging Python :
1989
2451
 
1990
2452
  ---
1991
2453
 
1992
- [⬆️ Retour en haut](#-multi-builder-premium)
1993
-
1994
- ## �🗺️ Roadmap - Vision Multi-Plateforme
2454
+ ## 🗺️ Roadmap - Vision Multi-Plateforme
1995
2455
 
1996
2456
  ### Phase 1 : Windows ✅ (Actuelle)
1997
2457
  - ✅ Build portable (.exe)