#NEWLINE# def make_jar( self ) : #NEWLINE# #INDENT# '\n        move all .class files to compiled.jar\n        ' #NEWLINE# self . log . debug ( 'Making .jar started' ) #NEWLINE# with open ( os . path . join ( self . artifacts_dir , 'jar.out' ) , 'ab' ) as jar_out : #NEWLINE# #INDENT# with open ( os . path . join ( self . artifacts_dir , 'jar.err' ) , 'ab' ) as jar_err : #NEWLINE# #INDENT# class_files = [ java_file for java_file in os . listdir ( self . working_dir ) if java_file . endswith ( '.class' ) ] #NEWLINE# jar_name = self . settings . get ( 'jar-name' , 'compiled.jar' ) #NEWLINE# if class_files : #NEWLINE# #INDENT# compile_jar_cl = [ 'jar' , '-cf' , err_file ] #NEWLINE# compile_jar_cl . extend ( class_files ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# package_dir = os . listdir ( self . working_dir ) [ 0 ] #NEWLINE# compile_jar_cl = [ 'jar' , '-cf' , jar_name , '-C' , package_dir , '.' ] #NEWLINE# #UNINDENT# self . log . debug ( 'running jar: %s' , compile_jar_cl ) #NEWLINE# self . process = shell_exec ( compile_jar_cl , cwd = self . working_dir , stdout = jar_out , stderr = jar_err ) #NEWLINE# ret_code = self . process . poll ( ) #NEWLINE# while ( ret_code is None ) : #NEWLINE# #INDENT# self . log . debug ( 'Making jar file...' ) #NEWLINE# time . sleep ( 1 ) #NEWLINE# ret_code = self . process . poll ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ret_code != 0 ) : #NEWLINE# #INDENT# with open ( jar_err . name ) as err_file : #NEWLINE# #INDENT# out = err_file . read ( ) #NEWLINE# #UNINDENT# self . log . info ( 'Making jar failed with code %s' , ret_code ) #NEWLINE# self . log . info ( 'jar output: %s' , out ) #NEWLINE# raise RuntimeError ( 'Jar exited with non-zero code' ) #NEWLINE# #UNINDENT# self . log . info ( 'Making .jar file completed' )