50
FUJITSU Software PGRelief CI Tool Collaboration Jenkins Plugin Manual PGR-0003-E4Z0(00) October 2019

CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

FUJITSU Software PGRelief

CI Tool Collaboration Jenkins Plugin Manual

PGR-0003-E4Z0(00) October 2019

Page 2: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

i

Preface CI (Continuous Integration) Tool Collaboration Jenkins Plugin is plugin to total with CI tool (Jenkins) and to display the analytical result of PGRelief. In CI Tool Collaboration Jenkins plugin, the following Functions are offered.

- It is an execution from the Job of Jenkins as for PGRelief (*1) (*2) (*3). - It is a View on Jenkins as for the PGRelief execution result (*3).

(*1) PGRelief cannot be executed only by CI Tool Collaboration Jenkins plugin. (*2) One analytical license of PGRelief is consumed about the one-Job execution of Jenkins. (*3) This plugin cannot execute IPA/SEC-C/C++ check, PGRelief MISRA option and PGRelief CERT

option.

In this book, it explains the usage of CI Tool Collaboration Jenkins plugin. Refer to "Message Indications Manual" (PGRelief C/C++) or "Rule Detail Manual" (PGRelief J) for pointed out message of the program defect that PGRelief outputs. Refer to "Command manual" for the error message and the command option that PGRelief outputs.

Page 3: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

ii

[High Risk Activity]

This Product is designed, developed and manufactured as contemplated for general use, including without limitation, general office use, personal use, household use, and ordinary industrial use, but is not designed, developed and manufactured as contemplated for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could lead directly to death, personal injury, severe physical damage or other loss (hereinafter "High Safety Required Use"), including without limitation, nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system. You shall not use this Product without securing the sufficient safety required for the High Safety Required Use. If you wish to use this Product for High Safety Required Use, please consult with our sales representatives in charge before such use.

Microsoft, Windows, Windows Server are registered trademarks of Microsoft Corporation in the United States and other countries. MISRA and its logo are registered trademarks of MIRA Ltd, held on behalf of the MISRA Consortium. CERT is registered trademark of Carnegie Mellon University in the United States. The names of other products and services referred to in this document are trademarks of their respective developers and manufacturers.

Particular technologies disclosed in this document may be subject to the Foreign Exchange and Foreign Trade Control Law. Export of this document or any part thereof, or supply of this document or any part thereof to a foreign resident, must be undertaken only in compliance with the provisions of the law.

FUJITSU SOFTWARE TECHNOLOGIES LIMITED

Notes

- Transmission or copying of this document in whole or in part is prohibited.

- The content of this document is subject to change without prior notice.

All rights reserved, Copyright(C) 2016-2019 FUJITSU SOFTWARE TECHNOLOGIES LIMITED.

Page 4: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

iii

Contents 1. Running Environment ............................................................................................... 1

1.1 Running OS.............................................................................................................. 1 1.2 JDK / JRE ................................................................................................................. 1 1.3 CI Tool ...................................................................................................................... 1 1.4 PGRelief ................................................................................................................... 2

2. Preparation ................................................................................................................. 3 2.1 Install of PGRelief .................................................................................................... 3 2.2 Install of CI Tool Collaboration Jenkins plugin ......................................................... 3

2.2.1 Configuration of CI Tool Collaboration Jenkins plugin ..................................... 3 2.2.2 Install of PGRelief Jenkins plugin ..................................................................... 4 2.2.3 Install of PGRelief Maven plugin ...................................................................... 8

2.3 Setting .................................................................................................................... 12 2.3.1 Configure Jenkins System .............................................................................. 12

3. Execution/Confirmation .......................................................................................... 16 3.1 When you use PGRelief J ...................................................................................... 16

3.1.1 Setting of build ................................................................................................ 16 3.1.2 Jenkins Job ..................................................................................................... 19 3.1.3 Build ................................................................................................................ 25 3.1.4 Confirmation of build result ............................................................................. 26

3.2 When you use PGRelief C/C++ ............................................................................. 29 3.2.1 Setting of build ................................................................................................ 29 3.2.2 Jenkins Job ..................................................................................................... 32 3.2.3 Build ................................................................................................................ 38 3.2.4 Confirmation of build result ............................................................................. 39

