Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

If your license allows it, gmStudio can be operated in a batch mode.  You will typically do this using the sample batch files we provide. This section describes the gmStudio command line.

gmStudio Command Line Syntax

The form of the gmStudio command line is as shown below:

gmStudio /AUTOBATCH=[YES|NO] "/CFG='cfgpath'" "/MIG='migpath'" "/TOOLS='tool_list'" "/TASKS='task_list'" "/REPORTS='report_list'" [/IGNOREMRU] ["/LOGSTART='startup log path'"] "[/FILTER='source filter']" where:

/AUTOBATCH = YES|NO

If AutoBatch=YES then the command list specified in the migration project file (.gmproj) will be performed. Otherwise, the set of task/tools specified on the command line will be performed.

/CFG sets the path to an application config file (gmstudio.cfg) /MIG = "migpath" sets path to a migration project file (.gmproj)

or

/MIG = a migration project specification string: one of more of the following semicolon delimited list of project creation parameters:

Parameter

Description

Status/Default

Name=name;

name is the name of new upgrade project

optional, default=NewUpgrade

Source=source;

source is the name of the folder containing the source codes

required

NetLang=lang;

lang is the target .NET language (csh|vbn)

optional, default=csh

SendTo=sendto;

sendto is the name of the folder to store the project workspace

required

SourceFilter=pattern;

pattern is *.vbp|*.asp|fully qualified path to a single file

optional=*.vbp

VSVersion=VSnnnn;

VSnnnn is a VSversion name (e.g. VS2010, VS2010, VS2015)

optional, default=VS2013

OverWrite=yes|no;

'yes' means to replace a pre-existing gmProj silently and 'no' indicates to promot the user

optional, default="no"


See sample listing below:


/FILTER restricts processing to the source tasks listed. Multiple tasks indicated using '+'. Wildcard using '*'.

/TOOLS specifies a comma delimited list of the following tools (iterate over all migration units for each tool)

      Apply Task Filter,
      Author Interop Assemblies,
      Author Interface Descriptions,
      Set Build Order,
      Author Resx Files,
Generate Visual Studio Solution,
Update Project Metalang File 

 /TASKS specifies a comma-delimited list of the following tasks (iterate over list of all tasks for each migration unit)

       Validate Source,
Build VB6, 
Snapshot a Baseline, 
Reset Task Status, 
Run Translation, 
Deploy Translation, 
Build Translation,
Run Functional Test 

/REPORTS  specifies a comma-delimited list of reports (See Reports Article for more information)

      Source Structure,
      Source References,
      Source Members,
      Source GUI Scan,
      Source Code Scan,
      Iceberg,
      Project Summary,
      Metrics Summary,
      Migration Set,
      Interface File Headers,
      Interface File ProgIds,
      Code Bundle Metrics,
      .NET Build Logs,
      Translation Logs,
      All Logs,
      Semantic References,
      Semantic Definitions,
      Semantic Symbols,
      Semantic Audit,
Generate Visual Studio Solution,
Migration Project List,
Target Code Scan,

Note that tools are processed before tasks.

/IGNOREMRU: do not reload most recently used project 

/LOGSTART: specify that startup diagnostics should be logged to a file.  If filepath is blank, the file will be written to C:\Users\<NAME>\AppData\Roaming\GreatMigrations\gmstartup.*.log

Sample Command Script

    • RunGmStudio.cmd: allows running gmStudio for a specific project from the command line 

Sample script for using Command Line Project Execution

No Format
:: this script may be used to run gmStudio in batch
@echo off

set GmStudioExe="C:\Program Files (x86)\GreatMigrations\gmStudio\gmStudio.exe"

::-----------------------------------------------------------------
:: mig is the gmStudio project to process
::-----------------------------------------------------------------

set mig=C:\gmTestBed\ScanTool\proj_csh\ScanTool_csh.gmproj

::-----------------------------------------------------------------
:: Filter may contain a string specifying one or more migration
:: tasks to include in processing.  Multiple tasks can be joined
:: by '+', wildcard = '*'.  This string should not be quoted.
:: if blank, all tasks in tasks list are processed.
::-----------------------------------------------------------------
set filter=%1
:: remove double quotes
set filter=%filter:~1,-1%

::-----------------------------------------------------------------
:: If AutoBatch=YES then  the tasks/tools specified in the
:: migrationSet file (.gmproj) will be performed.  Otherwise, the 
:: set of task/tools specified below will be performed.
:: must be =NO for reports to run.
::-----------------------------------------------------------------

set autobatch="/AUTOBATCH='no'"


::-----------------------------------------------------------------
:: Select Migration Tasks (only used when AUTOBATCH=NO)
::-----------------------------------------------------------------
set tasks=
::set tasks=%tasks%Validate Source,
::set tasks=%tasks%Build VB6,
::set tasks=%tasks%Snapshot a Baseline,
::set tasks=%tasks%Reset Task Status,
set tasks=%tasks%Run Translation,
set tasks=%tasks%Deploy Translation,
::set tasks=%tasks%Build Translation

::-----------------------------------------------------------------
:: Select Migration Tools (only used when AUTOBATCH=NO)
::-----------------------------------------------------------------

set tools=
::set tools=%tools%Apply Task Filter,
::set tools=%tools%Author Interop Assemblies,
::set tools=%tools%Author Interface Descriptions,
::set tools=%tools%Run Assessment Wizard,
::set tools=%tools%Set Build Order,
::set tools=%tools%Author Resx Files,

::-----------------------------------------------------------------
:: Select Reports
::-----------------------------------------------------------------

