Makefile 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. build:
  2. ./compile.sh
  3. npm: npm-test npm-debug
  4. mkdir -p ./npm-wasm/bin
  5. mkdir -p ./npm-asmjs/bin
  6. ./compile.sh
  7. cp ../../out/pathkit/pathkit.js ./npm-wasm/bin
  8. cp ../../out/pathkit/pathkit.wasm ./npm-wasm/bin
  9. ./compile.sh asm.js
  10. cp ../../out/pathkit/pathkit.js ./npm-asmjs/bin/pathkit.js
  11. cp ../../out/pathkit/pathkit.js.mem ./npm-asmjs/bin/pathkit.js.mem
  12. publish:
  13. cd npm-wasm; npm publish
  14. cd npm-asmjs; npm publish
  15. update-major:
  16. cd npm-wasm; npm version major
  17. cd ../npm-asmjs; npm version major
  18. echo "Don't forget to publish."
  19. update-minor:
  20. cd npm-wasm; npm version minor
  21. cd npm-asmjs; npm version minor
  22. echo "Don't forget to publish."
  23. update-patch:
  24. cd npm-wasm; npm version patch
  25. cd npm-asmjs; npm version patch
  26. echo "Don't forget to publish."
  27. # Build the library and run the tests. If developing locally, test-continuous is better
  28. # suited for that, although if you make changes to the C++/WASM code, you will need
  29. # to manually call make npm-test to re-build.
  30. test: npm-test
  31. npm install
  32. npx karma start ./karma.conf.js --single-run
  33. ASM_JS=1 npx karma start ./karma.conf.js --single-run
  34. test-continuous:
  35. echo "Assuming npm install has been run by user"
  36. echo "Also assuming make npm-test has also been run by a user (if needed)"
  37. npx karma start ./karma.conf.js --no-single-run --watch-poll
  38. test-continuous-asmjs:
  39. echo "Assuming npm install has been run by user"
  40. echo "Also assuming make npm-test has also been run by a user (if needed)"
  41. ASM_JS=1 npx karma start ./karma.conf.js --no-single-run --watch-poll
  42. # Build the library and run the tests using the docker image. If developing locally,
  43. # test-docker-continuous is better, although if you make changes to the C++/WASM code,
  44. # you will need to manually call make npm-test to re-build.
  45. test-docker:
  46. mkdir -p ./npm-wasm/bin/test
  47. mkdir -p ./npm-asmjs/bin/test
  48. mkdir -p $$SKIA_ROOT/out/dockerbuild
  49. docker run --rm -v $$SKIA_ROOT:/SRC -v $$SKIA_ROOT/out/dockerbuild:/OUT \
  50. gcr.io/skia-public/emsdk-release:prod /SRC/infra/pathkit/build_pathkit.sh
  51. cp ../../out/dockerbuild/pathkit.js ./npm-wasm/bin/test/pathkit.js
  52. cp ../../out/dockerbuild/pathkit.wasm ./npm-wasm/bin/test/pathkit.wasm
  53. docker run --rm -v $$SKIA_ROOT:/SRC -v $$SKIA_ROOT/out/dockerbuild:/OUT \
  54. gcr.io/skia-public/emsdk-release:prod /SRC/infra/pathkit/build_pathkit.sh asm.js
  55. cp ../../out/dockerbuild/pathkit.js ./npm-asmjs/bin/test/pathkit.js
  56. cp ../../out/dockerbuild/pathkit.js.mem ./npm-asmjs/bin/test/pathkit.js.mem
  57. docker run --shm-size=2gb -v $$SKIA_ROOT:/SRC gcr.io/skia-public/karma-chrome-tests:72.0.3626.121_v1 \
  58. karma start /SRC/modules/pathkit/karma.conf.js --single-run
  59. docker run --shm-size=2gb -v $$SKIA_ROOT:/SRC -e ASM_JS=1 gcr.io/skia-public/karma-chrome-tests:72.0.3626.121_v1 \
  60. karma start /SRC/modules/pathkit/karma.conf.js --single-run
  61. test-docker-continuous:
  62. echo "Assuming make npm-test has also been run by a user (if needed)"
  63. docker run --shm-size=2gb -v $$SKIA_ROOT:/SRC gcr.io/skia-public/karma-chrome-tests:72.0.3626.121_v1 \
  64. karma start /SRC/modules/pathkit/karma.conf.js --no-single-run
  65. test-docker-continuous-asmjs:
  66. echo "Assuming make npm-test has also been run by a user (if needed)"
  67. docker run --shm-size=2gb -v $$SKIA_ROOT:/SRC -e ASM_JS=1 gcr.io/skia-public/karma-chrome-tests:72.0.3626.121_v1 \
  68. karma start /SRC/modules/pathkit/karma.conf.js --no-single-run
  69. npm-test:
  70. # This compile time is typically faster than release and good for use with
  71. # local-example-test
  72. mkdir -p ./npm-wasm/bin/test
  73. mkdir -p ./npm-asmjs/bin/test
  74. ./compile.sh test
  75. cp ../../out/pathkit/pathkit.js ./npm-wasm/bin/test/pathkit.js
  76. cp ../../out/pathkit/pathkit.wasm ./npm-wasm/bin/test/pathkit.wasm
  77. ./compile.sh asm.js test
  78. cp ../../out/pathkit/pathkit.js ./npm-asmjs/bin/test/pathkit.js
  79. cp ../../out/pathkit/pathkit.js.mem ./npm-asmjs/bin/test/pathkit.js.mem
  80. npm-debug:
  81. # This compile time is typically faster than release and good for use with
  82. # local-example-test
  83. mkdir -p ./npm-wasm/bin/debug
  84. mkdir -p ./npm-asmjs/bin/debug
  85. ./compile.sh debug
  86. cp ../../out/pathkit/pathkit.js ./npm-wasm/bin/debug/pathkit.js
  87. cp ../../out/pathkit/pathkit.wasm ./npm-wasm/bin/debug/pathkit.wasm
  88. cp ../../out/pathkit/pathkit.wasm.map ./npm-wasm/bin/debug/pathkit.wasm.map
  89. ./compile.sh asm.js debug
  90. cp ../../out/pathkit/pathkit.js ./npm-asmjs/bin/debug/pathkit.js
  91. cp ../../out/pathkit/pathkit.js.map ./npm-asmjs/bin/debug/pathkit.js.map
  92. example:
  93. npm install pathkit-asmjs pathkit-wasm
  94. echo "Go check out localhost:8000/npm-wasm/example.html"
  95. python serve.py
  96. local-example:
  97. rm -rf node_modules/pathkit-wasm
  98. rm -rf node_modules/pathkit-asmjs
  99. mkdir -p node_modules
  100. ln -s -T ../npm-wasm node_modules/pathkit-wasm
  101. ln -s -T ../npm-asmjs node_modules/pathkit-asmjs
  102. echo "Go check out http://localhost:8000/npm-wasm/example.html"
  103. echo "or http://localhost:8000/npm-asmjs/example.html"
  104. python serve.py
  105. local-example-test:
  106. rm -rf node_modules/pathkit-wasm
  107. rm -rf node_modules/pathkit-asmjs
  108. mkdir -p node_modules/pathkit-wasm
  109. mkdir -p node_modules/pathkit-asmjs
  110. ln -s -T ../../npm-wasm/bin/test node_modules/pathkit-wasm/bin
  111. ln -s -T ../../npm-asmjs/bin/test node_modules/pathkit-asmjs/bin
  112. echo "Go check out localhost:8000/npm-wasm/example.html"
  113. echo "or http://localhost:8000/npm-asmjs/example.html"
  114. python serve.py
  115. local-example-debug:
  116. rm -rf node_modules/pathkit-wasm
  117. rm -rf node_modules/pathkit-asmjs
  118. mkdir -p node_modules/pathkit-wasm
  119. mkdir -p node_modules/pathkit-asmjs
  120. ln -s -T ../../npm-wasm/bin/debug node_modules/pathkit-wasm/bin
  121. ln -s -T ../../npm-asmjs/bin/debug node_modules/pathkit-asmjs/bin
  122. echo "Go check out localhost:8000/npm-wasm/example.html"
  123. echo "or http://localhost:8000/npm-asmjs/example.html"
  124. python serve.py