Giter Site home page Giter Site logo

Comments (2)

chrismgrayftsinc avatar chrismgrayftsinc commented on July 21, 2024 1

Yeah I can probably do that -- no timeline though.

from rules_jvm.

illicitonion avatar illicitonion commented on July 21, 2024

Sounds very sensible - can I interest you in putting together a PR?

This is where we parse out the metadata of jar files:

func NewResolver(installFile string, logger zerolog.Logger) (Resolver, error) {
r := resolver{
data: multiset.NewStringMultiSet(),
logger: logger.With().Str("_c", "maven-resolver").Logger(),
}
c, err := loadConfiguration(installFile)
if err != nil {
r.logger.Warn().Err(err).Msg("not loading maven dependencies")
return &r, nil
}
r.logger.Debug().Int("count", len(c.DependencyTree.Dependencies)).Msg("Dependency count")
r.logger.Debug().Str("conflicts", fmt.Sprintf("%#v", c.DependencyTree.ConflictResolution)).Msg("Maven install conflict")
for _, dep := range c.DependencyTree.Dependencies {
for _, pkg := range dep.Packages {
c, err := ParseCoordinate(dep.Coord)
if err != nil {
return nil, fmt.Errorf("failed to parse coordinate %v: %w", dep.Coord, err)
}
l := label.New("maven", "", bazel.CleanupLabel(c.ArtifactString()))
r.data.Add(pkg, l.String())
}
}
return &r, nil
}

And this is where we parse out directives:

for _, d := range f.Directives {
switch d.Key {
case javaconfig.JavaExtensionDirective:
switch d.Value {
case "enabled":
cfg.SetExtensionEnabled(true)
case "disabled":
cfg.SetExtensionEnabled(false)
default:
jc.lang.logger.Fatal().Msgf("invalid value for directive %q: %s: possible values are enabled/disabled",
javaconfig.JavaExtensionDirective, d.Value)
}
case javaconfig.MavenInstallFile:
cfg.SetMavenInstallFile(d.Value)
case javaconfig.ModuleGranularityDirective:
if err := cfg.SetModuleGranularity(d.Value); err != nil {
jc.lang.logger.Fatal().Err(err).Msgf("invalid value for directive %q", javaconfig.ModuleGranularityDirective)
}
case javaconfig.TestMode:
cfg.SetTestMode(d.Value)
}
}
}

Wiring things up between the two should be pretty easy :)

from rules_jvm.

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.