mirror of
https://github.com/github/semantic.git
synced 2025-01-05 22:28:10 +03:00
rename the flags and condense around compilation_mode
This commit is contained in:
parent
20ac0523e3
commit
b034378ac2
2
.bazelrc
2
.bazelrc
@ -8,7 +8,7 @@ build --disk_cache=.bazel-cache/bazel-disk
|
||||
build --repository_cache=tmp/bazel-repo
|
||||
build --color=yes
|
||||
build --jobs=8
|
||||
|
||||
common --compilation_mode=fastbuild
|
||||
|
||||
# test environment does not propagate locales by default
|
||||
# some tests reads files written in UTF8, we need to propagate the correct
|
||||
|
15
BUILD.bazel
15
BUILD.bazel
@ -34,6 +34,21 @@ haskell_toolchain_library(name = "template-haskell")
|
||||
|
||||
haskell_toolchain_library(name = "transformers")
|
||||
|
||||
config_setting(
|
||||
name = "release",
|
||||
values = {"compilation_mode": "opt"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "development",
|
||||
values = {"compilation_mode": "fastbuild"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "debug",
|
||||
values = {"compilation_mode": "dbg"},
|
||||
)
|
||||
|
||||
haskell_repl(
|
||||
name = "hie-bios",
|
||||
collect_data = False,
|
||||
|
@ -7,8 +7,10 @@ load(
|
||||
)
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
STANDARD_GHC_WARNINGS = [
|
||||
"-O0",
|
||||
DEVELOPMENT_GHC_FLAGS = ["-O0"]
|
||||
RELEASE_GHC_FLAGS = ["-O1"]
|
||||
|
||||
GHC_FLAGS = [
|
||||
"-v1",
|
||||
"-j8",
|
||||
"-fdiagnostics-color=always",
|
||||
@ -25,7 +27,13 @@ STANDARD_GHC_WARNINGS = [
|
||||
"-Wno-all-missed-specialisations",
|
||||
"-Wno-star-is-type",
|
||||
"-Wno-missing-deriving-strategies",
|
||||
]
|
||||
] + select(
|
||||
{
|
||||
"//:release": RELEASE_GHC_FLAGS,
|
||||
"//:development": DEVELOPMENT_GHC_FLAGS,
|
||||
"//:debug": DEVELOPMENT_GHC_FLAGS,
|
||||
},
|
||||
)
|
||||
|
||||
STANDARD_EXECUTABLE_FLAGS = [
|
||||
"-threaded",
|
||||
@ -58,10 +66,10 @@ def semantic_language_library(language, name, srcs, ts_package = "", nodetypes =
|
||||
# We can't use Template Haskell to find out the location of the
|
||||
# node-types.json files, but we can pass it in as a preprocessor
|
||||
# directive.
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + [
|
||||
compiler_flags = GHC_FLAGS + [
|
||||
'-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes),
|
||||
],
|
||||
repl_ghci_args = STANDARD_GHC_WARNINGS + [
|
||||
repl_ghci_args = GHC_FLAGS + [
|
||||
'-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes),
|
||||
],
|
||||
srcs = srcs,
|
||||
|
@ -20,8 +20,9 @@ The first time you run `bazel build`, it'll take some time, as Bazel will compil
|
||||
| Build `TARGET` library | `cabal build TARGET:lib` | `bazel build //TARGET` |
|
||||
| Build semantic executable | `cabal build semantic:exe:semantic` | `bazel build //semantic:exe` |
|
||||
| Build/run executable | `cabal run semantic -- ARGS` | `bazel run //semantic:exe -- ARGS` |
|
||||
| Load REPL component | `script/ghci` and `:load` | `bazel build //TARGET@repl` |
|
||||
| Load REPL component | `script/ghci` and `:load` | `bazel build //TARGET@repl` |
|
||||
| Run tests | `cabal test all` | `bazel test //...` |
|
||||
| Build with optimizations | `cabal build --flags="+release"` | `bazel build -copt //...` |
|
||||
|
||||
## Adding a new dependency
|
||||
|
||||
@ -53,7 +54,7 @@ The default `.bazelrc` file imports a `.bazelrc.local` file if it's present; use
|
||||
|
||||
## Shared variables
|
||||
|
||||
* `STANDARD_GHC_WARNINGS`: the standard set of Cabal flags that all targets should use.
|
||||
* `GHC_FLAGS`: the standard set of Cabal flags that all targets should use.
|
||||
* `STANDARD_EXECUTABLE_FLAGS`: ditto, but with executable-specific flags.
|
||||
|
||||
## Custom rules
|
||||
|
@ -14,13 +14,13 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"GHC_FLAGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-analysis",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + ["-XOverloadedStrings"],
|
||||
compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"],
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:containers",
|
||||
|
@ -14,13 +14,13 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"GHC_FLAGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-ast",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + ["-XOverloadedStrings"],
|
||||
compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"],
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:bytestring",
|
||||
|
@ -14,5 +14,6 @@ semantic_language_library(
|
||||
|
||||
semantic_language_parsing_test(
|
||||
language = "codeql",
|
||||
project = "ql",
|
||||
semantic_package = "ql",
|
||||
ts_package = "ql",
|
||||
)
|
||||
|
@ -14,14 +14,14 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"GHC_FLAGS",
|
||||
"STANDARD_EXECUTABLE_FLAGS",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-core",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
compiler_flags = GHC_FLAGS,
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:text",
|
||||
@ -45,7 +45,7 @@ haskell_test(
|
||||
"test/*.hs",
|
||||
"test/Source/Test.hs",
|
||||
]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + STANDARD_EXECUTABLE_FLAGS,
|
||||
compiler_flags = GHC_FLAGS + STANDARD_EXECUTABLE_FLAGS,
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:text",
|
||||
|
@ -8,7 +8,7 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"GHC_FLAGS",
|
||||
)
|
||||
|
||||
# Doesn't build right now.
|
||||
@ -16,7 +16,7 @@ load(
|
||||
haskell_binary(
|
||||
name = "exe",
|
||||
srcs = ["app/Main.hs"],
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
compiler_flags = GHC_FLAGS,
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:bytestring",
|
||||
|
@ -14,13 +14,13 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"GHC_FLAGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-scope-graph",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + ["-XOverloadedStrings"],
|
||||
compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"],
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:containers",
|
||||
|
@ -14,14 +14,14 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"GHC_FLAGS",
|
||||
"STANDARD_EXECUTABLE_FLAGS",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-source",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + ["-XOverloadedStrings"],
|
||||
compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"],
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:bytestring",
|
||||
@ -44,7 +44,7 @@ haskell_test(
|
||||
"test/Source/Test.hs",
|
||||
"test/Test.hs",
|
||||
],
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + STANDARD_EXECUTABLE_FLAGS,
|
||||
compiler_flags = GHC_FLAGS + STANDARD_EXECUTABLE_FLAGS,
|
||||
deps = [
|
||||
":semantic-source",
|
||||
"//:base",
|
||||
|
@ -14,13 +14,13 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"GHC_FLAGS",
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "semantic-tags",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
compiler_flags = GHC_FLAGS,
|
||||
deps = [
|
||||
"//:base",
|
||||
"//:text",
|
||||
|
@ -16,8 +16,8 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"GHC_FLAGS",
|
||||
"STANDARD_EXECUTABLE_FLAGS",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
)
|
||||
load(
|
||||
"//:build/example_repos.bzl",
|
||||
@ -55,7 +55,7 @@ semantic_common_dependencies = [
|
||||
haskell_library(
|
||||
name = "semantic",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + ["-XStrictData"],
|
||||
compiler_flags = GHC_FLAGS + ["-XStrictData"],
|
||||
version = "0.11.0.0",
|
||||
deps = semantic_common_dependencies + [
|
||||
"//:base",
|
||||
@ -110,7 +110,7 @@ haskell_library(
|
||||
haskell_binary(
|
||||
name = "exe",
|
||||
srcs = glob(["app/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + STANDARD_EXECUTABLE_FLAGS + ["-XStrictData"],
|
||||
compiler_flags = GHC_FLAGS + STANDARD_EXECUTABLE_FLAGS + ["-XStrictData"],
|
||||
deps = [
|
||||
":semantic",
|
||||
"//:base",
|
||||
@ -142,7 +142,7 @@ haskell_test(
|
||||
"test/System/Path/Fixture.hs",
|
||||
],
|
||||
),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + STANDARD_EXECUTABLE_FLAGS + [
|
||||
compiler_flags = GHC_FLAGS + STANDARD_EXECUTABLE_FLAGS + [
|
||||
"-XStrictData",
|
||||
],
|
||||
data = glob(include = [
|
||||
@ -186,7 +186,7 @@ haskell_test(
|
||||
srcs = [
|
||||
"test/Examples.hs",
|
||||
],
|
||||
compiler_flags = STANDARD_GHC_WARNINGS + STANDARD_EXECUTABLE_FLAGS + [
|
||||
compiler_flags = GHC_FLAGS + STANDARD_EXECUTABLE_FLAGS + [
|
||||
"-XStrictData",
|
||||
],
|
||||
data = glob(include = [
|
||||
|
Loading…
Reference in New Issue
Block a user