diff --git a/.gitignore b/.gitignore index 25b63a08d..bf25b5759 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /_build/ -/dune-project +dune-project *~ *.merlin cache/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ab62674f..fd988aca4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ stages: - test .website_build: &website_build - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_and_deploy_website + stage: build_and_deploy_website image: node:8 before_script: - scripts/install_native_dependencies.sh @@ -18,18 +18,12 @@ stages: - eval $(opam config env) - scripts/setup_switch.sh - eval $(opam config env) - - scripts/debug_show_versions.sh || true + - scripts/setup_repos.sh # install deps for internal documentation - - opam install -y odoc - # - vendors/opam-repository-tools/rewrite-local-opam-repository.sh - # - opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" - scripts/install_vendors_deps.sh + - opam install -y odoc - scripts/build_ligo_local.sh - # - opam install -y --build-test --deps-only ./src/ - # - dune build -p ligo - # TODO: also try instead from time to time: - #- (cd ./src/; dune build -p ligo) # build with odoc - dune build @doc @@ -67,14 +61,10 @@ stages: - scripts/install_native_dependencies.sh - scripts/install_opam.sh # TODO: or scripts/install_build_environment.sh ? - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" - - echo "$PATH"; which ocaml || true - eval $(opam config env) - - echo "$PATH"; which ocaml || true - scripts/setup_switch.sh - - echo "$PATH"; which ocaml || true - eval $(opam config env) - - echo "$PATH"; which ocaml || true - - scripts/debug_show_versions.sh || true + - scripts/setup_repos.sh local-dune-job: <<: *before_script @@ -115,7 +105,7 @@ remote-repo-job: # Run a docker build without publishing to the registry build-current-docker-image: - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_docker + stage: build_docker <<: *docker <<: *docker_build except: @@ -125,7 +115,7 @@ build-current-docker-image: # When a MR/PR is merged to dev # take the previous build and publish it to Docker Hub build-and-publish-latest-docker-image: - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_and_deploy_docker + stage: build_and_deploy_docker <<: *docker <<: *docker_build after_script: @@ -133,9 +123,6 @@ build-and-publish-latest-docker-image: - docker push $LIGO_REGISTRY_IMAGE:next only: - dev - - refactor/new-tezos-deps-ci - - refactor/new-tezos-deps-cicliexe - # Pages are deployed from both master & dev, be careful not to override 'next' # in case something gets merged into 'dev' while releasing. @@ -144,5 +131,3 @@ pages: only: - master - dev - - refactor/new-tezos-deps-ci - - refactor/new-tezos-deps-cicliexe diff --git a/Makefile b/Makefile index 21dd72cc7..b11ce6fd8 100644 --- a/Makefile +++ b/Makefile @@ -10,20 +10,14 @@ install-deps: scripts/install_build_environment.sh # TODO: or scripts/install_opam.sh ? build-deps: - echo aa export PATH="/usr/local/bin$${PATH:+:}$${PATH:-}" # Create opam dev switch locally for use with Ligo, add merlin/etc if [ -n "`opam switch show | grep -P ".+/ligo"`" ]; then :; else scripts/setup_dev_switch.sh; fi - echo bb eval $$(opam config env) - echo cc # Install OCaml build dependencies for Ligo scripts/install_vendors_deps.sh - echo dd - scripts/install_ligo_with_dependencies.sh # TODO: rename & cleanup - echo ee build: build-deps export PATH="/usr/local/bin$${PATH:+:}$${PATH:-}" diff --git a/docker/Dockerfile b/docker/Dockerfile index a67504209..057bd6436 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,5 @@ -# We could use one of the nomadiclab's docker images as a base instead -# We're using 4.06 instead of 4.06.1, if this causes problems build a custom 4.06.1 image instead -FROM ocaml/opam2:4.06 +# At the moment, this really means 4.07.1 +FROM ocaml/opam2:4.07 USER root @@ -23,18 +22,14 @@ RUN sh scripts/install_native_dependencies.sh # TODO: or scripts/install_build_environment.sh ? RUN sh scripts/install_opam.sh -# Creat opam switch -RUN sh scripts/setup_switch.sh +# Add tezos repository +RUN sh scripts/setup_repos.sh RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN sh -c pwd -RUN sh scripts/build_ligo_local.sh -RUN sh -c pwd -RUN ls -l -RUN sh -c 'ls -l /ligo/_build/default/src/bin/cli.exe || true' +RUN opam install -y ./src # Use the ligo binary as a default command -ENTRYPOINT [ "/ligo/_build/default/src/bin/cli.exe" ] +ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] diff --git a/gitlab-pages/website/pages/en/versions.js b/gitlab-pages/website/pages/en/versions.js index 4cc1bd3b5..6abeaa02e 100644 --- a/gitlab-pages/website/pages/en/versions.js +++ b/gitlab-pages/website/pages/en/versions.js @@ -18,15 +18,13 @@ const versions = require(`${CWD}/versions.json`); function Versions(props) { const {config: siteConfig} = props; const latestVersion = versions[0]; - const repoUrl = `https://github.com/${siteConfig.organizationName}/${ - siteConfig.projectName - }`; + const repoUrl = `${siteConfig.repoUrl}`; return (
-

{siteConfig.title} Versions

+

{siteConfig.title} Versions

Current version

diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh index 8ccfd8658..b78e4ffd6 100755 --- a/scripts/build_ligo_local.sh +++ b/scripts/build_ligo_local.sh @@ -2,7 +2,7 @@ set -e eval $(opam config env) -dune build src # TODO: make it work with -p ligo +dune build -p ligo # TODO: also try instead from time to time: #- (cd ./src/; dune build -p ligo) diff --git a/scripts/debug_show_versions.sh b/scripts/debug_show_versions.sh deleted file mode 100755 index 1c744a566..000000000 --- a/scripts/debug_show_versions.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -echo "$PATH" -opam --version -printf '' | ocaml -opam switch - diff --git a/scripts/install_ligo_with_dependencies.sh b/scripts/install_ligo_with_dependencies.sh deleted file mode 100755 index 78e5d8b62..000000000 --- a/scripts/install_ligo_with_dependencies.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -set -e - -cd src -opam install . --yes diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 9d2035b45..3da674636 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -2,11 +2,5 @@ set -e # Install local dependencies -opam install -y ./vendors/ligo-utils/simple-utils -opam install -y ./vendors/ligo-utils/tezos-protocol-alpha -opam install -y ./vendors/ligo-utils/tezos-protocol-alpha-parameters -opam install -y ./vendors/ligo-utils/memory-proto-alpha -opam install -y ./vendors/ligo-utils/tezos-utils/michelson-parser -opam install -y ./vendors/ligo-utils/tezos-utils -opam install -y ./vendors/ligo-utils/proto-alpha-utils -opam install -y getopt ppx_deriving menhir +opam install -y --deps-only --with-test $(find src vendors -name \*.opam) +opam install -y $(find vendors -name \*.opam) diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh index 88662c79a..e4cd196cb 100755 --- a/scripts/setup_dev_switch.sh +++ b/scripts/setup_dev_switch.sh @@ -2,6 +2,7 @@ set -e "$(dirname "$0")"/setup_switch.sh +"$(dirname "$0")"/setup_repos.sh opam install -y ocp-indent tuareg merlin alcotest-lwt crowbar opam -y user-setup install diff --git a/scripts/setup_repos.sh b/scripts/setup_repos.sh new file mode 100755 index 000000000..e14c81707 --- /dev/null +++ b/scripts/setup_repos.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e +set -x + +eval $(opam config env) + +# Remove the nomadic-labs tezos repo (from ligo switch only) +opam repository remove tezos-opam-repository + +# Add ligolang tezos repo +opam repository add ligolang-tezos-opam-repository https://gitlab.com/ligolang/tezos-opam-repository.git diff --git a/scripts/setup_switch.sh b/scripts/setup_switch.sh index 070e720a7..ed1e839b2 100755 --- a/scripts/setup_switch.sh +++ b/scripts/setup_switch.sh @@ -4,12 +4,3 @@ set -x printf '' | opam switch create . 4.07.1 # toto ocaml-base-compiler.4.06.1 eval $(opam config env) - -# Add Tezos opam repository -opam repo add tezos-opam-repository https://gitlab.com/nomadic-labs/tezos-opam-repository.git - -# TODO: move this to install_vendor_deps.sh -# Pin the versions of some dependencies -opam pin -y zarith 1.7 -opam pin -y ipaddr 3.1.0 -opam pin -y macaddr 3.1.0 diff --git a/src/dune-project b/src/dune-project deleted file mode 100644 index 13109bb9b..000000000 --- a/src/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.6) -(using menhir 2.0) diff --git a/src/passes/1-parser/camligo/dune b/src/passes/1-parser/camligo/dune index 428f10424..01a68e5cb 100644 --- a/src/passes/1-parser/camligo/dune +++ b/src/passes/1-parser/camligo/dune @@ -28,7 +28,7 @@ (targets parser_generated.mly) (deps partial_parser.mly pre_parser.mly) (action (system "cat pre_parser.mly partial_parser.mly > parser_generated.mly")) - (mode promote-until-clean) + (mode (promote (until-clean) (only *))) ) (rule @@ -43,7 +43,7 @@ (targets ast_generated.ml) (deps generator.exe) (action (system "./generator.exe ast > ast_generated.ml")) - (mode promote-until-clean) + (mode (promote (until-clean) (only *))) ) ;; Generating Generator @@ -57,4 +57,10 @@ lex ) (modules generator) + (preprocess + (pps + ppx_let + ppx_deriving.std + ) + ) ) diff --git a/src/passes/1-parser/ligodity/dune b/src/passes/1-parser/ligodity/dune index 1d26b826f..db5d8a6bc 100644 --- a/src/passes/1-parser/ligodity/dune +++ b/src/passes/1-parser/ligodity/dune @@ -27,16 +27,16 @@ ; (targets Parser.exe) ; (deps ParserMain.exe) ; (action (copy ParserMain.exe Parser.exe)) -; (mode promote-until-clean)) +; (mode (promote (until-clean) (only *)))) ;(rule ; (targets Lexer.exe) ; (deps LexerMain.exe) ; (action (copy LexerMain.exe Lexer.exe)) -; (mode promote-until-clean)) +; (mode (promote (until-clean) (only *)))) (rule (targets Version.ml) (action (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) - (mode promote-until-clean)) + (mode (promote (until-clean) (only *)))) diff --git a/src/passes/1-parser/shared/dune b/src/passes/1-parser/shared/dune index 7e62da9a8..b9ec951ee 100644 --- a/src/passes/1-parser/shared/dune +++ b/src/passes/1-parser/shared/dune @@ -25,4 +25,4 @@ (targets Version.ml) (action (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) - (mode promote-until-clean)) \ No newline at end of file + (mode (promote (until-clean) (only *)))) diff --git a/vendors/ligo-utils/memory-proto-alpha/dune-project b/vendors/ligo-utils/memory-proto-alpha/dune-project deleted file mode 100644 index 1cf86c9fe..000000000 --- a/vendors/ligo-utils/memory-proto-alpha/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.11) -(name tezos-memory-proto-alpha) diff --git a/vendors/ligo-utils/proto-alpha-utils/dune-project b/vendors/ligo-utils/proto-alpha-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/proto-alpha-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam index 4a4e6cfc8..af3f7d9fe 100644 --- a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam +++ b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam @@ -18,7 +18,9 @@ depends: [ "ezjsonm" "hex" "hidapi" - "ipaddr" + # opam does not handle tezos' constraints well (why?) + "ipaddr" { >= "3.1.0" & < "4.0.0" } + "macaddr" { >= "3.1.0" & < "4.0.0" } "irmin" "js_of_ocaml" "lwt" @@ -31,7 +33,8 @@ depends: [ "stdio" "uri" "uutf" - "zarith" + # tezos does not constrain their required version + "zarith" {= "1.7"} "ocplib-json-typed" "ocplib-json-typed-bson" "tezos-crypto" diff --git a/vendors/ligo-utils/simple-utils/dune-project b/vendors/ligo-utils/simple-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/simple-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project deleted file mode 100644 index 4afa89be6..000000000 --- a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.10) -(name tezos-protocol-alpha-parameters) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/dune-project b/vendors/ligo-utils/tezos-protocol-alpha/dune-project deleted file mode 100644 index 6d415f3bf..000000000 --- a/vendors/ligo-utils/tezos-protocol-alpha/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.10) -(name tezos-embedded-protocol-alpha) diff --git a/vendors/ligo-utils/tezos-utils/dune-project b/vendors/ligo-utils/tezos-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/tezos-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project b/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6)