Re-work the 'external snapshot' related build rules.
authorvogelheim <vogelheim@chromium.org>
Mon, 30 Mar 2015 14:54:22 +0000 (07:54 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 30 Mar 2015 14:54:27 +0000 (14:54 +0000)
This prepares for re-landing crrev.com/956373002

This pulls all decision about the snapshot [no|internal|external] into one rule. Previously, this logic was in separate places and not /quite/ the same, which causes build problems.

BUG=

Review URL: https://codereview.chromium.org/1016603004

Cr-Commit-Position: refs/heads/master@{#27523}

test/cctest/cctest.gyp
test/unittests/unittests.gyp
tools/gyp/v8.gyp

index 3f7d56aa431a8f1d998cd568b61d91e3903d6da7..7b39c1ae23a274816d5b901077352abc2df33da6 100644 (file)
         ['component=="shared_library"', {
           # cctest can't be built against a shared library, so we need to
           # depend on the underlying static target in that case.
-          'conditions': [
-            ['v8_use_snapshot=="true" and v8_use_external_startup_data==0', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_snapshot'],
-            }],
-            ['v8_use_snapshot=="true" and v8_use_external_startup_data==1', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_external_snapshot'],
-            }],
-            ['v8_use_snapshot!="true"', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_nosnapshot'],
-            }],
-          ],
+          'dependencies': ['../../tools/gyp/v8.gyp:v8_maybe_snapshot'],
         }, {
           'dependencies': ['../../tools/gyp/v8.gyp:v8'],
         }],
index 2ed05b8adc9fb4111b8253de85e8963086e6fc49..eb5d784857c8239b6a258205ddc399eb74e9701b 100644 (file)
         ['component=="shared_library"', {
           # compiler-unittests can't be built against a shared library, so we
           # need to depend on the underlying static target in that case.
-          'conditions': [
-            ['v8_use_snapshot=="true" and v8_use_external_startup_data==0', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_snapshot'],
-            }],
-            ['v8_use_snapshot=="true" and v8_use_external_startup_data==1', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_external_snapshot'],
-            }],
-            ['v8_use_snapshot!="true"', {
-              'dependencies': ['../../tools/gyp/v8.gyp:v8_nosnapshot'],
-            }],
-          ],
+          'dependencies': ['../../tools/gyp/v8.gyp:v8_maybe_snapshot'],
         }, {
           'dependencies': ['../../tools/gyp/v8.gyp:v8'],
         }],
index effec7b357613d658d37a0aa6c5b81bcea11ed65..d764b2fcf58d77c36b77b30cb96e0cb73a39e622 100644 (file)
     {
       'target_name': 'v8',
       'dependencies_traverse': 1,
+      'dependencies': ['v8_maybe_snapshot'],
       'conditions': [
         ['want_separate_host_toolset==1', {
           'toolsets': ['host', 'target'],
         }, {
           'toolsets': ['target'],
         }],
-
-        ['v8_use_snapshot=="true" and v8_use_external_startup_data==0', {
-          # The dependency on v8_base should come from a transitive
-          # dependency however the Android toolchain requires libv8_base.a
-          # to appear before libv8_snapshot.a so it's listed explicitly.
-          'dependencies': ['v8_base', 'v8_snapshot'],
-        }],
-        ['v8_use_snapshot!="true" and v8_use_external_startup_data==0', {
-          # The dependency on v8_base should come from a transitive
-          # dependency however the Android toolchain requires libv8_base.a
-          # to appear before libv8_snapshot.a so it's listed explicitly.
-          'dependencies': ['v8_base', 'v8_nosnapshot'],
-        }],
-        ['v8_use_external_startup_data==1 and want_separate_host_toolset==1', {
-          'dependencies': ['v8_base', 'v8_external_snapshot'],
-          'target_conditions': [
-            ['_toolset=="host"', {
-              'inputs': [
-                '<(PRODUCT_DIR)/snapshot_blob_host.bin',
-              ],
-            }, {
-              'inputs': [
-                '<(PRODUCT_DIR)/snapshot_blob.bin',
-              ],
-            }],
-          ],
-        }],
-        ['v8_use_external_startup_data==1 and want_separate_host_toolset==0', {
-          'dependencies': ['v8_base', 'v8_external_snapshot'],
-          'inputs': [ '<(PRODUCT_DIR)/snapshot_blob.bin', ],
-        }],
         ['component=="shared_library"', {
           'type': '<(component)',
           'sources': [
         ],
       },
     },
+    {
+      # This rule delegates to either v8_snapshot, v8_nosnapshot, or
+      # v8_external_snapshot, depending on the current variables.
+      # The intention is to make the 'calling' rules a bit simpler.
+      'target_name': 'v8_maybe_snapshot',
+      'type': 'none',
+      'conditions': [
+        ['v8_use_snapshot!="true"', {
+          # The dependency on v8_base should come from a transitive
+          # dependency however the Android toolchain requires libv8_base.a
+          # to appear before libv8_snapshot.a so it's listed explicitly.
+          'dependencies': ['v8_base', 'v8_nosnapshot'],
+        }],
+        ['v8_use_snapshot=="true" and v8_use_external_startup_data==0', {
+          # The dependency on v8_base should come from a transitive
+          # dependency however the Android toolchain requires libv8_base.a
+          # to appear before libv8_snapshot.a so it's listed explicitly.
+          'dependencies': ['v8_base', 'v8_snapshot'],
+        }],
+        ['v8_use_snapshot=="true" and v8_use_external_startup_data==1 and want_separate_host_toolset==0', {
+          'dependencies': ['v8_base', 'v8_external_snapshot'],
+          'inputs': [ '<(PRODUCT_DIR)/snapshot_blob.bin', ],
+        }],
+        ['v8_use_snapshot=="true" and v8_use_external_startup_data==1 and want_separate_host_toolset==1', {
+          'dependencies': ['v8_base', 'v8_external_snapshot'],
+          'target_conditions': [
+            ['_toolset=="host"', {
+              'inputs': [
+                '<(PRODUCT_DIR)/snapshot_blob_host.bin',
+              ],
+            }, {
+              'inputs': [
+                '<(PRODUCT_DIR)/snapshot_blob.bin',
+              ],
+            }],
+          ],
+        }],
+        ['want_separate_host_toolset==1', {
+          'toolsets': ['host', 'target'],
+        }, {
+          'toolsets': ['target'],
+        }],
+      ]
+    },
     {
       'target_name': 'v8_snapshot',
       'type': 'static_library',