Skip to content

Commit

Permalink
Merge pull request crossbario#240 from oberstet/reorg_repo
Browse files Browse the repository at this point in the history
Reorg repo
  • Loading branch information
Tobias Oberstein authored Nov 15, 2016
2 parents ebc5638 + 35757c2 commit d480ff7
Show file tree
Hide file tree
Showing 94 changed files with 121 additions and 15,653 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ node_modules
*.pyc
*.pid
.idea/
.*.swp
.lock-*
package/.crossbar/
File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) Tavendo GmbH and contributors.
Copyright (C) Crossbar.io Technologies GmbH and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.PHONY: clean build publish
.PHONY: clean build publish test

default:
@echo "Targets: clean, build, publish"

clean:
rm -rf build
rm -rf ./node_modules
rm -f .sconsign.dblite

build:
scons
Expand All @@ -16,3 +18,22 @@ publish:

closure_version:
java -jar ${JS_COMPILER} --version

requirements:
pip install -U scons scour taschenmesser boto


test:
npm test

test_connect:
nodeunit test/test_connect.js

test_msgpack_serialization:
nodeunit test/test_msgpack_serialization.js

dependencies:
npm update

publish_npm:
npm publish
8 changes: 4 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ env = Environment(tools = ['default', 'taschenmesser'],
ENV = os.environ)

# Get package version
version = json.load(open('package/package.json'))['version']
version = json.load(open('package.json'))['version']
print("Building AutobahnJS {}".format(version))

env['JS_DEFINES'] = {
# 'AUTOBAHNJS_VERSION': "'%s'" % version
}

# Source for Autobahn package
sourcedir = 'package/lib'
sourcedir = 'lib'
sources = [os.path.join(sourcedir, d) for d in os.listdir(sourcedir)]

# browserified
ab = env.Command("build/autobahn.js",
"package/lib/autobahn.js",
"lib/autobahn.js",
"browserify $SOURCE --standalone autobahn -o $TARGET")
Depends(ab, sources)

Expand Down Expand Up @@ -50,7 +50,7 @@ checksums.append(env.SHA256("build/CHECKSUM.SHA256", artifacts))

# fixed static files to be included
statics = []
for f in ["LICENSE.md"]:
for f in ["LICENSE"]:
statics.append(Command("build/{}".format(f), [], Copy("$TARGET", f)))

# The default target consists of all artifacts that
Expand Down
9 changes: 0 additions & 9 deletions copy2crossbar.py

This file was deleted.

130 changes: 77 additions & 53 deletions doc/building.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,105 @@
# Building Autobahn|JS

To build **Autobahn|JS** for use in browsers, you will need
The following describes how to build and publish **Autobahn|JS** for browser and Node.

- [Node.js](http://nodejs.org/)
- [Google Closure Compiler](http://dl.google.com/closure-compiler/compiler-latest.zip)
- [SCons](http://www.scons.org/)
- [Taschenmesser](https://github.com/oberstet/taschenmesser)
- [browserify](http://browserify.org/)
- [ws](http://websockets.github.io/ws/)
- [crypto-js](https://www.npmjs.org/package/crypto-js)

**Install NodeJS**
## Build environment (browser build)

*on Windows*
Install [Node.js](http://nodejs.org/)

Download the installer from [the NodeJS website](http://nodejs.org/download/).
sudo apt-get install -y nodejs nodejs-legacy npm

*on Ubuntu*
Install [browserify](http://browserify.org/)

sudo apt-get install nodejs nodejs-legacy npm
sudo npm install -g browserify nodeunit

SCons is a Python based build tool, so you will need [Python](http://python.org/) as well.
Install Python tools (preferrably into a dedicated virtualenv)

**Install Taschenmesser**, a SCons toolbelt also written in Python
pip install -U scons boto scour taschenmesser

*on Windows*
Install Java JDK

pip install --upgrade taschenmesser[aws,svg]
sudo apt install -y openjdk-8-jdk

*on Ubuntu*
Install [Google Closure Compiler](https://developers.google.com/closure/compiler/)

sudo pip install --upgrade taschenmesser[aws,svg]
cd ~
rm -f compiler-latest.zip
wget https://dl.google.com/closure-compiler/compiler-latest.zip
unzip -o compiler-latest.zip

**Set environment variables**
This will produce a file like `closure-compiler-v20161024.jar` in your `$HOME`.

*on Windows*
Install library dependencies

1. `JAVA_HOME` pointing to your Java run-time
sudo npm install -g ws when crypto-js msgpack-lite utf-8-validate

C:\Program Files\Java\jre7
Set environment variables (add that to `$HOME/.profile`):

1. Add Python and Python script to `PATH`

C:\Python27;C:\Python27\Scripts;

1. Set `JS_COMPILER` pointing to the Google Closure `compiler.jar`

C:\Program Files\Google Closure\compiler.jar

*on Ubuntu*

export JS_COMPILER=$HOME/compiler.jar
export JS_COMPILER=$HOME/closure-compiler-v20161024.jar
export JAVA_HOME=/usr/lib/jvm/default-java
export NODE_PATH=/usr/local/lib/node_modules/

**Clone the Autobahn|JS repo**

git clone [email protected]:tavendo/AutobahnJS.git
cd autobahnjs

**Install JavaScript dependencies in NodeJS**
## Building for browsers

npm install ws when crypto-js

**Start the build**:
To start the build:

scons

> **note**
>
> When using a bash shell under Windows (e.g. git shell), use 'scons.py'.
**You get 3 files inside the** `build` **directory**

build/autobahn.js
build/autobahn.min.js
build/autobahn.min.jgz

To **clean up your build** (i.e. remove previously created files):
To clean up your build:

scons -uc

Here is a typical build output (*some* warnings are "ok" - they come from dependencies we don't control):


```console
(cpy2712_1) oberstet@office-corei7:~/scm/crossbario/autobahn-js$ scons
scons: Reading SConscript files ...
Building AutobahnJS 0.11.0
scons: done reading SConscript files.
scons: Building targets ...
browserify lib/autobahn.js --standalone autobahn -o build/autobahn.js
js_builder(["build/autobahn.min.js"], ["build/autobahn.js"])
java -jar /home/oberstet/closure-compiler-v20161024.jar --compilation_level SIMPLE_OPTIMIZATIONS --js build/autobahn.js --js_output_file build/autobahn.min.js
build/autobahn.js:772: WARNING - Suspicious negated left operand of in operator.
while ( k < len && ! k in t ) k++;
^

build/autobahn.js:866: WARNING - Suspicious negated left operand of in operator.
while ( k >= 0 && ! k in t ) k--;
^

build/autobahn.js:6098: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
array.byteLength // this throws if `array` is not a valid ArrayBuffer
^

build/autobahn.js:15857: WARNING - Suspicious code. The result of the 'not' operator is not being used.
!function(exports) {
^

0 error(s), 4 warning(s)
gzipper(["build/autobahn.min.jgz"], ["build/autobahn.min.js"])
checksumsMD5(["build/CHECKSUM.MD5"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
checksumsSHA1(["build/CHECKSUM.SHA1"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
checksumsSHA256(["build/CHECKSUM.SHA256"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
Copy("build/LICENSE", "LICENSE")
scons: done building targets.
```

This should produce the following build artifacts:

```console
(cpy2712_1) oberstet@office-corei7:~/scm/crossbario/autobahn-js$ ls -la build/
insgesamt 896
drwxrwxr-x 2 oberstet oberstet 4096 Nov 15 10:51 .
drwxrwxr-x 7 oberstet oberstet 4096 Nov 15 10:51 ..
-rw-rw-r-- 1 oberstet oberstet 573208 Nov 15 10:51 autobahn.js
-rw-rw-r-- 1 oberstet oberstet 58009 Nov 15 10:51 autobahn.min.jgz
-rw-rw-r-- 1 oberstet oberstet 198906 Nov 15 10:51 autobahn.min.js
-rw-rw-r-- 1 oberstet oberstet 168 Nov 15 10:51 CHECKSUM.MD5
-rw-rw-r-- 1 oberstet oberstet 195 Nov 15 10:51 CHECKSUM.SHA1
-rw-rw-r-- 1 oberstet oberstet 273 Nov 15 10:51 CHECKSUM.SHA256
-rw-rw-r-- 1 oberstet oberstet 1086 Nov 15 10:46 LICENSE
```
13 changes: 1 addition & 12 deletions DEVELOPERS.md → doc/releasesteps.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
## Google Closure

For building the browser version of AutobahnJS, you will need the [Google Closure Compiler](https://developers.google.com/closure/compiler/index).

Download from [here](https://dl.google.com/closure-compiler/compiler-latest.zip).

cd ~
wget https://dl.google.com/closure-compiler/compiler-latest.zip
unzip -o compiler-latest.zip

Set `$JS_COMPILER` to `${HOME}/compiler.jar`.

# Releasing Autobahn|JS

## Release Steps

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 14 additions & 12 deletions package/package.json → package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{
"name": "autobahn",
"version": "0.10.1",
"version": "0.11.0",
"description": "An implementation of The Web Application Messaging Protocol (WAMP).",
"main": "index.js",
"browser": {
"lib/transport/rawsocket.js": false,
"msgpack-lite": "msgpack-lite/global"
},
"scripts": {
"test": "nodeunit test/test.js"
},
"dependencies": {
"crypto-js": ">= 3.1.5",
"when": ">= 3.7.3",
"ws": ">= 0.8.0",
"msgpack-lite": ">= 0.1.17"
"crypto-js": ">= 3.1.8",
"tweetnacl": ">= 0.14.3",
"when": ">= 3.7.7",
"ws": ">= 1.1.1",
"msgpack-lite": ">= 0.1.26"
},
"optionalDependencies": {
"bufferutil": ">= 1.2.1",
"utf-8-validate": ">= 1.2.1"
},
"devDependencies": {
"browserify": ">= 11.0.1",
"nodeunit": ">= 0.9.1"
"browserify": ">= 13.1.1",
"nodeunit": ">= 0.10.2"
},
"browser": {
"ws": false,
"lib/transport/rawsocket.js": false,
"msgpack-lite": "msgpack-lite/global"
},
"repository": {
"type": "git",
Expand All @@ -34,6 +36,6 @@
"RPC",
"PubSub"
],
"author": "Tavendo GmbH",
"author": "Crossbar.io Technologies GmbH",
"license": "MIT"
}
5 changes: 0 additions & 5 deletions package/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions package/Makefile

This file was deleted.

14 changes: 0 additions & 14 deletions package/README.md

This file was deleted.

File renamed without changes.
17 changes: 0 additions & 17 deletions test/basicpubsub/__init__.py

This file was deleted.

Binary file removed test/basicpubsub/__init__.pyc
Binary file not shown.
9 changes: 0 additions & 9 deletions test/basicpubsub/backend.html

This file was deleted.

Loading

0 comments on commit d480ff7

Please sign in to comment.