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

Fix blocks upgrades with tilemaps #7339

Merged
merged 3 commits into from
Jul 21, 2020
Merged

Conversation

jwunderl
Copy link
Member

@jwunderl jwunderl commented Jul 20, 2020

re: microsoft/pxt-arcade#2197, this fixes blocks upgrades when there's a tilemap.

The issue was that the blocks compile was generating main.ts as if tilemap.g.ts exists, so it didn't have the namespace at the top. This adds on to the blocks patch logic to copy over the generated files to the patch when we're validating that it creates an okay program.

This feels like potentially a bit too much tilemap specific logic in the upgrade logic, but not sure where a better fix would be.

})
.then(() => {
const compiledFiles = project.getAllFiles();
const generatedFileNames = Object.keys(compiledFiles).filter(el => /\.g\.ts/.test(el));
Copy link
Member

Choose a reason for hiding this comment

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

why not just copy over all non-main.ts files?

Copy link
Member Author

Choose a reason for hiding this comment

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

No particular reason, these were just the ones that were breaking things.

I'll switch it so it hopefully avoids the issue in the future~

@riknoll
Copy link
Member

riknoll commented Jul 21, 2020

I think the way to make this less tilemappy would be to refactor so that there is only one codepath that compiles projects, but it's outside the scope of this change.

@jwunderl jwunderl merged commit f05e205 into master Jul 21, 2020
@jwunderl jwunderl deleted the fixBlocksUpgradesWithTilemaps branch July 21, 2020 17:11
abchatra pushed a commit that referenced this pull request Jul 22, 2020
* fix blocks upgrade rules when tilemaps are present (needs cleanup)

* don't hardcode tilemap.g.ts / generalize a tiny bit

* just patch over all but main.* files to hopefully avoid similar issues in future
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.

2 participants