@@ -771,16 +771,27 @@ namespace :java do
771771 task :dependencies do
772772 file_path = 'java/maven_deps.bzl'
773773 content = File . read ( file_path )
774+ # For some reason ./go wrapper is not outputting from Open3, so cannot use Bazel class directly
775+ output = `bazel run @maven//:outdated`
774776
775- Bazel . execute ( 'run' , [ ] , '@maven//:outdated' ) do |output |
776- versions = output . scan ( /(\S +) \[ \S + -> (\S +)\] / ) . to_h
777- versions . each do |artifact , version |
778- next if artifact . match? ( 'graphql' )
779- content . gsub! ( /#{ artifact } :\d +\. \d +[^\\ "]+/ , "#{ artifact } :#{ version } " )
780- end
777+ output . scan ( /\S + \[ \S +-alpha\] / ) . each do |match |
778+ puts "WARNING — Cannot automatically update alpha version of: #{ match } "
781779 end
782780
781+ versions = output . scan ( /(\S +) \[ \S + -> (\S +)\] / ) . to_h
782+ versions . each do |artifact , version |
783+ if artifact . match? ( 'graphql' )
784+ puts "WARNING — Cannot automatically update graphql"
785+ next
786+ end
787+
788+ replacement = artifact . include? ( 'googlejavaformat' ) ? "#{ artifact } :jar:#{ version } " : "#{ artifact } :#{ version } "
789+ content . gsub! ( /#{ artifact } :(jar:)?\d +\. \d +[^\\ "]+/ , replacement )
790+ end
783791 File . write ( file_path , content )
792+
793+ args = [ '--action_env=RULES_JVM_EXTERNAL_REPIN=1' ]
794+ Bazel . execute ( 'run' , args , '@unpinned_maven//:pin' )
784795 end
785796
786797 desc 'Update Java version'
0 commit comments