Coder Social home page Coder Social logo

Comments (4)

tim2CF avatar tim2CF commented on June 24, 2024

Not sure what exactly happen, but this change did solve the transitive dependency issue at least in my project
gleam-lang/mix_gleam#39

from gleam.

brunoparga avatar brunoparga commented on June 24, 2024

So, I have never written a line of Rust in my life, but I'm trying to follow what exactly causes this to happen, and think in general terms of a solution.

analyse::record_imported_items_for_use_detection emits the warning if !direct_dependencies.contains_key(&module_info.package) (and other conditions). I presume that if dependencies from mix.exs make their way into this direct_dependencies HashMap argument, the issue will be solved; I would like y'all's opinion on whether this is indeed the case and a desirable solution.

I tried to figure out how the dependencies from gleam.toml make their way to this direct_dependencies thingy. Here's the path of function calls I could identify:

  • analyse::record_imported_items_for_use_detection
  • analyse::infer_module
  • package_compiler::analyse (where dev dependencies are included if needed)
  • package_config.dependencies_for
  • package_compiler.compile
  • package_compiler.new (as that creates the config struct with the deps)

Here it branches into two paths, each reaching two very similar functions:

  • project_compiler.compile_gleam_package
  • project_compiler.compile_gleam_dep_package
  • package_config.read

-or-

  • compile_package::command
  • config::read

Both these read functions parse TOML. ProjectCompiler also has a compile_mix_dep_package method, which I don't know if it is related.

So, a few questions:
1 - should there really be these two almost identical read functions?
2 - how can they be modified to include dependencies from mix.exs so the transitive deps warning goes away?
3 - is this all anywhere near correct?

from gleam.

lpil avatar lpil commented on June 24, 2024

As Tynan says the solution is to have the gleam compile-package API not emit that warning ever, so it just needs to set some extra configuration on the package compiler which is passed to the analyser.

from gleam.

brunoparga avatar brunoparga commented on June 24, 2024

Yeah, that seems more complicated than I can do with zero Rust knowledge.

from gleam.

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.