|
|
DescriptionGN (Android): Fix packaging excess libs when target_cpu is changed
E.g.: Build for x86, then build for arm without first deleting the out
directory would result in an apk with libs for both architectures.
Committed: https://crrev.com/6be715d1ca1fad4dc80f194a4aa710f1eb6f9399
Cr-Commit-Position: refs/heads/master@{#345436}
Patch Set 1 #
Total comments: 2
Messages
Total messages: 16 (4 generated)
agrieve@chromium.org changed reviewers: + cjhopman@chromium.org
agrieve@chromium.org changed reviewers: + dpranke@chromium.org - cjhopman@chromium.org
On 2015/08/12 03:18:16, agrieve wrote: bump
dpranke@chromium.org changed reviewers: + brettw@chromium.org
https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni File build/config/android/rules.gni (right): https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + "/lib-$target_cpu" Brett, is there a better convention for toolchain-specific generated files?
https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni File build/config/android/rules.gni (right): https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + "/lib-$target_cpu" Brett points out to me that this should actually be okay; ninja should note that the file was generated by a particular command line, and so if you change the target_cpu, shouldn't you have a different command line and automatically rebuild?
On 2015/08/19 20:14:49, Dirk Pranke wrote: > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni > File build/config/android/rules.gni (right): > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... > build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + > "/lib-$target_cpu" > Brett points out to me that this should actually be okay; ninja should note that > the file was generated by a particular command line, and so if you change the > target_cpu, shouldn't you have a different command line and automatically > rebuild? From what I can tell, the main target is generated in out/Debug, and if you change the toolset via a target:toolset label, then those files will end up in out/Debug/toolset/... In this case, we're doing one build with target_cpu="arm", and then doing another build with target_cpu="x86" without wiping the output directory in-between. Both times files go into out/Debug. If we changed GN to put *all* outputs into toolchain subdirectories I think this would be fine, but it'd be a pretty big change from how GYP works.
On 2015/08/19 20:28:39, agrieve wrote: > On 2015/08/19 20:14:49, Dirk Pranke wrote: > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni > > File build/config/android/rules.gni (right): > > > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... > > build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + > > "/lib-$target_cpu" > > Brett points out to me that this should actually be okay; ninja should note > that > > the file was generated by a particular command line, and so if you change the > > target_cpu, shouldn't you have a different command line and automatically > > rebuild? > > From what I can tell, the main target is generated in out/Debug, and if you > change the toolset via a target:toolset label, then those files will end up in > out/Debug/toolset/... > > In this case, we're doing one build with target_cpu="arm", and then doing > another build with target_cpu="x86" without wiping the output directory > in-between. Both times files go into out/Debug. This is correct. However, if the files have the same name, wouldn't it be rebuilt because the command lines would be different?
On 2015/08/19 20:46:10, Dirk Pranke wrote: > On 2015/08/19 20:28:39, agrieve wrote: > > On 2015/08/19 20:14:49, Dirk Pranke wrote: > > > > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni > > > File build/config/android/rules.gni (right): > > > > > > > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... > > > build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + > > > "/lib-$target_cpu" > > > Brett points out to me that this should actually be okay; ninja should note > > that > > > the file was generated by a particular command line, and so if you change > the > > > target_cpu, shouldn't you have a different command line and automatically > > > rebuild? > > > > From what I can tell, the main target is generated in out/Debug, and if you > > change the toolset via a target:toolset label, then those files will end up in > > out/Debug/toolset/... > > > > In this case, we're doing one build with target_cpu="arm", and then doing > > another build with target_cpu="x86" without wiping the output directory > > in-between. Both times files go into out/Debug. > > This is correct. > > However, if the files have the same name, wouldn't it be > rebuilt because the command lines would be different? Aha - not in this case because the files live within an $android_app_abi subdirectory within _native_libs_dir. So, alternative fix would be to change the "${_template_name}__prepare_native" rule to take in the native_lib_dir and android_app_abi as separate parameters so that it can rm -r the directory itself (it currently rm -r's the android_app_abi subdirectory, but siblings to it remain). Is that a better option?
On 2015/08/20 00:31:14, agrieve wrote: > On 2015/08/19 20:46:10, Dirk Pranke wrote: > > On 2015/08/19 20:28:39, agrieve wrote: > > > On 2015/08/19 20:14:49, Dirk Pranke wrote: > > > > > > > > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.gni > > > > File build/config/android/rules.gni (right): > > > > > > > > > > > > > > https://codereview.chromium.org/1290643002/diff/1/build/config/android/rules.... > > > > build/config/android/rules.gni:1455: _native_libs_dir = gen_dir + > > > > "/lib-$target_cpu" > > > > Brett points out to me that this should actually be okay; ninja should > note > > > that > > > > the file was generated by a particular command line, and so if you change > > the > > > > target_cpu, shouldn't you have a different command line and automatically > > > > rebuild? > > > > > > From what I can tell, the main target is generated in out/Debug, and if you > > > change the toolset via a target:toolset label, then those files will end up > in > > > out/Debug/toolset/... > > > > > > In this case, we're doing one build with target_cpu="arm", and then doing > > > another build with target_cpu="x86" without wiping the output directory > > > in-between. Both times files go into out/Debug. > > > > This is correct. > > > > However, if the files have the same name, wouldn't it be > > rebuilt because the command lines would be different? > > Aha - not in this case because the files live within an $android_app_abi > subdirectory within _native_libs_dir. So, alternative fix would be to change the > "${_template_name}__prepare_native" rule to take in the native_lib_dir and > android_app_abi as separate parameters so that it can rm -r the directory itself > (it currently rm -r's the android_app_abi subdirectory, but siblings to it > remain). Is that a better option? bump
got it, lgtm.
The CQ bit was checked by agrieve@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1290643002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1290643002/1
Message was sent while issue was closed.
Committed patchset #1 (id:1)
Message was sent while issue was closed.
Patchset 1 (id:??) landed as https://crrev.com/6be715d1ca1fad4dc80f194a4aa710f1eb6f9399 Cr-Commit-Position: refs/heads/master@{#345436} |