Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 57 lines 1.3 kB view raw
1{ stdenv, lib, writeText, runCommandCC, bazel }: 2 3let 4 WORKSPACE = writeText "WORKSPACE" '' 5 workspace(name = "our_workspace") 6 ''; 7 8 pythonLib = writeText "lib.py" '' 9 def foo(): 10 return 43 11 ''; 12 13 pythonBin = writeText "bin.py" '' 14 from lib import foo 15 16 assert foo() == 43 17 ''; 18 19 pythonBUILD = writeText "BUILD" '' 20 py_library( 21 name = "lib", 22 srcs = [ "lib.py" ], 23 ) 24 25 py_test( 26 name = "bin", 27 srcs = [ "bin.py" ], 28 deps = [ ":lib" ], 29 ) 30 ''; 31 32 runLocal = name: script: runCommandCC name { preferLocalBuild = true; } script; 33 34 workspaceDir = runLocal "our_workspace" '' 35 mkdir $out 36 cp ${WORKSPACE} $out/WORKSPACE 37 mkdir $out/python 38 cp ${pythonLib} $out/python/lib.py 39 cp ${pythonBin} $out/python/bin.py 40 cp ${pythonBUILD} $out/python/BUILD.bazel 41 ''; 42 43 testBazel = runLocal "bazel-test-builtin-rules" '' 44 export HOME=$(mktemp -d) 45 # Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609 46 # about why to create a subdir for the workspace. 47 cp -r ${workspaceDir} wd && chmod u+w wd && cd wd 48 ${bazel}/bin/bazel \ 49 test \ 50 --test_output=errors \ 51 --host_javabase='@local_jdk//:jdk' \ 52 //... 53 54 touch $out 55 ''; 56 57in testBazel