Giter Club home page Giter Club logo

Comments (5)

SrodriguezO avatar SrodriguezO commented on May 29, 2024

@bjchambers thanks for filing this issue and for including a test that catches it. This does seem like a bug. I'll see if we can get a fix in over the next couple days.

from rules_scala.

bjchambers avatar bjchambers commented on May 29, 2024

It looks like this is an issue with the C++ implementation of singlejar. If I'm reading this right:

INFO: From singlejar resources plain:
singlejar_local: src/tools/singlejar/output_jar.cc:923: Duplicate resource name reference.conf in the --classpath_resource or --resource option

If I look at
https://github.com/bazelbuild/bazel/blob/master/src/tools/singlejar/output_jar.cc#L933
I see this, which makes it look the resource is skipped if it is already present and warn_duplicate_resources is on:

  if (known_members_.count(resource_name)) {
    if (options_->warn_duplicate_resources) {
      diag_warnx(
          "%s:%d: Duplicate resource name %s in the --classpath_resource or "
          "--resource option",
          __FILE__, __LINE__, resource_name.c_str());
      // TODO(asmundak): this mimics old behaviour. Confirm that unless
      // we run with --warn_duplicate_resources, the output zip file contains
      // the concatenated contents of the all the resources with the same name.
      return;
    }
  }

Later in the same file, I see:

void OutputJar::ExtraCombiner(const std::string &entry_name,
                              Combiner *combiner) {
  extra_combiners_.emplace_back(combiner);
  known_members_.emplace(entry_name, EntryInfo{combiner});
}

And in the main file
https://github.com/bazelbuild/bazel/blob/master/src/tools/singlejar/singlejar_main.cc
I see:

  output_jar.ExtraCombiner("reference.conf",
                           new Concatenator("reference.conf"));

Comparing bazel aquery :plain to bazel aquery :plain_java reveals the java_library doesn't pass the warn_duplicate_resources, and removing it from the rules/common/private/utils.bzl fixes the test (see second commit in the PR).

from rules_scala.

SrodriguezO avatar SrodriguezO commented on May 29, 2024

Very interesting. Good find! I'm surprised that Bazel skips the resource altogether if warn_duplicate_resources is specified..

I think the solution here is, as you saw, to stop passing that flag. If you'd like to promote your draft PR to a regular PR I will gladly approve it :)

from rules_scala.

bjchambers avatar bjchambers commented on May 29, 2024

Done -- Thanks!

from rules_scala.

SrodriguezO avatar SrodriguezO commented on May 29, 2024

Closed by #215

from rules_scala.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.