Esempio n. 1
0
 def testNoJars(self):
     aar = zipfile.ZipFile(StringIO.StringIO(), "w")
     param_file = StringIO.StringIO()
     aar_embedded_jars_extractor.ExtractEmbeddedJars(
         aar, param_file, "out_dir")
     self.assertEqual([], os.listdir("out_dir"))
     param_file.seek(0)
     self.assertEqual("--exclude_build_data\n", param_file.read())
Esempio n. 2
0
 def testOnlyClassesJar(self):
     aar = zipfile.ZipFile(StringIO.StringIO(), "w")
     aar.writestr("classes.jar", "")
     param_file = StringIO.StringIO()
     aar_embedded_jars_extractor.ExtractEmbeddedJars(
         aar, param_file, "out_dir")
     self.assertEqual(["classes.jar"], os.listdir("out_dir"))
     param_file.seek(0)
     self.assertEqual(
         ["--exclude_build_data\n", "--sources\n", "out_dir/classes.jar\n"],
         param_file.readlines())
 def testClassesJarAndLibsJars(self):
     aar = zipfile.ZipFile(StringIO.StringIO(), "w")
     aar.writestr("classes.jar", "")
     aar.writestr("libs/a.jar", "")
     aar.writestr("libs/b.jar", "")
     param_file = StringIO.StringIO()
     os.makedirs("out_dir")
     aar_embedded_jars_extractor.ExtractEmbeddedJars(
         aar, param_file, "out_dir")
     self.assertItemsEqual(["classes.jar", "libs"], os.listdir("out_dir"))
     self.assertItemsEqual(["a.jar", "b.jar"], os.listdir("out_dir/libs"))
     param_file.seek(0)
     self.assertEqual([
         "--exclude_build_data\n", "--sources\n", "out_dir/classes.jar\n",
         "--sources\n", "out_dir/libs/a.jar\n", "--sources\n",
         "out_dir/libs/b.jar\n"
     ], param_file.readlines())