set rprts=
::-----------------------------------------------------------------
:: Code Scans
::-----------------------------------------------------------------
::set rprts=%rprts%Source Structure,
::set rprts=%rprts%Source References,
::set rprts=%rprts%Source Members,
::set rprts=%rprts%Source GUI Scan,
::set rprts=%rprts%Source Code Scan,
::set rprts=%rprts%Iceberg,
::-----------------------------------------------------------------
:: Project Reports
::-----------------------------------------------------------------
set rprts=%rprts%Project Summary,
::set rprts=%rprts%Metrics Summary,
::set rprts=%rprts%Migration Set,
::set rprts=%rprts%Interface File Headers,
::set rprts=%rprts%Interface File ProgIds,
::set rprts=%rprts%Code Bundle Metrics,
::set rprts=%rprts%.NET Build Logs,
::set rprts=%rprts%Translation Logs,
::set rprts=%rprts%All Logs,
::-----------------------------------------------------------------
:: Semantic Model Reports
::-----------------------------------------------------------------
::set rprts=%rprts%Semantic Definitions,
::set rprts=%rprts%Semantic References,
::set rprts=%rprts%Semantic Audit,
::-----------------------------------------------------------------
:: Utility Reports
::-----------------------------------------------------------------
::set rprts=%rprts%Migration Project List,
::set rprts=%rprts%Target Code Scan,
::set rprts=%rprts%Generate Visual Studio Solution,

echo running %GmStudioExe%

set logstart=
::"/logstart='\temp\gmStudioStartUp.log'"
set      mig="/MIG='%mig%'"
set    tasks="/TASKS='%tasks%'"
set    tools="/TOOLS='%tools%'"
set    rprts=/REPORTS='%rprts%'" 
set      cfg=
::"/CFG='%wrk%\batch\gmStudioBatch.cfg'"
set   filter="/FILTER='%filter%'"

%GmStudioExe% %autoBatch% %filter% %mig% %tasks% %tools% %rprts% %cfg% %logstart%


Sample script for creating a project from the command line

Code Block
languagecoldfusion
:: run the batch process and report results

@echo off

set GmStudioExe=%ProgramFiles%\GreatMigrations\gmStudio\gmStudio.exe
if not exist "%GmStudioExe%" set GmStudioExe=%ProgramFiles(x86)%\GreatMigrations\gmStudio\gmStudio.exe
if not exist "%GmStudioExe%" echo cannot find gmStudio.exe && goto end

::-------------------------------------------------------------
:: set the root folder location of the test area here
::-------------------------------------------------------------

Set TestBed=C:\gmTestBed
set wrk=%TestBed%

::-------------------------------------------------------------
:: clear results of prior run
::-------------------------------------------------------------
pushd "%TestBed%\batch"
if exist NewProj.log     del NewProj.log 

set lang=csh& set usestb=yes& call :autorunGroup
set lang=vbn& set usestb=yes& call :autorunGroup
popd
exit/b

:: here are all the scenarios: vbn/csh x stub/interop
set lang=csh& set usestb=nop& call :autoRunGroup
set lang=csh& set usestb=yes& call :autoRunGroup

set lang=vbn& set usestb=nop& call :autoRunGroup
set lang=vbn& set usestb=yes& call :autoRunGroup

popd
exit/b

::------------------------------------------------------------------------
:autorunGroup
::------------------------------------------------------------------------

:: the following two lines run a single test case
::call :autorun1 FileExplorer    %lang% %usestb%
::exit/b

call :autorun1 ScanTool        %lang% %usestb%
call :autorun1 FileExplorer    %lang% %usestb%
call :autorun1 FMStocks        %lang% %usestb%
call :autorun1 vb3Ddefine      %lang% %usestb%
call :autorun1 Waves           %lang% %usestb%
call :autorun1 StringEvaluator %lang% %usestb%
call :autorun1 Calculator      %lang% %usestb%
exit/b

::------------------------------------------------------------------------
:autorun1
::------------------------------------------------------------------------
set name=%1
if not exist "%wrk%\%name%\src" echo "%wrk%\%name%\src NOT FOUND" & goto skip

set locname=std
set stbname=iop
if [%useloc%]==[yes] set locname=loc
if [%usestb%]==[yes] set stbname=stb
set out=%name%_%lang%_%locname%_%stbname%
set logStart="/logstart='%cd%\%out%.Start.log'"
set mig="/MIG='Name=%name%;Source=%wrk%\%name%\src;SendTo=%wrk%\NewProj\%out%;netLang=%lang%;UseStubs=%usestb%;VSVersion=VS2013;OverWrite=yes'" 
set autobatch="/AUTOBATCH=YES"
set rprts=
set rprts=%rprts%Project Summary,
set rprts=%rprts%All Logs,
set rprts="/REPORTS='%rprts%'"

echo AutoRun1 %out%
echo MAKE GMPROJ: %mig% %autobatch% %logstart%>>NewProj.log 

:: create a new project and run standard batch operations
"%GmStudioExe%" %mig% %autobatch% %logstart%>nul

:: open teh new project and run reports
set mig="/MIG='%wrk%\NewProj\%out%\%name%.gmproj'"
set autobatch="/AUTOBATCH=NO"

echo RUN REPORT: %mig% %rprts% %autobatch%>>NewProj.log
"%GmStudioExe%" %mig% %rprts% %autobatch%>nul

powershell "Start-Sleep -s 1"

set rptfldr=%wrk%\NewProj\%out%\report
findstr /c:"SubSystem=" /c:"BuildFile=" "%rptfldr%\*-AllLog.txt" >> NewProj.log
findstr /c:"Translation Status" /c:"NET Build Status" "%rptfldr%\*-AllLog.txt" >> NewProj.log
:skip
exit/b

:end

Table of Contents