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

feat: setup bootstrap and ci #3

Merged
merged 9 commits into from
Sep 25, 2024
Merged

feat: setup bootstrap and ci #3

merged 9 commits into from
Sep 25, 2024

Conversation

Wybxc
Copy link
Contributor

@Wybxc Wybxc commented Sep 19, 2024

This pull request sets up the bootstrap process and CI for the C codegen backend.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

I left some minor nits. I also have a question for this backend: is there a reason why you need to reinvent a bootstrap instead of forking the rust repo then adding additional logic as necessary?

EDIT: to clarify, it's entirely possible that you have very good reasons or run into difficult limitations for doing so. I'm asking because using Yet Another Bootstrap makes (1) upstreaming the backend very very difficult and (2) makes it more difficult for other rustc contributors who wants to make changes to this backend because they have to deal with the intricacies of Yet Another Build System.

@@ -0,0 +1 @@
/target
Copy link
Member

Choose a reason for hiding this comment

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

Nit: can you make sure the files have trailing newlines because I think some Unix tools assume trailing newlines exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Per the GH UI, these are still missing. Just look at the diff view and make sure none of the files have that symbol.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

@jieyouxu did you mean to mark this as resolved? Looks like they are still there

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, or maybe you had it resolved before and I just commented without unresolving :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh maybe I thought they were fixed, not sure

bootstrap/src/clean.rs Outdated Show resolved Hide resolved
bootstrap/src/fmt.rs Outdated Show resolved Hide resolved
bootstrap/src/test.rs Show resolved Hide resolved
bootstrap/src/test.rs Outdated Show resolved Hide resolved
bootstrap/src/test.rs Outdated Show resolved Hide resolved
@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 20, 2024

I left some minor nits. I also have a question for this backend: is there a reason why you need to reinvent a bootstrap instead of forking the rust repo then adding additional logic as necessary?我留下了一些小虱子。我对这个后端还有一个问题:是否有理由需要重新发明引导程序,而不是分叉rust存储库,然后根据需要添加额外的逻辑?

EDIT: to clarify, it's entirely possible that you have very good reasons or run into difficult limitations for doing so. I'm asking because using Yet Another Bootstrap makes (1) upstreaming the backend very very difficult and (2) makes it more difficult for other rustc contributors who wants to make changes to this backend because they have to deal with the intricacies of Yet Another Build System.编辑:澄清一下,您完全有可能有很好的理由或遇到困难的限制。我这么问是因为使用 Yet Another Bootstrap 会(1)使后端上游变得非常非常困难,并且(2)使其他想要更改此后端的 rustc 贡献者变得更加困难,因为他们必须处理 Yet Another 的复杂性构建系统。

In projects such as rustc_codegen_cranelift or rust_codegen_gcc, there exists a component referred to as the build_system, which serves a similar function to what is termed "bootstrap" in this context. It is important to distinguish this from the bootstrap process of the Rust compiler itself. In this instance, we assume the presence of an operational Rust compiler, and we merely encapsulate some command-line invocations to rustc, making rustc_codegen_c the default code generation option.

@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 20, 2024

Refer to #2 (comment)

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

I think this looks pretty good overall. Please just make sure absolute paths are used everywhere, otherwise it looks like a lot of things will break when running from a different directory.

Aside from that, a few other comments but I don't see any big issues.

@@ -0,0 +1 @@
/target
Copy link
Contributor

Choose a reason for hiding this comment

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

Per the GH UI, these are still missing. Just look at the diff view and make sure none of the files have that symbol.

image

.github/workflows/main.yaml Show resolved Hide resolved
bootstrap/src/clean.rs Show resolved Hide resolved
bootstrap/src/fmt.rs Show resolved Hide resolved
}
}

pub fn perform(&self, command: &mut Command) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: perform and run should probably get different names since it isn't very obvious what the difference is. Or ideally, just put this into a trait so all steps are required to use the same interface.

Nonblocker though, this can be changed later.

bootstrap/src/main.rs Outdated Show resolved Hide resolved
bootstrap/src/manifest.rs Show resolved Hide resolved
bootstrap/src/test.rs Outdated Show resolved Hide resolved
@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 22, 2024

I think this looks pretty good overall. Please just make sure absolute paths are used everywhere, otherwise it looks like a lot of things will break when running from a different directory.

Aside from that, a few other comments but I don't see any big issues.

The use cases for bootstrap are typically highly specific to the project structure, making execution in alternative directories impractical. Additionally, the brevity of the ./y command serves as a clear reminder of the current working directory.

As far as I am aware, rustc_codegen_gcc also utilizes relative paths:
https://github.com/rust-lang/rustc_codegen_gcc/blob/3018d9dc8fc2fe19a0e7366166ceb6829d1b273d/build_system/src/clean.rs#L72
https://github.com/rust-lang/rustc_codegen_gcc/blob/3018d9dc8fc2fe19a0e7366166ceb6829d1b273d/build_system/src/main.rs#L16

@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 24, 2024

@tgross35 Please check the latest changes.

@tgross35
Copy link
Contributor

tgross35 commented Sep 24, 2024

Additionally, the brevity of the ./y command serves as a clear reminder of the current working directory.

Forgot this relaunches with the given directory, makes sense then.

@tgross35 Please check the latest changes.

There are a couple unresolved comments still. Specifically #3 (comment) so tools don't break (I guess that one was labeled resolved even though that might not have been accurate), and #3 (comment) to make one CLI option more consistent.

Other than that LGTM. This could be squashed, or I can just do it on merge.

@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 25, 2024

Other than that LGTM. This could be squashed, or I can just do it on merge.

A squash merge seems like a good idea.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Awesome, let's get this off the ground. Thanks!

@tgross35 tgross35 merged commit 38d9c4d into rust-lang:main Sep 25, 2024
5 checks passed
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