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

Javascript extractor: Bazel-based build #14552

Merged
merged 3 commits into from Oct 24, 2023
Merged

Javascript extractor: Bazel-based build #14552

merged 3 commits into from Oct 24, 2023

Conversation

criemen
Copy link
Collaborator

@criemen criemen commented Oct 20, 2023

This introduces a bazel-based build for the Java components of the JS extractor.

@github-actions github-actions bot added the JS label Oct 20, 2023
@criemen criemen marked this pull request as ready for review October 20, 2023 14:33
@criemen criemen requested a review from a team as a code owner October 20, 2023 14:33
@criemen
Copy link
Collaborator Author

criemen commented Oct 20, 2023

@redsun82 will this interfere with the in-repo bazel build defined elsewhere?

"@//resources/lib/java:jericho-html",
"@//resources/lib/java:slf4j-api",
"@//resources/lib/java:snakeyaml",
"@//resources/lib/java/DO_NOT_DISTRIBUTE:junit",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need this in deps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Surprisingly, yes. I think the project could use a better setup, to not compile (and ship) the unit tests (see https://github.com/github/codeql/tree/main/javascript/extractor/src/com/semmle/js/extractor/test).
I don't know how or where those tests are run either.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know how or where those tests are run either.

That seems important to find out, if only to ensure that we don't break anything by accident.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found out how it's working - there's a separate build target that runs these tests, and it's not broken by either this PR or the internal PR.

@redsun82
Copy link
Contributor

redsun82 commented Oct 23, 2023

@redsun82 will this interfere with the in-repo bazel build defined elsewhere?

it shouldn't... it will break bazel build //..., but otherwise specific //swift targets will be unaffected.

On the other hand, it is a bit weird to have open source code that only builds with an internal closed source build configuration. But I guess it was the case already before this change, right?

@criemen
Copy link
Collaborator Author

criemen commented Oct 23, 2023

Yes, exactly, this is not a regression. As we depend on a bunch of internal projects here it's not so easy to make this buildable standalone, and that's not the goal of my PR either.

@redsun82
Copy link
Contributor

@criemen I've opened a draft PR here #14562 that triggers the swift bazel build, just to be sure 🙂

@redsun82
Copy link
Contributor

Yeah, I can confirm this has no effect on other in-repo bazel builds 👍

@erik-krogh
Copy link
Contributor

Can you explain what the Fix errorprone violations. commit is about?

@criemen
Copy link
Collaborator Author

criemen commented Oct 23, 2023

Sure - bazel now compiles everything with errorprone, and that discovered that the two ifs I removed were never actually taken (char is unsigned in Java, therefore it can never be less than zero).

@erik-krogh
Copy link
Contributor

Sure - bazel now compiles everything with errorprone, and that discovered that the two ifs I removed were never actually taken (char is unsigned in Java, therefore it can never be less than zero).

Can you instead change the peek() method? Change the (char) -1 in there to something else, and use that new value in the locations you deleted in the Fix errorprone violations commit.

@criemen
Copy link
Collaborator Author

criemen commented Oct 24, 2023

Sure, I replaced -1 with Character.MAX_VALUE. Can you approve the PR based on that?

Copy link
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

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

I replaced -1 with Character.MAX_VALUE. Can you approve the PR based on that?

Yes 👍

Although I have no idea about the Bazel file.

Copy link
Contributor

@cklin cklin left a comment

Choose a reason for hiding this comment

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

👍 for the Bazel part

@criemen criemen merged commit 790615f into main Oct 24, 2023
8 checks passed
@criemen criemen deleted the criemen/bazel-js branch October 24, 2023 17:36
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.

None yet

4 participants