Skip to content

Conversation

@MrcSnm
Copy link

@MrcSnm MrcSnm commented Sep 12, 2025

I've also included some improvements which makes the setup run in parallel when downloading the build tool

Copy link
Collaborator

@the-horo the-horo left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Some mostly-style tweaks. macOS latest with older compilers is failing, which is a known issue. I'll look into removing those jobs some time tomorrow.

You also have a small failure in the unittests. You can run them locally with npm test and I think they're a much nicer development experience than having to go through CI every time.

If @Geod24 is fine with the changes conceptually then I don't have anything against adding redub support in here.


For the rest of this I'll put my marketing salesman hat on and ask you to please review your experiences with this project. Since you're new to this, I would like to know what you encountered issues with and what you wished would have been done differently. This is one of the bigger projects that I work on and I would like to know how to make it and maintain it better.

src/d.ts Outdated
Comment on lines 793 to 798
static async initialize(version: string, token: string) {
if (version === "latest") {
let json = await utils.body_as_text(
`https://api.github.com/repos/MrcSnm/redub/releases/latest`,
token
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The preferred indentation is 4 spaces. While there are files that don't respect this, I want new code or changes to existing code to use 4-space indents. I wouldn't agree with a change that just reformats the entire code base as I care about the history, so just fix the format in your changes, even if they are copied from another part of this file.

src/main.ts Outdated
Comment on lines 57 to 67
const [compiler, dub, redub] = await Promise.all([
compiler_promise,
dub_promise,
redub_promise
]);

await Promise.all([
compiler.makeAvailable(),
dub?.makeAvailable(),
redub?.makeAvailable()
]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has to be dropped.

Installing dub and the D compiler must happen in a specific order because of PATH modifications. The order should be compiler > dub, this way the dub available in PATH will be the one that was specifically requested to be installed, not the one that comes with dmd or ldc. This is why some dub CI tests are failing.

This would also mess up the logs, even though there are few, and it would make debugging the action harder.

Personally, I strongly disagree with optimizing without a clear vision. How long did it previously take and how long does it take now? From a quick look at a CI run in this PR and in #94 the Install D compiler steps takes 8 seconds on both.


Just as a FYI, the more asynchronous version of you code would be something like:

const tools = [ compiler_promise, dub_promise, redub_promise ]
await Promise.all(tools.map(tool_promise => tool_promise?.then(tool => tool.makeAvailable())))

Copy link
Author

Choose a reason for hiding this comment

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

I think I agree with you, maybe I can keep that at least for redub since it is not distributed and the PATH doesn't matter for it?

Co-authored-by: Andrei Horodniceanu <[email protected]>
@Geod24
Copy link
Member

Geod24 commented Sep 12, 2025

I don't think we should be doing it, it will just fraction the community even more. If you want this to happen, I would try to convince Walter & Atila.

@MrcSnm
Copy link
Author

MrcSnm commented Sep 12, 2025

I don't think we should be doing it, it will just fraction the community even more. If you want this to happen, I would try to convince Walter & Atila.

I'm only making this PR since I thought this wasn't an official thing for D. If it indeed is, I have no reason to continue in the PR since I'm not willing to deal with lots of bureaucracy :)

@WebFreak001
Copy link
Member

note that you can tell users to use your fork without it needing to be merged as well in case of it being unable to get merged

Copy link
Collaborator

@the-horo the-horo left a comment

Choose a reason for hiding this comment

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

A few more changes and a unittest failure that you've got. The rest of the macOS pipeline are expected failures. But, since I told you to ask Mathias and Mathias told you to ask Atila or Walter, wouldn't it be better for you to try to make a separate action that just installs redub? If all you care for is my review I could just review your changes there

Comment on lines 45 to 55
const redub_promise = redub_version ? d.Redub.initialize(redub_version, gh_token) : undefined

console.log('Enabling:')
console.log(` compiler '${d_compiler}'`)
if (dub_version) console.log(` dub '${dub_version}'`)
if (redub_version) console.log(` redub '${redub_version}'`)

const [compiler, redub] = await Promise.all([
compiler_promise,
redub_promise
]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like how this looks, with logic code followed by console logs followed by more logic code. I would much rather have something like:

console.log('Enabling:')
console.log(`  compiler '${d_compiler}'`)
if (dub_version) console.log(`  dub '${dub_version}'`)
if (redub_version) console.log(`  redub '${redub_version}'`)

let compiler_promise: Promise<d.ITool>
if (d_compiler.startsWith('dmd'))
    compiler_promise = d.DMD.initialize(d_compiler, gh_token)
else if (d_compiler.startsWith('ldc'))
    compiler_promise = d.LDC.initialize(d_compiler, gh_token)
else if (d_compiler.startsWith('gdc'))
    compiler_promise = d.GDC.initialize(d_compiler, gdmd_sha)
else
    throw new Error(`Unrecognized compiler: '${d_compiler}'`)
const dub_promise = dub_version ? d.Dub.initialize(dub_version, gh_token) : undefined
const redub_promise = redub_version ? d.Redub.initialize(redub_version, gh_token) : undefined

async function installD () {
      const [compiler, dub] = await Promise.all([compiler_promise, dub_promise])
      await compiler.makeAvailable()
      await dub?.makeAvailable()
}
async function installRedub () {
      const redub = await redub_promise
      await redub?.makeAvailable()
}

await Promise.all([installD(), installRedub()])

console.log("Done");

Again, I disagree with this optimization unless you can provide some numbers that prove that you can get some benefit out of this. How do I know that the bottleneck in the runners isn't the network speed?

@the-horo
Copy link
Collaborator

I've added #96, if you want to rebase to get a cleaner CI

@Geod24
Copy link
Member

Geod24 commented Sep 13, 2025

I'm only making this PR since I thought this wasn't an official thing for D.

That is a good point. We should move this to dlang

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.

4 participants