Skip to content

Conversation

@ptomato
Copy link
Contributor

@ptomato ptomato commented Feb 14, 2023

This consists of various fixes and improvements to the build instructions and tests that I came across when building for the first time. (Doesn't fix any specific issue number.) See the individual commit messages for more explanation, but here's a summary:

  • Add steps to the build instructions in the README describing how to install the jsparser test dependencies and which environment variables need to be set
  • Fixes for the static binding generator tests (they relied on being able to load Java system classes from an actual JAR file, which doesn't exist in recent Java versions)
  • A fix for the AST parser tests taking a really long time to time out if they failed

No new tests; the changes are either in the documentation, in the tests themselves, or fixes that enable the tests to complete successfully on my machine.

@cla-bot
Copy link

cla-bot bot commented Feb 14, 2023

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign the CLA at https://www.nativescript.org/cla.
CLA has not been signed by users: @ptomato.
After signing the CLA, you can ask me to recheck this PR by posting @cla-bot check as a comment to the PR.

@cla-bot cla-bot bot added the cla: yes label Mar 6, 2023
@ptomato ptomato changed the base branch from main to feature/v8-10.3.22-perf March 6, 2023 23:40
@ptomato
Copy link
Contributor Author

ptomato commented Mar 6, 2023

Retargeted to the feature/v8-10.3.22-perf branch for now.

@ptomato ptomato changed the base branch from feature/v8-10.3.22-perf to main April 4, 2023 00:51
@ptomato
Copy link
Contributor Author

ptomato commented Apr 4, 2023

Retargeted back to main.

ptomato added 9 commits April 6, 2023 17:30
Previously, if these tests were to fail, they'd never call `done()` and so
Jasmine would wait for the full timeout period before declaring the tests
failed. (This would happen if you didn't have the NPM dependencies
installed.)
The build file for SBG tests uses some properties, such as
ns_default_asm_version, that are defined in the toplevel build file. This
build file needs to import those properties.
One step for installing the jsparser tests dependencies. This also updates
the lockfile if you do it with a recent version of NPM; speculatively
including that in this commit in case it doesn't break anything else.

Another step for setting the appropriate environment variables. They're
already mentioned in the Android Studio instructions above, but you'll
need to set them separately in your shell if building from the command
line.
This JAR file, which contains the Java runtime classes, doesn't exist as a
separate file ever since Java 9.x. Therefore this test can't work as it
previously did.

This removes the setup code that tries to read rt.jar, which always fails.
It adds assertions for the results of generateBinding(), since in the
current state of the test, without access to rt.jar, the generation fails
and generateBinding() returns null.
Since we can no longer load lib/rt.jar, and system classes no longer exist
in an actual JAR file, this introduces a small helper function to get a
BCEL JavaClass for a system class, using ClassPath.SYSTEM_CLASS_PATH.

(I'm not sure why this only came up in tests and not in runtime execution
of the static binding generator, though.)
The Pack200 interface was removed in Java 11, so these interfaces no
longer exist in modern Java. I believe they were only used as sample
interfaces in the tests anyway, so just remove them from the test data.
"gradlew runtest" doesn't work because Gradle complains the name of the
target is ambiguous.
Some of the paths need to be updated.

The JSON file is now generated, not checked in to V8. So in order to edit
the protocol we need to modify the PDL file, which is the source of the
JSON file.
These files make it possible to run the test-app in Android Studio, then
connect it to the devtools inspector with `ns debug android --start`.
(The package.json lists a dependency, but there's no need to run `npm
install` if you have the NativeScript CLI already installed globally.)
@triniwiz triniwiz merged commit d08c4a5 into NativeScript:main May 16, 2023
@ptomato ptomato deleted the build-process branch May 16, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants