Skip to content

Commit 7375c71

Browse files
Merge pull request #1 from kateinoigakukun/build-system
Simplify build system
2 parents 0db7f03 + 267146d commit 7375c71

File tree

11 files changed

+32
-59
lines changed

11 files changed

+32
-59
lines changed

Diff for: .github/workflows/test.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ on: [push, pull_request]
33
jobs:
44
test:
55
name: Build and Test
6-
runs-on: macOS-10.15
6+
strategy:
7+
matrix:
8+
os: [macOS-10.15]
9+
include:
10+
- os: macOS-10.15
11+
toolchain: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2020-03-08-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2020-03-08-a-osx.tar.gz
12+
runs-on: ${{ matrix.os }}
713
steps:
814
- name: Checkout
915
uses: actions/checkout@master
@@ -19,4 +25,4 @@ jobs:
1925
make bootstrap
2026
make test
2127
env:
22-
TOOLCHAIN_DOWNLOAD: https://github.com/kateinoigakukun/swiftwasm/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2020-03-05-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2020-03-05-a-osx.tar.gz
28+
TOOLCHAIN_DOWNLOAD: ${{ matrix.toolchain }}

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
dist
22
node_modules
3-
.wasi-sdk
43
.DS_Store
54
/.build
65
/Packages

Diff for: .swift-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
wasm-DEVELOPMENT-SNAPSHOT-2020-03-05-a
1+
wasm-DEVELOPMENT-SNAPSHOT-2020-03-08-a

Diff for: Example/JavaScriptKitExample/Makefile

-8
This file was deleted.

Diff for: Example/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
22

33
.PHONY: JavaScriptKitExample
44
JavaScriptKitExample:
5-
cd JavaScriptKitExample && make build
5+
cd JavaScriptKitExample && \
6+
swift build --triple wasm32-unknown-wasi
67

78
dist/JavaScriptKitExample.wasm: JavaScriptKitExample
89
mkdir -p dist

Diff for: IntegrationTests/JavaScriptKitExec/Makefile

-8
This file was deleted.

Diff for: IntegrationTests/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
22

33
.PHONY: JavaScriptKitExec
44
JavaScriptKitExec:
5-
cd JavaScriptKitExec && make build
5+
cd JavaScriptKitExec && \
6+
swift build --triple wasm32-unknown-wasi
67

78
dist/JavaScriptKitExec.wasm: JavaScriptKitExec
89
mkdir -p dist

Diff for: Makefile

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
2-
WASI_SDK_DIR ?= $(MAKEFILE_DIR)/.wasi-sdk
3-
WASI_SYSROOT ?= $(WASI_SDK_DIR)/share/wasi-sysroot
42

53
.PHONY: bootstrap
64
bootstrap:
75
cd Runtime && npm install
86

97
.PHONY: build
10-
build: .wasi-sdk/dummy
11-
./script/build-package.sh $(WASI_SYSROOT)
8+
build:
9+
swift build --triple wasm32-unknown-wasi
1210
cd Runtime && npm run build
1311

1412
.PHONY: test
15-
test: build
13+
test:
1614
cd IntegrationTests && make test
1715

18-
.wasi-sdk/dummy:
19-
./script/install-wasi-sdk.sh $(WASI_SDK_DIR)
20-
touch .wasi-sdk/dummy

Diff for: Package.swift

+16-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,23 @@ let package = Package(
1010
targets: [
1111
.target(
1212
name: "JavaScriptKit",
13-
dependencies: ["_CJavaScriptKit"]),
13+
dependencies: ["_CJavaScriptKit"],
14+
linkerSettings: [
15+
.unsafeFlags([
16+
"-Xlinker",
17+
"--export=swjs_call_host_function",
18+
"-Xlinker",
19+
"--export=swjs_prepare_host_function_call"
20+
])
21+
]),
1422
.target(
15-
name: "_CJavaScriptKit"),
23+
name: "_CJavaScriptKit",
24+
linkerSettings: [
25+
.unsafeFlags([
26+
"-Xlinker",
27+
"--allow-undefined",
28+
])
29+
]),
1630
.testTarget(
1731
name: "JavaScriptKitTests",
1832
dependencies: ["JavaScriptKit"]),

Diff for: script/build-package.sh

-10
This file was deleted.

Diff for: script/install-wasi-sdk.sh

-17
This file was deleted.

0 commit comments

Comments
 (0)