2d515b55b25a62b1f5961955e977e2fce4ae511e,tests/python/pants_test/backend/jvm/tasks/test_binary_create.py,TestBinaryCreate,test_jvm_binaries_deploy_excludes,#TestBinaryCreate#,57

Before Change


                                            conf="default",
                                            resolved_jars=[foo_artifact, baz_artifact])

    with self.add_data(context.products, "classes_by_target", binary_target, "Bar.class"):
      with self.add_data(context.products, "resources_by_target", binary_target, "bar.txt"):
        self.execute(context)
        jvm_binary_products = context.products.get("jvm_binaries")
        self.assertIsNotNone(jvm_binary_products)
        product_data = jvm_binary_products.get(binary_target)
        dist_root = os.path.join(self.build_root, "dist")
        self.assertEquals({dist_root: ["bar-binary.jar"]}, product_data)

        with open_zip(os.path.join(dist_root, "bar-binary.jar")) as jar:
          self.assertEqual(sorted(["META-INF/",
                                   "META-INF/MANIFEST.MF",
                                   "foo/",
                                   "foo/Foo.class",
                                   "Bar.class",
                                   "bar.txt"]),
                           sorted(jar.namelist()))

After Change


    foo_jar_lib = self.make_target(spec="3rdparty/jvm/org/example:foo",
                                   target_type=JarLibrary,
                                   jars=[JarDependency(org="org.example", name="foo", rev="1.0.0")])
    binary_target = self.make_target(spec="//bar:bar-binary",
                                     target_type=JvmBinary,
                                     source="Bar.java",
                                     dependencies=[foo_jar_lib],
                                     deploy_excludes=[Exclude(org="org.pantsbuild")])
    context = self.context(target_roots=[binary_target])
    classpath_products = self.ensure_classpath_products(context)

    foo_artifact = self.create_artifact(org="org.example", name="foo", rev="1.0.0")
    with open_zip(foo_artifact.pants_path, "w") as jar:
      jar.writestr("foo/Foo.class", "")

    baz_artifact = self.create_artifact(org="org.pantsbuild", name="baz", rev="2.0.0")
    with open_zip(baz_artifact.pants_path, "w") as jar:
      // This file should not be included in the binary jar since org.pantsbuild is deploy excluded.
      jar.writestr("baz/Baz.class", "")

    classpath_products.add_jars_for_targets(targets=[foo_jar_lib],
                                            conf="default",
                                            resolved_jars=[foo_artifact, baz_artifact])

    self.add_to_runtime_classpath(context, binary_target, {"Bar.class": "", "bar.txt": ""})

    self.execute(context)
    jvm_binary_products = context.products.get("jvm_binaries")
    self.assertIsNotNone(jvm_binary_products)
    product_data = jvm_binary_products.get(binary_target)
    dist_root = os.path.join(self.build_root, "dist")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: tests/python/pants_test/backend/jvm/tasks/test_binary_create.py
Class Name: TestBinaryCreate
Method Name: test_jvm_binaries_deploy_excludes


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: tests/python/pants_test/backend/jvm/tasks/test_binary_create.py
Class Name: TestBinaryCreate
Method Name: test_jvm_binaries_products


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: tests/python/pants_test/backend/jvm/tasks/test_binary_create.py
Class Name: TestBinaryCreate
Method Name: test_jvm_binaries_deploy_excludes


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: tests/python/pants_test/backend/jvm/tasks/test_bundle_create.py
Class Name: TestBundleCreate
Method Name: test_jvm_bundle_products