Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1105)

Unified Diff: chrome/common/extensions/docs/server2/features_bundle.py

Issue 302143003: Docserver: Make API features inherit 'channel' from their dependencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another test, cleanup Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/features_bundle.py
diff --git a/chrome/common/extensions/docs/server2/features_bundle.py b/chrome/common/extensions/docs/server2/features_bundle.py
index 155a395e6bac53a0fd31c4564dc9cb5495169239..98a0dfe1d49ac693b51d3d6b37a21ac8fd2216e4 100644
--- a/chrome/common/extensions/docs/server2/features_bundle.py
+++ b/chrome/common/extensions/docs/server2/features_bundle.py
@@ -23,10 +23,10 @@ def _GetFeaturePaths(feature_file, *extra_paths):
return paths
-def _AddPlatformsFromDependencies(feature,
- api_features,
- manifest_features,
- permission_features):
+def _AddPlatformsAndChannelsFromDependencies(feature,
+ api_features,
+ manifest_features,
+ permission_features):
features_map = {
'api': api_features,
'manifest': manifest_features,
@@ -34,8 +34,9 @@ def _AddPlatformsFromDependencies(feature,
}
dependencies = feature.get('dependencies')
if dependencies is None:
- return ['apps', 'extensions']
+ return
platforms = set()
+ channel = None
for dependency in dependencies:
dep_type, dep_name = dependency.split(':')
dependency_features = features_map[dep_type]
@@ -43,9 +44,18 @@ def _AddPlatformsFromDependencies(feature,
# If the dependency can't be resolved, it is inaccessible and therefore
# so is this feature.
if dependency_feature is None:
- return []
- platforms = platforms.union(dependency_feature['platforms'])
- feature['platforms'] = list(platforms)
+ return
+ # Import the platforms from the dependency. The logic is a bit odd; if
+ # |feature| specifies platforms the it's considered an override. If not,
+ # we form the union of all dependency's platforms.
+ # TODO(kalman): Fix this (see http://crbug.com/322094).
+ platforms.update(dependency_feature.get('platforms', set()))
+ # Import the channel from the dependency.
+ channel = dependency_feature.get('channel', channel)
+ if platforms and not feature.get('platforms'):
+ feature['platforms'] = list(platforms)
+ if channel and not feature.get('channel'):
+ feature['channel'] = channel
class _FeaturesCache(object):
@@ -126,7 +136,7 @@ class FeaturesBundle(object):
# If we don't store this value before annotating platforms, inter-API
# dependencies will lead to infinite recursion.
for feature in api_features.itervalues():
- _AddPlatformsFromDependencies(
+ _AddPlatformsAndChannelsFromDependencies(
feature, api_features, manifest_features, permission_features)
self._object_store.Set('api_features', api_features)
return api_features
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/server2/features_bundle_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698