diff --git a/build.sh b/build.sh index 17463e49b..3ef148891 100755 --- a/build.sh +++ b/build.sh @@ -3,8 +3,4 @@ # Put installed packages into ./bin export GOBIN=$PWD/`dirname $0`/bin -# We can't build all packages ala ./cmd/... because ./cmd/dendritejs only works for WASM -find ./cmd -mindepth 1 -maxdepth 1 -type d | grep -v dendritejs | xargs go install -v - -# worth compiling it to make sure it's happy though, and who knows maybe they do want to build for wasm ;) -GOOS=js GOARCH=wasm go build -o dendritejs.wasm $PWD/`dirname $0`/cmd/dendritejs \ No newline at end of file +go install -v $PWD/`dirname $0`/cmd/... \ No newline at end of file diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go index 6087babd3..347a52835 100644 --- a/cmd/dendritejs/main.go +++ b/cmd/dendritejs/main.go @@ -1,4 +1,4 @@ -// Copyright 2017 Vector Creations Ltd +// Copyright 2020 The Matrix.org Foundation C.I.C. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build wasm + package main import ( diff --git a/cmd/dendritejs/main_noop.go b/cmd/dendritejs/main_noop.go new file mode 100644 index 000000000..dcea032f2 --- /dev/null +++ b/cmd/dendritejs/main_noop.go @@ -0,0 +1,23 @@ +// Copyright 2020 The Matrix.org Foundation C.I.C. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !wasm + +package main + +import "fmt" + +func main() { + fmt.Println("dendritejs: no-op when not compiling for WebAssembly") +}