tmandry / lavender Goto Github PK
View Code? Open in Web Editor NEWGenerate Visual Studio projects for Bazel (experimental)
License: MIT License
Generate Visual Studio projects for Bazel (experimental)
License: MIT License
Hello, thanks for creating this tool! I'm having an issue with long file paths when trying to build a Visual Studio solution for tensor flow. The error is below.
DEBUG: C:/tmp/vkiilvyk/external/org_tensorflow/third_party/repo.bzl:109:14:
Warning: skipping import of repository 'pybind11' because it already exists.
Loading: 169 packages loaded
Traceback (most recent call last):
File "C:\Storage\lavender-master\generate.py", line 470, in
main(sys.argv)
File "C:\Storage\lavender-master\generate.py", line 465, in main
run_aspect(cfg)
File "C:\Storage\lavender-master\generate.py", line 209, in run_aspect
subprocess.check_call([
File "C:\Python38\lib\subprocess.py", line 359, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Python38\lib\subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Python38\lib\subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 206] The filename or extension is too long
What I have tried/verified:
I'm not sure what else it could be, other than maybe that the maximum path length limitation is still being applied within Python or some other tool. Any ideas or support would be greatly appreciated!
When I run the command in the source folder, I get the following error:
(env) % python ../lavender/generate.py -o ../vs-cpp-template
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
checking cached actions
Loading: 0 packages loaded
ERROR: Unable to find package for @@[unknown repo 'bazel-msbuild' requested from @@]//bazel-msbuild:msbuild.bzl: The repository '@@[unknown repo 'bazel-msbuild' requested from @@]' could not be resolved: No repository visible as '@bazel-msbuild' from main repository.
I see the msbuild.bzl in the lavender folder along with the package name but why is it not getting picked up automatically by generate.py?
bazel sets up a junction so that file paths in its exec_root (where it runs the compiler) point to the files/directories in the original source directory.
However, Visual Studio doesn't realize this, and thinks the files at the different paths are distinct. This breaks IntelliSense, modify/save behavior, etc when in the exec_root "upside-down".
Hello and first, thanks for making this!
It seems that a bazel change broke Lavender. When trying to convert a project, I get:
Information about the C++ toolchain API is not accessible anymore through ctx.fragments.cpp (see --incompatible_disable_legacy_cpp_toolchain_skylark_api on http://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-configuration-api for migration notes). Use CcToolchainInfo instead.
The link provides instructions for migration, but I just started learning Bazel so I did not manage to fix it myself. Removing the + ctx.fragments.cpp.compiler_options([]) + ctx.fragments.cpp.cxx_options([])
parts from msbuild.bzl
allows the script to complete.
I want to turn this project into a solution project using lavender but unfortunately it gives me this error every time I run it.
Visual Studio 2013 complains about something related to the FullOutput
macro.
Adding an empty src file to the library works around the issue.
Testing lavender's integration with Visual Studio is going to be difficult.
As a first step, let's just have a test that runs bazel, generates project files, and compares them to a known good output.
Test against Python 2 and 3.
I tried Commit: 184656b [184656b] with Bazel 0.26.0 and Visual Studio 2019 and Visual Studion 2017 on a HelloWorld example.
HelloWorld/WORKSPACE
workspace(name = "HelloWorld")
HelloWorld/BUILD
cc_binary(
name = "HelloWorld",
srcs = ["main.cpp"],
)
HelloWorld/main.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
}
I switched in Powershell to my HelloWorld folder (E:/dev/BazelDemos/HelloWorld) and typed:
python C:\lavender\generate.py
start .\msbuild\HelloWorld.sln
When Visual Studio starts it shows me "One or more projects in the solution were not loaded correctly. Please see Output Window for details"
Output window reports: " Project E:\HelloWorld.vcxproj" could not be found."
The HelloWorld.vcxproj file is located under E:\dev\BazelDemos\HelloWorld\msbuild\HelloWorld.vcxproj
When I open the generated solution file (HelloWorld.sln) in a text editor line 5 looks like this:
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld","\HelloWorld.vcxproj", "{00000000-0000-3000-A000-00003D2EF56C}"
If I change it to (removing the backslash character "")
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld.vcxproj", "{00000000-0000-3000-A000-00003D2EF56C}"
I can open the solution
Hi,
I'm Laszlo and I work on Bazel-on-Windows. We found your tool a couple of weeks ago and I think it would be really useful to some of our users! Would you mind if we mentioned it in the newsletter for the upcoming Bazel release?
I'd like to phrase it like so:
Tools:
- Tyler Mandry wrote a Visual Studio project generator for C++ rules: https://github.com/tmandry/bazel-msbuild
Please let me know what you think!
/cc @philwo
Right now generated projects are hardcoded to use Visual Studio 12.0 (2013). This causes annoying prompts in later versions of Visual Studio.
This might interest you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.