-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes the default GHC version publicly accessible and introduces a new repository which uses the default GHC version if not already defined.
- Loading branch information
Showing
5 changed files
with
39 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# If you change this, change stackage's version in the start script | ||
# (see stackage.org). | ||
|
||
# Currently, we are using GHC 9.2.x as default. | ||
DEFAULT_GHC_VERSION = "9.2.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
load("@rules_haskell//haskell:ghc.bzl", "DEFAULT_GHC_VERSION") | ||
|
||
def _init_ghc_version_repository(repository_ctx, GHC_VERSION): | ||
repository_ctx.file("BUILD") | ||
repository_ctx.file("ghc_version.bzl", content = "GHC_VERSION = {}".format(repr(GHC_VERSION))) | ||
|
||
def _ghc_version_impl(repository_ctx): | ||
ghc_version = repository_ctx.os.environ.get("GHC_VERSION") | ||
GHC_VERSION = repository_ctx.os.environ.get("GHC_VERSION") | ||
|
||
if ghc_version: | ||
print("Using GHC version {} from env variable `GHC_VERSION`".format(ghc_version)) | ||
if GHC_VERSION: | ||
print("Using GHC version {} from env variable `GHC_VERSION`".format(GHC_VERSION)) | ||
|
||
repository_ctx.file("BUILD") | ||
repository_ctx.file("ghc_version.bzl", content = "GHC_VERSION = {}".format(repr(ghc_version))) | ||
_init_ghc_version_repository(repository_ctx, GHC_VERSION) | ||
|
||
ghc_version = repository_rule( | ||
implementation = _ghc_version_impl, | ||
environ = ["GHC_VERSION"], | ||
configure = True, | ||
) | ||
|
||
|
||
def _ghc_default_version_impl(repository_ctx): | ||
_init_ghc_version_repository(repository_ctx, DEFAULT_GHC_VERSION) | ||
|
||
ghc_default_version = repository_rule( | ||
implementation = _ghc_default_version_impl, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters