Skip to content

Commit b761181

Browse files
authored
Merge pull request #1 from vlang/master
Update
2 parents 554f083 + 1e121d3 commit b761181

321 files changed

Lines changed: 48847 additions & 8147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
*.v linguist-language=Go
2-
website/* linguist-vendored
1+
*.v linguist-language=V

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ assignees: ''
99

1010
**V version:**
1111
**OS:**
12-
**C compiler version:**
1312

1413
**What did you do?**
1514

.github/PULL_REQUEST_TEMPLATE

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
**Please delete this information after reading it.*
2+
13
Please title your PR as follows: `time: fix foo bar`. Always start with the thing you are fixing, then describe the fix.
24
Don't use past tense (e.g. "fixed foo bar").
35

46
Explain what your PR does and why.
57

6-
Do not use # to generate C code. This feature will be removed in a couple of days.
8+
If you are adding a new function, please document it and add tests:
9+
10+
```
11+
// foo does foo and bar
12+
fn foo() {
13+
14+
// file_test.v
15+
fn test_foo() {
16+
assert foo() == ...
17+
...
18+
}
19+
```
720

8-
Squash commits into one if they refer to the same thing. Use `git rebase -i` for that.
21+
If you are fixing a bug, please add a test that covers it.
922

1023
Before submitting a PR, please run the tests with `make test`, and make sure V can still compile itself. Run this twice:
1124

12-
./v -o v
13-
./v -o v
25+
./v -o v compiler
26+
./v -o v compiler
1427

1528
I try to process PRs as soon as possible. They should be handled within 24 hours.
1629

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
5+
build-osx:
6+
runs-on: macOS-10.14
7+
steps:
8+
- uses: actions/checkout@v1
9+
- uses: actions/setup-node@v1
10+
with:
11+
node-version: 12.x
12+
- name: Install dependencies
13+
run: |
14+
brew install freetype glfw openssl
15+
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
16+
- name: Build V
17+
run: make && ./v -o v compiler
18+
- name: Build V using V
19+
run: ./v -o v2 compiler && ./v2 -o v3 compiler
20+
- name: Test v->c
21+
run: ./v test v
22+
- name: Test v->js
23+
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
24+
- name: Test vid
25+
run: |
26+
git clone --depth 1 https://github.com/vlang/vid.git
27+
cd vid && ../v -o vid .
28+
29+
build-ubuntu:
30+
runs-on: ubuntu-18.04
31+
steps:
32+
- uses: actions/checkout@v1
33+
- uses: actions/setup-node@v1
34+
with:
35+
node-version: 12.x
36+
- name: Install dependencies
37+
run: sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev
38+
- name: Build v
39+
run: make && ./v -o v compiler
40+
- name: Test v->c
41+
run: ./v test v
42+
- name: Test v->js
43+
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
44+
45+
build-ubuntu-tcc:
46+
runs-on: ubuntu-18.04
47+
steps:
48+
- uses: actions/checkout@v1
49+
- name: Install dependencies
50+
run: sudo apt-get update; sudo apt-get install --quiet -y tcc libglfw3 libglfw3-dev libfreetype6-dev libssl-dev
51+
- name: Build v
52+
run: make && ./v -o v compiler
53+
- name: Test v->c with tcc
54+
env:
55+
VFLAGS: -cc tcc
56+
run: |
57+
tcc -version
58+
./v -o v2 compiler # Make sure vtcc can build itself
59+
./v test v
60+
61+
build-windows-gcc:
62+
runs-on: windows-2019
63+
steps:
64+
- uses: actions/checkout@v1
65+
#- uses: actions/setup-node@v1
66+
# with:
67+
# node-version: 12.x
68+
- name: Build
69+
run: |
70+
gcc --version
71+
git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/
72+
.\make.bat -gcc
73+
- name: Test
74+
run: |
75+
.\v.exe test v
76+
## v.js dosent work on windows
77+
#.\v.exe -o hi.js examples/hello_v_js.v
78+
#node hi.js
79+
80+
build-windows-msvc:
81+
runs-on: windows-2019
82+
steps:
83+
- uses: actions/checkout@v1
84+
#- uses: actions/setup-node@v1
85+
# with:
86+
# node-version: 12.x
87+
- name: Build
88+
env:
89+
VFLAGS: -os msvc
90+
run: |
91+
git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/
92+
.\make.bat -msvc
93+
- name: Test
94+
env:
95+
VFLAGS: -os msvc
96+
run: |
97+
.\v.exe test v
98+
## v.js dosent work on windows
99+
#.\v.exe -o hi.js examples/hello_v_js.v
100+
#node hi.js

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
*.dSYM
22
*_test
3+
/v
4+
/vprod
5+
/v.c
6+
/v.*.c
7+
/v.c.out
8+
/v.exe
9+
/tools/vget
10+
/tools/vget.exe
11+
/tools/performance_compare
12+
/tools/performance_compare.exe
13+
*.exe
14+
*.o
15+
.*.c
16+
*.tmp.c
17+
vjs
18+
*.obj
19+
*.exp
20+
*.ilk
21+
*.pdb
22+
23+
#
24+
# macOS.gitignore
25+
#
26+
# General
27+
.DS_Store
28+
29+
# Thumbnails
30+
._*
31+
.vrepl_temp.v
32+
a.out

.travis.yml

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,89 @@ language: c
22
matrix:
33
include:
44
- os: linux
5+
name: "linux"
6+
dist: xenial
57
sudo: required
68
addons:
79
apt:
8-
sources:
9-
- ubuntu-toolchain-r-test
1010
packages:
11-
- gcc-5
12-
- g++-5
13-
- make
14-
- libglfw3
15-
- libglfw3-dev
16-
- libfreetype6-dev
17-
- libcurl3-dev
11+
- build-essential
12+
- libglfw3
13+
- libglfw3-dev
14+
- libfreetype6-dev
15+
- libssl-dev
16+
- os: windows
17+
name: "windows_gcc"
18+
language: bash
19+
filter_secrets: false
20+
- os: windows
21+
name: "windows_msvc"
22+
language: bash
23+
filter_secrets: false
1824
- os: osx
19-
osx_image: xcode10.2
25+
name: "osx"
26+
osx_image: xcode11
2027
addons:
2128
homebrew:
2229
packages:
23-
- freetype
24-
- glfw
25-
#env:
26-
# - MATRIX_EVAL="brew install freetype glfw"
30+
- freetype
31+
- glfw
32+
- openssl
2733
script:
2834
- |
29-
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
30-
sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
35+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
36+
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
3137
fi
32-
- export VROOT=$(pwd)
33-
- cd ./compiler
34-
- make
35-
- make test
38+
- |
39+
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
40+
### troubleshooting and diagnostics: show ALL environment variables in the instance
41+
#set
42+
set -e
43+
git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries thirdparty/freetype/
3644
45+
if [[ "${TRAVIS_JOB_NAME}" == "windows_gcc" ]]; then
46+
gcc --version
47+
echo "Building V with GCC"
48+
export VFLAGS="-os windows"
49+
./make.bat -gcc
50+
fi
51+
if [[ "${TRAVIS_JOB_NAME}" == "windows_msvc" ]]; then
52+
echo "Building V with MSVC"
53+
export VFLAGS="-os msvc"
54+
./make.bat -msvc
55+
fi
56+
57+
./v.exe test v
58+
set +e
59+
fi
60+
- |
61+
if [[ "${TRAVIS_OS_NAME}" != "windows" ]]; then
62+
make
63+
./v -o v compiler
64+
./v test v
65+
fi
66+
- |
67+
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
68+
## aliases do not work for some reason in travis, just use full commands :-|
69+
echo "Nodejs version:"
70+
node --version
71+
# Build hi.js
72+
echo "fn main(){ println('Hello from V.js') }" > hi.v
73+
./v -o hi.js hi.v
74+
node hi.js
75+
fi
76+
- |
77+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
78+
echo "Nodejs version:"
79+
node --version
80+
# Build hi.js
81+
echo "fn main(){ println('Hello from V.js') }" > hi.v
82+
./v -o hi.js hi.v
83+
node hi.js
84+
fi
85+
- |
86+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
87+
# Build Vid
88+
git clone https://github.com/vlang/vid
89+
cd vid && ../v -o vid .
90+
fi

BSDmakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CC ?= cc
2+
3+
all:
4+
rm -rf vc/
5+
git clone --depth 1 --quiet https://github.com/vlang/vc
6+
$(CC) -std=gnu11 -w -o v vc/v.c -lm
7+
rm -rf vc/
8+
@echo "V has been successfully built"

0 commit comments

Comments
 (0)