4. Error Message .......................................................................................................... 42 5. Appendix .................................................................................................................. 44

5.1 PGRelief J Maven plugin reference ....................................................................... 44 5.1.1 Property .......................................................................................................... 44 5.1.2 Output File ...................................................................................................... 45

5.2 PGRelief C/C++ Maven plugin reference .............................................................. 46 5.2.1 Property .......................................................................................................... 46 5.2.2 Output File ...................................................................................................... 46

Page 5: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

1

1. Running Environment 1.1 Running OS

It runs on the following OS. - Microsoft(R) Windows Server(R) 2008 R2 operating system - Microsoft(R) Windows Server(R) 2012 operating system - Microsoft(R) Windows Server(R) 2012 R2 operating system - Microsoft(R) Windows Server(R) 2016 operating system - Microsoft(R) Windows(R) 7 Home Premium - Microsoft(R) Windows(R) 7 Professional - Microsoft(R) Windows(R) 7 Enterprise - Microsoft(R) Windows(R) 7 Ultimate - Microsoft(R) Windows(R) 8.1 - Microsoft(R) Windows(R) 8.1 Pro - Microsoft(R) Windows(R) 8.1 Enterprise - Microsoft(R) Windows(R) 10 Home - Microsoft(R) Windows(R) 10 Pro - Microsoft(R) Windows(R) 10 Enterprise - Red Hat Enterprise Linux 5 - Red Hat Enterprise Linux 6 - Red Hat Enterprise Linux 7

1.2 JDK / JRE

The following versions of JDK and JRE are supported. - JDK / JRE 7 - JDK / JRE 8

1.3 CI Tool

The following versions of CI Tools are supported. - Jenkins(1.625.1, 1.625.2, 1.625.3, 1.642.1, 1.642.2, 1.642.3, 1.642.4)

It is necessary to install on the use of CI Tool Collaboration Jenkins plugin and to install an around and following CI Tool Collaboration Jenkins plugin in Jenkins beforehand.

- Static Code Analysis Plug-ins (version 1.75) https://wiki.jenkins-ci.org/display/JENKINS/Static+Code+Analysis+Plug-ins

Moreover, when the Maven project is used with Jenkins, it is necessary to install the following Tool in the system beforehand.

- Apache Maven(3.0.5 - 3.3.9)

Page 6: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

2

1.4 PGRelief

The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating license version - PGRelief C/C++ 2016 Wide-ranging Detective Option - PGRelief J 2017 floating license version - PGRelief C/C++ 2017 floating license version - PGRelief C/C++ 2017 Wide-ranging Detective Option - PGRelief J 2018 floating license version - PGRelief C/C++ 2018 floating license version - PGRelief C/C++ 2018 Wide-ranging Detective Option - PGRelief J 2019 floating license version - PGRelief C/C++ 2019 floating license version - PGRelief C/C++ 2019 Wide-ranging Detective Option

Page 7: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

3

2. Preparation 2.1 Install of PGRelief

PGRelief is installed according to installation instructions. JDK is necessary for PGRelief J as the operating environment. Please prepare the environment beforehand. Moreover, please set the install Path of JDK to environment variables JAVA_HOME.

2.2 Install of CI Tool Collaboration Jenkins plugin 2.2.1 Configuration of CI Tool Collaboration Jenkins plugin

Download and install CI Tool Collaboration Jenkins plugin from 'CI Tool Collaboration Jenkins plugin' on the download site.

PGRelief C/C++: https://www.fujitsu.com/jp/group/fst/en/services/pgr/download/ PGRelief J : https://www.fujitsu.com/jp/group/fst/en/services/pgr-java/download/

Download the self-extracting executable 'pgrelief-jenkins-plugin.exe', copy it to any location, and run it to create a 'pgrelief-jenkins-plugin' folder. The Content of the folder 'pgrelief-jenkins-plugin' is as follows.

Folder name Description PGRelief_JenkinsPlugin Filing folder of PGRelief Jenkins plugin PGRelief_MavenPlugin Filing folder of PGRelief Maven plugin

The Content of the folder 'PGRelief_JenkinsPlugin' is as follows.

File name Description pgreliefj.hpi Jenkins plugin of PGRelief J pgreliefc.hpi Jenkins plugin of PGRelief C/C++

The Content of the folder 'PGRelief_MavenPlugin' is as follows.

File name Description pgreliefj-maven-plugin-1.0.jar Maven plugin of PGRelief J pgreliefc-maven-plugin-1.0.jar Maven plugin of PGRelief C/C++

Page 8: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

4

2.2.2 Install of PGRelief Jenkins plugin

Please install "Static Code Analysis Plug-ins" before installing PGRelief Jenkins Plugin.

It is a procedure when Jenkins 1.642.4 is used, and operation procedure might be different in other Jenkins versions.

(1) Open the dashboard of Jenkins.

(2) Click "Manage Jenkins" of a left pane.

Page 9: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

5

(3) Click "Manage plugin".

(4) Click "Advanced" tab.

Page 10: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

6

(5) Click "Browse" Button of "Upload Plugin".

(6) Click "Open" Button after selecting PGRelief Jenkins Plugin.

Page 11: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

7

(7) Click "Upload".

Page 12: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

8

2.2.3 Install of PGRelief Maven plugin

Install of PGRelief Maven plugin is necessary when PGRelief is executed by using Maven. Please install Maven before installing PGRelief Maven Plugin.

PGRelief J Maven Plugin

(1) Move to the 'PGRelief_MavenPlugin' folder by using the command line. (2) Execute the mvn command.

[In the case of Install in the Maven local repository] The following parameters are specified for the mvn command. Parameter Description install:install-file Goal phrase to install plugin in local repository -Dfile=pgreliefj-maven-plugin-1.0.jar File name of PGRelief J Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief J Maven plugin

-DartifactId=pgreliefj-maven-plugin Name of PGRelief J Maven plugin -Dversion=1.0 Version of PGRelief J Maven plugin -Dpackaging=jar Format of PGRelief J Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief J Maven plugin (version 1.0) in Maven local repository

mvn install:install-file -Dfile=pgreliefj-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefj-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 13: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

9

[In the case of Install in the Maven remote repository] The following parameters are specified for the mvn command. Parameter Description

deploy:deploy-file Goal phrase to install plugin in remote repository

-Durl="Repository URL" URL of remote repository that installs plugin -DrepositoryId="Repository ID" ID of remote repository that installs plugin -Dfile=pgreliefj-maven-plugin-1.0.jar File name of PGRelief J Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief J Maven plugin

-DartifactId=pgreliefj-maven-plugin Name of PGRelief J Maven plugin -Dversion=1.0 Version of PGRelief J Maven plugin -Dpackaging=jar Format of PGRelief J Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief J Maven plugin (version 1.0) in Maven remote repository

mvn deploy:deploy-file -Durl=http://xx.xxx.xxx.xxx/repository -DrepositoryId=my-repository -Dfile=pgreliefj-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefj-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 14: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

10

PGRelief C/C++ Maven Plugin

(1) Move to the 'PGRelief_MavenPlugin' folder by using the command line. (2) Execute the mvn command.

[In the case of Install in the Maven local repository] The following parameters are specified for the mvn command. Parameter Description install:install-file Goal phrase to install plugin in local repository

-Dfile=pgreliefc-maven-plugin-1.0.jar File name of PGRelief C/C++ Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief C/C++ Maven plugin

-DartifactId=pgreliefc-maven-plugin Name of PGRelief C/C++ Maven plugin

-Dversion=1.0 Version of PGRelief C/C++ Maven plugin -Dpackaging=jar Format of PGRelief C/C++ Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief C/C++ Maven plugin (version 1.0) in Maven local repository

mvn install:install-file -Dfile=pgreliefc-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefc-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 15: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

11

[In the case of Install in the Maven remote repository] The following parameters are specified for the mvn command. Parameter Description

deploy:deploy-file Goal phrase to install plugin in remote repository

