2010-05-24 09:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* utils/hbmk2/hbmk2.prg
  + utils/hbmk2/examples/plug_moc.prg
    + Added experimental plugin system. Plugins are written in .prg
      or .hrb and can be passed using '-plug=<.prg|.hrb>' option
      or simply by passing '.hrb' filename from cmdline or .hbp/.hbm
      files. Plugin names without dir component will be searched
      in local dir, hbmk2 dir then PATH.
      For the details of the calling protocol and available hbmk2
      API calls and variables, pls check the example and hbmk2
      source code.
      Plugin is called from several build stages, in case of multiple
      plugins all of them are called at each stage. The plugin
      receives the stage name, hbmk2 context and a hash table for
      custom variables. The variables are shared between stages and
      plugins. Notice that hbmk2 isn't hbrun, so there is a limited
      set of the Harbour language which you can use, this also ensures
      that the plugins will behave like hbmk2 itself for the most part.
      Nothing is finalized.
    ; The example is the working replica of moc detection logic found
      inside hbqt.
This commit is contained in:
Viktor Szakats
2010-05-24 07:50:59 +00:00
parent 6b53962852
commit 8913c978e3
3 changed files with 437 additions and 175 deletions

View File

@@ -17,6 +17,28 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-05-24 09:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
+ utils/hbmk2/examples/plug_moc.prg
+ Added experimental plugin system. Plugins are written in .prg
or .hrb and can be passed using '-plug=<.prg|.hrb>' option
or simply by passing '.hrb' filename from cmdline or .hbp/.hbm
files. Plugin names without dir component will be searched
in local dir, hbmk2 dir then PATH.
For the details of the calling protocol and available hbmk2
API calls and variables, pls check the example and hbmk2
source code.
Plugin is called from several build stages, in case of multiple
plugins all of them are called at each stage. The plugin
receives the stage name, hbmk2 context and a hash table for
custom variables. The variables are shared between stages and
plugins. Notice that hbmk2 isn't hbrun, so there is a limited
set of the Harbour language which you can use, this also ensures
that the plugins will behave like hbmk2 itself for the most part.
Nothing is finalized.
; The example is the working replica of moc detection logic found
inside hbqt.
2010-05-23 20:54 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.pt_BR.po
* utils/hbmk2/hbmk2.hu_HU.po

View File

@@ -0,0 +1,60 @@
/*
* $Id$
*/
/*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* www - http://www.harbour-project.org
*
* See COPYING for licensing terms.
*/
FUNCTION hbmk2_plugin_moc( cState, hbmk2, hVars )
LOCAL cMOC_BIN
SWITCH cState
CASE "pre_c"
cMOC_BIN := GetEnv( "MOC_BIN" )
IF Empty( cMOC_BIN )
IF Empty( GetEnv( "HB_QT_MOC_BIN" ) )
IF hbmk2[ "cPLAT" ] == "win"
cMOC_BIN := GetEnv( "HB_WITH_QT" ) + "\..\bin\moc.exe"
IF ! hb_FileExists( cMOC_BIN )
hbmk2_OutErr( hbmk2[ "ctx" ], "HB_WITH_QT points to incomplete QT installation. moc executable not found." )
RETURN NIL
ENDIF
ELSE
cMOC_BIN := hbmk2_FindInPath( "moc", "/opt/qtsdk/qt/bin" )
IF Empty( cMOC_BIN )
cMOC_BIN := hbmk2_FindInPath( "moc", "/opt/qtsdk/qt/bin" )
IF Empty( cMOC_BIN )
hbmk2_OutErr( hbmk2[ "ctx" ], "HB_QT_MOC_BIN not set, could not autodetect" )
RETURN NIL
ENDIF
ENDIF
ENDIF
hbmk2_OutStd( hbmk2[ "ctx" ], "Using QT 'moc' executable: " + cMOC_BIN + " (autodetected)" )
ELSE
IF hb_FileExists( GetEnv( "HB_QT_MOC_BIN" ) )
cMOC_BIN := GetEnv( "HB_QT_MOC_BIN" )
hbmk2_OutStd( hbmk2[ "ctx" ], "Using QT 'moc' executable: " + cMOC_BIN )
ELSE
hbmk2_OutErr( hbmk2[ "ctx" ], "HB_QT_MOC_BIN points to non-existent file. Make sure to set it to full path and filename of moc executable." )
RETURN NIL
ENDIF
ENDIF
ENDIF
hVars[ "MOC_BIN" ] := cMOC_BIN
EXIT
CASE "post_all"
hbmk2_OutStd( hbmk2[ "ctx" ], "POST_ALL: " + hVars[ "MOC_BIN" ] )
OTHERWISE
IF hbmk2[ "lTRACE" ]
hbmk2_OutStd( hbmk2[ "ctx" ], "@@ Entered plugin: " + cState )
ENDIF
ENDSWITCH
RETURN NIL

File diff suppressed because it is too large Load Diff