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

simplify dist by merging sql-asm-memory-growth.js into sql-asm.js #431

Open
wants to merge 3 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
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ EMFLAGS = \
-s NODEJS_CATCH_REJECTION=0

EMFLAGS_ASM = \
-s WASM=0

EMFLAGS_ASM_MEMORY_GROWTH = \
-s WASM=0 \
-s ALLOW_MEMORY_GROWTH=1
-s ALLOW_MEMORY_GROWTH=1 \
-s LEGACY_VM_SUPPORT=1

EMFLAGS_WASM = \
-s WASM=1 \
Expand Down Expand Up @@ -90,7 +88,7 @@ dist/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FI
rm out/tmp-raw.js

.PHONY: optimized
optimized: dist/sql-asm.js dist/sql-wasm.js dist/sql-asm-memory-growth.js
optimized: dist/sql-asm.js dist/sql-wasm.js

dist/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FILES) $(EXPORTED_METHODS_JSON_FILES)
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) $(EMFLAGS_ASM) $(BITCODE_FILES) $(EMFLAGS_PRE_JS_FILES) -o $@
Expand All @@ -103,12 +101,9 @@ dist/sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FILES) $
mv $@ out/tmp-raw.js
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
rm out/tmp-raw.js

dist/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FILES) $(EXPORTED_METHODS_JSON_FILES)
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) $(EMFLAGS_ASM_MEMORY_GROWTH) $(BITCODE_FILES) $(EMFLAGS_PRE_JS_FILES) -o $@
mv $@ out/tmp-raw.js
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
rm out/tmp-raw.js
# TODO - remove code below in future releases to sunset sql-asm-memory-growth.js
printf 'console.error(\n "\\n\\nDEPRECATION WARNING.\\n"\n + "sql-asm-memory-growth.js will be removed in future releases.\\n"\n + "Use sql-asm.js instead, which now includes memory-growth support.\\n\\n"\n);\n' > dist/sql-asm-memory-growth.js
cat $@ >> dist/sql-asm-memory-growth.js

# Web worker API
.PHONY: worker
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ You can always find the latest published artifacts on https://github.com/sql-js/
For each [release](https://github.com/sql-js/sql.js/releases/), you will find a file called `sqljs.zip` in the *release assets*. It will contain:
- `sql-wasm.js` : The Web Assembly version of Sql.js. Minified and suitable for production. Use this. If you use this, you will need to include/ship `sql-wasm.wasm` as well.
- `sql-wasm-debug.js` : The Web Assembly, Debug version of Sql.js. Larger, with assertions turned on. Useful for local development. You will need to include/ship `sql-wasm-debug.wasm` if you use this.
- `sql-asm.js` : The older asm.js version of Sql.js. Slower and larger. Provided for compatibility reasons.
- `sql-asm-memory-growth.js` : Asm.js doesn't allow for memory to grow by default, because it is slower and de-optimizes. If you are using sql-asm.js and you see this error (`Cannot enlarge memory arrays`), use this file.
- `sql-asm.js` : The older asm.js version of Sql.js. Slower and larger. Provided for compatibility reasons. Includes memory-growth and IE 11 compatibility.
- `sql-asm-memory-growth.js` : DEPRECATED and will be removed in future releases. Use sql-asm.js instead, which now includes memory-growth support.
- `sql-asm-debug.js` : The _Debug_ asm.js version of Sql.js. Use this for local development.
- `worker.*` - Web Worker versions of the above libraries. More limited API. See [examples/GUI/gui.js](examples/GUI/gui.js) for a good example of this.

Expand Down
2 changes: 1 addition & 1 deletion examples/requireJS.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
baseUrl: baseUrl
});

// Options: 'sql-wasm', 'sql-asm', 'sql-asm-memory-growth.js', 'sql-wasm-debug', 'sql-asm-debug'
// Options: 'sql-wasm', 'sql-asm', 'sql-wasm-debug', 'sql-asm-debug'
require(['sql-wasm'],
function success(initSqlJs) {
console.log(typeof initSqlJs);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
"scripts": {
"build": "make",
"rebuild": "make clean && make",
"test": "npm run lint && npm run test-asm && npm run test-asm-debug && npm run test-wasm && npm run test-wasm-debug && npm run test-asm-memory-growth",
"test": "npm run lint && npm run test-asm && npm run test-asm-debug && npm run test-wasm && npm run test-wasm-debug",
"lint": "eslint .",
"prettify": "eslint . --fix",
"test-asm": "node test/all.js asm",
"test-asm-debug": "node test/all.js asm-debug",
"test-asm-memory-growth": "node test/all.js asm-memory-growth",
"test-wasm": "node test/all.js wasm",
"test-wasm-debug": "node test/all.js wasm-debug",
"doc": "jsdoc -c .jsdoc.config.json"
Expand Down
2 changes: 1 addition & 1 deletion test/test_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Worker {
exports.test = async function test(SQL, assert) {
var target = process.argv[2];
var file = target ? "sql-" + target : "sql-wasm";
if (file.indexOf('wasm') > -1 || file.indexOf('memory-growth') > -1) {
if (file.indexOf('wasm') > -1) {
console.error("Skipping worker test for " + file + ". Not implemented yet");
return;
};
Expand Down