SDK Multiplataforma en C logo

SDK Multiplataforma en C

NAppBuild

❮ Anterior

NAppBuild es una utilidad de Compilación remota que utilizamos para generar NAppGUI a diario (Figura 1). Es una aplicación por línea de comandos, sin interfaz gráfica, creada en C e instalada en una placa Raspberry-PI. Cada dos horas, el administrador cron de Unix lanza nbuild que comprueba si ha habido cambios en el repositorio de código fuente. En caso afirmativo, pondrá en marcha una nueva compilación en todos los host del build grid.

Servidor de integración continua instalado en una Raspberry-Pi.
Figura 1: Aplicación nbuild instalada en una Raspberry-Pi trabajando continuamente.

NBuild depende en exclusiva de la librería Core, a excepción de JSON, incluido en INet, como formato para la Entrada/Salida de datos (Figura 2).

Árbol de dependencias de nbuild.
Figura 2: Dependencias de nbuild.

1. Ejecución

1
nbuild -c [config.json] -p [profiles.json]
  • config.json: Archivo de configuración de la red de compilación.
  • profiles.json: Información sobre los proyectos a compilar y en que plataformas deben generarse.

2. Configuración

El formato del archivo config.json es el siguiente:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"master" : {
"name" : "RaspPi-Desk1",
"build_path" : "/home/pi/builds/builds",
"login" : {
"ip" : "localhost",
"user" : "XXXX",
"pass" : "XXXXXXXX",
"platform" : 3 } },
    
"hosts" : [ 

{"name" : "PC-i7 4790K",
"workpath" : "C:",
"login" : {
"ip" : "192.168.1.21", 
"user" : "XXXX", 
"pass" : "XXXXXXXX",
"platform" : 1 },
"archs": [ "x64", "x86" ],
"vs2019" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin",
"vs2017" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"vs2015" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"vs2013" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"vs2012" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"vs2010" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"vs2008" : "D:\\VS\\Microsoft Visual Studio 9",
"vs2005" : "D:\\VS\\Microsoft Visual Studio 8" }, 

{"name" : "iMac21 2017",
"workpath" : "/Users/fran", 
"login" : {
"ip" : "192.168.1.28", 
"user" : "XXXX", 
"pass" : "XXXXXXXX",
"platform" : 2 },
"archs" : ["x64", "x86"],
"xcode10" : "/Applications",
"xcode9" : "Volumes/High_Sierra/Applications",
"xcode8" : "/Volumes/Sierra/Applications",
"xcode7" : "/Volumes/Sierra/Xcode7",
"xcode6" : "/Volumes/Sierra/Xcode6",
"xcode5" : "/Volumes/Sierra/Xcode5" }, 

{"name" : "PC-G645",
"workpath" : "/home/fran", 
"login" : {
"ip" : "192.168.1.24", 
"user" : "XXXX", 
"pass" : "XXXXXXXX",
"platform" : 3 },
"archs" : ["x64"],
"gcc7" : "/usr/bin/gcc-7",
"gcc6" : "/usr/bin/gcc-6",
"gcc5" : "/usr/bin/gcc-5"
},

...
]
}

3. Perfil

Un perfil de compilación tiene este formato:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ 
"global" : {
"project" :  "NAppGUI",
"description" : "A Cross-Platform C SDK",
"author" : "(CC) 2015-2019 Francisco García Collado",
"repo_url" : "svn://192.168.1.2/svn/NAPPGUI/1_0",
"repo_user" : "XXXX",
"repo_pass" : "XXXXXXX",
"workpath" : "nappgui",
"license" : [
"Creative Commons BY-NC-SA 4.0 license",
"Attribution-NonCommercial-ShareAlike 4.0 International",
"https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en"]
},
    
"libs" : [
"sewer",
"osbs",
"core",
"geom2d",
"osdraw",
"osgui",
"gui",
"inet",
"dbase" ],
    
"exes" : [
{
    "name":"Products",
    "dest":"products"
},
{
    "name":"Die",
    "dest":"die"
}
],
    
"source" : [ {
"name" : "HelloWorld",
"path" : "demo/hello",
"depends" : "",
"nrcmode" : "NRC_NONE" 
}, {

"name" : "HelloCpp",
"path" : "demo/hellocpp",
"depends" : "",
"nrcmode" : "NRC_NONE" 
}, {

"name" : "Die",
"path" : "demo/die",
"depends" : "",
"nrcmode" : "NRC_NONE" 
}, {

"name" : "Products",
"path" : "demo/products",
"depends" : "inet",
"nrcmode" : "NRC_EMBEDDED" } ],
    