-Durl="Repository URL" URL of remote repository that installs plugin -DrepositoryId="Repository ID" ID of remote repository that installs plugin -Dfile=pgreliefc-maven-plugin-1.0.jar File name of PGRelief C/C++ Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief C/C++ Maven plugin

-DartifactId=pgreliefc-maven-plugin Name of PGRelief C/C++ Maven plugin

-Dversion=1.0 Version of PGRelief C/C++ Maven plugin -Dpackaging=jar Format of PGRelief C/C++ Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief C/C++ Maven plugin (version 1.0) in Maven remote repository

mvn deploy:deploy-file -Durl=http://xx.xxx.xxx.xxx/repository -DrepositoryId=my-repository -Dfile=pgreliefc-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefc-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 16: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

12

2.3 Setting

It explains a setting necessary to use PGRelief with Jenkins. 2.3.1 Configure Jenkins System

The setting of the environment variables is necessary to use PGRelief with Jenkins.

(1) Click "Manage Jenkins" of a left pane of the dashboard.

(2) Click "Configure System".

Page 17: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

13

(3) Check "Environment variables" of "Global properties".

(4) Click "Add" Button of "List of key-value pairs".

Page 18: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

14

(5) Set "name" and "value".

- Setting of License Server

name FST_LICENSE_FILE value port@host Specify the license server of PGRelief. - port : Port number

Specify the Port that the license server of PGRelief uses. Port number can be omitted if you do not specify the port number for the license server. Please confirm the port number that you should set to the administrator of the license server.

- host : License management server IP address or host name Always add '@' at the front even when the port number is omitted.

There is a possibility that PGRelief cannot be executed from Jenkins depending on the operating environment when the key is not set.

- Setting to prevent pop-up of license verification from appearing

name FLEXLM_BATCH value 1 The license verification pop-up of PGRelief is prevented from appearing. The pop up of the license attestation is displayed when the key is not set, and there is a possibility that the execution of the job of Jenkins does not progress.

Page 19: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

15

- Setting of environment variables of PGRelief [When you use PGRelief J]

name PGRJ_HOME value PGRelief InstallDirectory¥PGReliefJava

[When you use PGRelief C/C++]

name EPOMDIR value Windows :

PGRelief InstallDirectory¥PGRelief¥Analyze¥EPOM Linux :

PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM name PATH (Only Linux) value PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM name LD_LIBRARY_PATH (Only Linux) value PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM/lib There is a possibility that PGRelief cannot be executed from Jenkins depending on the operating environment when the key is not set.

Page 20: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

16

3. Execution/Confirmation 3.1 When you use PGRelief J 3.1.1 Setting of build

Describe the setting necessary for the execution of PGRelief J in Ant, Maven or the Windows batch command according to the build environment. The setting example is as follows.

Ant

Describe the setting of PGRelief J in build File (build.xml).

Describe the pgrjava command. Specify the option of the pgrjava command for the value attributes of the <arg> tag. Details of the pgrjava command are described to "Command Manual" of PGRelief J.

: <property environment="env"/> <!-- InstallDirectory of PGRelief J --> <property name="pgrj.dir" value="${env.PGRJ_HOME}"/> <!-- The Directory that outputs ResultFile --> <property name="report.dir" value="${basedir}/report"/> <!-- Task of PGRelief J --> <target name="pgreliefj" description="PGRelief J"> <!-- pgrjava command --> <exec executable="${pgrj.dir}/pgrjava.bat"> <!-- Add the value when you use the pgrjava command option <arg value="-r" /> <arg value="${pgrj.dir}/rule.pgrj" /> --> <!-- The Directory where source files that should be checked is stored --> <arg value="src" /> <!-- The Directory where class files that should be checked is stored --> <arg value="bin" /> <!-- ResultFile --> <arg value="${report.dir}/pgreliefj_message.csv" /> </exec> </target> :

Page 21: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

17

Maven Describe the setting of PGRelief J in POM File (pom.xml). Details of the PGRelief J Maven Properties are described to 5.1.1 Property.

: <properties> <pgrj.dir>C:/Program Files/PGRelief/PGReliefJava</pgrj.dir> </properties> :

<build> <plugins> :

