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

Allow building from source if no prebuilt binary is available #820

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hack3ric
Copy link
Contributor

@hack3ric hack3ric commented Feb 11, 2024

Prebuilts are limited to several platforms, so it is better to support building dprint from source when they are not available on current platform. As TypeScript now requires dprint to build, it should ease new platforms like RISC-V to build it.

WebAssembly plugins are portable across platforms. Native plugins (like dprint-plugin-prettier and -exec) still rely on fixed prebuilts. Is there any elegant solution to it? I would like to help and contribute my code for extending dprint's cross-platform ability, if there's a good way of doing it.

hack3ric added a commit to hack3ric/archriscv-packages that referenced this pull request Feb 11, 2024
Remove dprint from TypeScript's dependencies and building processes since dprint itself and its native plugins (non-WebAssembly ones) relies on prebuilt binaries.

Attempt to enable dprint using dprint/dprint#820 and disable its native Prettier plugins (only used to format YAML files) did not succeed, as [dprint-plugin-typescript (a WebAssembly plugin) produced inconsistent typescript.d.ts between riscv64 and x86_64](https://gist.github.com/hack3ric/bd7dd2364cadba4b01d6c834396ad06f). It is probably caused by immature Cranelift JIT implementation on RISC-V. The difference is only cosmetic though, therefore we can safely ignore the test for now.
hack3ric added a commit to hack3ric/archriscv-packages that referenced this pull request Feb 11, 2024
Remove dprint from TypeScript's dependencies and building processes since dprint itself and its native plugins (non-WebAssembly ones) relies on prebuilt binaries.

Attempt to enable dprint using dprint/dprint#820 and disable its native Prettier plugins (only used to format YAML files) did not succeed, as [dprint-plugin-typescript (a WebAssembly plugin) produced inconsistent typescript.d.ts between riscv64 and x86_64](https://gist.github.com/hack3ric/bd7dd2364cadba4b01d6c834396ad06f). It is probably caused by immature Cranelift JIT implementation on RISC-V. The difference is only cosmetic though, therefore we can safely ignore the test for now.
hack3ric added a commit to hack3ric/archriscv-packages that referenced this pull request Feb 11, 2024
Remove dprint from TypeScript's dependencies and building processes since dprint itself and its native plugins (non-WebAssembly ones) relies on prebuilt binaries.

Attempt to enable dprint using dprint/dprint#820 and disable its native Prettier plugins (only used to format YAML files) did not succeed, as [dprint-plugin-typescript (a WebAssembly plugin) produced inconsistent typescript.d.ts between riscv64 and x86_64](https://gist.github.com/hack3ric/bd7dd2364cadba4b01d6c834396ad06f). It is probably caused by immature Cranelift JIT implementation on RISC-V. The difference is only cosmetic though, therefore we can safely ignore the test for now.
felixonmars pushed a commit to felixonmars/archriscv-packages that referenced this pull request Feb 11, 2024
Remove dprint from TypeScript's dependencies and building processes since dprint itself and its native plugins (non-WebAssembly ones) relies on prebuilt binaries.

Attempt to enable dprint using dprint/dprint#820 and disable its native Prettier plugins (only used to format YAML files) did not succeed, as [dprint-plugin-typescript (a WebAssembly plugin) produced inconsistent typescript.d.ts between riscv64 and x86_64](https://gist.github.com/hack3ric/bd7dd2364cadba4b01d6c834396ad06f). It is probably caused by immature Cranelift JIT implementation on RISC-V. The difference is only cosmetic though, therefore we can safely ignore the test for now.
`https://github.com/dprint/dprint/archive/refs/tags/${packageVersion}.zip`,
dprintZip,
);
await unzipFile(dprintZip, tmp);
Copy link
Member

@dsherret dsherret Feb 18, 2024

Choose a reason for hiding this comment

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

Maybe it should run cargo install --locked --version VERSION_GOES_HERE dprint instead and only if DPRINT_BUILD_FROM_SOURCE is set (when not set we can maybe mention to set the env var)? That way it doesn't need a dependency on yauzl.

Also, what platform are you running on that dprint doesn't have a build for? Maybe we can try to add a distribution for that instead?

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 am currently working on Arch Linux RISC-V and I would appreciate if you consider adding linux-riscv64-{gnu,musl} distributions for dprint and its native plugins. Besides, running WASM plugins like TypeScript formatter on riscv64 could produce inconsistent results when I tried to build tsc, which definitely needs further investigation...

As for the change, I lost access to my main work PC recently and will get back to it a few days later. :)

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.

None yet

2 participants