利用 Rational ClearCase 和 STAF 实现自动化脚本的自动更新和编(2)

发表于:2012-03-19来源:IBM作者:张思思点击数: 标签:Rational Cle
二、编译(Ant) 代码更新成功之后,下一步就是要编译。这里使用默认的 Ant 构建文件 build.xml。Ant 的编译命令如下: 首先清理原来的编译文件: ant clean 然

  二、编译(Ant)

  代码更新成功之后,下一步就是要编译。这里使用默认的 Ant 构建文件 build.xml。Ant 的编译命令如下:

  首先清理原来的编译文件:

ant clean

  然后重新编译整个工程:

ant –f build.xml –lib ecj.jar

  通常会把 ant 的日志文件打印出来分析。如果编译成功在日志文件中可以看到如下关键字:

BUILD SUCCESSFUL
Total time: 25 seconds
Buildfile: build.xml

  如果编译失败,则会打印出如下日志。从日志中可以分析出出现编译错误的两个 java 文件是 MailSignatureTasks.java 和 SignatureAddVCardWithPhoto.java,下面已经用黑体字标出。

ECHO is off.
Buildfile: build.xml

init:
 [echo] Check for necessary classpath elements, fail without them.
 [echo] RFT Java compiler W32 = C:\Program Files\IBM\SDP70\jdk\bin\javac.exe
 [echo] Jar (cbg) = C:\Documents and Settings\zhangsis\zhangsis_notesclient_int\
 wplcqe.02\notesclient\utilities\svt\cbg.perf_1.5.0.jar
 [echo] Jar (jcommon) = C:\Documents and Settings\zhangsis\zhangsis_notesclient_int\
 wplcqe.02\notesclient\utilities\svt\jcommon-1.0.6.jar
 [echo] Jar (jfreechart) = C:\Documents and Settings\zhangsis\zhangsis_notesclient_int\
 wplcqe.02\notesclient\utilities\svt\jfreechart-1.0.2.jar
 [echo] Jar (Notes) = C:\Documents and Settings\zhangsis\zhangsis_notesclient_int\
 wplcqe.02\notesclient\utilities\jars\Notes.jar

compile_datastore_w32:
 [echo] Compile the Java files in notesclient RFT datastore
[rft_javac_1.5] Compiling 195 source files to C:\Documents and Settings\zhangsis\
zhangsis_notesclient_int\wplcqe.02\notesclient
[rft_javac_1.5] C:/Documents and Settings/zhangsis/zhangsis_notesclient_int/
wplcqe.02/notesclient/tasks/client/mail/MailSignatureTasks.java:270: cannot find symbol
[rft_javac_1.5] symbol : method deletePhoto()
[rft_javac_1.5] location: class appobjects.dialog.client.mail.DlgAppendVcard
[rft_javac_1.5] 					dlgAppend.deletePhoto();
[rft_javac_1.5] ^
[rft_javac_1.5] C:/Documents and Settings/zhangsis/zhangsis_notesclient_int/wplcqe.02/
notesclient/testcases/client/pim/mail/signature/SignatureAddVCardWithPhoto.java:112: 
  cannot find symbol
[rft_javac_1.5] symbol : method setPhoto(java.lang.String)
[rft_javac_1.5] location: class appobjects.dialog.client.mail.DlgAppendVcard
[rft_javac_1.5]           log.altVerify(true, dlgAppend.setPhoto(sPicname), "Set Photo");
[rft_javac_1.5] ^
[rft_javac_1.5] Note: * uses or overrides a deprecated API.
[rft_javac_1.5] Note: Recompile with -Xlint:deprecation for details.
[rft_javac_1.5] Note: Some input files use unchecked or unsafe operations.
[rft_javac_1.5] Note: Recompile with -Xlint:unchecked for details.
[rft_javac_1.5] 2 errors

  三、压缩文件(STAF)

  如果编译成功就压缩所有测试脚本,上传到 LA Server。利用 STAF 压缩文件的命令是:

staf local zip add zipfile <filename> directory <directory name> 
  RECURSE relativeto <Directory>

  四、创建 Maseline(Cleartool)

  编译成功之后,还有个任务是要创建 baseline,这样如果以后需要某个不同版本的代码,也可以顺利找回来,cleartool 命令是:

cleartool mkbl -view <baseline name>

  五、找编译错误的文件和作者(Cleartool)

  如果编译有错,则在日志文件中通过正则表达式匹配找到编译有错的脚本,然后通过如下 cleartool 命令找到最后在 ClearCase 里边更新脚本的 ID:

cleartool desc -fmt %u <element>

原文转自:http://www.ltesting.net