aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-08-18 18:03:47 +0200
committerRon Evans <[email protected]>2019-09-15 18:04:38 +0200
commit8d959b7c636a392046558046e9b423efb2c288bb (patch)
treeac08fb17aae4ef6a8ed61daf05d21854391e5aed
parent02c40202285da6c5d0a2f36279017e35223380d8 (diff)
downloadtinygo-8d959b7c636a392046558046e9b423efb2c288bb.tar.gz
tinygo-8d959b7c636a392046558046e9b423efb2c288bb.zip
all: replace dep with Go modules
We've moved to go modules, and keeping both working is burdensome. In fact, I think dep already wasn't working.
-rw-r--r--.circleci/config.yml14
-rw-r--r--BUILDING.md11
-rw-r--r--Dockerfile47
-rw-r--r--Gopkg.lock51
-rw-r--r--Gopkg.toml11
5 files changed, 37 insertions, 97 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3abf6d485..c65290eb7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -61,18 +61,19 @@ commands:
- install-node
- restore_cache:
keys:
- - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
- - go-cache-{{ checksum "Gopkg.lock" }}
+ - go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
+ - go-cache-v2-{{ checksum "go.mod" }}
- llvm-source-linux
- run: go install .
- run: go test -v
- run: make gen-device -j4
- run: make smoketest RISCV=0
- save_cache:
- key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
+ key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
paths:
- ~/.cache/go-build
- ~/.cache/tinygo
+ - /go/pkg/mod
- run: make fmt-check
build-linux:
steps:
@@ -95,8 +96,8 @@ commands:
- install-node
- restore_cache:
keys:
- - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
- - go-cache-{{ checksum "Gopkg.lock" }}
+ - go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
+ - go-cache-v2-{{ checksum "go.mod" }}
- llvm-source-linux
- restore_cache:
keys:
@@ -138,10 +139,11 @@ commands:
- store_artifacts:
path: /tmp/tinygo.linux-amd64.tar.gz
- save_cache:
- key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
+ key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
paths:
- ~/.cache/go-build
- ~/.cache/tinygo
+ - /go/pkg/mod
- run:
name: "Extract release tarball"
command: |
diff --git a/BUILDING.md b/BUILDING.md
index dbd90bb36..f8961fc66 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -16,7 +16,6 @@ LLVM, Clang and LLD are quite light on dependencies, requiring only standard
build tools to be built. Go is of course necessary to build TinyGo itself.
* Go (1.11+)
- * [dep](https://golang.github.io/dep/)
* Standard build tools (gcc/clang)
* git
* CMake
@@ -28,15 +27,19 @@ on a different system like Mac.
## Download the source
The first step is to download the TinyGo sources (use `--recursive` if you clone
-the git repository). Then, inside the directory, perform these steps:
+the git repository). Then, inside the directory, download the LLVM source:
- dep ensure -vendor-only # download Go dependencies
- make llvm-source # download LLVM
+ make llvm-source
You can also store LLVM outside of the TinyGo root directory by setting the
`LLVM_BUILDDIR`, `CLANG_SRC` and `LLD_SRC` make variables, but that is not
covered by this guide.
+TinyGo uses Go modules, so if you clone TinyGo inside your GOPATH (and are using
+Go below 1.13), make sure that Go modules are enabled:
+
+ export GO111MODULE=on
+
## Build LLVM, Clang, LLD
Before starting the build, you may want to set the following environment
diff --git a/Dockerfile b/Dockerfile
index f1071087d..0d3065b90 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,26 +6,23 @@ RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
apt-get update && \
apt-get install -y llvm-8-dev libclang-8-dev git
-RUN wget -O- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
-
-COPY . /go/src/github.com/tinygo-org/tinygo
+COPY . /tinygo
# remove submodules directories and re-init them to fix any hard-coded paths
# after copying the tinygo directory in the previous step.
-RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
+RUN cd /tinygo/ && \
rm -rf ./lib/* && \
git submodule update --init --recursive --force
-RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
- dep ensure --vendor-only && \
- go install /go/src/github.com/tinygo-org/tinygo/
+RUN cd /tinygo/ && \
+ go install /tinygo/
# tinygo-wasm stage installs the needed dependencies to compile TinyGo programs for WASM.
FROM tinygo-base AS tinygo-wasm
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
+COPY --from=tinygo-base /tinygo/src /tinygo/src
+COPY --from=tinygo-base /tinygo/targets /tinygo/targets
RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" >> /etc/apt/sources.list && \
@@ -36,13 +33,13 @@ RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
FROM tinygo-base AS tinygo-avr
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
+COPY --from=tinygo-base /tinygo/src /tinygo/src
+COPY --from=tinygo-base /tinygo/targets /tinygo/targets
+COPY --from=tinygo-base /tinygo/Makefile /tinygo/
+COPY --from=tinygo-base /tinygo/tools /tinygo/tools
+COPY --from=tinygo-base /tinygo/lib /tinygo/lib
-RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
+RUN cd /tinygo/ && \
apt-get update && \
apt-get install -y apt-utils python3 make binutils-avr gcc-avr avr-libc && \
make gen-device-avr && \
@@ -54,13 +51,13 @@ RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
FROM tinygo-base AS tinygo-arm
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
+COPY --from=tinygo-base /tinygo/src /tinygo/src
+COPY --from=tinygo-base /tinygo/targets /tinygo/targets
+COPY --from=tinygo-base /tinygo/Makefile /tinygo/
+COPY --from=tinygo-base /tinygo/tools /tinygo/tools
+COPY --from=tinygo-base /tinygo/lib /tinygo/lib
-RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
+RUN cd /tinygo/ && \
apt-get update && \
apt-get install -y apt-utils python3 make clang-8 && \
make gen-device-nrf && make gen-device-stm32 && \
@@ -71,11 +68,11 @@ RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
# tinygo-all stage installs the needed dependencies to compile TinyGo programs for all platforms.
FROM tinygo-wasm AS tinygo-all
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
-COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
+COPY --from=tinygo-base /tinygo/Makefile /tinygo/
+COPY --from=tinygo-base /tinygo/tools /tinygo/tools
+COPY --from=tinygo-base /tinygo/lib /tinygo/lib
-RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
+RUN cd /tinygo/ && \
apt-get update && \
apt-get install -y apt-utils python3 make clang-8 binutils-avr gcc-avr avr-libc && \
make gen-device && \
diff --git a/Gopkg.lock b/Gopkg.lock
deleted file mode 100644
index e6e7dba1e..000000000
--- a/Gopkg.lock
+++ /dev/null
@@ -1,51 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- branch = "master"
- digest = "1:06519a2ec1d59040eaccec40206f9d0b59dc662db2a032f974d6d6b9a2bcb839"
- name = "github.com/blakesmith/ar"
- packages = ["."]
- pruneopts = "UT"
- revision = "8bd4349a67f2533b078dbc524689d15dba0f4659"
-
-[[projects]]
- branch = "master"
- digest = "1:00b45e06c7843541372fc17d982242bd6adfc2fc382b6f2e9ef9ce53d87a50b9"
- name = "github.com/marcinbor85/gohex"
- packages = ["."]
- pruneopts = "UT"
- revision = "7a43cd876e46e0f6ddc553f10f91731a78e6e949"
-
-[[projects]]
- branch = "master"
- digest = "1:ba70784a3deee74c0ca3c87bcac3c2f93d3b2d27d8f237b768c358b45ba47da8"
- name = "golang.org/x/tools"
- packages = [
- "go/ast/astutil",
- "go/ssa",
- "go/types/typeutil",
- ]
- pruneopts = "UT"
- revision = "8dcc6e70cdefe9a82236b6e195e4f4e2108fcb9f"
-
-[[projects]]
- branch = "llvm8"
- digest = "1:bf5539bdf6b3cc3ec1e45926db05d81180da11ce722fa1edcce3f0b4e1967da5"
- name = "tinygo.org/x/go-llvm"
- packages = ["."]
- pruneopts = "UT"
- revision = "7707ae5d1261a8929edea7336c8087ca8b520d8d"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- input-imports = [
- "github.com/blakesmith/ar",
- "github.com/marcinbor85/gohex",
- "golang.org/x/tools/go/ast/astutil",
- "golang.org/x/tools/go/ssa",
- "tinygo.org/x/go-llvm",
- ]
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
deleted file mode 100644
index 7b02b5556..000000000
--- a/Gopkg.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-[[constraint]]
- branch = "llvm8"
- name = "tinygo.org/x/go-llvm"
-
-[[constraint]]
- branch = "master"
- name = "golang.org/x/tools"
-
-[prune]
- go-tests = true
- unused-packages = true