Do not use desugared library for recompilation to CF

Bug: 152155164
Fixes: 172805469
Fixes: 172805505
Change-Id: Ibc396692ac07cb228a7cb29342e9afdf2b4ee7fe
diff --git a/tools/compiledump.py b/tools/compiledump.py
index 4c57722..0369ba4 100755
--- a/tools/compiledump.py
+++ b/tools/compiledump.py
@@ -88,6 +88,12 @@
     help='Set desugared-library (default set from dump)',
     default=None)
   parser.add_argument(
+    '--disable-desugared-lib',
+    help='Disable desugared-libary if it will be set from dump',
+    default=False,
+    action='store_true'
+  )
+  parser.add_argument(
     '--loop',
     help='Run the compilation in a loop',
     default=False,
@@ -291,7 +297,7 @@
       cmd.extend(['--lib', dump.library_jar()])
     if dump.classpath_jar():
       cmd.extend(['--classpath', dump.classpath_jar()])
-    if dump.desugared_library_json():
+    if dump.desugared_library_json() and not args.disable_desugared_lib:
       cmd.extend(['--desugared-lib', dump.desugared_library_json()])
     if compiler != 'd8' and dump.config_file():
       if hasattr(args, 'config_file_consumer') and args.config_file_consumer:
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index d180bd5..d3a00bd 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -210,8 +210,6 @@
     'url': 'https://github.com/TeamNewPipe/NewPipe',
     'revision': 'f4435f90313281beece70c544032f784418d85fa',
     'folder': 'newpipe',
-    # TODO(b/172805505): Recompilation fails
-    'skip_recompilation': True,
   }),
   # TODO(b/172806808): Monkey runner does not work.
   App({
@@ -660,6 +658,7 @@
     'nolib': not is_minified_r8(shrinker),
     'config_file_consumer': remove_print_lines,
     'properties': app.compiler_properties,
+    'disable_desugared_lib': False,
   })
 
   app_jar = os.path.join(
@@ -683,6 +682,7 @@
     if compilation_step_index < compilation_steps - 1:
       args['classfile'] = True
       args['min_api'] = "10000"
+      args['disable_desugared_lib'] = True
       compile_result = compiledump.run1(compile_temp_dir, args, [])
       if compile_result == 0:
         recomp_jar = os.path.join(