Add native code editing support to Android Studio project generation |
|||
Issue descriptionFrom what I can tell, the only reasonable way to do this is to generate cmake project files. Luckily, it looks like skia team did this already: bin/gn gen out/config --ide=json --json-ide-script=third_party/skia/gn/gn_to_cmake.py The work involved here might largely be around upstreaming this script (likely to //tools/gn) and calling it from generate_gradle.py.
,
Feb 24 2017
Note that the gn_to_cmake.py in Skia is more or less the cmake.py I wrote for gyp which has been modified to work with gn. It could use some refactoring at the least and doesn't handle everything (though it does handle everything Skia needs, and then some). There are people on Skia using it, but I'm not actively working on it at the moment because I generally use KDevelop and wrote a project manager plugin which understands gn project.json files directly (which is much, much faster). On the other hand, the existing gn_to_cmake.py is probably a great place to start if you need such a thing since it already works around a lot of impedance mismatches between gn and cmake.
,
Mar 1 2017
As a note, if all you're looking for is code editing support, gn_to_cmake.py is probably fine. It should handle all the compiler flags, defines, and includes correctly.
,
Mar 1 2017
The script works perfectly (after adding in caching for GetObjectSourceDependencies, it was taking forever). "gn gen out/config --ide=json --json-ide-script=../../third_party/skia/gn/gn_to_cmake.py" didn't work for me, it never ran the script, I suspect I'm not passing in the right args, I just get right to "Done" with no CMakeList.txt generated. However, since project.json included all gn targets under the sun, Android Studio did not like that and crashed. After some imperfect target filtering, more crashes. I will see about importing your script and manually filtering target/source_set/shared_library etc in generate_gradle.py.
,
Mar 2 2017
> "gn gen out/config --ide=json --json-ide-script=../../third_party/skia/gn/gn_to_cmake.py" > didn't work for me, it never ran the script, I suspect I'm not passing in the right args, > I just get right to "Done" with no CMakeList.txt generated. Note that the CMakeList.txt will be generated into the out/config directory, next to the project.json file. Seems like that command should work though.
,
Mar 7 2017
Hmm... interestingly the full command works now on all my out directories.
,
Mar 8 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a45e8b336d2b214cfd5db0b3e3b5b85b688ce8db commit a45e8b336d2b214cfd5db0b3e3b5b85b688ce8db Author: wnwen <wnwen@chromium.org> Date: Wed Mar 08 20:08:42 2017 Android: Upstream gn_to_cmake.py The script was originally //third_party/skia/gn/gn_to_cmake.py Planning to use it to enable editing native files in android studio. Currently script does not allow full build, intended for editing only. BUG= 694699 Review-Url: https://codereview.chromium.org/2733353003 Cr-Commit-Position: refs/heads/master@{#455521} [add] https://crrev.com/a45e8b336d2b214cfd5db0b3e3b5b85b688ce8db/build/android/gradle/gn_to_cmake.py
,
May 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/23bc56150efb4ae54f6662e8552ac693fb41d485 commit 23bc56150efb4ae54f6662e8552ac693fb41d485 Author: avayvod <avayvod@chromium.org> Date: Tue May 09 13:02:47 2017 [Android, Tools] Speed up gn_to_cmake.py with caching BUG= 694699 TEST=local run Review-Url: https://codereview.chromium.org/2866863003 Cr-Commit-Position: refs/heads/master@{#470299} [modify] https://crrev.com/23bc56150efb4ae54f6662e8552ac693fb41d485/build/android/gradle/gn_to_cmake.py
,
Sep 6 2017
Not going to happen with cmake. Simply too overbearing for Chrome due to the sheer size of the project. We are hoping that android team's work on separating gradle from the android plugin will allow us to plug in gn as an alternative for android studio's native build system. |
|||
►
Sign in to add a comment |
|||
Comment 1 by agrieve@chromium.org
, Feb 24 2017