<!-- PGRelief J Maven Plugin --> <plugin> <groupId>com.fujitsu.jp.fst.pgrelief.maven</groupId> <artifactId>pgreliefj-maven-plugin</artifactId> <version>1.0</version> <!-- Add the Property when you use option. <configuration> <pgrCheckRuleDefinitionFile>${pgrj.dir}/rule.pgrj</pgrCheckRuleDefinitionFile> </configuration> --> <executions> <execution> <!-- Phase of PGRelief J --> <phase>verify</phase> <goals> <!-- Goal of PGRelief J (Requirement) --> <goal>pgreliefj</goal> </goals> </execution> </executions> </plugin> </plugins> </build> :

Page 22: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

18

Windows batch command Describe the setting of PGRelief J in Windows batch file. Describe the pgrjava command. Details of the pgrjava command are described to "Command Manual" of PGRelief J.

"C:¥Program Files¥PGRelief¥PGReliefJava¥pgrjava.bat" "C:¥Jenkins¥workspace¥Project1¥src" "C:¥Jenkins¥workspace¥Project1¥bin" "C:¥Jenkins¥workspace¥Project1¥report¥pgreliefj_message.csv"

Page 23: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

19

3.1.2 Jenkins Job

Freestyle project

(1) Click "Add build step" of the Build section.

(2) Click the added build step.

* Select the build Step set by 3.1.1 Setting of build. * "Execute shell" cannot be used for PGRelief J.

Page 24: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

20

1. Invoke Ant Specify "Targets".

* Specify "Targets" set to build File (build.xml) of 3.1.1 Setting of build. 2. Invoke top-level Maven targets

Specify "Goals".

* Specify either the following for "Goals".

- Phase set to POM file (pom.xml) of 3.1.1 Setting of build - Goal that PGRelief Maven plugin offers (pgreliefj)

Page 25: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

21

3. Execute Windows batch command Specify "Command".

* Specify the Windows batch file made by 3.1.1 Setting of build by using the call

command.

Page 26: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

22

(3) Click "Add post-build action" of the Post-build Actions section.

(4) Click "Publish PGRelief J analysis results".

Page 27: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

23

(5) Set PGRelief results. Specify the analytical result file of the PGRelief J.

Page 28: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

24

Maven project

(1) Specify "Goals and options" of the Build section.

* Specify phase set to POM File (pom.xml) of 3.1.1 Setting of build or goal that PGRelief J

Maven plugin offers. (2) Put the check in "Publish PGRelief J analysis results" of the Build Settings section.

Page 29: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

25

3.1.3 Build

Execute the build Job of Jenkins. Do either of the following Operations on the dashboard of Jenkins.

- Click the Build execution icon.

- Click "Build Now" of a left pane after clicking the Job of the target.

Page 30: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

26

3.1.4 Confirmation of build result

The build result is displayed on the dashboard of Jenkins. Confirm the build of the Job displayed in "All" view has succeeded, and confirm the execution result of PGRelief.

(1) Display the dashboard of Jenkins.

(2) Click the target Job displayed in "All" view.

Page 31: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

27

(3) The latest build displayed in "Build History" of a left pane is clicked.

(4) Confirm the error message is not output on the dashboard of Jenkins.

Page 32: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

28

(5) Click "PGRelief J Warnings" of a left pane.

(6) Confirm the analytical result of PGRelief is displayed.

Page 33: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

29

3.2 When you use PGRelief C/C++ 3.2.1 Setting of build

Describe the setting necessary for the execution of PGRelief C/C++ in Ant, Maven, Windows batch command or the Shell command according to the build environment. The setting example is as follows.

Ant

Describe the setting of PGRelief C/C++ in build File (build.xml).

Describe the pgr5 command. Specify the option of the pgr5 command for the value attributes of the <arg> tag. It is necessary to specify "--qm". Details of the pgr5 command are described to "Command Manual" of PGRelief C/C++.

: <property environment="env"/> <property name="workspace.dir" value="C:/work/sample"/> <!-- InstallDirectory of PGRelief C/C++ --> <property name="pgrc.dir" value="${env.EPOMDIR}"/> <!-- The Directory that outputs ResultFile --> <property name="report.dir" value="${basedir}/report"/> <!-- Task of PGRelief C/C++ --> <target name="pgreliefc" description="PGRelief C/C++"> <!-- pgr5 command --> <exec executable="${pgrc.dir}/pgr5.exe" output="${report.dir}/pgreliefc_message.csv" logError="true"> <!-- Add the value when you use the pgr5 command option. <arg value="-Z${pgrc.dir}/MessageInfo/default-pgr.rul" /> <arg value="-KMS/VC2010" /> <arg value="-Y${workspace.dir}/stdinc" /> <arg value="-I${workspace.dir}/priinc" /> <arg value="-D_DEBUG" /> <arg value="-SSJIS" /> --> <!-- Output Option (Requirement) --> <arg value="--qm" /> <!-- Source file of analysis object --> <arg value="src/sample/*.c" /> </exec> </target> :

Page 34: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

30

Maven Describe the setting of PGRelief C/C++ in POM File (pom.xml). Details of the PGRelief C/C++ Maven Properties are described to 5.2.1 Property.

: <properties> <pgrc.dir>C:/Program Files/PGRelief/PGRelief/Analyze/EPOM</pgrc.dir> <workspace.dir>C:/work/sample</workspace.dir> </properties> :

<build> <plugins> :

<!-- PGRelief C/C++ Maven Plugin --> <plugin> <groupId>com.fujitsu.jp.fst.pgrelief.maven</groupId> <artifactId>pgreliefc-maven-plugin</artifactId> <version>1.0</version> <!-- Add the Property when you use option. <configuration> <pgrOptions> <pgrOption>-Z${pgrc.dir}/MessageInfo/default-pgr.rul</pgrOption> <pgrOption>-KMS/VC2010</pgrOption> <pgrOption>-Y${workspace.dir}/stdinc</pgrOption> <pgrOption>-I${workspace.dir}/priinc</pgrOption> <pgrOption>-D_DEBUG</pgrOption> <pgrOption>-SSJIS</pgrOption> </pgrOptions> </configuration> --> <executions> <execution> <!-- Phase of PGRelief C/C++ --> <phase>verify</phase> <goals> <!-- Goal of PGRelief C/C++ (Requirement) --> <goal>pgreliefc</goal> </goals> </execution> </executions> </plugin> </plugins> </build> :

Page 35: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

31

Windows batch command Describe the setting of PGRelief C/C++ in Windows batch file. Describe the pgr5 command. It is necessary to specify "--qm". Details of the pgr5 command are described to "Command Manual" of PGRelief C/C++.

shell

Describe the setting of PGRelief C/C++ in the shell script. Describe the pgr5 command. It is necessary to specify "--qm". Details of the pgr5 command are described to "Command Manual" of PGRelief C/C++.

"C:¥Program Files¥PGRelief¥PGRelief¥Analyze¥EPOM¥pgr5.exe" --qm "C:¥Jenkins¥Workspace¥Project1¥src¥sample1.c" > "C:¥Jenkins¥Workspace¥Project1¥report¥pgreliefc_message.csv"

"/opt/FFSTpgr/FFSTpgr/Analyze/EPOM/pgr5" --qm "/home/Jenkins/Workspace/Project1/src/sample1.c" > "/home/Jenkins/Workspace/Project1/report/pgreliefc_message.csv"

Page 36: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

32

3.2.2 Jenkins Job

Freestyle project

(1) Click "Add build step" of the Build section.

(2) Click the added build step.

* Select the build Step set by 3.2.1 Setting of build.

Page 37: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

33

1. Invoke Ant Specify "Targets".

* Specify "Targets" set to build File (build.xml) of 3.2.1 Setting of build. 2. Invoke top-level Maven targets

Specify "Goals".

* Specify either the following for "Goals".

- Phase set to POM file (pom.xml) of 3.2.1 Setting of build - Goal that PGRelief Maven plugin offers (pgreliefc)

Page 38: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

34

3. Execute Windows batch command Specify "Command".

* Specify the Windows batch file made by 3.2.1 Setting of build by using the call

command. 4. Execute shell

Specify "Command".

