@@ -73,15 +73,17 @@ def get_artifacts_from_pom(pom_path: str, build_artifacts: list, debug: bool):
7373
7474def main ():
7575 parser = argparse .ArgumentParser (description = 'Runs compilation, testing, and linting for the passed artifacts.' )
76- parser .add_argument ('--artifacts' , '--a' , type = str , default = None , help = 'Comma separated list of groupId:artifactId identifiers' )
77- parser .add_argument ('--poms' , '--p' , type = str , default = None , help = 'Comma separated list of POM paths' )
78- parser .add_argument ('--skip-tests' , '--st' , action = 'store_true' , help = 'Skips running tests' )
79- parser .add_argument ('--skip-javadocs' , '--sj' , action = 'store_true' , help = 'Skips javadoc generation' )
80- parser .add_argument ('--skip-checkstyle' , '--sc' , action = 'store_true' , help = 'Skips checkstyle linting' )
81- parser .add_argument ('--skip-spotbugs' , '--ss' , action = 'store_true' , help = 'Skips spotbugs linting' )
82- parser .add_argument ('--skip-revapi' , '--sr' , action = 'store_true' , help = 'Skips revapi linting' )
83- parser .add_argument ('--command-only' , '--co' , action = 'store_true' , help = 'Indicates that only the command should be generated and not ran' )
84- parser .add_argument ('--debug' , '--d' , action = 'store_true' , help = 'Generates command with verbose logging' )
76+ parser .add_argument ('--artifacts' , '-a' , type = str , default = None , help = 'Comma separated list of groupId:artifactId identifiers' )
77+ parser .add_argument ('--poms' , '-p' , type = str , default = None , help = 'Comma separated list of POM paths' )
78+ parser .add_argument ('--skip-tests' , '-st' , action = 'store_true' , help = 'Skips running tests' )
79+ parser .add_argument ('--skip-javadocs' , '-sj' , action = 'store_true' , help = 'Skips javadoc generation' )
80+ parser .add_argument ('--skip-checkstyle' , '-sc' , action = 'store_true' , help = 'Skips checkstyle linting' )
81+ parser .add_argument ('--skip-spotbugs' , '-ss' , action = 'store_true' , help = 'Skips spotbugs linting' )
82+ parser .add_argument ('--skip-revapi' , '-sr' , action = 'store_true' , help = 'Skips revapi linting' )
83+ parser .add_argument ('--skip-readme' , '-smd' , action = 'store_true' , help = 'Skips README validation' )
84+ parser .add_argument ('--skip-changelog' , '-scl' , action = 'store_true' , help = 'Skips CHANGELOG validation' )
85+ parser .add_argument ('--command-only' , '-co' , action = 'store_true' , help = 'Indicates that only the command should be generated and not ran' )
86+ parser .add_argument ('--debug' , '-d' , action = 'store_true' , help = 'Generates command with verbose logging' )
8587 args = parser .parse_args ()
8688
8789 if args .artifacts == None and args .poms == None :
@@ -101,23 +103,36 @@ def main():
101103 if build_artifacts .count == 0 :
102104 raise ValueError ('No build artifacts found.' )
103105
104- skip_arguments = []
106+ arguments = []
105107 if args .skip_tests :
106- skip_arguments .append ('"-DskipTests=true"' )
108+ arguments .append ('"-DskipTests=true"' )
107109
108110 if args .skip_javadocs :
109- skip_arguments .append ('"-Dmaven.javadocs.skip=true"' )
111+ arguments .append ('"-Dmaven.javadocs.skip=true"' )
110112
111113 if args .skip_checkstyle :
112- skip_arguments .append ('"-Dcheckstyle.skip=true"' )
114+ arguments .append ('"-Dcheckstyle.skip=true"' )
113115
114116 if args .skip_spotbugs :
115- skip_arguments .append ('"-Dspotbugs.skip=true"' )
117+ arguments .append ('"-Dspotbugs.skip=true"' )
116118
117119 if args .skip_revapi :
118- skip_arguments .append ('"-Drevapi.skip=true"' )
120+ arguments .append ('"-Drevapi.skip=true"' )
119121
120- maven_command = base_command .format (',' .join (list (set (build_artifacts ))), ' ' .join (skip_arguments ))
122+ if not args .skip_readme :
123+ arguments .append ('"-Dverify-readme"' )
124+
125+ if not args .skip_changelog :
126+ arguments .append ('"-Dverify-changelog"' )
127+
128+ # If Checkstyle, Spotbugs, or RevApi is being ran install sdk-build-tools to ensure the linting configuration is up-to-date.
129+ if not args .skip_checkstyle or not args .skip_spotbugs or not args .skip_revapi :
130+ if debug :
131+ print ('Installing sdk-build-tools as Checkstyle, Spotbugs, or RevApi linting is being performed.' )
132+
133+ os .system ('mvn install -f ' + os .path .join ('eng' , 'code-quality-reports' , 'pom.xml' ))
134+
135+ maven_command = base_command .format (',' .join (list (set (build_artifacts ))), ' ' .join (arguments ))
121136
122137 print ('Running Maven command: {}' .format (maven_command ))
123138
0 commit comments