gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
17.83k stars 745 forks source link

Dependencies using rebar causes gleam build to exit with error #2291

Closed emilpersson closed 7 months ago

emilpersson commented 1 year ago

Dependencies using rebar causes gleam build to exit with the following message:

error: Unsupported build tool

The package base64url cannot be built as it does not use a build tool
supported by Gleam. It uses ["rebar"].

Steps to reproduce:

gleam new jwt_rebar_package
cd jwt_rebar_package
gleam add jwt
gleam build

manifest.toml:

# This file was generated by Gleam
# You typically do not need to edit this file

packages = [
  { name = "base64url", version = "0.0.1", build_tools = ["rebar"], requirements = [], otp_app = "base64url", source = "hex", outer_checksum = "FAB09B20E3F5DB886725544CBCF875B8E73EC93363954EB8A1A9ED834AA8C1F9" },
  { name = "gleam_stdlib", version = "0.30.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "03710B3DA047A3683117591707FCA19D32B980229DD8CE8B0603EB5B5144F6C3" },
  { name = "gleeunit", version = "0.10.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "ECEA2DE4BE6528D36AFE74F42A21CDF99966EC36D7F25DEB34D47DD0F7977BAF" },
  { name = "jsx", version = "2.8.3", build_tools = ["mix", "rebar3"], requirements = [], otp_app = "jsx", source = "hex", outer_checksum = "FC3499FED7A726995AA659143A248534ADC754EBD16CCD437CD93B649A95091F" },
  { name = "jwt", version = "0.1.11", build_tools = ["rebar3"], requirements = ["base64url", "jsx"], otp_app = "jwt", source = "hex", outer_checksum = "B483FBB786D1BD050B3C551D323112D604E5B0F9CF9DC5671ADEEC462C2E36BB" },
]

[requirements]
gleam_stdlib = { version = "~> 0.30" }
gleeunit = { version = "~> 0.10" }
jwt = { version = "~> 0.1" }
lpil commented 1 year ago

Thank you! Let's get this fixed 💜

I think we may be able to use the existing rebar3 compiler to compile rebar projects, but I have not verified this.

isaacharrisholt commented 7 months ago

Hey, it looks like just changing rebar to rebar3 in the manifest.toml works, so it should be all good to just use rebar3 instead? Could be totally wrong here, and more testing is probably needed, but, since it's already broken, there's potential to implement the naive fix for now nad deal with edge cases as they crop up

lpil commented 7 months ago

I'm not sure what the support is for these projects, let's try ask our local Erlang wizard. :)

@tsloughter is rebar3 expected to be able to compile rebar projects?

tsloughter commented 7 months ago

Basic ones will compile. Like no plugins or hooks.

lpil commented 7 months ago

What do you think of Gleam using rebar3 to compile rebar deps?

tsloughter commented 7 months ago

Worth a shot. In this case it looks like the app should compile fine.

lpil commented 7 months ago

Fab, thank you!