Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General build process fixes #482

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,14 +23,18 @@ 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
- (cd /tmp/swiftlint; swiftenv install; swift build -c release --static-swift-stdlib)
- git clone --branch 0.38.1 https://github.com/realm/SwiftLint.git /tmp/swiftlint
- (cd /tmp/swiftlint; swiftenv install; swift build -c release)
- export PATH="/tmp/swiftlint/.build/x86_64-unknown-linux/release:$PATH"
script:
- cd $HOME/.flint
- make
- make release
- make test
- os: osx
language: objective-c
osx_image: xcode11.3
if: tag =~ ^*-macos$
before_deploy:
- swift package update
- make release
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ 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)
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

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:
Expand All @@ -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 $(ZIP_EXECUTABLES); do \
cp .build/release/$$EXECUTABLE $$EXECUTABLE; \
done
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
Expand Down
22 changes: 22 additions & 0 deletions docs/language_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down