Giter Club home page Giter Club logo

Comments (5)

alokpr avatar alokpr commented on September 27, 2024 1

Thanks for the pointers. I will give it a shot.

from target-determinator.

alokpr avatar alokpr commented on September 27, 2024

I think for each affected target bazel cquery --config=asan "config(target, id)" must be called to check if the target should be selected.

https://bazel.build/query/cquery#config

from target-determinator.

illicitonion avatar illicitonion commented on September 27, 2024

Thanks for the bug report! Yeah, this makes sense - I think the right place for us to fix this is in MatchingTargets:

// MatchingTargets stores the top-level targets within a repository,
// i.e. those matching the Bazel pattern `...`.
type MatchingTargets struct {
labels *ss.SortedSet[label.Label]
labelsToConfigurations map[label.Label]*ss.SortedSet[Configuration]
}
func (mt *MatchingTargets) Labels() []label.Label {
return mt.labels.SortedSlice()
}
func (mt *MatchingTargets) ConfigurationsFor(label label.Label) []Configuration {
return mt.labelsToConfigurations[label].SortedSlice()
}
func (mt *MatchingTargets) ContainsLabelAndConfiguration(label label.Label, configuration Configuration) bool {
configurations, ok := mt.labelsToConfigurations[label]
if !ok {
return false
}
return configurations.Contains(configuration)
}

There are two approaches I can see to going about changing it:

  1. Either when we're populating it, or when we're returning targets, run a cquery like this to filter to just the targets in the right configuration
  2. We do have all of the configuration details in this struct, we just don't use it - if we knew the configuration we wanted to build for, we could do this just with in-memory map lookups without needing to call out to Bazel again

I'd probably lean towards 1 because a clear "filter via an opaque call to bazel" is more obviously correct than "work out the correct configuration ID and filter by it", but I think either could work.

Could I interest you in putting together a PR? I imagine it would take the shape of running one more cquery to filter this slice:

labels: ss.NewSortedSetFunc(labels, CompareLabels),
and possibly only conditionally doing so based on a new field in Context (because some users may want the superset for other analysis reasons, rather than to perform platform filtering)

from target-determinator.

alokpr avatar alokpr commented on September 27, 2024

Hi Daniel, I looked into your suggestions. I have not yet decided which option to use. But was wondering if the second one is even feasible. Is this information available somewhere - "if we knew the configuration we wanted to build for"? Is there a command to query the configuration id given bazel-opts?

from target-determinator.

illicitonion avatar illicitonion commented on September 27, 2024

Is there a command to query the configuration id given bazel-opts?

After running bazel cquery, if you run bazel config, you'll get a dump of configurations which exist - some will be explicitly labelled as "exec" or "host" configs, and others won't be. I believe any that aren't exec or host, are target configs which we may be attempting to build for. But I'll be honest - I'm not completely sure on this part. It definitely leads me to prefer approach 1, but if someone wants to do the research to work out a viable way to do 2, that could be interesting too :)

from target-determinator.

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.