"agents": [
"v142_x64",
"v141_xp_x86",
"sdk10_14_x64",
"gcc7_gtk3_x64",
"gcc6_gtk3_arm" ],
    
"configs" : [
"Debug",
"Release",
"ReleaseWithAssert" 
] }

4. Front-End

El resultado de cada ejecución de nbuild se guarda en formato json. Por el momento, el front-end de nbuild es muy simplista, ya que vuelca el contenido del json en stdout. Aunque cumple perfectamente su cometido, tenemos prevista una interfaz Web para organizar los resultados de una forma más aparente.

Front-End de nbuild
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[22:00:03] [OK] Readed '/home/pi/NAppGUI_1_0/src/nbuild_config.json' file.
[22:00:03] [OK] Readed '/home/pi/NAppGUI_1_0/src/nbuild_profiles.json' file.
[22:01:00] [OK] Build 'v142_x64-Debug' in host 'PC-i7 4790K'.
[22:01:51] [OK] Build 'v142_x64-Release' in host 'PC-i7 4790K'.
[22:02:41] [OK] Build 'v142_x64-ReleaseWithAssert' in host 'PC-i7 4790K'.
[22:05:45] [FAIL] Host 'iMac21 2017' is offline 'sdk10_14_x64-Debug'
[22:05:47] [FAIL] Host 'iMac21 2017' is offline 'sdk10_14_x64-Release'
[22:05:50] [FAIL] Host 'iMac21 2017' is offline 'sdk10_14_x64-ReleaseWithAssert'
[22:05:50]  
[22:05:50] NAppGUI-r1675
[22:05:50] [OK] Headers:sewer
[22:05:50] [OK] Headers:osbs
[22:05:50] [OK] Headers:core
[22:05:50] [OK] Headers:geom2d
[22:05:50] [OK] Headers:draw2d
[22:05:50] [OK] Headers:osgui
[22:05:50] [OK] Headers:gui
[22:05:50] [OK] Headers:inet
[22:05:50] [OK] Headers:dbase
[22:05:50] [OK] v142_x64-Debug W:0 E:0 D:10/04/2019-22:01:07
[22:05:50] [OK] v142_x64-Release W:1 E:0 D:10/04/2019-22:01:57
[22:05:50] [OK] v142_x64-ReleaseWithAssert W:0 E:0 D:10/04/2019-22:02:47
[22:05:50] [OK] v141_xp_x86-Debug W:12 E:0 D:10/04/2019-22:03:44
[22:05:50] [OK] v141_xp_x86-Release W:12 E:0 D:10/04/2019-22:04:31
[22:05:50] [OK] v141_xp_x86-ReleaseWithAssert W:12 E:0 D:10/04/2019-22:05:18
[22:05:50] [FAIL] sdk10_14_x64-Debug W:0 E:0 D:
[22:05:50] [FAIL] sdk10_14_x64-Release W:0 E:0 D:
[22:05:50] [FAIL] sdk10_14_x64-ReleaseWithAssert W:0 E:0 D:
[22:05:50] [OK] gcc7_gtk3_x64-Debug W:0 E:0 D:10/04/2019-10:01:16
[22:05:50] [OK] gcc7_gtk3_x64-Release W:0 E:0 D:10/04/2019-10:01:53
[22:05:50] [OK] gcc7_gtk3_x64-ReleaseWithAssert W:0 E:0 D:10/04/2019-10:02:32
[22:05:50] [OK] gcc6_gtk3_arm-Debug W:0 E:0 D:10/04/2019-00:03:26
[22:05:50] [OK] gcc6_gtk3_arm-Release W:0 E:0 D:10/04/2019-00:05:22
[22:05:50] [OK] gcc6_gtk3_arm-ReleaseWithAssert W:0 E:0 D:10/04/2019-00:07:24
[22:05:50]  
[22:05:50] [FAIL] There are WARNINGS!
[22:05:50]  
[22:05:50] [OK] Heap Memory Staticstics
[22:05:50] ============================
[22:05:50] Total a/dellocations: 2770, 2770
[22:05:50] Total bytes a/dellocated: 1952852, 1952852
[22:05:50] Max bytes allocated: 226146
[22:05:50] Effective reallocations: (0/38)
[22:05:50] Real allocations: 14 pages of 65536 bytes
[22:05:50]                   9 pages greater than 65536 bytes
[22:05:50] ============================
❮ Anterior