Skip to content
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

Update dependencies - take 2 #17

Merged
merged 6 commits into from
Feb 10, 2022
Merged

Update dependencies - take 2 #17

merged 6 commits into from
Feb 10, 2022

Conversation

facundominguez
Copy link
Member

No description provided.

- nixpkgs so now it is using bazel 4.2.1:
https://lazamar.co.uk/nix-versions/?channel=nixos-unstable&package=bazel
- rules_haskell to latest release
- rules_go to 0.30.0
- ghc to 8.10.7
@facundominguez
Copy link
Member Author

facundominguez commented Feb 10, 2022

Tests weren't passing in main yet, so I reverted the changes of #15 and #16 and created this PR which does run CI. Feel free to amend it here.

@kczulko
Copy link
Contributor

kczulko commented Feb 10, 2022

@facundominguez

It turns out that haskell_binary for //package-a:bench-b wants to have main_file attribute filled... Do you have any idea what could cause this requirement to appear?

Traceback (most recent call last):
	File "/var/lib/buildkite-agent-agent/.cache/bazel/_bazel_buildkite-agent-agent/e8a5da19fef7f5fb3305a1799d9fb92e/external/rules_haskell/haskell/private/haskell_impl.bzl", line 98, column 39, in haskell_binary_impl
		return _haskell_binary_common_impl(ctx, is_test = False)
	File "/var/lib/buildkite-agent-agent/.cache/bazel/_bazel_buildkite-agent-agent/e8a5da19fef7f5fb3305a1799d9fb92e/external/rules_haskell/haskell/private/haskell_impl.bzl", line 208, column 40, in _haskell_binary_common_impl
		module_map = determine_module_names(srcs_files, not main_as_haskell_module, ctx.attr.main_function, ctx.file.main_file)
	File "/var/lib/buildkite-agent-agent/.cache/bazel/_bazel_buildkite-agent-agent/e8a5da19fef7f5fb3305a1799d9fb92e/external/rules_haskell/haskell/private/path_utils.bzl", line 137, column 21, in determine_module_names
		fail("""\

Error in fail: No source file defining the main module 'Main'.
You may need to set the 'main_file' attribute.

�[32mAnalyzing:�[0m 18 targets (19 packages loaded, 2295 targets configured)
�[1A�[K�[31m�[1mERROR: �[0mAnalysis of target '//package-a:bench-b' failed; build aborted: Analysis of target '//package-a:bench-b' failed

Indeed, setting the main_file attribute fixed this issue locally on my setup.

 haskell_binary(
     name = "bench-b",
+    main_file = "app/MainB.hs",
+    srcs = [
+        "app/MainB.hs",
+        "app/PackageA/Other/C.hs",
+    ],
     compiler_flags = [
         "-DSOME_VALUE=1",  # keep
+        "-DVERSION_package_a=\"0.1.0.0\"",

Funny thing is that app/MainB.hs defines Main module :) Does it mean we should pass main_is attribute from .cabal to BUILD.bazel ?

@facundominguez
Copy link
Member Author

Funny thing is that app/MainB.hs defines Main module :) Does it mean we should pass main_is attribute from .cabal to BUILD.bazel ?

That is a good idea for a feature request. It may only be necessary if the main file isn't called Main.hs.

I think main_file became necessary as part of tweag/rules_haskell#1281.

@kczulko
Copy link
Contributor

kczulko commented Feb 10, 2022

You're right... :bench-a target build without any objections and that's probably because the file is named there Main.hs. No need to add main_file attribute in that case.

So in order to proceed with this PR I propose to:

  • manually add main_file for :bench-b target to fix the build,
  • add a feature request issue for handling main_is cabal's attribute,
  • create an issue under rules_haskell about misleading error msg: Error in fail: No source file defining the main module 'Main'.

Best regards,
Karol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants