-
-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev dependencies are written into the app list in .app.src #3035
Comments
The compiler (or rebar3?) also warns
and indeed |
I guess this is the place responsible (suitable TODO here 😁): gleam/compiler-core/src/codegen.rs Lines 114 to 138 in 55a4e58
|
Whether dev deps are included is controlled by this line:
We could turn it to |
Would it ever make sense to include dev deps in prod? Cause the project compiler already has the mode for dev vs prod so unless there is a reason we would want to keep dev deps in prod we could always update that line to check |
But, do we ever use the prod mode? I was under the impression that we don't have prod builds. That's what I meant by having a dev/prod distinction, i.e. do we need to start using prod builds? A lighter alternative could be to detect when building for Hex upload and not including dev deps then? |
Yeah there are a couple places where the compiler looks at the mode to determine what to do though i know for javascript generation specifically it ignores the mode. For example https://github.com/gleam-lang/gleam/blob/main/compiler-core/src/build/package_loader.rs#L214 the package loader doesn't load test modules in prod. This seems like it would fall under the same category? |
Hmm, I guess I'll try it out and see. 👍 |
I made this change: diff --git a/compiler-core/src/build/project_compiler.rs b/compiler-core/src/build/project_compiler.rs
index de2f2006..79eea3d6 100644
--- a/compiler-core/src/build/project_compiler.rs
+++ b/compiler-core/src/build/project_compiler.rs
@@ -517,7 +517,7 @@ where
.collect();
super::TargetCodegenConfiguration::Erlang {
app_file: Some(ErlangAppCodegenConfiguration {
- include_dev_deps: is_root,
+ include_dev_deps: self.mode() != Mode::Prod,
package_name_overrides,
}),
} After running {application, bigi, [
{vsn, "3.0.0"},
{applications, [gleam_stdlib]},
{description, "Arbitrary precision integer arithmetic for Gleam"},
{modules, [bigi]},
{registered, []}
]}. After running just {application, bigi, [
{vsn, "3.0.0"},
{applications, [gleam_stdlib,
gleeunit]},
{description, "Arbitrary precision integer arithmetic for Gleam"},
{modules, [bigi,
bigi_test]},
{registered, []}
]}. So it seems to work. Is there something specific I should test? This does not seem to be tested directly as the only mention of |
It'd be good to have a test for the contents of the Hex tarball if that's something we don't already have. |
There is a |
See the
gleam.toml
in https://preview.hex.pm/preview/bigi/3.0.0/show/gleam.toml,gleeunit
is only a development dependency. But in the created.app.src
,gleeunit
is included as a dependency application: https://preview.hex.pm/preview/bigi/3.0.0/show/src/bigi.app.src.Context: I managed to get
bigi
compiling in Elixir by putting{:bigi, "~> 3.0", manager: :rebar3}
inmix.exs
, but trying to run fails due to not havinggleeunit
. If I edit_build/dev/lib/bigi/ebin/bigi.app
and removegleeunit
manually, I can open IEx and runbigi
code successfully! :)The text was updated successfully, but these errors were encountered: