From 9bb9a7c2777e16e9c857c7c848afe55dbc271c61 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Tue, 7 Jan 2020 15:48:05 +0000 Subject: [PATCH 1/8] Pin swiftlint version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8d2a8580..e6e2d35f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: - eval "$(curl -sLk https://swiftenv.fuller.li/install.sh)" - "swiftenv install 5.0.2 || true" - "swiftenv install 4.2 || true" - - git clone https://github.com/realm/SwiftLint.git /tmp/swiftlint + - git clone --branch 0.38.1 https://github.com/realm/SwiftLint.git /tmp/swiftlint - (cd /tmp/swiftlint; swiftenv install; swift build -c release --static-swift-stdlib) - export PATH="/tmp/swiftlint/.build/x86_64-unknown-linux/release:$PATH" script: From cca3ef963e469fa75a8945605f4f5fe239bb2acd Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 11:30:39 +0000 Subject: [PATCH 2/8] Add all flint binaries to zip target --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6cef1b74..e71fc34b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ Z3=z3/build/z3 Boogie_Z3_slink=boogie/Binaries/z3.exe Symbooglix_Z3_slink=symbooglix/src/SymbooglixDriver/bin/Release/z3.exe Z3_SYSTEM_PATH = $(shell which z3) +RELEASE_EXECUTABLES=flintc flint-test flint-repl flint-ca flint-lsp .PHONY: all debug release zip test lint generate-sources generate-mocks test-nogen clean all: generate-sources $(BOOGIE_EXE) $(SYMBOOGLIX_EXE) debug @@ -24,9 +25,11 @@ run: swift run dev_version zip: release - cp .build/release/flintc flintc - zip -r flintc.zip flintc stdlib - rm flintc + for EXECUTABLE in $(RELEASE_EXECUTABLES); do \ + cp .build/release/$$EXECUTABLE $$EXECUTABLE; \ + done + zip -r flintc.zip $(RELEASE_EXECUTABLES) stdlib + rm $(RELEASE_EXECUTABLES) test: lint generate-mocks release sed -i -e "s/ as / as! /g" .build/checkouts/Cuckoo/Source/Initialization/ThreadLocal.swift From 8e93af771fcf383eec18af1b48edf5e8a59bca1f Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 11:58:19 +0000 Subject: [PATCH 3/8] Removed --static-swift-stdlib when building --- .travis.yml | 2 +- Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6e2d35f..cd369abf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: - "swiftenv install 5.0.2 || true" - "swiftenv install 4.2 || true" - git clone --branch 0.38.1 https://github.com/realm/SwiftLint.git /tmp/swiftlint - - (cd /tmp/swiftlint; swiftenv install; swift build -c release --static-swift-stdlib) + - (cd /tmp/swiftlint; swiftenv install; swift build -c release) - export PATH="/tmp/swiftlint/.build/x86_64-unknown-linux/release:$PATH" script: - cd $HOME/.flint diff --git a/Makefile b/Makefile index e71fc34b..3fd71d36 100644 --- a/Makefile +++ b/Makefile @@ -5,16 +5,17 @@ Boogie_Z3_slink=boogie/Binaries/z3.exe Symbooglix_Z3_slink=symbooglix/src/SymbooglixDriver/bin/Release/z3.exe Z3_SYSTEM_PATH = $(shell which z3) RELEASE_EXECUTABLES=flintc flint-test flint-repl flint-ca flint-lsp +BUILD_ARGS= .PHONY: all debug release zip test lint generate-sources generate-mocks test-nogen clean all: generate-sources $(BOOGIE_EXE) $(SYMBOOGLIX_EXE) debug debug: generate-sources - swift build + swift build $(BUILD_ARGS) cp -r stdlib .build/debug/ release: generate-sources $(BOOGIE_EXE) $(SYMBOOGLIX_EXE) - swift build -c release --static-swift-stdlib + swift build -c release $(BUILD_ARGS) cp -r stdlib .build/release/ xcode: From a0419b0c120eed1a1a9732f6012e4e9f5e36db55 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 11:58:48 +0000 Subject: [PATCH 4/8] Add osx target in .travis.yml --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index cd369abf..4a88bccb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,10 @@ matrix: - make - make release - make test + - os: osx + language: objective-c + osx_image: xcode11.3 + if: tag =~ ^*-macos$ before_deploy: - swift package update - make release From 2c49123f28f28f20af116e1b7d92a48bd39070e4 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 12:05:12 +0000 Subject: [PATCH 5/8] Update node version in .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a88bccb..89350837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list - sudo add-apt-repository -y ppa:ethereum/ethereum - - curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - + - curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - - sudo apt-get update - sudo apt-get install -y solc nodejs mono-complete clang z3 - test -f /usr/bin/msbuild && echo "msbuild exists" From eadb4082d43bd12ef644d33ce7229cec3274a2f4 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 13:23:20 +0000 Subject: [PATCH 6/8] Fixed BUILD_ARGS in Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 3fd71d36..838f5e76 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ Boogie_Z3_slink=boogie/Binaries/z3.exe Symbooglix_Z3_slink=symbooglix/src/SymbooglixDriver/bin/Release/z3.exe Z3_SYSTEM_PATH = $(shell which z3) RELEASE_EXECUTABLES=flintc flint-test flint-repl flint-ca flint-lsp -BUILD_ARGS= .PHONY: all debug release zip test lint generate-sources generate-mocks test-nogen clean all: generate-sources $(BOOGIE_EXE) $(SYMBOOGLIX_EXE) debug From a5b3e2fb67666139e5828cf04c1f18f3aa163787 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 13:26:21 +0000 Subject: [PATCH 7/8] Renamed RELEASE_EXECUTABLES to ZIP_EXECUTABLES in Makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 838f5e76..c819729b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ Z3=z3/build/z3 Boogie_Z3_slink=boogie/Binaries/z3.exe Symbooglix_Z3_slink=symbooglix/src/SymbooglixDriver/bin/Release/z3.exe Z3_SYSTEM_PATH = $(shell which z3) -RELEASE_EXECUTABLES=flintc flint-test flint-repl flint-ca flint-lsp +ZIP_EXECUTABLES ?= flintc flint-test flint-repl flint-ca flint-lsp .PHONY: all debug release zip test lint generate-sources generate-mocks test-nogen clean all: generate-sources $(BOOGIE_EXE) $(SYMBOOGLIX_EXE) debug @@ -25,11 +25,11 @@ run: swift run dev_version zip: release - for EXECUTABLE in $(RELEASE_EXECUTABLES); do \ + for EXECUTABLE in $(ZIP_EXECUTABLES); do \ cp .build/release/$$EXECUTABLE $$EXECUTABLE; \ done - zip -r flintc.zip $(RELEASE_EXECUTABLES) stdlib - rm $(RELEASE_EXECUTABLES) + zip -r flintc.zip $(ZIP_EXECUTABLES) stdlib + rm $(ZIP_EXECUTABLES) test: lint generate-mocks release sed -i -e "s/ as / as! /g" .build/checkouts/Cuckoo/Source/Initialization/ThreadLocal.swift From 10efe5437a6ef3d4aa52f82c00425ee046132c86 Mon Sep 17 00:00:00 2001 From: Noel Lee Date: Thu, 30 Jan 2020 13:39:48 +0000 Subject: [PATCH 8/8] Update language guide to include Makefile options --- docs/language_guide.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/language_guide.md b/docs/language_guide.md index cafd1787..d1827072 100644 --- a/docs/language_guide.md +++ b/docs/language_guide.md @@ -171,6 +171,28 @@ bash <(curl -s https://raw.githubusercontent.com/flintlang/flint/master/utils/in Note that this script can be run from any directory, but will always install Flint in `~/.flint`. +#### Makefile options +The Makefile provides some options for you to customize your builds. + +##### `BUILD_ARGS` +This option allows you to specify extra arguments for the `swift build` step. + +For example, the following command builds only the `flintc` executable, but not the rest. + +```bash +BUILD_ARGS="--product flintc" make release +``` + +##### `ZIP_EXECUTABLES` +This option allows you to specify which executables to include in the resulting zip file. +If not set, the `make zip` target will try to include all Flint executables in the zip file by default. + +For example, the following command includes only `flintc` and `flint-repl` in the final zip file. + +```bash +ZIP_EXECUTABLES="flintc flint-repl" make zip +``` + ### Docker To use Flint in a [Docker](https://www.docker.com/) container run the following: