Commit 050a36b2 authored by Claes Sjofors's avatar Claes Sjofors

Wb build, second commit

parent a2fee825
...@@ -47,5 +47,7 @@ graphaction <no action defined in graph object> /error ...@@ -47,5 +47,7 @@ graphaction <no action defined in graph object> /error
inlibhier <Object is in library hierarchy> /info inlibhier <Object is in library hierarchy> /info
nobuilt <Nothing is built> /info nobuilt <Nothing is built> /info
plcpgmchild <Object can not be a child to a PlcPgm> /error plcpgmchild <Object can not be a child to a PlcPgm> /error
makeerror <Error from make> /error
makeupdated <Make dependency updated> /info
...@@ -41,11 +41,61 @@ SObject pwrb:Class ...@@ -41,11 +41,61 @@ SObject pwrb:Class
! @Group ProjectConfig ! @Group ProjectConfig
! @Summary Build configuration root object. ! @Summary Build configuration root object.
! The BuildConfig is the root object for the build configuration. ! The BuildConfig is the root object for the build configuration.
! This object is placed in the directory volume as toplevel object
! in the node view.
!
! The build configuration makes it possible to handle
! - building of applications, with execution of makefiles and copying
! of include files.
! - copying of graph files.
! - copying of configuration files from $pwrp_cnf.
! - importing files from other projects.
! - exporting files to other projects.
!
! Other objects in the build configuration
!
! @bBuildDirectory
! Configures how a directory, eg $pwrp_appl or $pwrp_pop is built. The
! actions executed when building the directory is specified with
! BuildCopy, BuildMake and BuildExecute object.
!
! @BuildCopy
! Copies a file, or a number of files specified with wildcard from the
! source directory to the build tree.
!
! @BuildMake
! Executes a make file.
!
! @BuildExec
! Executes a shell command.
!
! @Export
! Configures files that should be exported to other projects. Normally
! files are exported to a common directory from where they are imported
! by other projects. Specific files to export is configured with
! ApplExport objects.
!
! @Import
! Configures files that is imported from other projects. Specific
! files are imported with ApplImport objects.
!
! The build, export and import can be performed automatically when building
! a node, by configuring BuildBeforeNode or BuildAfterNode in the Option
! attribute of the BuildDirectory, Import and Export objects.
!
! To perform an selective build, export or import, the Build Directories,
! Import and Export window is opened from the Functions menu in the
! configurator.
! !
! @b See also ! @b See also
! @classlink BuildDirectory pwrb_builddirectory.html ! @classlink BuildDirectory pwrb_builddirectory.html
! @classlink BuildCopy pwrb_buildcopy.html ! @classlink BuildCopy pwrb_buildcopy.html
! @classlink BuildMake pwrb_buildmake.html
! @classlink BuildExecute pwrb_buildexecute.html ! @classlink BuildExecute pwrb_buildexecute.html
! @classlink Import pwrb_import.html
! @classlink ApplImport pwrb_applimport.html
! @classlink Export pwrb_export.html
! @classlink ApplExport pwrb_applexport.html
!*/ !*/
Object BuildConfig $ClassDef 630 Object BuildConfig $ClassDef 630
Body SysBody Body SysBody
......
...@@ -39,21 +39,25 @@ SObject pwrb:Class ...@@ -39,21 +39,25 @@ SObject pwrb:Class
!/** !/**
! @Version 1.0 ! @Version 1.0
! @Group ProjectConfiguration ! @Group ProjectConfiguration
! @Summary Configures export of applications. ! @Summary Configures copying of files from source to build tree.
! The ApplExport object configures export of files to other projects. ! The BuildCopy object configures copying of files from source to build tree.
! !
! One ApplExport object causes one or several files (with wildcard ! One BuildCopy object causes one or several files (with wildcard
! specification) to be copied from a directory in the src tree to the ! specification) to be copied from a directory in the source tree to the
! bld tree. ! build tree.
! !
! The object reside in the project volume beneath an BuildDirectory object. ! The object reside in the project volume beneath an BuildDirectory object.
! !
! The distribution is carried out when Build Project in the configurator menu ! The copy is carried out when Build Directories in the configurator menu
! is activated. ! is activated, or when the node is built.
!
! If the Options attribute in the BuildDirectory object is set to BuildBeforeNode
! the copy is performed automatically before a node is built.
! !
! @b See also ! @b See also
! @classlink BuildConfig pwrb_buildconfig.html ! @classlink BuildConfig pwrb_buildconfig.html
! @classlink BuildDirectory pwrb_builddirectory.html ! @classlink BuildDirectory pwrb_builddirectory.html
! @classlink BuildMake pwrb_buildmake.html
! @classlink BuildExecute pwrb_buildexecute.html ! @classlink BuildExecute pwrb_buildexecute.html
!*/ !*/
Object BuildCopy $ClassDef 628 Object BuildCopy $ClassDef 628
......
...@@ -40,11 +40,20 @@ SObject pwrb:Class ...@@ -40,11 +40,20 @@ SObject pwrb:Class
! @Version 1.0 ! @Version 1.0
! @Group ProjectConfiguration ! @Group ProjectConfiguration
! @Summary Configures build of a directory. ! @Summary Configures build of a directory.
! The BuildDirectory object configures build of a directory. ! The BuildDirectory object configures build of a directory in the project
! source tree, eg $pwrp_appl.
!
! The build actions are configured with BuildCopy, BuildMake and BuildExecute
! objects, to copy files from the directory to the build tree and execute make
! or shellscripts.
!
! The build is actived from build directories in the configurator menu, but can
! also be executed automatically every time a node is built.
! !
! @b See also ! @b See also
! @classlink BuildConfig pwrb_buildconfig.html ! @classlink BuildConfig pwrb_buildconfig.html
! @classlink BuildCopy pwrb_buildcopy.html ! @classlink BuildCopy pwrb_buildcopy.html
! @classlink BuildMake pwrb_buildmake.html
! @classlink BuildExecute pwrb_buildexecute.html ! @classlink BuildExecute pwrb_buildexecute.html
!*/ !*/
Object BuildDirectory $ClassDef 627 Object BuildDirectory $ClassDef 627
...@@ -62,12 +71,22 @@ SObject pwrb:Class ...@@ -62,12 +71,22 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Options.
! - BuildBeforeNode, directory is automatically built before any
! node is built.
!*/
Object Options $Attribute 2
Body SysBody
Attr TypeRef = "pwrb:Type-BuildDirectoryMask"
EndBody
EndObject
!/**
! Directory specification. ! Directory specification.
! !
! Example ! Example
! $pwrp_pop ! $pwrp_pop
!*/ !*/
Object Directory $Attribute 2 Object Directory $Attribute 3
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$String256" Attr TypeRef = "pwrs:Type-$String256"
EndBody EndBody
......
...@@ -40,18 +40,22 @@ SObject pwrb:Class ...@@ -40,18 +40,22 @@ SObject pwrb:Class
! @Version 1.0 ! @Version 1.0
! @Group ProjectConfiguration ! @Group ProjectConfiguration
! @Summary Configures build actions with shell commands. ! @Summary Configures build actions with shell commands.
! The ApplExport object configures build actions performed with shell commands, ! The BuildExecute object configures build actions performed with shell commands,
! for example executing make files or shell scripts. ! for example executing make files or shell scripts.
! !
! The object reside in the project volume beneath an BuildDirectory object. ! The object reside in the project volume beneath an BuildDirectory object.
! !
! The distribution is carried out when Build Project in the configurator men ! The execution is carried out when Build Directories in the configurator menu
! is activated. ! is activated.
! !
! If the Options attribute in the BuildDirectory object is set to BuildBeforeNode
! the copy is performed automatically before a node is built.
!
! @b See also ! @b See also
! @classlink BuildConfig pwrb_buildconfig.html ! @classlink BuildConfig pwrb_buildconfig.html
! @classlink BuildDirectory pwrb_builddirectory.html ! @classlink BuildDirectory pwrb_builddirectory.html
! @classlink BuildCopy pwrb_buildcopy.html ! @classlink BuildCopy pwrb_buildcopy.html
! @classlink BuildMake pwrb_buildmake.html
!*/ !*/
Object BuildExecute $ClassDef 629 Object BuildExecute $ClassDef 629
Body SysBody Body SysBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_buildmake.wb_load -- Defines the class BuildMake.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group ProjectConfiguration
! @Summary Configures build actions with make.
! The BuildMake object configures build actions performed with GNU make.
!
! The object reside in the project volume beneath an BuildDirectory object.
!
! The execution is carried out when Build Directories in the configurator menu
! is activated.
!
! If the Options attribute in the BuildDirectory object is set to BuildBeforeNode
! the makefile is executed automatically before a node is built. In this case
! the makefile is first executed with the -q option to examine if any dependencies
! needs to be updated. The result is a dependency for if the node is rebuilt or not.
!
! If Build Force is set in the settings, the makefile is executed with the -B
! option (unconditionally make all targets).
!
! @b See also
! @classlink BuildConfig pwrb_buildconfig.html
! @classlink BuildDirectory pwrb_builddirectory.html
! @classlink BuildCopy pwrb_buildcopy.html
! @classlink BuildExecute pwrb_buildexecute.html
!*/
Object BuildMake $ClassDef 631
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
EndBody
Object DevBody $ObjBodyDef 2
!/**
! The name of the makefile.
! If Makefile is left empty make will use the default file
! "makefile".
!*/
Object Makefile $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
EndObject
EndSObject
...@@ -62,6 +62,9 @@ SObject pwrb:Class ...@@ -62,6 +62,9 @@ SObject pwrb:Class
! !
! Other files can be included with an ApplExport object. ! Other files can be included with an ApplExport object.
! !
! If the Options attribute is set to BuildAfterNode the export is performed
! automatically after a node is built.
!
! @b See also ! @b See also
! @classlink ApplExport pwrb_applexport.html ! @classlink ApplExport pwrb_applexport.html
!*/ !*/
...@@ -98,6 +101,16 @@ SObject pwrb:Class ...@@ -98,6 +101,16 @@ SObject pwrb:Class
Attr TypeRef = "pwrb:Type-ExportImportMask" Attr TypeRef = "pwrb:Type-ExportImportMask"
EndBody EndBody
EndObject EndObject
!/**
! Options.
! - BuildAfterNode, export is automatically built before any
! node is built.
!*/
Object Options $Attribute 4
Body SysBody
Attr TypeRef = "pwrb:Type-BuildExportMask"
EndBody
EndObject
EndObject EndObject
Object Template Export Object Template Export
Body DevBody Body DevBody
......
...@@ -62,6 +62,9 @@ SObject pwrb:Class ...@@ -62,6 +62,9 @@ SObject pwrb:Class
! !
! Other files can be included with an ApplImport object. ! Other files can be included with an ApplImport object.
! !
! If the Options attribute is set to BuildBeforeNode the import is performed
! automatically before a node is built.
!
! @b See also ! @b See also
! @classlink ApplImport pwrb_applimport.html ! @classlink ApplImport pwrb_applimport.html
!*/ !*/
...@@ -97,6 +100,16 @@ SObject pwrb:Class ...@@ -97,6 +100,16 @@ SObject pwrb:Class
Attr TypeRef = "pwrb:Type-ExportImportMask" Attr TypeRef = "pwrb:Type-ExportImportMask"
EndBody EndBody
EndObject EndObject
!/**
! Options.
! - BuildBeforeNode, directory is automatically built before any
! node is built.
!*/
Object Options $Attribute 4
Body SysBody
Attr TypeRef = "pwrb:Type-BuildDirectoryMask"
EndBody
EndObject
EndObject EndObject
Object Template Import Object Template Import
Body DevBody Body DevBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_td_builddirectorymask.wb_load -- Defines the mask type BuildDirectoryMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Defines options mask for BuildDirectory.
!*/
Object BuildDirectoryMask $TypeDef 77
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "BuildDirectoryMask"
EndBody
!/**
! Directory is automatically built before a node is built.
!*/
Object BuildBeforeNode $Bit
Body SysBody
Attr PgmName = "BuildBeforeNode"
Attr Text = "BuildBeforeNode"
Attr Value = 1
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_td_buildexportmask.wb_load -- Defines the mask type BuildExportMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Defines options mask for BuildExport.
!*/
Object BuildExportMask $TypeDef 78
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "BuildExportMask"
EndBody
!/**
! Export is automatically built after a node is built.
!*/
Object BuildAfterNode $Bit
Body SysBody
Attr PgmName = "BuildAfterNode"
Attr Text = "BuildAfterNode"
Attr Value = 1
EndBody
EndObject
EndObject
EndSObject
...@@ -47,10 +47,8 @@ SObject pwrb:Type ...@@ -47,10 +47,8 @@ SObject pwrb:Type
Attr PgmName = "ExportImportMask" Attr PgmName = "ExportImportMask"
EndBody EndBody
!/** !/**
! Loadfiles are included, i.e. ! Loadfiles are exported or imported, i.e. all dbs-files and rtt
! - loadfiles for volumes configured with RootVolumeLoad, SubVolumeLoad ! crossreference files on $pwrp_load.
! and ClassVolumeLoad objects, and volumes referenced by these volumes,
! - rtt crossreference files.
!*/ !*/
Object LoadFiles $Bit Object LoadFiles $Bit
Body SysBody Body SysBody
......
...@@ -645,6 +645,7 @@ palette ProjectNavigatorPalette ...@@ -645,6 +645,7 @@ palette ProjectNavigatorPalette
class BuildConfig class BuildConfig
class BuildDirectory class BuildDirectory
class BuildCopy class BuildCopy
class BuildMake
class BuildExecute class BuildExecute
} }
menu Export/Import menu Export/Import
......
...@@ -1352,10 +1352,10 @@ void WttGtk::activate_buildnode( GtkWidget *w, gpointer data) ...@@ -1352,10 +1352,10 @@ void WttGtk::activate_buildnode( GtkWidget *w, gpointer data)
wtt->activate_buildnode(); wtt->activate_buildnode();
} }
void WttGtk::activate_buildproject( GtkWidget *w, gpointer data) void WttGtk::activate_builddirectories( GtkWidget *w, gpointer data)
{ {
Wtt *wtt = (Wtt *)data; Wtt *wtt = (Wtt *)data;
wtt->activate_buildproject(); wtt->activate_builddirectories();
} }
void WttGtk::activate_buildimport( GtkWidget *w, gpointer data) void WttGtk::activate_buildimport( GtkWidget *w, gpointer data)
...@@ -1918,7 +1918,7 @@ void WttGtk::boot_ok_cb(GtkWidget *w, gpointer data) ...@@ -1918,7 +1918,7 @@ void WttGtk::boot_ok_cb(GtkWidget *w, gpointer data)
wtt->message( 'E', "Nothing to build"); wtt->message( 'E', "Nothing to build");
return; return;
} }
sprintf( msg, "Bootfile%s created", (bootfile_count == 1) ? "":"s"); sprintf( msg, "Node%s built", (bootfile_count == 1) ? "":"s");
wtt->message( 'I', msg); wtt->message( 'I', msg);
} }
...@@ -2519,9 +2519,9 @@ WttGtk::WttGtk( ...@@ -2519,9 +2519,9 @@ WttGtk::WttGtk(
g_signal_connect( menu_buildobject_w, "activate", g_signal_connect( menu_buildobject_w, "activate",
G_CALLBACK(WttGtk::activate_buildobject), this); G_CALLBACK(WttGtk::activate_buildobject), this);
menu_buildproject_w = gtk_menu_item_new_with_mnemonic( "Bui_ld Directory"); menu_buildproject_w = gtk_menu_item_new_with_mnemonic( "Bui_ld Directories");
g_signal_connect( menu_buildproject_w, "activate", g_signal_connect( menu_buildproject_w, "activate",
G_CALLBACK(WttGtk::activate_buildproject), this); G_CALLBACK(WttGtk::activate_builddirectories), this);
menu_buildimport_w = gtk_menu_item_new_with_mnemonic( "_Import"); menu_buildimport_w = gtk_menu_item_new_with_mnemonic( "_Import");
g_signal_connect( menu_buildimport_w, "activate", g_signal_connect( menu_buildimport_w, "activate",
......
...@@ -240,7 +240,7 @@ class WttGtk : public Wtt { ...@@ -240,7 +240,7 @@ class WttGtk : public Wtt {
static void activate_openclasseditor( GtkWidget *w, gpointer data); static void activate_openclasseditor( GtkWidget *w, gpointer data);
static void activate_buildvolume( GtkWidget *w, gpointer data); static void activate_buildvolume( GtkWidget *w, gpointer data);
static void activate_buildnode( GtkWidget *w, gpointer data); static void activate_buildnode( GtkWidget *w, gpointer data);
static void activate_buildproject( GtkWidget *w, gpointer data); static void activate_builddirectories( GtkWidget *w, gpointer data);
static void activate_buildimport( GtkWidget *w, gpointer data); static void activate_buildimport( GtkWidget *w, gpointer data);
static void activate_buildexport( GtkWidget *w, gpointer data); static void activate_buildexport( GtkWidget *w, gpointer data);
static void activate_distribute( GtkWidget *w, gpointer data); static void activate_distribute( GtkWidget *w, gpointer data);
......
...@@ -118,15 +118,33 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt) ...@@ -118,15 +118,33 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
pwr_tStatus status; pwr_tStatus status;
char currentnode[80]; char currentnode[80];
char node[80]; char node[80];
pwr_tStatus sumsts; pwr_tStatus sumsts = PWRB__NOBUILT;
printf( "-- Build node %s\n", nodename); printf( "-- Build node %s\n", nodename);
wb_log::push(); wb_log::push();
if ( !opt.manual)
rebuild = 0;
import_files( bld_ePass_BeforeNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
directories( 0, bld_ePass_BeforeNode);
if ( m_sts == PWRB__MAKEUPDATED) {
rebuild = 1;
m_sts = PWRB__SUCCESS;
}
else if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
if ( !opt.manual) { if ( !opt.manual) {
// Check if there is any new dbsfile // Check if there is any new dbsfile
rebuild = 0;
for ( int i = 0; i < volumecnt; i++) { for ( int i = 0; i < volumecnt; i++) {
if ( cdh_NoCaseStrcmp( nodename, vlist[i].p1) == 0) { if ( cdh_NoCaseStrcmp( nodename, vlist[i].p1) == 0) {
if ( bussid == -1) { if ( bussid == -1) {
...@@ -200,6 +218,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt) ...@@ -200,6 +218,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
m_sts = PWRB__NOBUILT; m_sts = PWRB__NOBUILT;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
syi_NodeName( &m_sts, currentnode, sizeof(currentnode)); syi_NodeName( &m_sts, currentnode, sizeof(currentnode));
...@@ -306,6 +325,12 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt) ...@@ -306,6 +325,12 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
sumsts = m_sts; sumsts = m_sts;
} }
export_files( bld_ePass_AfterNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
if ( ODD(sumsts) && sumsts != PWRB__NOBUILT) { if ( ODD(sumsts) && sumsts != PWRB__NOBUILT) {
char msg[200]; char msg[200];
...@@ -314,6 +339,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt) ...@@ -314,6 +339,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
} }
m_sts = sumsts; m_sts = sumsts;
} }
void wb_build::volume() void wb_build::volume()
...@@ -1413,7 +1439,7 @@ void wb_build::classdef( pwr_tOid oid) ...@@ -1413,7 +1439,7 @@ void wb_build::classdef( pwr_tOid oid)
} }
void wb_build::project( char *dir) void wb_build::directories( char *dir, bld_ePass pass)
{ {
pwr_tFileName fname; pwr_tFileName fname;
char line[400]; char line[400];
...@@ -1422,10 +1448,13 @@ void wb_build::project( char *dir) ...@@ -1422,10 +1448,13 @@ void wb_build::project( char *dir)
int num; int num;
int sts; int sts;
pwr_tCmd cmd; pwr_tCmd cmd;
pwr_tMask current_options = 0;
dcli_translate_filename( fname, load_cNameDistribute); dcli_translate_filename( fname, load_cNameDistribute);
ifstream is( fname); ifstream is( fname);
m_sts = PWRB__NOBUILT;
while ( is.getline( line, sizeof(line))) { while ( is.getline( line, sizeof(line))) {
dcli_trim( line, line); dcli_trim( line, line);
if ( line[0] == '#' || line[0] == '!') if ( line[0] == '#' || line[0] == '!')
...@@ -1437,15 +1466,31 @@ void wb_build::project( char *dir) ...@@ -1437,15 +1466,31 @@ void wb_build::project( char *dir)
if ( !num) if ( !num)
continue; continue;
if ( dir && strncmp( dir, line_item[1], strlen(dir)) != 0) if ( dir && cdh_NoCaseStrcmp( dir, line_item[1]) != 0)
continue; continue;
if ( strcmp( cdh_Low(line_item[0]), "buildcopy") == 0) { if ( strcmp( cdh_Low(line_item[0]), "builddir") == 0) {
if ( num != 4) {
printf("File corrupt " load_cNameDistribute);
continue;
}
int sts = sscanf( line_item[2], "%d", &current_options);
if ( sts != 1) {
printf("File corrupt " load_cNameDistribute);
current_options = 0;
}
if ( !(pass == bld_ePass_BeforeNode && !(current_options & pwr_mBuildDirectoryMask_BuildBeforeNode)))
wb_log::log( wlog_eCategory_DirectoryBuild, line_item[1], 0);
}
else if ( strcmp( cdh_Low(line_item[0]), "buildcopy") == 0) {
if ( num != 4) { if ( num != 4) {
printf("File corrupt " load_cNameDistribute); printf("File corrupt " load_cNameDistribute);
continue; continue;
} }
if ( pass == bld_ePass_BeforeNode && !(current_options & pwr_mBuildDirectoryMask_BuildBeforeNode))
continue;
for ( sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_INIT); for ( sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_INIT);
ODD(sts); ODD(sts);
sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_NEXT)) { sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_NEXT)) {
...@@ -1481,16 +1526,55 @@ void wb_build::project( char *dir) ...@@ -1481,16 +1526,55 @@ void wb_build::project( char *dir)
continue; continue;
sprintf( cmd, "cp -a %s %s", source, target); sprintf( cmd, "cp -a %s %s", source, target);
// system( cmd); system( cmd);
sprintf( cmd, "Build: %s %s -> %s", line_item[1], source, target); sprintf( cmd, "Build: copy %s %s -> %s", line_item[1], source, target);
MsgWindow::message( 'I', cmd, msgw_ePop_No); MsgWindow::message( 'I', cmd, msgw_ePop_No);
// wb_log::log( wlog_eCategory_GeBuild, name, 0); // wb_log::log( wlog_eCategory_GeBuild, name, 0);
if ( m_sts != PWRB__MAKEUPDATED)
m_sts = PWRB__SUCCESS; m_sts = PWRB__SUCCESS;
} }
dcli_search_file( line_item[1], found_file, DCLI_DIR_SEARCH_END); dcli_search_file( line_item[1], found_file, DCLI_DIR_SEARCH_END);
} }
else if ( strcmp( cdh_Low(line_item[0]), "buildmake") == 0) {
if ( num != 4) {
printf("File corrupt " load_cNameDistribute);
continue;
}
if ( pass == bld_ePass_BeforeNode && !(current_options & pwr_mBuildDirectoryMask_BuildBeforeNode))
continue;
int update = 0;
sprintf( cmd, "cd %s;make -q %s", line_item[2], line_item[3]);
sts = system( cmd);
if ( WEXITSTATUS(sts) != 0)
update = 1;
if ( !opt.force && !update)
continue;
// Needs update
if ( opt.force)
// Execute make with -B, unconditionally make all targets
sprintf( cmd, "cd %s;make -B %s", line_item[2], line_item[3]);
else
sprintf( cmd, "cd %s;make %s", line_item[2], line_item[3]);
sts = system( cmd);
if ( WEXITSTATUS(sts) != 0) {
sprintf( cmd, "Build: make error %s %s", line_item[2], line_item[3]);
MsgWindow::message( 'E', cmd, msgw_ePop_Yes);
m_sts = PWRB__MAKEERROR;
}
else {
sprintf( cmd, "Build: executed %s %s", line_item[2], line_item[3]);
MsgWindow::message( 'I', cmd, msgw_ePop_No);
m_sts = PWRB__MAKEUPDATED;
}
// wb_log::log( wlog_eCategory_GeBuild, name, 0);
}
else if ( strcmp( cdh_Low(line_item[0]), "buildexec") == 0) { else if ( strcmp( cdh_Low(line_item[0]), "buildexec") == 0) {
if ( num != 4) { if ( num != 4) {
...@@ -1498,12 +1582,16 @@ void wb_build::project( char *dir) ...@@ -1498,12 +1582,16 @@ void wb_build::project( char *dir)
continue; continue;
} }
if ( pass == bld_ePass_BeforeNode && !(current_options & pwr_mBuildDirectoryMask_BuildBeforeNode))
continue;
sprintf( cmd, "cd %s;%s", line_item[2], line_item[3]); sprintf( cmd, "cd %s;%s", line_item[2], line_item[3]);
// system( cmd); system( cmd);
sprintf( cmd, "Build: executed %s %s", line_item[2], line_item[3]); sprintf( cmd, "Build: executed %s %s", line_item[2], line_item[3]);
MsgWindow::message( 'I', cmd, msgw_ePop_No); MsgWindow::message( 'I', cmd, msgw_ePop_No);
// wb_log::log( wlog_eCategory_GeBuild, name, 0); // wb_log::log( wlog_eCategory_GeBuild, name, 0);
if ( m_sts != PWRB__MAKEUPDATED)
m_sts = PWRB__SUCCESS; m_sts = PWRB__SUCCESS;
} }
} }
...@@ -1511,3 +1599,109 @@ void wb_build::project( char *dir) ...@@ -1511,3 +1599,109 @@ void wb_build::project( char *dir)
is.close(); is.close();
} }
void wb_build::export_import_files( int type, bld_ePass pass)
{
pwr_tFileName fname;
char line[400];
char line_item[4][250];
pwr_tFileName found_file;
int num;
int sts;
pwr_tCmd cmd;
char tag[20];
pwr_tMask current_options = 0;
if ( type == bld_eType_Export)
strcpy( tag, "export");
else
strcpy( tag, "import");
dcli_translate_filename( fname, load_cNameDistribute);
ifstream is( fname);
m_sts = PWRB__NOBUILT;
while ( is.getline( line, sizeof(line))) {
dcli_trim( line, line);
if ( line[0] == '#' || line[0] == '!')
continue;
num = dcli_parse( line, " ", "", (char *)line_item,
sizeof(line_item)/sizeof(line_item[0]),
sizeof(line_item[0]), 0);
if ( !num)
continue;
if ( strcmp( cdh_Low(line_item[0]), tag) == 0) {
if ( num != 4) {
printf("File corrupt " load_cNameDistribute);
continue;
}
sts = sscanf( line_item[1], "%d", &current_options);
if ( sts != 1) {
printf("File corrupt " load_cNameDistribute);
current_options = 0;
}
if ( type == bld_eType_Import &&
pass == bld_ePass_BeforeNode &&
!(current_options & pwr_mBuildDirectoryMask_BuildBeforeNode))
continue;
if ( type == bld_eType_Export &&
pass == bld_ePass_AfterNode &&
!(current_options & pwr_mBuildExportMask_BuildAfterNode))
continue;
for ( sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_INIT);
ODD(sts);
sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_NEXT)) {
// Check if file should be updated
int update = 0;
pwr_tFileName source, target;
pwr_tTime source_time, target_time;
strncpy( source, found_file, sizeof(source));
strncpy( target, line_item[3], sizeof(target));
sts = dcli_file_time( source, &source_time);
if ( target[strlen(target)-1] == '/') {
// Target is a directory, add file name
char *s = strrchr( source, '/');
if ( !s)
strncat( target, source, sizeof(target));
else
strncat( target, s+1, sizeof(target));
}
dcli_translate_filename( target, target);
sts = dcli_file_time( target, &target_time);
if ( ODD(sts) && time_Acomp( &source_time, &target_time) != 1)
update = 0;
else
update = 1;
if ( !opt.force && !update)
continue;
sprintf( cmd, "cp -a %s %s", source, target);
system( cmd);
sprintf( cmd, "Build: %s %s -> %s", tag, source, target);
MsgWindow::message( 'I', cmd, msgw_ePop_No);
// wb_log::log( wlog_eCategory_GeBuild, name, 0);
m_sts = PWRB__SUCCESS;
}
dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_END);
}
}
is.close();
}
...@@ -45,6 +45,18 @@ ...@@ -45,6 +45,18 @@
class Wtt; class Wtt;
typedef enum {
bld_eType_Export,
bld_eType_Import
} bld_eType;
typedef enum {
bld_ePass_None,
bld_ePass_BeforeNode,
bld_ePass_AfterNode
} bld_ePass;
class wb_build : public wb_status class wb_build : public wb_status
{ {
public: public:
...@@ -66,7 +78,10 @@ class wb_build : public wb_status ...@@ -66,7 +78,10 @@ class wb_build : public wb_status
void appgraph( pwr_tOid oid); void appgraph( pwr_tOid oid);
void application( pwr_tOid oid); void application( pwr_tOid oid);
void classdef( pwr_tOid oid); void classdef( pwr_tOid oid);
void project( char *dir); void directories( char *dir, bld_ePass pass);
void export_import_files( int type, bld_ePass pass);
void export_files( bld_ePass pass) { export_import_files(bld_eType_Export, pass);}
void import_files( bld_ePass pass) { export_import_files(bld_eType_Import, pass);}
wb_build_opt opt; wb_build_opt opt;
wb_session m_session; wb_session m_session;
......
...@@ -74,9 +74,9 @@ WbExpW::WbExpW( ...@@ -74,9 +74,9 @@ WbExpW::WbExpW(
strcpy( btext, "_Import files"); strcpy( btext, "_Import files");
strcpy( typetext, "import"); strcpy( typetext, "import");
} }
else if ( type == expw_eType_BuildProject) { else if ( type == expw_eType_BuildDirectories) {
strcpy( action, "Build Project"); strcpy( action, "Build Directories");
strcpy( btext, "_Build Project"); strcpy( btext, "_Build Directories");
strcpy( typetext, "build"); strcpy( typetext, "build");
} }
......
...@@ -652,8 +652,8 @@ void WbExpWNav::show() ...@@ -652,8 +652,8 @@ void WbExpWNav::show()
case expw_eType_Export: case expw_eType_Export:
show_export_import(); show_export_import();
break; break;
case expw_eType_BuildProject: case expw_eType_BuildDirectories:
show_buildproject(); show_builddir();
break; break;
default: ; default: ;
} }
...@@ -664,7 +664,7 @@ void WbExpWNav::show_export_import() ...@@ -664,7 +664,7 @@ void WbExpWNav::show_export_import()
pwr_tFileName fname; pwr_tFileName fname;
char line[400]; char line[400];
char line_item[3][250]; char line_item[4][250];
pwr_tFileName found_file; pwr_tFileName found_file;
int num; int num;
int sts; int sts;
...@@ -693,14 +693,14 @@ void WbExpWNav::show_export_import() ...@@ -693,14 +693,14 @@ void WbExpWNav::show_export_import()
strcpy( tag, "import"); strcpy( tag, "import");
if ( strcmp( cdh_Low(line_item[0]), tag) == 0) { if ( strcmp( cdh_Low(line_item[0]), tag) == 0) {
if ( num != 3) { if ( num != 4) {
printf("File corrupt " load_cNameDistribute); printf("File corrupt " load_cNameDistribute);
continue; continue;
} }
for ( sts = dcli_search_file( line_item[1], found_file, DCLI_DIR_SEARCH_INIT); for ( sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_INIT);
ODD(sts); ODD(sts);
sts = dcli_search_file( line_item[1], found_file, DCLI_DIR_SEARCH_NEXT)) { sts = dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_NEXT)) {
// Check if file should be updated // Check if file should be updated
int update = 0; int update = 0;
...@@ -708,7 +708,7 @@ void WbExpWNav::show_export_import() ...@@ -708,7 +708,7 @@ void WbExpWNav::show_export_import()
pwr_tTime source_time, target_time; pwr_tTime source_time, target_time;
strncpy( source, found_file, sizeof(source)); strncpy( source, found_file, sizeof(source));
strncpy( target, line_item[2], sizeof(target)); strncpy( target, line_item[3], sizeof(target));
sts = dcli_file_time( source, &source_time); sts = dcli_file_time( source, &source_time);
...@@ -732,11 +732,11 @@ void WbExpWNav::show_export_import() ...@@ -732,11 +732,11 @@ void WbExpWNav::show_export_import()
if ( !show_all && !update) if ( !show_all && !update)
continue; continue;
ItemExp *item = new ItemExp( this, found_file, line_item[2], 0, 0, flow_eDest_IntoLast); ItemExp *item = new ItemExp( this, found_file, line_item[3], 0, 0, flow_eDest_IntoLast);
if ( update) if ( update)
brow_SetRadiobutton( item->node, 0, 1); brow_SetRadiobutton( item->node, 0, 1);
} }
dcli_search_file( line_item[1], found_file, DCLI_DIR_SEARCH_END); dcli_search_file( line_item[2], found_file, DCLI_DIR_SEARCH_END);
} }
} }
...@@ -749,7 +749,7 @@ void WbExpWNav::show_export_import() ...@@ -749,7 +749,7 @@ void WbExpWNav::show_export_import()
} }
void WbExpWNav::show_buildproject() void WbExpWNav::show_builddir()
{ {
pwr_tFileName fname; pwr_tFileName fname;
...@@ -776,14 +776,14 @@ void WbExpWNav::show_buildproject() ...@@ -776,14 +776,14 @@ void WbExpWNav::show_buildproject()
continue; continue;
if ( strcmp( cdh_Low(line_item[0]), "builddir") == 0) { if ( strcmp( cdh_Low(line_item[0]), "builddir") == 0) {
if ( num != 3) { if ( num != 4) {
printf("File corrupt " load_cNameDistribute); printf("File corrupt " load_cNameDistribute);
continue; continue;
} }
ExpWDir *dir = dir_find( line_item[1]); ExpWDir *dir = dir_find( line_item[1]);
if ( !dir) if ( !dir)
dir = dir_insert( line_item[1], line_item[2]); dir = dir_insert( line_item[1], line_item[2], line_item[3]);
} }
else if ( strcmp( cdh_Low(line_item[0]), "buildcopy") == 0) { else if ( strcmp( cdh_Low(line_item[0]), "buildcopy") == 0) {
...@@ -842,6 +842,24 @@ void WbExpWNav::show_buildproject() ...@@ -842,6 +842,24 @@ void WbExpWNav::show_buildproject()
brow_SetRadiobutton( item->node, 0, 1); brow_SetRadiobutton( item->node, 0, 1);
} }
else if ( strcmp( cdh_Low(line_item[0]), "buildmake") == 0) {
int update = 1;
if ( num != 4) {
printf("File corrupt " load_cNameDistribute);
continue;
}
ExpWDir *dir = dir_find( line_item[1]);
if ( !dir) {
printf("File corrupt " load_cNameDistribute);
continue;
}
dir->make_insert( line_item[2], line_item[3], update);
if ( update)
dir->update = 1;
}
else if ( strcmp( cdh_Low(line_item[0]), "buildexec") == 0) { else if ( strcmp( cdh_Low(line_item[0]), "buildexec") == 0) {
int update = 1; int update = 1;
...@@ -875,7 +893,7 @@ void WbExpWNav::set_show_all( int set) ...@@ -875,7 +893,7 @@ void WbExpWNav::set_show_all( int set)
case expw_eType_Import: case expw_eType_Import:
show(); show();
break; break;
case expw_eType_BuildProject: case expw_eType_BuildDirectories:
redraw(); redraw();
break; break;
} }
...@@ -916,6 +934,11 @@ void WbExpWNav::list_free() ...@@ -916,6 +934,11 @@ void WbExpWNav::list_free()
cp_next = cp->next; cp_next = cp->next;
delete cp; delete cp;
} }
ExpWMake *mp_next;
for ( ExpWMake *mp = dp->makelist; mp; mp = mp_next) {
mp_next = mp->next;
delete mp;
}
ExpWExec *ep_next; ExpWExec *ep_next;
for ( ExpWExec *ep = dp->execlist; ep; ep = ep_next) { for ( ExpWExec *ep = dp->execlist; ep; ep = ep_next) {
ep_next = ep->next; ep_next = ep->next;
...@@ -927,10 +950,17 @@ void WbExpWNav::list_free() ...@@ -927,10 +950,17 @@ void WbExpWNav::list_free()
dirlist = 0; dirlist = 0;
} }
ExpWDir *WbExpWNav::dir_insert( char *name, char *description) ExpWDir *WbExpWNav::dir_insert( char *name, char *options_str, char *description)
{ {
int num;
ExpWDir *dir = new ExpWDir(); ExpWDir *dir = new ExpWDir();
strncpy( dir->name, name, sizeof(dir->name)); strncpy( dir->name, name, sizeof(dir->name));
num = sscanf( options_str, "%d", &dir->options);
if ( num != 1) {
printf( "** BuildDirectory.Options syntax error\n");
dir->options = 0;
}
strncpy( dir->description, description, sizeof(dir->description)); strncpy( dir->description, description, sizeof(dir->description));
if ( !dirlist) if ( !dirlist)
...@@ -960,6 +990,23 @@ ExpWCopy *ExpWDir::copy_insert( char *source, char *target, int update) ...@@ -960,6 +990,23 @@ ExpWCopy *ExpWDir::copy_insert( char *source, char *target, int update)
return copy; return copy;
} }
ExpWMake *ExpWDir::make_insert( char *dir, char *makefile, int update)
{
ExpWMake *make = new ExpWMake();
strncpy( make->dir, dir, sizeof(make->dir));
strncpy( make->makefile, makefile, sizeof(make->makefile));
make->update = update;
if ( !makelist)
makelist = make;
else {
ExpWMake *ep;
for ( ep = makelist; ep->next; ep = ep->next) ;
ep->next = make;
}
return make;
}
ExpWExec *ExpWDir::exec_insert( char *dir, char *command, int update) ExpWExec *ExpWDir::exec_insert( char *dir, char *command, int update)
{ {
ExpWExec *exec = new ExpWExec(); ExpWExec *exec = new ExpWExec();
...@@ -1016,7 +1063,7 @@ pwr_tStatus WbExpWNav::exp() ...@@ -1016,7 +1063,7 @@ pwr_tStatus WbExpWNav::exp()
show(); show();
break; break;
} }
case expw_eType_BuildProject: { case expw_eType_BuildDirectories: {
for ( ExpWDir *dp = dirlist; dp; dp = dp->next) { for ( ExpWDir *dp = dirlist; dp; dp = dp->next) {
if ( !dp->update) if ( !dp->update)
continue; continue;
...@@ -1040,6 +1087,19 @@ pwr_tStatus WbExpWNav::exp() ...@@ -1040,6 +1087,19 @@ pwr_tStatus WbExpWNav::exp()
if ( !dp->update) if ( !dp->update)
continue; continue;
for ( ExpWMake *mp = dp->makelist; mp; mp = mp->next) {
if ( !mp->update)
continue;
sprintf( cmd, "cd %s;make %s", mp->dir, mp->makefile);
printf( "%s\n", cmd);
sts = system( cmd);
if ( sts != 0) {
char msg[250];
snprintf( msg, sizeof(msg), "Build error %d, %s", WEXITSTATUS(sts), cmd);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
}
}
for ( ExpWExec *ep = dp->execlist; ep; ep = ep->next) { for ( ExpWExec *ep = dp->execlist; ep; ep = ep->next) {
if ( !ep->update) if ( !ep->update)
continue; continue;
...@@ -1079,11 +1139,13 @@ void WbExpWNav::check_all() ...@@ -1079,11 +1139,13 @@ void WbExpWNav::check_all()
brow_SetRadiobutton( node, 0, 1); brow_SetRadiobutton( node, 0, 1);
break; break;
} }
case expw_eType_BuildProject: { case expw_eType_BuildDirectories: {
for ( ExpWDir *dir = dirlist; dir; dir = dir->next) { for ( ExpWDir *dir = dirlist; dir; dir = dir->next) {
dir->update = 1; dir->update = 1;
for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next) for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next)
cp->update = 1; cp->update = 1;
for ( ExpWMake *mp = dir->makelist; mp; mp = mp->next)
mp->update = 1;
for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next) for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next)
ep->update = 1; ep->update = 1;
} }
...@@ -1108,11 +1170,13 @@ void WbExpWNav::check_clear() ...@@ -1108,11 +1170,13 @@ void WbExpWNav::check_clear()
brow_SetRadiobutton( node, 0, 0); brow_SetRadiobutton( node, 0, 0);
break; break;
} }
case expw_eType_BuildProject: { case expw_eType_BuildDirectories: {
for ( ExpWDir *dir = dirlist; dir; dir = dir->next) { for ( ExpWDir *dir = dirlist; dir; dir = dir->next) {
dir->update = 0; dir->update = 0;
for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next) for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next)
cp->update = 0; cp->update = 0;
for ( ExpWMake *mp = dir->makelist; mp; mp = mp->next)
mp->update = 0;
for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next) for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next)
ep->update = 0; ep->update = 0;
} }
...@@ -1192,11 +1256,11 @@ ItemDir::ItemDir( WbExpWNav *item_expwnav, ExpWDir *item_dir, char *item_name, c ...@@ -1192,11 +1256,11 @@ ItemDir::ItemDir( WbExpWNav *item_expwnav, ExpWDir *item_dir, char *item_name, c
// Check if map or leaf // Check if map or leaf
int child_exist = 0; int child_exist = 0;
if ( expwnav->show_all) { if ( expwnav->show_all) {
if ( dir->copylist || dir->execlist) if ( dir->copylist || dir->execlist || dir->makelist)
child_exist = 1; child_exist = 1;
} }
else { else {
if ( dir->execlist) if ( dir->execlist || dir->makelist)
child_exist = 1; child_exist = 1;
else { else {
for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next) { for ( ExpWCopy *cp = dir->copylist; cp; cp = cp->next) {
...@@ -1247,6 +1311,14 @@ int ItemDir::open_children() ...@@ -1247,6 +1311,14 @@ int ItemDir::open_children()
// Create some children // Create some children
brow_SetNodraw( expwnav->brow->ctx); brow_SetNodraw( expwnav->brow->ctx);
for ( ExpWMake *mp = dir->makelist; mp; mp = mp->next) {
pwr_tCmd cmd;
sprintf( cmd, "make %s", mp->makefile);
ItemExp *item = new ItemExp( expwnav, mp->dir, cmd, mp, node, flow_eDest_IntoLast);
if ( mp->update)
brow_SetRadiobutton( item->node, 0, 1);
child_exist = 1;
}
for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next) { for ( ExpWExec *ep = dir->execlist; ep; ep = ep->next) {
ItemExp *item = new ItemExp( expwnav, ep->dir, ep->command, ep, node, flow_eDest_IntoLast); ItemExp *item = new ItemExp( expwnav, ep->dir, ep->command, ep, node, flow_eDest_IntoLast);
if ( ep->update) if ( ep->update)
......
...@@ -67,7 +67,7 @@ typedef enum { ...@@ -67,7 +67,7 @@ typedef enum {
typedef enum { typedef enum {
expw_eType_Export, expw_eType_Export,
expw_eType_Import, expw_eType_Import,
expw_eType_BuildProject expw_eType_BuildDirectories
} expw_eType; } expw_eType;
typedef enum { typedef enum {
...@@ -108,18 +108,31 @@ class ExpWExec : public ExpWList { ...@@ -108,18 +108,31 @@ class ExpWExec : public ExpWList {
ExpWExec() : next(0), prev(0) {} ExpWExec() : next(0), prev(0) {}
}; };
class ExpWMake : public ExpWList {
public:
ExpWMake *next;
ExpWMake *prev;
pwr_tFileName makefile;
pwr_tFileName dir;
ExpWMake() : next(0), prev(0) {}
};
class ExpWDir : public ExpWList { class ExpWDir : public ExpWList {
public: public:
ExpWDir *next; ExpWDir *next;
ExpWDir *prev; ExpWDir *prev;
ExpWCopy *copylist; ExpWCopy *copylist;
ExpWMake *makelist;
ExpWExec *execlist; ExpWExec *execlist;
int open; int open;
char name[80]; char name[80];
pwr_tMask options;
char description[80]; char description[80];
ExpWDir() : next(0), prev(0), copylist(0), execlist(0), open(0) {} ExpWDir() : next(0), prev(0), copylist(0), makelist(0), execlist(0), open(0), options(0) {}
ExpWCopy *copy_insert( char *source, char *target, int update); ExpWCopy *copy_insert( char *source, char *target, int update);
ExpWMake *make_insert( char *dir, char *makefile, int update);
ExpWExec *exec_insert( char *dir, char *command, int update); ExpWExec *exec_insert( char *dir, char *command, int update);
}; };
...@@ -161,7 +174,7 @@ class WbExpWNav { ...@@ -161,7 +174,7 @@ class WbExpWNav {
void show(); void show();
void show_export_import(); void show_export_import();
void show_buildproject(); void show_builddir();
void redraw(); void redraw();
void clear(); void clear();
void zoom( double zoom_factor); void zoom( double zoom_factor);
...@@ -172,7 +185,7 @@ class WbExpWNav { ...@@ -172,7 +185,7 @@ class WbExpWNav {
void check_reset(); void check_reset();
void set_show_all( int set); void set_show_all( int set);
ExpWDir *dir_find( char *name); ExpWDir *dir_find( char *name);
ExpWDir *dir_insert( char *name, char *description); ExpWDir *dir_insert( char *name, char *options_str, char *description);
void list_free(); void list_free();
static int init_brow_cb( FlowCtx *fctx, void *client_data); static int init_brow_cb( FlowCtx *fctx, void *client_data);
......
...@@ -2440,8 +2440,10 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2440,8 +2440,10 @@ pwr_tStatus lfu_SaveDirectoryVolume(
sts = ldh_GetNextObject( ldhses, exportoid, &exportoid)) { sts = ldh_GetNextObject( ldhses, exportoid, &exportoid)) {
pwr_tFileName dir; pwr_tFileName dir;
char *dir_ptr; char *dir_ptr;
pwr_tMask *options_ptr;
pwr_mExportImportMask *components_ptr; pwr_mExportImportMask *components_ptr;
pwr_tOid appoid; pwr_tOid appoid;
pwr_tMask current_options = 0;
sts = ldh_GetObjectPar( ldhses, exportoid, "DevBody", sts = ldh_GetObjectPar( ldhses, exportoid, "DevBody",
"TargetDirectory", (char **)&dir_ptr, &size); "TargetDirectory", (char **)&dir_ptr, &size);
...@@ -2457,16 +2459,30 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2457,16 +2459,30 @@ pwr_tStatus lfu_SaveDirectoryVolume(
if ( dir[strlen(dir)-1] != '/') if ( dir[strlen(dir)-1] != '/')
strcat( dir, "/"); strcat( dir, "/");
sts = ldh_GetObjectPar( ldhses, exportoid, "DevBody",
"Options", (char **)&options_ptr, &size);
if ( EVEN(sts)) return sts;
current_options = *options_ptr;
free( options_ptr);
sts = ldh_GetObjectPar( ldhses, exportoid, "DevBody", sts = ldh_GetObjectPar( ldhses, exportoid, "DevBody",
"Components", (char **)&components_ptr, &size); "Components", (char **)&components_ptr, &size);
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
if ( *components_ptr & pwr_mExportImportMask_IncludeFiles) if ( *components_ptr & pwr_mExportImportMask_IncludeFiles)
fprintf( file, "export $pwrp_inc/*.h %s\n", dir); fprintf( file, "export %d $pwrp_inc/*.h %s\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_GraphFiles) if ( *components_ptr & pwr_mExportImportMask_GraphFiles)
fprintf( file, "export $pwrp_exe/*.pwg %s\n", dir); fprintf( file, "export %d $pwrp_exe/*.pwg %s\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_FlowFiles) if ( *components_ptr & pwr_mExportImportMask_FlowFiles)
fprintf( file, "export $pwrp_load/*.flw %s\n", dir); fprintf( file, "export %d $pwrp_load/*.flw %s\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_LoadFiles) {
fprintf( file, "export %d $pwrp_load/*.dbs %s\n", current_options, dir);
fprintf( file, "export %d $pwrp_load/rtt_crr_*.dat %s\n", current_options, dir);
fprintf( file, "export %d $pwrp_load/rtt_crro_*.dat %s\n", current_options, dir);
fprintf( file, "export %d $pwrp_load/rtt_crrs_*.dat %s\n", current_options, dir);
fprintf( file, "export %d $pwrp_load/rtt_crrc_*.dat %s\n", current_options, dir);
}
free( components_ptr); free( components_ptr);
...@@ -2487,7 +2503,7 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2487,7 +2503,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
"Target", (char **)&target_ptr, &size); "Target", (char **)&target_ptr, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
fprintf( file, "export %s %s%s\n", source_ptr, dir, target_ptr); fprintf( file, "export %d %s %s%s\n", current_options, source_ptr, dir, target_ptr);
free( source_ptr); free( source_ptr);
free( target_ptr); free( target_ptr);
...@@ -2508,6 +2524,8 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2508,6 +2524,8 @@ pwr_tStatus lfu_SaveDirectoryVolume(
char *dir_ptr; char *dir_ptr;
pwr_mExportImportMask *components_ptr; pwr_mExportImportMask *components_ptr;
pwr_tOid appoid; pwr_tOid appoid;
pwr_tMask *options_ptr;
pwr_tMask current_options = 0;
sts = ldh_GetObjectPar( ldhses, importoid, "DevBody", sts = ldh_GetObjectPar( ldhses, importoid, "DevBody",
"SourceDirectory", (char **)&dir_ptr, &size); "SourceDirectory", (char **)&dir_ptr, &size);
...@@ -2523,16 +2541,30 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2523,16 +2541,30 @@ pwr_tStatus lfu_SaveDirectoryVolume(
if ( dir[strlen(dir)-1] != '/') if ( dir[strlen(dir)-1] != '/')
strcat( dir, "/"); strcat( dir, "/");
sts = ldh_GetObjectPar( ldhses, importoid, "DevBody",
"Options", (char **)&options_ptr, &size);
if ( EVEN(sts)) return sts;
current_options = *options_ptr;
free( options_ptr);
sts = ldh_GetObjectPar( ldhses, importoid, "DevBody", sts = ldh_GetObjectPar( ldhses, importoid, "DevBody",
"Components", (char **)&components_ptr, &size); "Components", (char **)&components_ptr, &size);
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
if ( *components_ptr & pwr_mExportImportMask_IncludeFiles) if ( *components_ptr & pwr_mExportImportMask_IncludeFiles)
fprintf( file, "import %s*.h $pwrp_inc/\n", dir); fprintf( file, "import %d %s*.h $pwrp_inc/\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_GraphFiles) if ( *components_ptr & pwr_mExportImportMask_GraphFiles)
fprintf( file, "import %s*.pwg $pwrp/exe/\n", dir); fprintf( file, "import %d %s*.pwg $pwrp/exe/\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_FlowFiles) if ( *components_ptr & pwr_mExportImportMask_FlowFiles)
fprintf( file, "import %s*.flw $pwrp_load/\n", dir); fprintf( file, "import %d %s*.flw $pwrp_load/\n", current_options, dir);
if ( *components_ptr & pwr_mExportImportMask_LoadFiles) {
fprintf( file, "import %d %s*.dbs $pwrp_load/\n", current_options, dir);
fprintf( file, "import %d %srtt_crr_*.dat $pwrp_load/\n", current_options, dir);
fprintf( file, "import %d %srtt_crro_*.dat $pwrp_load/\n", current_options, dir);
fprintf( file, "import %d %srtt_crrs_*.dat $pwrp_load/\n", current_options, dir);
fprintf( file, "import %d %srtt_crrc_*.dat $pwrp_load/\n", current_options, dir);
}
free( components_ptr); free( components_ptr);
...@@ -2553,7 +2585,7 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2553,7 +2585,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
"Target", (char **)&target_ptr, &size); "Target", (char **)&target_ptr, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
fprintf( file, "import %s%s %s\n", dir, source_ptr, target_ptr); fprintf( file, "import %d %s%s %s\n", current_options, dir, source_ptr, target_ptr);
free( source_ptr); free( source_ptr);
free( target_ptr); free( target_ptr);
...@@ -2577,6 +2609,7 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2577,6 +2609,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
pwr_tFileName dir; pwr_tFileName dir;
char *dir_ptr; char *dir_ptr;
char *descr_ptr; char *descr_ptr;
pwr_tMask *options_ptr;
sts = ldh_ObjidToName( ldhses, builddir_oid, ldh_eName_Object, sts = ldh_ObjidToName( ldhses, builddir_oid, ldh_eName_Object,
oname, sizeof(oname), &size); oname, sizeof(oname), &size);
...@@ -2618,11 +2651,16 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2618,11 +2651,16 @@ pwr_tStatus lfu_SaveDirectoryVolume(
if ( dir[strlen(dir)-1] != '/') if ( dir[strlen(dir)-1] != '/')
strcat( dir, "/"); strcat( dir, "/");
sts = ldh_GetObjectPar( ldhses, builddir_oid, "DevBody",
"Options", (char **)&options_ptr, &size);
if ( EVEN(sts)) return sts;
sts = ldh_GetObjectPar( ldhses, builddir_oid, "DevBody", sts = ldh_GetObjectPar( ldhses, builddir_oid, "DevBody",
"Description", (char **)&descr_ptr, &size); "Description", (char **)&descr_ptr, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
fprintf( file, "builddir %s \"%s\"\n", fullname, descr_ptr); fprintf( file, "builddir %s %d \"%s\"\n", fullname, *options_ptr, descr_ptr);
free( options_ptr);
free( descr_ptr); free( descr_ptr);
for ( sts = ldh_GetChild( ldhses, builddir_oid, &coid); for ( sts = ldh_GetChild( ldhses, builddir_oid, &coid);
...@@ -2660,6 +2698,18 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2660,6 +2698,18 @@ pwr_tStatus lfu_SaveDirectoryVolume(
free( command_ptr); free( command_ptr);
break; break;
} }
case pwr_cClass_BuildMake: {
char *makefile_ptr;
sts = ldh_GetObjectPar( ldhses, coid, "DevBody",
"Makefile", (char **)&makefile_ptr, &size);
if ( EVEN(sts)) return sts;
fprintf( file, "buildmake %s %s \"%s\"\n", cdh_Low(fullname), dir, makefile_ptr);
free( makefile_ptr);
break;
}
default: ; default: ;
} }
} }
......
...@@ -134,6 +134,9 @@ void wb_log::category_to_string( wlog_eCategory category, char *str) ...@@ -134,6 +134,9 @@ void wb_log::category_to_string( wlog_eCategory category, char *str)
case wlog_eCategory_VolumeClone: case wlog_eCategory_VolumeClone:
strcpy( str, "VolumeClone"); strcpy( str, "VolumeClone");
break; break;
case wlog_eCategory_DirectoryBuild:
strcpy( str, "DirectoryBuild");
break;
default: default:
strcpy( str, ""); strcpy( str, "");
} }
...@@ -169,6 +172,8 @@ void wb_log::string_to_category( char *str, wlog_eCategory *category) ...@@ -169,6 +172,8 @@ void wb_log::string_to_category( char *str, wlog_eCategory *category)
*category = wlog_eCategory_WbLoad; *category = wlog_eCategory_WbLoad;
else if ( strcmp( str, "VolumeClone") == 0) else if ( strcmp( str, "VolumeClone") == 0)
*category = wlog_eCategory_VolumeClone; *category = wlog_eCategory_VolumeClone;
else if ( strcmp( str, "DirectoryBuild") == 0)
*category = wlog_eCategory_DirectoryBuild;
else else
*category = wlog_eCategory_; *category = wlog_eCategory_;
} }
...@@ -261,6 +266,7 @@ NodeBuild Node is built. Built node displayed in item.\n\ ...@@ -261,6 +266,7 @@ NodeBuild Node is built. Built node displayed in item.\n\
PlcBuild Plc window compiled. Built window displayed in item.\n\ PlcBuild Plc window compiled. Built window displayed in item.\n\
GeBuild Ge graph built. Built graph displayed in item.\n\ GeBuild Ge graph built. Built graph displayed in item.\n\
GeExport Ge graph exported to java. Exported graph displayed in item.\n\ GeExport Ge graph exported to java. Exported graph displayed in item.\n\
DirectoryBuild Directory built. Directory displayed in item.\n\
UpdateClasses Classes updated.\n\ UpdateClasses Classes updated.\n\
CreatePackage Distribution package created. Created package displayed in item.\n\ CreatePackage Distribution package created. Created package displayed in item.\n\
CopyPackage Package distributed to process or operator station. Package displayed in item.\n\ CopyPackage Package distributed to process or operator station. Package displayed in item.\n\
......
...@@ -62,6 +62,7 @@ typedef enum { ...@@ -62,6 +62,7 @@ typedef enum {
wlog_eCategory_UpdateClasses, wlog_eCategory_UpdateClasses,
wlog_eCategory_WbLoad, wlog_eCategory_WbLoad,
wlog_eCategory_VolumeClone, wlog_eCategory_VolumeClone,
wlog_eCategory_DirectoryBuild,
wlog_eCategory__, wlog_eCategory__,
} wlog_eCategory; } wlog_eCategory;
......
...@@ -5150,7 +5150,7 @@ static int wnav_build_func( void *client_data, ...@@ -5150,7 +5150,7 @@ static int wnav_build_func( void *client_data,
free( sel_list); free( sel_list);
free( sel_is_attr); free( sel_is_attr);
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "PROJECT", strlen( arg1_str)) == 0) { else if ( cdh_NoCaseStrncmp( arg1_str, "DIRECTORIES", strlen( arg1_str)) == 0) {
if ( !(CoLogin::privilege() & pwr_mPrv_DevConfig)) { if ( !(CoLogin::privilege() & pwr_mPrv_DevConfig)) {
wnav->message( 'E', "User is not authorized to build"); wnav->message( 'E', "User is not authorized to build");
...@@ -5164,7 +5164,7 @@ static int wnav_build_func( void *client_data, ...@@ -5164,7 +5164,7 @@ static int wnav_build_func( void *client_data,
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
wnav->expw_new( (char *)"Build Project", expw_eType_BuildProject, &sts); wnav->expw_new( (char *)"Build Directories", expw_eType_BuildDirectories, &sts);
if ( EVEN(sts)) if ( EVEN(sts))
wnav->message(' ', wnav_get_message(sts)); wnav->message(' ', wnav_get_message(sts));
} }
...@@ -5185,7 +5185,7 @@ static int wnav_build_func( void *client_data, ...@@ -5185,7 +5185,7 @@ static int wnav_build_func( void *client_data,
else else
dirp = arg2_str; dirp = arg2_str;
build.project( dirp); build.directories( dirp, bld_ePass_None);
wnav->message(' ', wnav_get_message(build.sts())); wnav->message(' ', wnav_get_message(build.sts()));
} }
} }
...@@ -5209,7 +5209,14 @@ static int wnav_build_func( void *client_data, ...@@ -5209,7 +5209,14 @@ static int wnav_build_func( void *client_data,
wnav->message(' ', wnav_get_message(sts)); wnav->message(' ', wnav_get_message(sts));
} }
else { else {
// TODO wb_build build( *(wb_session *)wnav->ldhses, wnav);
build.opt.force = ODD( dcli_get_qualifier( "/FORCE", 0, 0));
build.opt.debug = ODD( dcli_get_qualifier( "/DEBUG", 0, 0));
build.opt.crossref = ODD( dcli_get_qualifier( "/CROSSREFERENCE", 0, 0));
build.opt.manual = ODD( dcli_get_qualifier( "/MANUAL", 0, 0));
build.export_files( bld_ePass_None);
wnav->message(' ', wnav_get_message(build.sts()));
} }
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "IMPORT", strlen( arg1_str)) == 0) { else if ( cdh_NoCaseStrncmp( arg1_str, "IMPORT", strlen( arg1_str)) == 0) {
...@@ -5232,7 +5239,14 @@ static int wnav_build_func( void *client_data, ...@@ -5232,7 +5239,14 @@ static int wnav_build_func( void *client_data,
wnav->message(' ', wnav_get_message(sts)); wnav->message(' ', wnav_get_message(sts));
} }
else { else {
// TODO wb_build build( *(wb_session *)wnav->ldhses, wnav);
build.opt.force = ODD( dcli_get_qualifier( "/FORCE", 0, 0));
build.opt.debug = ODD( dcli_get_qualifier( "/DEBUG", 0, 0));
build.opt.crossref = ODD( dcli_get_qualifier( "/CROSSREFERENCE", 0, 0));
build.opt.manual = ODD( dcli_get_qualifier( "/MANUAL", 0, 0));
build.import_files( bld_ePass_None);
wnav->message(' ', wnav_get_message(build.sts()));
} }
} }
else { else {
......
...@@ -2071,9 +2071,9 @@ void Wtt::activate_buildnode() ...@@ -2071,9 +2071,9 @@ void Wtt::activate_buildnode()
reset_cursor(); reset_cursor();
} }
void Wtt::activate_buildproject() void Wtt::activate_builddirectories()
{ {
char cmd[80] = "build project/window"; char cmd[80] = "build directories/window";
if ( !focused_wnav) if ( !focused_wnav)
set_focus_default(); set_focus_default();
focused_wnav->command( cmd); focused_wnav->command( cmd);
......
...@@ -252,7 +252,7 @@ class Wtt : public WUtility { ...@@ -252,7 +252,7 @@ class Wtt : public WUtility {
void activate_openclasseditor(); void activate_openclasseditor();
void activate_buildvolume(); void activate_buildvolume();
void activate_buildnode(); void activate_buildnode();
void activate_buildproject(); void activate_builddirectories();
void activate_buildimport(); void activate_buildimport();
void activate_buildexport(); void activate_buildexport();
void activate_distribute(); void activate_distribute();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment