Skip to content

Conversation

@TimothyGillespie
Copy link
Member

Quiet some work has to be done here.

The swipl-wasm files cannot be imported via "import" because they are not in the src folder. It works with npm test but not with npm start.

Other issues may appear when using npm start like unused dependencies.
If it works like this is yet to be seen. The tests pass for now.

@TimothyGillespie
Copy link
Member Author

I added a deployment key to semaphore but it didn't work. I will look into what I did wrong tomorrow.

@TimothyGillespie TimothyGillespie force-pushed the TimothyGillespie/diprocheIntegration branch from 7ad38cc to 022a695 Compare August 21, 2019 23:34
@TimothyGillespie
Copy link
Member Author

I made the mistake of using https instead of ssh. Semaphore of course cannot use the deploy key with https. But the ssh set up doesn't work either even though I did things the same way as with the first diproche dependency. I tried a few things, but couldn't figure it out for now.

@TimothyGillespie
Copy link
Member Author

Two errors occure. With npm start this error list will be given:

npm start error
./src/util/swipl-wasm/swipl-web.js
  Line 19:    Unexpected use of 'location'                                           no-restricted-globals
  Line 21:     Unexpected use of 'location'                                           no-restricted-globals
  Line 23:    Unexpected use of 'location'                                           no-restricted-globals
  Line 1319:  'read' is not defined                                                  no-undef
  Line 1325:  'readbuffer' is not defined                                            no-undef
  Line 1327:  'read' is not defined                                                  no-undef
  Line 1332:  'scriptArgs' is not defined                                            no-undef
  Line 1334:  'arguments' is not defined                                             no-undef
  Line 1338:   'quit' is not defined                                                  no-undef
  Line 1380:  Unexpected use of 'print'                                              no-restricted-globals
  Line 1381:   Unexpected use of 'print'                                              no-restricted-globals
  Line 1385:   'printErr' is not defined                                              no-undef
  Line 1555:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 1555:   'tempI64' is not defined                                               no-undef
  Line 1557:  'tempDouble' is not defined                                            no-undef
  Line 1558:  'tempDouble' is not defined                                            no-undef
  Line 1559:  'tempDouble' is not defined                                            no-undef
  Line 1560:  'tempDouble' is not defined                                            no-undef
  Line 1564:  'tempDouble' is not defined                                            no-undef
  Line 1564:  'tempDouble' is not defined                                            no-undef
  Line 1568:  'tempI64' is not defined                                               no-undef
  Line 1569:  'tempI64' is not defined                                               no-undef
  Line 2761:  'readline' is not defined                                              no-undef
  Line 3715:  'FileReaderSync' is not defined                                        no-undef
  Line 4935:  'path' is not defined                                                  no-undef
  Line 5576:   'Browser' is not defined                                               no-undef
  Line 5603:   'Browser' is not defined                                               no-undef
  Line 5865:  'SOCKFS' is not defined                                                no-undef
  Line 5873:  '__read_sockaddr' is not defined                                       no-undef
  Line 5875:  'DNS' is not defined                                                   no-undef
  Line 6706:  'loadWebAssemblyModule' is not defined                                 no-undef
  Line 6824:   Unexpected use of 'self'                                               no-restricted-globals
  Line 6825:   Unexpected use of 'self'                                               no-restricted-globals
  Line 6827:  Unexpected use of 'self'                                               no-restricted-globals
  Line 6828:  Unexpected use of 'self'                                               no-restricted-globals

Search for the keywords to learn more about each error.

This error occurred during the build time and cannot be dismissed.
These are ts errors in the swipl-js file, but I apparently cannot disable ts checks of these. I tried the `// @ts-nocheck` flag and the `"checkJs": "false"` option in the `tsconfig.jason`. Both didn't seem to work. They must have been previously ignored since they were not in the src folder.


The test of diprocheHandler.test.ts threw this:

diprocheHandler test errors
    TypeError: Cannot read property 'expectedDataFileDownloads' of undefined

      1 | // Not sure why it has to be imported like this, but if I don't it breaks
      2 | import { Module } from "../../../src/util/prolog/swiplwasmHandler";
    > 3 | if (!Module.expectedDataFileDownloads) {
        |             ^
      4 |   Module.expectedDataFileDownloads = 0;
      5 |   Module.finishedDataFileDownloads = 0;
      6 | }

      at Object.expectedDataFileDownloads (src/util/swipl-wasm/swipl-web.js:3:13)
      at Object.<anonymous> (src/util/prolog/swiplwasmHandler.ts:3:1)
      at Object.<anonymous> (src/util/diproche/diprocheHandler.ts:3:1)
      at Object.<anonymous> (src/util/diproche/diprocheHandler.test.ts:1:1)

The latter error was resolvable by changing the import order, but there is still an issue with the diprocheHandler test just timing out and thus failing. It did work previously, when the swipl-wasm files were outside the src folder.


function addDiprocheIssues(unverifiedLines: number[]): void {
unverifiedLines.forEach((singleLine: number) => {
addIssue("UNVERIFIED_LINE", { fromIndex: singleLine, toIndex: singleLine});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines are not indices

// swipl-wasm cannot parse multiple results
// This line will display multiple results for a variable X in a bag
// Not a nice solution, could be improved upon. Works for diproche though.
return query("bagof(X, " + queryText.substr(0, queryText.length - 1) + ", Xs).");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just do query = `bagof(X, ${queryText.substr(0, queryText.length - 1)}, Xs).`; in line 11. Then this function would always just behave the same and return a list of results (sometimes containing just a single element).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause issues with answers like "true" and only the same variable can be used which is X. But some more consistency really would be nice. I will see how I can manage this in the end.

TimothyGillespie and others added 5 commits August 27, 2019 21:36
Co-Authored-By: Fabian Grewing <Fabian.Heimbuerger@gmail.com>
Co-Authored-By: Fabian Grewing <Fabian.Heimbuerger@gmail.com>
Co-Authored-By: Fabian Grewing <Fabian.Heimbuerger@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants