Giter Site home page Giter Site logo

rebar_gleam's People

Contributors

adambrodzinski avatar lpil avatar mgwidmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rebar_gleam's Issues

Module defined multiple times error

Hi!

When running rebar3 compile and then rebar3 eunit immediately after, this error appears:

$ rm -rf rebar.lock _build/ gen/* && rebar3 compile && rebar3 eunit
===> Fetching rebar_gleam v0.1.0
===> Analyzing applications...
===> Compiling rebar_gleam
===> Verifying dependencies...
===> Fetching gleam_stdlib v0.16.0
Compiling resistor_color
Compiling gleam/string_builder
Compiling gleam/should
Compiling resistor_color_test
Compiling gleam/pair
Compiling gleam/atom
Compiling gleam/bit_string
Compiling gleam/bit_builder
Compiling gleam/io
Compiling gleam/order
Compiling gleam/int
Compiling gleam/list
Compiling gleam/option
Compiling gleam/regex
Compiling gleam/result
Compiling gleam/map
Compiling gleam/queue
Compiling gleam/set
Compiling gleam/float
Compiling gleam/bool
Compiling gleam/dynamic
Compiling gleam/function
Compiling gleam/iterator
Compiling gleam/string
Compiling gleam/base
Compiling gleam/os
Compiling gleam/uri

warning: Unused variable
   โ”Œโ”€ /home/michal/projects/exercism-gleam/exercises/practice/resistor-color/src/resistor_color.gleam:14:13
   โ”‚
14 โ”‚ pub fn code(color: Color) -> Int {
   โ”‚             ^^^^^^^^^^^^ This variable is never used.

Hint: you can ignore it with an underscore: `_color`.
Done!
===> Analyzing applications...
===> Compiling gleam_stdlib
===> Analyzing applications...
===> Compiling resistor_color
gen/src/resistor_color.erl:19:6: Warning: variable 'Color' is unused

===> Verifying dependencies...

error: Duplicate module

The module `resistor_color` is defined multiple times.

First:  /home/michal/projects/exercism-gleam/exercises/practice/resistor-color/src/resistor_color.gleam
Second: /home/michal/projects/exercism-gleam/exercises/practice/resistor-color/src/resistor_color.gleam

===> Unable to compile Gleam project

Project: https://github.com/exercism/gleam/tree/main/exercises/practice/resistor-color

Gleam 0.16.0, rebar 3.16.1, erlang 24.0.2

New compiler API

I'm looking to write a new rebar3 plugin for the new compiler API

The API

The API is to be called once per Erlang application within the project, starting with the left applications that have no deps, up to the root, so that dependancy modules are compiled before dependant modules.

It looks something like this:

gleam compile-package \
  --name app_name \
  --src directory/containing/gleam/files \
  --out directory/to/write/to \
  --lib path/to/out/dir/of/dep \
  --lib path/to/out/dir/of/another/dep # ...etc

It reads metadata files from the --lib directories for type information from already compiled Gleam applications, then it reads all the Gleam files from --src, then it writes compiled Erlang files and metadata files to the --out directory.

rebar3 integration

I have been looking at the rebar_compiler behaviour, but it seems to be focused on compiling individual files, but the Gleam compiler operates at the application level.
https://github.com/erlang/rebar3/blob/dd9b8b1f41520c307f08b6005eb77ce70d54ee42/src/rebar_compiler.erl#L34

I found a project_builder concept here. It is just a build/1 function that returns ok or an error tuple.

https://github.com/erlang/rebar3/blob/dd9b8b1f41520c307f08b6005eb77ce70d54ee42/src/rebar_state.erl#L446

Questions

How does the project_type field get set? https://github.com/erlang/rebar3/blob/73aa64fb342ef76bf6fc4d1734c6df711bebe5ab/src/rebar_prv_compile.erl#L326-L339

How do we invoke the normal rebar3 build process after the Gleam project builder has run?

@tsloughter If have a spare moment I would be very grateful if you could share whether you think I'm going in the right direction. Thank you! ๐Ÿ™

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.