Parcourir la source

Fix google-java-format/cipd exists check.

Bug: b/345761161
Change-Id: I3e3e7d84d962530b02a345d14ad8c15f57a49838
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5606286
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Joanna Wang il y a 1 an
Parent
commit
705b8d2d85
1 fichiers modifiés avec 8 ajouts et 6 suppressions
  1. 8 6
      google_java_format.py

+ 8 - 6
google_java_format.py

@@ -24,17 +24,19 @@ def FindGoogleJavaFormat():
             # Make relative to solution root if not an absolute path.
             return os.path.join(primary_solution_path, override)
 
-        path = os.path.join(primary_solution_path, 'third_party',
-                            'google-java-format', 'google-java-format')
+        bin_path = os.path.join(primary_solution_path, 'third_party',
+                                'google-java-format', 'google-java-format')
+        cipd_path = os.path.join(primary_solution_path, 'third_party',
+                                 'google-java-format', 'cipd',
+                                 'google-java-format.jar')
         # Check that the .jar exists, since it is conditionally downloaded via
         # DEPS conditions.
         # TODO(b/345761161): Remove old os.path.exists(path + '.jar') check,
         # when third_party/google-java-format
         #     -> third_party/google-java-format/cipd is fully rolled out.
-        if os.path.exists(path) and (
-                os.path.exists(path + '.jar')
-                or os.path.exists(os.path.join(path, 'cipd') + '.jar')):
-            return path
+        if os.path.exists(bin_path) and (os.path.exists(bin_path + '.jar')
+                                         or os.path.exists(cipd_path)):
+            return bin_path
     return None