Skip to content

Commit

Permalink
fix: always use POSIX-normalized paths in .pkg files (#300)
Browse files Browse the repository at this point in the history
This makes it easier for TON verifiers to work with .pkg
files produced on Windows
  • Loading branch information
anton-trunov authored Apr 26, 2024
1 parent 1ef4691 commit e3196b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jobs:
run: |
yarn lint:schema
- name: Show an example .pkg file on Windows
if: runner.os == 'Windows'
run: |
type examples\output\echo_Echo.pkg
- name: Compare Tact version from CLI flag `--version` against package.json
if: runner.os != 'Windows'
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The `dump()` and `dumpStack()` functions now print the file path, line number, and column number in addition to the data: PR [#271](https://github.com/tact-lang/tact/pull/271)
- Use `|` instead of `+` for send mode flags because the bitwise OR operation is idempotent and hence safer: PR [#274](https://github.com/tact-lang/tact/pull/274)
- Bumped the versions of `@ton/core` and `ohm-js` to the most recent ones: PR [#276](https://github.com/tact-lang/tact/pull/276)
- Generated `.pkg`-files always use POSIX file paths (even on Windows): PR [# 300](https://github.com/tact-lang/tact/pull/300)

### Fixed

Expand Down
11 changes: 7 additions & 4 deletions src/pipeline/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function build(args: {
// Configure context
let ctx: CompilerContext = new CompilerContext({ shared: {} });
const cfg: string = JSON.stringify({
entrypoint: config.path,
entrypoint: posixNormalize(config.path),
options: config.options || {},
});
if (config.options) {
Expand Down Expand Up @@ -235,9 +235,12 @@ export async function build(args: {
source.path.startsWith(project.root) &&
!source.path.startsWith(stdlib.root)
) {
sources[source.path.slice(project.root.length)] = Buffer.from(
source.code,
).toString("base64");
const source_path = posixNormalize(
source.path.slice(project.root.length),
);
sources[source_path] = Buffer.from(source.code).toString(
"base64",
);
}
}

Expand Down

0 comments on commit e3196b7

Please sign in to comment.