Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question WebGL - JSlib validation without building

Discussion in 'Editor & General Support' started by Oneiros90, Feb 15, 2021.

  1. Oneiros90

    Oneiros90

    Joined:
    Apr 29, 2014
    Posts:
    77
    Hi, I wanted to ask if there's any way to "compile" a .jslib file in order to know immediately if there are any syntax errors or some incompatible calls in the javascript code. I don't want to wait the TWENTY minutes needed by the building process just to get informed that I missed a '
    (
    ' or something like that.
    I noticed that this is the internal call that compiles the jslib file:

    "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"<my project>\Temp\emcc_arguments.resp"


    I tried to call this command directly through the command prompt but emcc cannot find the correct paths to LLVM and Node.JS... does it need an environement to be configured?

    Here's the .resp file that is generated by the building process and that is passed to emcc (I separated arguments in new lines for readability):
    Code (csharp):
    1. -O3
    2. -g0
    3. -DUNITY_WEBGL=1
    4. -s PRECISE_F32=2
    5. -s USE_WEBGL2=1
    6. -s FULL_ES3=1
    7. -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addRunDependency','removeRunDependency','FS_createPath','FS_createDataFile','ccall','cwrap','stackTrace']"
    8. -s DISABLE_EXCEPTION_CATCHING=0
    9. -s TOTAL_MEMORY=32MB
    10. -s WASM=1
    11. -s "BINARYEN_TRAP_MODE='allow'"
    12. -s ALLOW_MEMORY_GROWTH=1
    13. --memory-init-file 1
    14. --emit-symbol-map
    15. --output_eol linux
    16. -o "<my project>\Temp\StagingArea\Data\linkresult_wasm\build.js"
    17. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\UserJsprePlaceholder.js"
    18. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\prejs\Error.js"
    19. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\prejs\FileSystem.js"
    20. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\prejs\FullScreen.js"
    21. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\prejs\MediaDevices.js"
    22. --pre-js "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\prejs\SendMessage.js"
    23. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Audio.js"
    24. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\case_1179945_workaround.js"
    25. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Cursor.js"
    26. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Eval.js"
    27. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\FileSystem.js"
    28. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Logging.js"
    29. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Profiler.js"
    30. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\SystemInfo.js"
    31. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\UnetWebSocket.js"
    32. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\Video.js"
    33. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\WebCam.js"
    34. --js-library "D:/Development/Programs/Unity/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\WebRequest.js"
    35. --js-library "<my project>\Assets\MicrophoneWebGL\Plugins\WebGLMicrophone.jslib"
     
    Last edited: Feb 15, 2021
    megame_dev and GreenTVlad like this.
  2. eyalfx

    eyalfx

    Joined:
    Oct 8, 2010
    Posts:
    108
    I'm also looking for a solution for that.
     
  3. GreenTVlad

    GreenTVlad

    Joined:
    Oct 2, 2019
    Posts:
    19
    Up.
    It's not normal to wait rebuild on every change just to know that there is another mistake.
    Maybe someone can tell how to change .jslib zipped inside build without rebuild whole project?
     
  4. ryan-at-melcher

    ryan-at-melcher

    Joined:
    Oct 22, 2018
    Posts:
    13
    Hey Vlad. I was able to modify a jslib without rebuilding the project.

    I opened my <buildname>/Build/<buildname>.framework.js.gz file and extracted the framework.js file. The framework file contains a minified version of my jslib. I made the changes I needed, repacked the .gz file and uploaded it. This worked.