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

"dub convert" command to convert between dub.json and dub.sdl. Fixes #689. #732

Merged
merged 10 commits into from
Jan 13, 2016

Conversation

s-ludwig
Copy link
Member

No description provided.

@s-ludwig s-ludwig force-pushed the sdl-json-convert branch 2 times, most recently from 802cf29 to 705c01c Compare December 11, 2015 11:31
@s-ludwig s-ludwig changed the title "dub convert" command to convert between dub.json and dub.sdl "dub convert" command to convert between dub.json and dub.sdl. Fixes #689. Dec 16, 2015
@blm768
Copy link

blm768 commented Dec 17, 2015

It might not be a bad idea to explicitly warn the user that the old config file will be deleted. It's not a major issue if people are using source control properly, but it seems dicey to rely on that.

@s-ludwig
Copy link
Member Author

It has a warning on the dub convert --help screen: https://github.com/D-Programming-Language/dub/pull/732/files#diff-e325b56891c9001a2e2cb1e3bc0a0a36R1665
I'd say that should usually be sufficient, since no actual data gets lost in the conversion process. Thoughts?

@blm768
Copy link

blm768 commented Jan 11, 2016

Probably. I'm just thinking of the few users who might get tripped up, but with bidirectional conversion, it shouldn't be an issue unless there's a bug in the converter. Does the converter at least ensure that the new file is written before the old one is deleted?

@s-ludwig
Copy link
Member Author

Yes, the new file is written before deleting the old one (any error will skip the deletion).

@MartinNowak
Copy link
Member

foreach (suffix, arr; bs.preBuildCommands) adda("preBuildCommands", suffix, arr);
foreach (suffix, arr; bs.postBuildCommands) adda("postBuildCommands", suffix, arr);
foreach (suffix, bits; bs.buildRequirements) adda("buildRequirements", suffix, toNameArray!BuildRequirement(bits));
foreach (suffix, bits; bs.buildOptions) adda("buildOptions", suffix, toNameArray!BuildOption(bits));
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a 1-to-1 mapping, so maybe use generic code and convert all members of bs? You could blacklist members that shouldn't be converted, but doing this makes it impossible to forget something and will be easier to maintain.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to postpone that to a separate PR - and then also for de-serialization and for JSON.

@s-ludwig
Copy link
Member Author

Fixed and rebased.

MartinNowak added a commit that referenced this pull request Jan 13, 2016
"dub convert" command to convert between dub.json and dub.sdl. Fixes #689.
@MartinNowak MartinNowak merged commit 46a08b6 into master Jan 13, 2016
@MartinNowak MartinNowak deleted the sdl-json-convert branch January 13, 2016 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants