Guest User

Untitled

a guest
Jul 15th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "Cleaning up..."
  4. rm -rf sync
  5. rm -rf components/sync
  6. rm components/sync.gyp
  7. git reset --hard origin/master
  8.  
  9. echo "Moving files within sync..."
  10. cd sync/internal_api
  11. # Move cc files back next to their headers.
  12. git mv activation_context.cc base_node.cc base_transaction.cc change_record.cc delete_journal.cc http_bridge.cc http_bridge_network_resources.cc http_bridge_unittest.cc internal_components_factory_impl.cc model_type_connector.cc model_type_store_backend.cc model_type_store_backend_unittest.cc model_type_store_impl.cc model_type_store_impl_unittest.cc processor_entity_tracker.cc processor_entity_tracker_unittest.cc read_node.cc read_transaction.cc shared_model_type_processor.cc shared_model_type_processor_unittest.cc sync_db_util.cc sync_manager_factory.cc user_share.cc write_node.cc write_transaction.cc public
  13. git mv events/* public/events
  14. cd ..
  15. git mv engine engine_impl
  16. git mv sessions sessions_impl
  17. git rm util/DEPS
  18. git mv util/* base
  19. git rm internal_api/public/base/DEPS
  20. git mv internal_api/public/base/* base
  21. git mv internal_api/public/util/* base
  22. git mv internal_api/public/engine engine
  23. git mv internal_api/public/sessions sessions
  24. git mv internal_api/public/events engine/
  25. git mv internal_api/public core
  26. git mv internal_api core_impl
  27. mkdir android/java/src/org/chromium/components
  28. mkdir android/javatests/src/org/chromium/components
  29. mkdir test/android/javatests/src/org/chromium/components
  30. git mv android/java/src/org/chromium/sync android/java/src/org/chromium/components/sync
  31. git mv android/javatests/src/org/chromium/sync android/javatests/src/org/chromium/components/sync
  32. git mv test/android/javatests/src/org/chromium/sync test/android/javatests/src/org/chromium/components/sync
  33.  
  34. # replace performs a string replacement for all files in the repo under the
  35. # current folder and is defined as:
  36. #
  37. #     git grep -l "$1" | xargs sed -i "s/$1/$2/g"
  38.  
  39. echo "Updating sync build files..."
  40. replace "\"engine\/" "\"engine_impl\/"
  41. replace "'engine\/" "'engine_impl\/"
  42. replace "\"sessions\/" "\"sessions_impl\/"
  43. replace "'sessions\/" "'sessions_impl\/"
  44. replace "\"util\/" "\"base\/"
  45. replace "'util\/" "'base\/"
  46. # Fixes for the specifically moved cc files.
  47. replace "internal_api\/activation_context.cc" "internal_api\/public\/activation_context.cc"
  48. replace "internal_api\/base_node.cc" "internal_api\/public\/base_node.cc"
  49. replace "internal_api\/base_transaction.cc" "internal_api\/public\/base_transaction.cc"
  50. replace "internal_api\/change_record.cc" "internal_api\/public\/change_record.cc"
  51. replace "internal_api\/delete_journal.cc" "internal_api\/public\/delete_journal.cc"
  52. replace "internal_api\/events\/" "internal_api\/public\/events\/"
  53. replace "internal_api\/http_bridge.cc" "internal_api\/public\/http_bridge.cc"
  54. replace "internal_api\/http_bridge_network_resources.cc" "internal_api\/public\/http_bridge_network_resources.cc"
  55. replace "internal_api\/http_bridge_unittest.cc" "internal_api\/public\/http_bridge_unittest.cc"
  56. replace "internal_api\/internal_components_factory_impl.cc" "internal_api\/public\/internal_components_factory_impl.cc"
  57. replace "internal_api\/model_type_connector.cc" "internal_api\/public\/model_type_connector.cc"
  58. replace "internal_api\/model_type_store_backend.cc" "internal_api\/public\/model_type_store_backend.cc"
  59. replace "internal_api\/model_type_store_backend_unittest.cc" "internal_api\/public\/model_type_store_backend_unittest.cc"
  60. replace "internal_api\/model_type_store_impl.cc" "internal_api\/public\/model_type_store_impl.cc"
  61. replace "internal_api\/model_type_store_impl_unittest.cc" "internal_api\/public\/model_type_store_impl_unittest.cc"
  62. replace "internal_api\/processor_entity_tracker.cc" "internal_api\/public\/processor_entity_tracker.cc"
  63. replace "internal_api\/processor_entity_tracker_unittest.cc" "internal_api\/public\/processor_entity_tracker_unittest.cc"
  64. replace "internal_api\/read_node.cc" "internal_api\/public\/read_node.cc"
  65. replace "internal_api\/read_transaction.cc" "internal_api\/public\/read_transaction.cc"
  66. replace "internal_api\/shared_model_type_processor.cc" "internal_api\/public\/shared_model_type_processor.cc"
  67. replace "internal_api\/shared_model_type_processor_unittest.cc" "internal_api\/public\/shared_model_type_processor_unittest.cc"
  68. replace "internal_api\/sync_db_util.cc" "internal_api\/public\/sync_db_util.cc"
  69. replace "internal_api\/sync_manager_factory.cc" "internal_api\/public\/sync_manager_factory.cc"
  70. replace "internal_api\/user_share.cc" "internal_api\/public\/user_share.cc"
  71. replace "internal_api\/write_node.cc" "internal_api\/public\/write_node.cc"
  72. replace "internal_api\/write_transaction.cc" "internal_api\/public\/write_transaction.cc"
  73.  
  74. cd ..
  75. echo "Moving sync to components..."
  76. git mv sync components
  77. git mv components/sync/sync.gyp components/sync.gyp
  78.  
  79. echo "Fixing strings repo-wide..."
  80. # The moved sync.gyp file.
  81. replace "sync\/sync\.gyp" "components\/sync\.gyp"
  82. # Other sync references in gyp.
  83. replace "\.\.\/sync\/" "\.\.\/components\/sync\/"
  84. # All includes.
  85. replace "include \"sync\/" "include \"components\/sync\/"
  86. # DEPS files.
  87. replace "\"+sync" "\"+components\/sync"
  88. # Reorganized folders.
  89. replace "components\/sync\/engine" "components\/sync\/engine_impl"
  90. replace "components\/sync\/sessions" "components\/sync\/sessions_impl"
  91. replace "components\/sync\/util" "components\/sync\/base"
  92. replace "internal_api\/public\/base\/" "base\/"
  93. replace "internal_api\/public\/engine" "engine"
  94. replace "internal_api\/public\/events" "engine\/events"
  95. replace "internal_api\/public\/sessions" "sessions"
  96. replace "internal_api\/public\/util" "base"
  97. replace "internal_api\/public" "core"
  98. # Fix a couple things just within the sync folder.
  99. cd components/sync
  100. # gyp file fixes.
  101. replace "'\.\.\/" "'\.\.\/\.\.\/"
  102. # Any occurences of internal_api left must be core_impl, not core.
  103. replace "internal_api" "core_impl"
  104. cd ../..
  105. # BUILD.gn fixes.
  106. replace "\"\/\/sync" "\"\/\/components\/sync"
  107. replace " \/\/sync" " \/\/components\/sync"
  108. # Other misc stray references to things.
  109. replace "test_support_sync_internal_api" "test_support_sync_core_impl"
  110. replace "\/\/sync\/protocol" "\/\/components\/sync\/protocol"
  111. replace "\"sync\/protocol" "\"components\/sync\/protocol"
  112. replace "\"sync\/base" "\"components\/sync\/base"
  113. replace "sync\/internal_api" "sync\/core_impl"
  114. # Java fixes.
  115. replace "org\.chromium\.sync" "org\.chromium\.components\.sync"
  116. replace "org\/chromium\/sync" "org\/chromium\/components\/sync"
  117. # This file should not be modified.
  118. git co .git-blame-ignore-revs
  119.  
  120. echo "Fixing include guards..."
  121. cd components/sync/core
  122. replace "_INTERNAL_API_" "_CORE_"
  123. replace "_PUBLIC_" "_"
  124. cd ..
  125. replace "SYNC_ENGINE_" "SYNC_ENGINE_IMPL_"
  126. replace "SYNC_SESSIONS_" "SYNC_SESSIONS_IMPL_"
  127. replace "SYNC_UTIL_" "SYNC_BASE_"
  128. replace "INTERNAL_API_PUBLIC_BASE" "BASE"
  129. replace "INTERNAL_API_PUBLIC_ENGINE" "ENGINE"
  130. replace "INTERNAL_API_PUBLIC_EVENTS" "ENGINE_EVENTS"
  131. replace "INTERNAL_API_PUBLIC_SESSIONS" "SESSIONS"
  132. replace "INTERNAL_API_PUBLIC_UTIL" "BASE"
  133. replace "_INTERNAL_API_" "_CORE_IMPL_"
  134. replace "ifndef SYNC_" "ifndef COMPONENTS_SYNC_"
  135. replace "define SYNC_" "define COMPONENTS_SYNC_"
  136. replace "endif  \/\/ SYNC_" "endif  \/\/ COMPONENTS_SYNC_"
  137. # Fix some macros that the above few lines mess up.
  138. replace "COMPONENTS_SYNC_DATA_TYPE_HISTOGRAM" "SYNC_DATA_TYPE_HISTOGRAM"
  139. replace "COMPONENTS_SYNC_FREQ_HISTOGRAM" "SYNC_FREQ_HISTOGRAM"
  140. replace "COMPONENTS_SYNC_EXPORT" "SYNC_EXPORT"
  141. replace "COMPONENTS_SYNC_PROTO_EXPORT" "SYNC_PROTO_EXPORT"
  142. cd ../..
  143.  
  144. # sort_includes is a hacked version of cpplint/nitpick.py that sorts Java
  145. # imports in addition to C++ includes. It mostly just sorts within blocks of
  146. # includes, but can also insert newlines to create new blocks if it detects
  147. # different types of include (e.g. C++ vs C system headers).
  148. echo "Sorting includes..."
  149. git diff --name-only --diff-filter=ACMR origin/master | xargs sort_includes --quiet
  150.  
  151. echo "Formatting..."
  152. git cl format
  153. # These two files get seriously messed up by git cl format.
  154. git co components/sync/syncable/directory_backing_store.cc
  155. git co components/sync/syncable/directory_backing_store_unittest.cc
  156. git commit --all -m "Automated changes." > /dev/null
  157.  
  158. echo "Cherry-picking manual changes..."
  159. # This commit contains DEP file fixes and the changes for the two above files.
  160. git cherry-pick 39077d05
  161.  
  162. echo "Building..."
  163. build_chrome
  164.  
  165. echo "Running presubmit checks..."
  166. git cl presubmit
Advertisement
Add Comment
Please, Sign In to add comment