@@ -25,7 +25,7 @@ def initialize(projects, options, branch_config, branch_name)
2525 def get_pmd_binary_file
2626 logger . info "#{ @pmd_branch_name } : Start packaging PMD"
2727 Dir . chdir ( @local_git_repo ) do
28- build_branch_sha = Cmd . execute ( "git rev-parse #{ @pmd_branch_name } ^{commit}" )
28+ build_branch_sha = Cmd . execute_successfully ( "git rev-parse #{ @pmd_branch_name } ^{commit}" )
2929
3030 checkout_build_branch # needs a clean working tree, otherwise fails
3131
@@ -70,28 +70,28 @@ def build_pmd(into_dir:)
7070 ' -Dcheckstyle.skip=true' \
7171 ' -Dpmd.skip=true' \
7272 ' -T1C -B'
73- Cmd . execute ( package_cmd )
73+ Cmd . execute_successfully ( package_cmd )
7474 end
7575
7676 logger . info "#{ @pmd_branch_name } : Extracting the zip"
77- Cmd . execute ( "unzip -qo #{ pmd_dist_target } -d pmd-dist/target/exploded" )
78- Cmd . execute ( "mv pmd-dist/target/exploded/pmd-bin-#{ @pmd_version } #{ into_dir } " )
77+ Cmd . execute_successfully ( "unzip -qo #{ pmd_dist_target } -d pmd-dist/target/exploded" )
78+ Cmd . execute_successfully ( "mv pmd-dist/target/exploded/pmd-bin-#{ @pmd_version } #{ into_dir } " )
7979 end
8080
8181 def determine_pmd_version
8282 version_cmd = "./mvnw -q -Dexec.executable=\" echo\" -Dexec.args='${project.version}' " \
8383 '--non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec'
84- Cmd . execute ( version_cmd )
84+ Cmd . execute_successfully ( version_cmd )
8585 end
8686
8787 def get_last_commit_sha
8888 get_last_commit_sha_cmd = 'git rev-parse HEAD^{commit}'
89- Cmd . execute ( get_last_commit_sha_cmd )
89+ Cmd . execute_successfully ( get_last_commit_sha_cmd )
9090 end
9191
9292 def get_last_commit_message
9393 get_last_commit_message_cmd = 'git log -1 --pretty=%B'
94- Cmd . execute ( get_last_commit_message_cmd )
94+ Cmd . execute_successfully ( get_last_commit_message_cmd )
9595 end
9696
9797 def generate_pmd_report ( project )
@@ -107,14 +107,16 @@ def generate_pmd_report(project)
107107 "#{ auxclasspath_option } " \
108108 "#{ pmd7? ? ' --no-progress' : '' } "
109109 start_time = Time . now
110+ exit_code = nil
110111 if File . exist? ( project . get_pmd_report_path ( @pmd_branch_name ) )
111112 logger . warn "#{ @pmd_branch_name } : Skipping PMD run - report " \
112113 "#{ project . get_pmd_report_path ( @pmd_branch_name ) } already exists"
113114 else
114- Cmd . execute ( pmd_cmd )
115+ status = Cmd . execute ( pmd_cmd , project . get_project_target_dir ( @pmd_branch_name ) )
116+ exit_code = status . exitstatus
115117 end
116118 end_time = Time . now
117- [ end_time - start_time , end_time ]
119+ [ end_time - start_time , end_time , exit_code ]
118120 end
119121
120122 def generate_config_for ( project )
@@ -141,12 +143,12 @@ def generate_pmd_reports
141143 progress_logger = SimpleProgressLogger . new ( "generating #{ project . name } 's PMD report" )
142144 progress_logger . start
143145 generate_config_for ( project )
144- execution_time , end_time = generate_pmd_report ( project )
146+ execution_time , end_time , exit_code = generate_pmd_report ( project )
145147 progress_logger . stop
146148 sum_time += execution_time
147149
148- report_details = PmdReportDetail . new ( execution_time : execution_time , timestamp : end_time )
149- report_details . save ( project . get_report_info_path ( @pmd_branch_name ) )
150+ PmdReportDetail . create ( execution_time : execution_time , timestamp : end_time ,
151+ exit_code : exit_code , report_info_path : project . get_report_info_path ( @pmd_branch_name ) )
150152 logger . info "#{ project . name } 's PMD report was generated successfully"
151153 end
152154
@@ -169,7 +171,7 @@ def build
169171 def checkout_build_branch
170172 logger . info "#{ @pmd_branch_name } : Checking out the branch"
171173 # note that this would fail if the tree is dirty
172- Cmd . execute ( "git checkout #{ @pmd_branch_name } " )
174+ Cmd . execute_successfully ( "git checkout #{ @pmd_branch_name } " )
173175
174176 # determine the version
175177 @pmd_version = determine_pmd_version
@@ -195,7 +197,7 @@ def saved_distro_path(build_sha)
195197 end
196198
197199 def wd_has_dirty_git_changes
198- !Cmd . execute ( 'git status --porcelain' ) . empty?
200+ !Cmd . execute_successfully ( 'git status --porcelain' ) . empty?
199201 end
200202
201203 def should_use_long_cli_options
0 commit comments