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

Feature/Microsoft Visual Studio Tasks #1321

Conversation

markmaker
Copy link

Microsoft Visual Studio Build Tasks

Adds simple Build tasks to Microsoft Visual Studio "Open Folder" development. This is the new cool way to edit almost any type of cross platform project:

In Visual Studio 2017, you can open code from nearly any type of directory-based project into Visual Studio without the need for a solution or project file. This means you can, for example, clone a repo on GitHub, open it directly into Visual Studio, and begin developing, without having to create a solution or project. If needed, you can specify custom build tasks and launch parameters through simple JSON files.

After you open your code files in Visual Studio, Solution Explorer displays all the files in the folder. You can click on any file to begin editing it. In the background, Visual Studio starts indexing the files to enable IntelliSense, navigation, and refactoring features. As you edit, create, move, or delete files, Visual Studio tracks the changes automatically and continuously updates its IntelliSense index. Code will appear with syntax colorization and, in many cases, include basic IntelliSense statement completion.

https://docs.microsoft.com/en-us/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions

You can simply open the Smoothieware project using File / Open Folder... and choose the Smoothieware folder. You'll get all the nice stuff described above.

This pull request adds simple Build, Rebuild, Clean tasks as described here.

https://docs.microsoft.com/en-us/visualstudio/ide/customize-build-and-debug-tasks-in-visual-studio

You can then right-click on the makefile in the Smoothieware root folder and choose one of the tasks in the context menu (see Screenshot):
grafik

NOTE: In order for this to work, you need to re-install the build tools using win_install.cmd and this will only succeed if you delete your existing gcc-arm-none-eabi folder first, otherwise win_install.cmd will fail trying to recreate that directory.

Why is re-installing needed?

I needed to modify win_install.cmd to slightly change the generated BuildCommand.cmd and buildenv.cmd to propagate and execute a command line passed as arguments. This way Visual Studio can send the build commands into the proper build environment. I have tried recreating the environment directly in the task, but failed. But calling the central BuildShell.cmd may be more future proof anyway.

NOTE 2: as per Visual Studio's standard, tasks.vs.json is in the .vs subdirectory so it might be hidden from some directory views.

In Visual Studio use the Show all Files Button to see it:
grafik

…lopment.

"In Visual Studio 2017, you can open code from nearly any type of directory-based project into Visual Studio without the need for a solution or project file. This means you can, for example, clone a repo on GitHub, open it directly into Visual Studio, and begin developing, without having to create a solution or project. If needed, you can specify custom build tasks and launch parameters through simple JSON files.

After you open your code files in Visual Studio, Solution Explorer displays all the files in the folder. You can click on any file to begin editing it. In the background, Visual Studio starts indexing the files to enable IntelliSense, navigation, and refactoring features. As you edit, create, move, or delete files, Visual Studio tracks the changes automatically and continuously updates its IntelliSense index. Code will appear with syntax colorization and, in many cases, include basic IntelliSense statement completion."

https://docs.microsoft.com/en-us/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions

Added simple Build, Rebuild, Clean tasks as described here.

https://docs.microsoft.com/en-us/visualstudio/ide/customize-build-and-debug-tasks-in-visual-studio

Needed to modify win_install.cmd to extend BuildCommand.cmd and buildenv.cmd to propagate and execute a command line passed as arguments.

tasks.vs.json is in the .vs subdirectory.
@wolfmanjm
Copy link
Contributor

As visual studio is not an open source tool, I suspect we will not be able to accept this request.
maybe this would be better to document on the wiki.

@markmaker
Copy link
Author

Hi wolfmanjm

Thanks for the quick reply.

I struggle to see the red line here, please advise.

You already have some .cmd files in the repo. Those only run against cmd.exe and only on Microsoft Windows ... neither of which are open source, as far as I know.

What is the difference for the single .json file I add here?

After all, I am not commiting Visual Studio binaries and in now way does this change mean you become somehow dependent on Visual Studio. You can still build from the command-line, in fact this tiny solution does nothing else.

If it is your "political" principle not to embrace such products at all, then I could understand (not agree). But I don't see how adding this to the Wiki would make a difference, then?

Thank you for having a fresh look.

_Mark

@arthurwolf
Copy link
Contributor

arthurwolf commented May 3, 2018 via email

@wolfmanjm wolfmanjm closed this May 3, 2018
@markmaker
Copy link
Author

Hi

thanks for the clarification.

Is there a chance you would merge just the shell part?

https://github.com/Smoothieware/Smoothieware/pull/1321/files#diff-ea076c228b65dbef8cb08e86a332c3dc

This is useful outside of any Visual Studio discussion. One can call a command line inside the build environment. Useful for creating shortcuts, more elaborate scripting etc.

_Mark

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

3 participants