Hi,Android and Linux share some source files, while not all Linux files are applicable on Android. Sometimes we want to reuse some files/directories that are originally for linux only. The files were named "_linux.(cc|h)" and directories named "linux". In current build/filename_rules.gypi, these files are by default excluded on Android.To include them on Android, we may use several different methods:1. Rename 'linux' to 'posix'. Need to exclude the files on mac, that is: posix - mac2. Rename 'linux' to 'linuxish'. In build/filename_rules.gypi, linuxish = linux + bsd + android ~= posix - mac3. Use a tricky 'target_condition' section to include the files without renaming.(In gyp, 'sources/' under normal 'condition' doesn't work because the rules in build/filename_rules.gypi have higher priority)
I think we should keep consistent. I'd like 2 but maybe we need a better name than 'linuxish'.BTW, another issue about linux and android is that in WebKit OS(LINUX) includes OS(ANDROID), but in Chromium OS_LINUX doesn't include OS_ANDROID. I think we should also make them consistent. I suggest to change WebKit to conform to the Chromium rule.
What are your opinions?Xianzhu
--
Android and Linux share some source files, while not all Linux files are applicable on Android. Sometimes we want to reuse some files/directories that are originally for linux only. The files were named "_linux.(cc|h)" and directories named "linux". In current build/filename_rules.gypi, these files are by default excluded on Android.To include them on Android, we may use several different methods:1. Rename 'linux' to 'posix'. Need to exclude the files on mac, that is: posix - mac
2. Rename 'linux' to 'linuxish'. In build/filename_rules.gypi, linuxish = linux + bsd + android ~= posix - mac
3. Use a tricky 'target_condition' section to include the files without renaming.(In gyp, 'sources/' under normal 'condition' doesn't work because the rules in build/filename_rules.gypi have higher priority)
Xianzhu Wang wrote:
Android and Linux share some source files, while not all Linux files are applicable on Android. Sometimes we want to reuse some files/directories that are originally for linux only. The files were named "_linux.(cc|h)" and directories named "linux". In current build/filename_rules.gypi, these files are by default excluded on Android.To include them on Android, we may use several different methods:1. Rename 'linux' to 'posix'. Need to exclude the files on mac, that is: posix - macThis is definitely not correct.2. Rename 'linux' to 'linuxish'. In build/filename_rules.gypi, linuxish = linux + bsd + android ~= posix - macThis is only correct if the files in question are actually appropriate on the various BSDs and other systems people have ported Chromium to.3. Use a tricky 'target_condition' section to include the files without renaming.(In gyp, 'sources/' under normal 'condition' doesn't work because the rules in build/filename_rules.gypi have higher priority)If Android wants those _linux files, maybe it should switch to including them by default. It is, after all, Linux.
Which is smaller, the number of _linux files that Android would need to exclude if they were included by default, or the number of _linux files that it needs to include because they’re currently excluded by default?When Android doesn’t want to use an existing _linux file, what is the reason? Are those files misnamed as it is? We have extensions for toolkits and other things as well, so would _x11 or _gtk or something else be more appropriate in those cases?Unfortunately, everything in this area is always going to wind up a compromise.
--
Also on a practical side, we found that having OS_ANDROID imply OS_LINUX resulted in more special-casing to remove unwanted files than the reverse.
Do we really need a new name at all? i.e. option 3 would add the linux files that are necessary in a target_condition section. That seems the most reasonable to me given that Android port doesn't want all Linux files by default.
For the particular case of http://codereview.chromium.org/10544103/, my current opinion is to rename the '_linux.cc' files to '_harfbuzz.cc' because the underlying implementation in WebKit is under a directory named 'harfbuzz'.
Just thought of another solution:1. Move third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp to third_party/WebKit/Source/WebCore/platform/graphics/skia/FontPlatformDataSkia.cpp. Actually the file only depends on Skia. Though the related features may depend on some libraries used by Skia, the interfaces are available in Skia on all platforms.2. Move WebFontRendering.h and cpp out of subdirectory to make them available for all platforms.3. Combine render_view_linux.cc into render_view_impl.cc.4. We'll still have different font rendering configurations for different platforms. For Android, they will be in ui/gfx/font_render_params_android.cc.Does this make sense?
What about the existing "linuxish" files in chrome/webkit? Can we rename them to use linux and use the target_conditions to include them on Android?