Skip to content

Commit

Permalink
windows: root build (digital-asset#1894)
Browse files Browse the repository at this point in the history
* windows: root build

* windows: fixed haskell bindings tests

* windows: disable client_server_test test

* windows: marking daml_test flaky due to digital-asset#1907

* windows: removing da-hs-damlc-app run from build.ps1

* windows: disable hie-core alias of currently disabled target
  • Loading branch information
majcherm-da authored Jun 28, 2019
1 parent 199aea3 commit 2afefb7
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 53 deletions.
3 changes: 2 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ load(
"c2hs_toolchain",
)
load("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_repl")
load("@os_info//:os_info.bzl", "is_windows")

exports_files([".hlint.yaml"])

Expand Down Expand Up @@ -153,7 +154,7 @@ alias(
alias(
name = "hie-core",
actual = "//compiler/hie-core:hie-core-exe",
)
) if not is_windows else None # Disable on Windows until ghc-paths is fixed upstream

alias(
name = "daml-lf-repl",
Expand Down
3 changes: 2 additions & 1 deletion bazel_tools/client_server_test/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
)
load("@os_info//:os_info.bzl", "is_windows")

sh_binary(
name = "client",
Expand Down Expand Up @@ -41,4 +42,4 @@ client_server_test(
":client_input_file",
],
server = ":server",
)
) if not is_windows else None
43 changes: 2 additions & 41 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,8 @@ function bazel() {
# which is a workaround for this problem.
bazel shutdown

# FIXME: Until all bazel issues on Windows are resolved we will be testing only specific bazel targets
bazel build `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/build_execution_windows.log `
//:git-revision `
@com_github_grpc_grpc//:grpc `
@haskell_c2hs//... `
//3rdparty/... `
//compiler/... `
//daml-assistant/... `
//daml-foundations/... `
//daml-lf/... `
//extractor/... `
//hazel/... `
//language-support/... `
//ledger/... `
//ledger-api/... `
//libs-haskell/... `
//navigator/... `
//nix/... `
//notices-gen/... `
//release/... `
//rules_daml/... `
//scala-protoc-plugins/... `
//templates/...
bazel build `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/build_execution_windows.log //...

bazel shutdown

bazel run `
//daml-foundations/daml-tools/da-hs-damlc-app `-`- `-h

bazel shutdown

bazel test `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/test_execution_windows.log `
//compiler/... `
//daml-lf/... `
//extractor/... `
//language-support/codegen-common/... `
//language-support/java/... `
//language-support/scala/... `
//ledger/... `
//ledger-api/... `
//libs-haskell/... `
//navigator/... `
//daml-assistant/... `
//daml-foundations/...
bazel test `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/test_execution_windows.log //...
2 changes: 2 additions & 0 deletions daml-foundations/daml-ghc/util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def _daml_ghc_compile_test_impl(ctx):
stack_opt = "-K" + ctx.attr.stack_limit if ctx.attr.stack_limit else ""
heap_opt = "-M" + ctx.attr.heap_limit if ctx.attr.heap_limit else ""
script = """
set -eou pipefail
DAMLC=$(rlocation $TEST_WORKSPACE/{damlc})
MAIN=$(rlocation $TEST_WORKSPACE/{main})
Expand Down
20 changes: 15 additions & 5 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@os_info//:os_info.bzl", "is_linux")
load("@os_info//:os_info.bzl", "is_linux", "is_windows")
load("//rules_daml:daml.bzl", "daml_test")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")

Expand Down Expand Up @@ -73,7 +73,7 @@ genrule(
":grunt",
"@sass_nix//:bin/sass",
],
)
) if not is_windows else None

genrule(
name = "sources",
Expand Down Expand Up @@ -146,7 +146,7 @@ genrule(
"@sphinx_nix//:bin/sphinx-build",
"@imagemagick_nix//:bin/convert",
] + (["@glibc_locales//:locale-archive"] if is_linux else []),
)
) if not is_windows else None

genrule(
name = "docs-no-pdf",
Expand Down Expand Up @@ -199,7 +199,7 @@ genrule(
tools =
["@sphinx_nix//:bin/sphinx-build"] +
(["@glibc_locales//:locale-archive"] if is_linux else []),
)
) if not is_windows else None

genrule(
name = "redirects",
Expand Down Expand Up @@ -258,7 +258,7 @@ genrule(
"""<url><loc>%LOC%</loc><lastmod>%DATE%</lastmod><changefreq>daily</changefreq><priority>0.8</priority></url>""",
"""</urlset>""",
),
)
) if not is_windows else None

filegroup(
name = "daml-assistant-iou-setup",
Expand Down Expand Up @@ -325,52 +325,62 @@ java_binary(
daml_test(
name = "ledger-api-daml-test",
srcs = glob(["source/app-dev/code-snippets/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "bindings-java-daml-test",
srcs = glob(["source/app-dev/bindings-java/code-snippets/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "patterns-daml-test",
srcs = glob(["source/daml/patterns/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "daml-studio-daml-test",
srcs = glob(["source/daml/daml-studio/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "daml-ref-daml-test",
timeout = "long",
srcs = glob(["source/daml/code-snippets/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "introduction-daml-test",
srcs = glob(["source/getting-started/introduction/code/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "quickstart-daml-test",
srcs = glob(["source/getting-started/quickstart/template-root/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "ledger-model-daml-test",
srcs = glob(["source/concepts/ledger-model/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "java-bindings-docs-daml-test",
srcs = glob(["source/app-dev/bindings-java/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

daml_test(
name = "daml-intro-daml-test",
srcs = glob(["source/daml/intro/daml/**/*.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions language-support/hs/bindings/examples/group-chat/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

load("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_test")
load("//rules_daml:daml.bzl", "daml_compile", "daml_test")
load("@os_info//:os_info.bzl", "is_windows")

daml_compile(
name = "GroupChat",
Expand All @@ -13,4 +14,5 @@ daml_compile(
daml_test(
name = "GroupChat-test",
srcs = glob(["daml/GroupChat.daml"]),
flaky = is_windows, # https://github.com/digital-asset/daml/issues/1907
)
11 changes: 8 additions & 3 deletions language-support/hs/bindings/test/DA/Ledger/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module DA.Ledger.Tests (main) where
import Control.Concurrent (MVar,newMVar,takeMVar,withMVar)
import Control.Monad(unless)
import Control.Monad.IO.Class(liftIO)
import DA.Bazel.Runfiles
import DA.Daml.LF.Proto3.Archive (decodeArchive)
import DA.Daml.LF.Reader(ManifestData(..),manifestFromDar)
import DA.Ledger.Sandbox (Sandbox,SandboxSpec(..),startSandbox,shutdownSandbox,withSandbox)
Expand All @@ -16,6 +17,7 @@ import Data.Text.Lazy (Text)
import System.Environment.Blank (setEnv)
import System.Random (randomIO)
import System.Time.Extra (timeout)
import System.FilePath
import Test.Tasty as Tasty (TestName,TestTree,testGroup,withResource,defaultMain)
import Test.Tasty.HUnit as Tasty(assertFailure,assertBool,assertEqual,testCase)
import qualified Codec.Archive.Zip as Zip
Expand Down Expand Up @@ -295,9 +297,10 @@ assertTextContains text frag =
enableSharing :: Bool
enableSharing = True

specQuickstart :: SandboxSpec
specQuickstart = SandboxSpec {dar}
where dar = "language-support/hs/bindings/quickstart.dar"
createSpecQuickstart :: IO SandboxSpec
createSpecQuickstart = do
dar <- locateRunfiles (mainWorkspace </> "language-support/hs/bindings/quickstart.dar")
return SandboxSpec {dar}

testGroupWithSandbox :: TestName -> [WithSandbox -> TestTree] -> TestTree
testGroupWithSandbox name tests =
Expand All @@ -309,6 +312,7 @@ testGroupWithSandbox name tests =
else do
-- runs in it's own freshly (and very slowly!) spun-up sandbox
let withSandbox' f = do
specQuickstart <- createSpecQuickstart
pid <- mainPackageId specQuickstart
withSandbox specQuickstart $ \sandbox -> f sandbox pid
testGroup name $ map (\f -> f withSandbox') tests
Expand All @@ -330,6 +334,7 @@ data SharedSandbox = SharedSandbox (MVar (Sandbox, PackageId))

acquireShared :: IO SharedSandbox
acquireShared = do
specQuickstart <- createSpecQuickstart
sandbox <- startSandbox specQuickstart
pid <- mainPackageId specQuickstart
mv <- newMVar (sandbox, pid)
Expand Down
12 changes: 10 additions & 2 deletions rules_daml/daml.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ daml_compile = rule(

def _daml_test_impl(ctx):
script = """
{damlc} test --files {files}
""".format(damlc = ctx.executable.damlc.short_path, files = " ".join([f.short_path for f in ctx.files.srcs]))
set -eou pipefail
DAMLC=$(rlocation $TEST_WORKSPACE/{damlc})
rlocations () {{ for i in $@; do echo $(rlocation $TEST_WORKSPACE/$i); done; }}
$DAMLC test --files $(rlocations "{files}")
""".format(
damlc = ctx.executable.damlc.short_path,
files = " ".join([f.short_path for f in ctx.files.srcs]),
)

ctx.actions.write(
output = ctx.outputs.executable,
Expand Down

0 comments on commit 2afefb7

Please sign in to comment.