* Specify the shell script made by 3.2.1 Setting of build by using the sh command.

Page 39: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

35

(3) Click "Add post-build action" of the Post-build Actions section.

(4) Click "Publish PGRelief C/C++ analysis results".

Page 40: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

36

(5) Set PGRelief results. Specify the analytical result file of the PGRelief C/C++.

Page 41: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

37

Maven project

(1) Specify "Goals and options" of the Build section.

* Specify phase set to POM File (pom.xml) of 3.2.1 Setting od build or goal that PGRelief

C/C++ Maven plugin offers. (2) Put the check in "Publish PGRelief C/C++ analysis results" of the Build Settings

section.

Page 42: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

38

3.2.3 Build

Execute the build Job of Jenkins. Do either of the following Operations on the dashboard of Jenkins.

- Click the Build execution icon.

- Click "Build Now" of a left pane after clicking the Job of the target.

Page 43: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

39

3.2.4 Confirmation of build result

The build result is displayed on the dashboard of Jenkins. Confirm the build of the Job displayed in "All" view has succeeded, and confirm the execution result of PGRelief.

(1) Display the dashboard of Jenkins.

(2) Click the target Job displayed in "All" view.

Page 44: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

40

(3) The latest build displayed in "Build History" of a left pane is clicked.

(4) Confirm the error message is not output on the dashboard of Jenkins.

Page 45: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

41

(5) Click "PGRelief C/C++ Warnings" of a left pane.

(6) Confirm the analytical result of PGRelief is displayed.

Page 46: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

42

4. Error Message

Error message related to Jenkins plugin

Error message format

[PGRELIEFJ] @1: com.fujitsu.jp.fst.pgreliefj.jenkins.parser.PGReliefResultFileFormatException: @2

or

[PGRELIEFC] @1: com.fujitsu.jp.fst.pgreliefc.jenkins.parser.PGReliefResultFileFormatException: @2

Explanation of Error message format @1 The message that Jenkins outputs is displayed. @2 The error message is displayed. Refer to the following message list for details. Message list ErrorMessage Description Measure The Format of PGRelief Result File (CSV) is abnormal.

There is a problem in PGRelief execution result file format.

Collect only the PGRelief execution result files.

Error message related to Maven plugin

Error message format [@1] @2 @3:@4 Explanation of Error message format @1 The error level is displayed. Refer to the following message list for details. @2 The message that Maven outputs is displayed. (This output might be omitted.) @3 Either of "PGRelief J Maven Plugin Error" or "PGRelief C Maven Plugin Error" is

displayed. @4 The error message is displayed. Refer to the following message list for details. Message list Error level

ErrorMessage Description Measure

ERROR Failed to execute PGRelief J. or Failed to execute PGRelief C/C++.

It is an errors of the PGRelief command execution.

Confirm the Content of the PGRelief output file. [PGRelief J output file]

pgreliefj_message.csv or pgreliefj_result.txt

[PGRelief C/C++ output file]

pgreliefc_message.csv or pgreliefc_result.txt

Details of the error message that PGRelief outputs are written in "Command Manual".

ERROR Plugin execute error. It failed in the execution of the PGRelief Maven plugin.

Confirm the Content of the PGRelief output file.

Page 47: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

43

[PGRelief J output file] pgreliefj_message.csv or pgreliefj_result.txt

[PGRelief C/C++ output file]

pgreliefc_message.csv or pgreliefc_result.txt

ERROR Install directory setting error.

The installation directory of PGRelief is not set.

[PGRelief J] Set environment variable

PGRJ_HOME. [PGRelief C/C++]

Set environment variable EPOMDIR.

ERROR Install directory @1 is not exist. @1:Directory

There is a problem in the setting of install the Directory of PGRelief.

[PGRelief J] Set environment variable

PGRJ_HOME correctly. [PGRelief C/C++] Set environment variable EPOMDIR correctly.

ERROR Unsafe command line string.

An illegal Character is included in the command line text. ;|&`()$<>*?{}[]!

Do not contain these Characters in the command line text.

WARNING

Skip non existing source Directory. @1 No sources to analyze. @1:Directory

The File of the analysis object does not exist. For instance, when the source file of the analysis object does not exist, this error message might be displayed in the multimodule project.

Confirm whether there is a specified mistake of the source directory and the source file.

Page 48: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

44

5. Appendix 5.1 PGRelief J Maven plugin reference

The execution result of PGRelief J (pgrjava command) can be output by using the PGRelief J Maven plugin.

Information groupId com.fujitsu.jp.fst.pgrelief.maven artifactId pgreliefj-maven-plugin version 1.0 phase (default) verify goal pgreliefj

5.1.1 Property

The property can be set to POM File (pom.xml) by the <configuration> tag. Set it if necessary. The property where the default value exists need not be set as long as there is no special reason. Name Type Description Default value pgrCheckRuleDefinitionFile

File Specify the inspection point Definition File by the full path. (Correspond to the "-r" of the pgrjava command.)

Check Rule Definition File in the Directory set by environment variables PGRJ_HOME (rule.pgrj)

pgrSrcDirectory

File Specify the Directory where the source files that to be the source directory and to be checked is stored by the full path.

First the Directory of compile source directory list of Maven project (${project.compileSourceRoots})

pgrClassesDirectory

File Specify the Directory where the class files that to be Class the Directory and to be checked is stored by the full path.

Classes the Directory in Target the Directory of Maven project (${project.build.directory}/classes)

pgrClassPathListFile

File Specify the File that describes the Class Path list File and the Class Path list by the full path. (Correspond to the "-af" of the pgrjava command.)

Class Path list of Maven project

pgrOutputDirectory

File Specify presentation the Directory of the PGRelief J execution result file. * "pgreliefj_message.csv" is output to specified the Directory.

The Directory of build target of Maven project (${project.build.directory})

pgrEncoding

Text Specify the code of the Java source to be checked. The setting of the following values can be done. Cp1252 | UTF-8

(Correspond to the "-e" of the pgrjava command.)

Encoding setting of Maven project (${project.build.sourceEncoding}) * Encode to which PGRelief J cannot be recognized might be set. In that case, specify this option.

Page 49: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

45

pgrOptions List Specify the option of the pgrjava command.

There is no specification

5.1.2 Output File

When the execution of PGRelief ends, the following files are output. Name Content Output Directory pgreliefj_message.csv PGRelief J analytical

result The Directory specified by pgrOutputDirectory property of POM File

pgreliefj_result.txt Standard Output of pgrjava command

The Directory specified by pgrOutputDirectory property of POM File

Page 50: CI Tool Collaboration Jenkins Plugin Manual...2 1.4 PGRelief The following versions of PGRelief are supported. - PGRelief J 2016 floating license version - PGRelief C/C++ 2016 floating

46

5.2 PGRelief C/C++ Maven plugin reference

The execution result of PGRelief C/C++ (pgr5 command) can be output by using the PGRelief C/C++ Maven plugin. Information groupId com.fujitsu.jp.fst.pgrelief.maven artifactId pgreliefc-maven-plugin version 1.0 phase (default) verify goal pgreliefc

5.2.1 Property

The property can be set to POM File (pom.xml) by the <configuration> tag. Set it if necessary. The property where the default value exists need not be set as long as there is no special reason. Name Type Description Default value pgrSrcDirectory

File Specify the Directory where the source files that to be the source directory and to be checked is stored by the full path.

The Directory of src of Maven project (${project.basedir}/src)

pgrCplusplusExt

List Specify the extension of the C++ source file.

.cc and .cpp

pgrOutputDirectory

File Specify presentation the Directory of the PGRelief C/C++ execution result file. * "pgreliefc_message.csv" is output to specified the Directory.

The Directory of build target of Maven project (${project.build.directory})

pgrOptions List Specify the option of the pgr5 command.

There is no specification

5.2.2 Output File

When the execution of PGRelief ends, the following files are output. Name Content Output Directory pgreliefc_message.csv PGRelief C/C++ analytical

result The Directory specified by pgrOutputDirectory property of POM File

pgreliefc_result.txt Standard Output of pgr5 command

The Directory specified by pgrOutputDirectory property of POM File