@@ -231,6 +231,37 @@ def ensure_test_options(self) -> None:
231231 def remove_dex_options (self ) -> None :
232232 self .content = re .sub (r"\s*dexOptions\s*\{[^{}]*\}\s*" , "\n " , self .content )
233233
234+ def convert_lint_options (self ) -> None :
235+ block = self ._find_block ("lintOptions" , parent = "android" )
236+ if not block :
237+ return
238+ block_text = self .content [block [0 ]:block [1 ]]
239+ start = block_text .find ('{' )
240+ end = block_text .rfind ('}' )
241+ if start == - 1 or end == - 1 or end <= start :
242+ self .content = (
243+ self .content [:block [0 ]]
244+ + " lint {\n }\n "
245+ + self .content [block [1 ]:]
246+ )
247+ return
248+ body = block_text [start + 1 : end ]
249+ lines = []
250+ for line in body .splitlines ():
251+ stripped = line .strip ()
252+ if not stripped :
253+ lines .append ("" )
254+ else :
255+ lines .append (f" { stripped } " )
256+ joined = "\n " .join (lines )
257+ if joined :
258+ joined = joined + "\n "
259+ replacement = f" lint {{\n { joined } }}\n "
260+ self .content = self .content [:block [0 ]] + replacement + self .content [block [1 ]:]
261+
262+ def remove_jcenter (self ) -> None :
263+ self .content = re .sub (r"^\s*jcenter\(\)\s*$\n?" , "" , self .content , flags = re .MULTILINE )
264+
234265 def ensure_dependencies (self ) -> None :
235266 block = self ._find_dependencies_block ()
236267 if not block :
@@ -318,6 +349,8 @@ def apply(self) -> None:
318349 self .ensure_default_config ()
319350 self .ensure_test_options ()
320351 self .remove_dex_options ()
352+ self .convert_lint_options ()
353+ self .remove_jcenter ()
321354 self .ensure_dependencies ()
322355
323356 def summary (self ) -> str :
0 commit comments