mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
33e47828e3
* bazel: 0.28.1 --> 1.1.0 * bazel-watcher sha256 * Fix missing line in patch * proto_source_root --> strip_import_prefix See https://github.com/bazelbuild/bazel/issues/7153 for details. * Update rules_nixpkgs Required to avoid errors of the form ``` ERROR: An error occurred during the fetch of repository 'node_nix': parameter 'sep' may not be specified by name, for call to method split(sep, maxsplit = None) of 'string' ``` and ``` ERROR: An error occurred during the fetch of repository 'node_nix': Traceback (most recent call last): File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149 _execute_or_fail(repository_ctx, <3 more arguments>) File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail fail(<1 more arguments>) Cannot build Nix attribute 'nodejs'. Command: [/Users/runner/.nix-profile/bin/nix-build, /private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/node_nix/nix/bazel.nix, "-A", "nodejs", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/nixpkgs/nixpkgs"] Return code: 1 Error output: src/main/tools/process-tools.cc:173: "setitimer": Invalid argument ``` * Update rules_scala * .proto has been removed, use [ProtoInfo] instead See https://docs.bazel.build/versions/1.1.0/be/protocol-buffer.html#proto_library * python3_nix add nix_file attribute To avoid the following error ``` ERROR: /home/aj/tweag.io/da/da-bazel-1.1/BUILD:66:1: //:nix_python3_runtime depends on @python3_nix//:bin/python in repository @python3_nix which failed to fetch. no such package '@python3_nix//': Traceback (most recent call last): File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149 _execute_or_fail(repository_ctx, <3 more arguments>) File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail fail(<1 more arguments>) Cannot build Nix attribute 'python3'. Command: [/home/aj/.nix-profile/bin/nix-build, "-E", "import <nixpkgs> { config = {}; overlays = []; }", "-A", "python3", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs"] Return code: 1 Error output: error: anonymous function at /home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs.nix:3:1 called with unexpected argument 'config', at (string):1:1 ``` * rules_haskell unnamed string.split(_, maxsplit = _) The keyword argument may no longer be named. * string.replace(_, _, maxsplit = _) may not be named * Move proto sources from deps to data Fixes ``` ERROR: /home/aj/tweag.io/da/da-bazel-1.1/daml-lf/archive/BUILD.bazel:150:1: in deps attribute of scala_test rule //daml-lf/archive:daml_lf_archive_reader_tests_test_suite_src_test_scala_com_digitalasset_daml_lf_archive_DecodeV1Spec.scala: '//daml-lf/archive:daml_lf_1.6_archive_proto_srcs' does not have mandatory providers: 'JavaInfo'. Since this rule was created by the macro 'da_scala_test_suite', the error might have been caused by the macro implementation ``` * Define sha256 for haskell_ghc__paths Bazel 1.1.0 fails on missing hashes. * Disable --incompatible_windows_native_test_wrapper * //compiler/daml-extension don't modify sources Modifying sources in-place can cause issues on Windows, where build actions are not sandboxed and changes on sources can affect other build steps. * bazel-genfiles --> bazel-bin The bazel-genfiles symlink has been removed since Bazel 1.0. See https://github.com/bazelbuild/bazel/issues/8651 * Mark dev_env_tool repository rule as configure See https://docs.bazel.build/versions/1.1.0/skylark/lib/globals.html#repository_rule * Move data deps into data attribute * Mark dev_env_tool as local = True * Manually fetch @makensis_dev_env
125 lines
3.6 KiB
Bash
Executable File
125 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
# Make sure they are in the right repo
|
|
readonly REPO_ROOT=$(bazel info workspace)
|
|
if [[ "${REPO_ROOT}/dev-env/bin/daml-sdk-head" != "${BASH_SOURCE}" ]];
|
|
then
|
|
echo "Repo root does not match the script being run."
|
|
echo "Make sure you run this script from a directory within the 'daml' repository "
|
|
exit 1
|
|
fi
|
|
|
|
# get rid of old .daml-head installation
|
|
if [ -d "$HOME/.daml-head" ] ; then
|
|
chmod -R u+w "$HOME/.daml-head"
|
|
rm -rf "$HOME/.daml-head"
|
|
fi
|
|
|
|
|
|
NUKE=0
|
|
PROFILING=0
|
|
SKIP_JARS=0
|
|
for opt in "$@" ; do
|
|
case $opt in
|
|
"--nuke")
|
|
NUKE=1
|
|
;;
|
|
"--profiling")
|
|
PROFILING=1
|
|
;;
|
|
"--skip-jars")
|
|
SKIP_JARS=1;
|
|
;;
|
|
*)
|
|
echo "Unknown option: $opt"
|
|
echo "Available options:"
|
|
echo " --nuke Remove existing daml installation before installing daml-head."
|
|
echo " --profiling Build Haskell executables with profiling enabled."
|
|
echo " --skip-jars Skip building and installing the JARs."
|
|
exit 1
|
|
esac
|
|
done
|
|
|
|
BAZEL_MODE_FLAG=""
|
|
|
|
if [ "$PROFILING" -ne "0" ] ; then
|
|
BAZEL_MODE_FLAG="-c dbg"
|
|
fi
|
|
|
|
readonly DAML_HOME="$HOME/.daml"
|
|
if [ -d $DAML_HOME ] && [ "$NUKE" -ne "0" ] ; then
|
|
echo "$(tput setaf 3)Removing existing daml installation.$(tput sgr 0)"
|
|
chmod -R u+w $DAML_HOME
|
|
rm -rf $DAML_HOME
|
|
fi
|
|
|
|
readonly DAML_HEAD_SDK="$DAML_HOME/sdk/0.0.0"
|
|
if [ -d $DAML_HEAD_SDK ] ; then
|
|
echo "$(tput setaf 3)Removing existing daml-head installation.$(tput sgr 0)"
|
|
rm -f $DAML_HOME/bin/daml-head
|
|
chmod -R u+w $DAML_HEAD_SDK
|
|
rm -rf $DAML_HEAD_SDK
|
|
fi
|
|
|
|
|
|
echo "$(tput setaf 3)Building version 0.0.0 - this may take a while ...$(tput sgr 0)"
|
|
echo ""
|
|
|
|
function cleanup() {
|
|
echo "SDK 0.0.0 failed to build/install - if you need help ask on #product-daml"
|
|
echo "$(tput setaf 3)FAILED TO INSTALL! $(tput sgr 0)"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
# Building here separately so the user can see the build process which could take a while
|
|
bazel build $BAZEL_MODE_FLAG //release:sdk-head-tarball.tar.gz
|
|
|
|
readonly TARBALL=$(bazel info bazel-bin $BAZEL_MODE_FLAG)/release/sdk-head-tarball.tar.gz
|
|
readonly TMPDIR=$(mktemp -d)
|
|
mkdir -p $TMPDIR/sdk-head
|
|
|
|
tar xzf $TARBALL -C $TMPDIR/sdk-head --strip-components 1
|
|
|
|
readonly DAML_CMD="$(which daml)"
|
|
if [ -x "$DAML_CMD" ] && [ "$DAML_CMD" == "$DAML_HOME/bin/daml" ] ; then
|
|
# A daml installation already exists, so just install SDK version 0.0.0.
|
|
$DAML_HOME/bin/daml install $TMPDIR/sdk-head --force
|
|
else
|
|
# No daml installation detected, so install the tarball normally but disable auto-install.
|
|
$TMPDIR/sdk-head/install.sh --force
|
|
echo "auto-install: false" > $DAML_HOME/daml-config.yaml
|
|
fi
|
|
|
|
cat > $DAML_HOME/bin/daml-head << EOF
|
|
#!/bin/bash
|
|
exec env DAML_SDK_VERSION=0.0.0 $DAML_HEAD_SDK/daml/daml "\$@"
|
|
EOF
|
|
chmod +x $DAML_HOME/bin/daml-head
|
|
|
|
trap - EXIT
|
|
echo "$(tput setaf 3)Successfully installed daml-head command.$(tput sgr 0)"
|
|
|
|
if [ "$SKIP_JARS" -eq "0" ]; then
|
|
echo "$(tput setaf 3)Installing JARs as 100.0.0...$(tput sgr 0)"
|
|
|
|
cp "$REPO_ROOT/VERSION" "$REPO_ROOT/VERSION.head-build-in-progress"
|
|
|
|
function cleanup() {
|
|
echo "$(tput setaf 3)FAILED TO INSTALL JARS! $(tput sgr 0)"
|
|
mv "$REPO_ROOT/VERSION.head-build-in-progress" "$REPO_ROOT/VERSION"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
echo "0.0.0" > "$REPO_ROOT/VERSION"
|
|
|
|
bazel build //release:release
|
|
tmp=$(mktemp -d)
|
|
"$REPO_ROOT/bazel-bin/release/release" --artifacts "$REPO_ROOT/release/artifacts.yaml" --release-dir $tmp --all-artifacts --install-head-jars
|
|
|
|
mv "$REPO_ROOT/VERSION.head-build-in-progress" "$REPO_ROOT/VERSION"
|
|
trap - EXIT
|
|
|
|
echo "$(tput setaf 3)Done installing JARs as 100.0.0.$(tput sgr 0)"
|
|
fi
|