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

[WIP] Bazel build system #11337

Open
wants to merge 105 commits into
base: develop
Choose a base branch
from
Open

[WIP] Bazel build system #11337

wants to merge 105 commits into from

Conversation

Frizi
Copy link
Contributor

@Frizi Frizi commented Oct 16, 2024

Pull Request Description

Created a bazel-based build system, implemented a whole GUI build target within it.

Currently this PR open in order to develop and test the github actions workflow.

Frizi and others added 30 commits April 19, 2024 14:39
Using latest JDK (after proper GraalVM integration) broke compilation of
Scala projects due to a problem with SecurityManager in `scala_rules`.
Workaround it by having custom toolchain.

Added example BUILD for mixed Scala/Java project with a small number of
dependencies.
@Frizi Frizi added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Oct 23, 2024
@Frizi Frizi marked this pull request as ready for review October 23, 2024 21:09
Copy link
Contributor

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

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

Review in-progress

app/gui/BUILD.bazel Outdated Show resolved Hide resolved
app/gui/BUILD.bazel Outdated Show resolved Hide resolved
app/gui/BUILD.bazel Outdated Show resolved Hide resolved
app/gui/env.d.ts Outdated Show resolved Hide resolved
app/gui/scripts/envReplacer.mjs Outdated Show resolved Hide resolved
app/gui/src/config.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

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

I was skipping files which are related to Java/Scala stuff because I assume they will change in the future.

@@ -1251,7 +1251,7 @@ export default class RemoteBackend extends Backend {
async logEvent(message: string, projectId?: string | null, metadata?: object | null) {
// Prevent events from being logged in dev mode, since we are often using production environment
// and are polluting real logs.
if (detect.IS_DEV_MODE && process.env.ENSO_CLOUD_ENVIRONMENT === 'production') {
Copy link
Contributor

Choose a reason for hiding this comment

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

While the check is questionable, wouldn’t it change the behavior for the dashboard team?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this check myself back when we were unintentionally sending all development logs to production database. The environment check wasn't really the best approach though, but my intention was to indeed do the least amount of change. Now I'm pretty confident that we flat out don't want to send any dev logs to production logger, so I changed that once I noticed this line when applying the config changes. If we want logging during testing, we should configure a separate logger endpoint for that.

if (payload != null) {
const contentType = options.mimetype ?? 'application/json'
headers.set('Content-Type', contentType)
}

// `Blob` request payloads are NOT VISIBLE in Playwright due to a Chromium bug.
// https://github.com/microsoft/playwright/issues/6479#issuecomment-1574627457
if (process.env.IS_IN_PLAYWRIGHT_TEST === 'true' && payload instanceof Blob) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about removing of this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I have in notes to verify on CI if this trips anything up. I needed to remove it to make the dist package independent of envs. After carefully reading the linked issue, it seems to manifest itself only when request payload is being cloned. We don't use that functionality anywhere in our code, so it's worth to verify if it's actually necessary. If it turns out to be necessary, we should somehow fix it in the playwright test setup code instead, so the app code doesn't need to be specialized for tests.

app/ide-desktop/client/src/preload.ts Outdated Show resolved Hide resolved
app/toolchains/dummy_cc/BUILD.bazel Outdated Show resolved Hide resolved
name = "tsc",
srcs = glob(
["src/**/*.ts"],
IGNORED_GENERATED_FILES,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why we use IGNORED files as an input. Perhaps a better name is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not an input. Second glob parameter is a list of files to ignore during the search.

@@ -447,7 +447,7 @@ function makeAbstractType(
schema,
),
tsf.createEnumDeclaration(
[modifiers.export, modifiers.const],
[modifiers.export],
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, didn’t we fix it with some flag in the config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It ended up crashing during tests. I wasn't able to fix it with different config flags. I actually looked at the usage patterns of this, and it's not really a big deal that this is not inlined. All the important things (byte offsets) are still preserved as number literals, while the type enum is only really used for rare type comparisons. So it doesn't have a good reason to be a const enum to begin with.

@@ -64,7 +64,7 @@ impl From<Browser> for wasm_pack::TestFlags {

/// Lists members of given Cargo.toml workspace.
pub fn get_all_crates(repo_root: impl AsRef<Path>) -> Result<Vec<PathBuf>> {
let pattern = repo_root.as_ref().join("**/Cargo.toml");
let pattern = repo_root.as_ref().join("[al][pi][pb]/**/Cargo.toml");
Copy link
Contributor

Choose a reason for hiding this comment

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

🤣

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah i don't know about this one... it'd technically match things like lip and apb, although to be fair it's unlikely for those folders to ever exist... but still if something like {app,lib} works i would definitely prefer that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would too, but seems like it's not a supported syntax. This code will soon be gone anyway, so I though this is the easiest way to go about it in the mean time.

ignore.js Outdated Show resolved Hide resolved
lib/js/runner/src/runner/config.ts Outdated Show resolved Hide resolved
toolchains/dummy_cc/BUILD.bazel Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants