 .../Core/Page/DefaultHtmlFragmentRenderer.php      |  2 +-
 .../Drupal/Core/Page/DefaultHtmlPageRenderer.php   |  8 ++--
 .../system/src/Tests/Common/PageRenderTest.php     | 27 ++++-------
 core/modules/system/system.module                  | 22 ---------
 .../system/tests/modules/bc_test/bc_test.info.yml  |  6 ---
 .../system/tests/modules/bc_test/bc_test.module    | 44 ------------------
 .../tests/modules/common_test/common_test.module   | 10 +++-
 core/modules/system/theme.api.php                  | 54 ----------------------
 core/modules/views/views.module                    |  2 +-
 9 files changed, 22 insertions(+), 153 deletions(-)

diff --git a/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
index 0cdd613..d2ccc88 100644
--- a/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
+++ b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
@@ -49,7 +49,7 @@ public function render(HtmlFragmentInterface $fragment, $status_code = 200) {
     }
 
     // Build the full page array by calling drupal_prepare_page(), which invokes
-    // hook_page_build(). This adds the other regions to the page.
+    // _block_page_build(). This adds the other regions to the page.
     $page_array = drupal_prepare_page($page_content);
 
     // Build the HtmlPage object.
diff --git a/core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php b/core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php
index eea3e16..2968deb 100644
--- a/core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php
+++ b/core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php
@@ -45,7 +45,7 @@ public function render(HtmlPage $page) {
    * This is functionally very similar to DefaultHtmlFragmentRenderer::render()
    * but with the following important differences:
    *
-   * - drupal_prepare_page() and hook_page_build() cannot be invoked on the
+   * - drupal_prepare_page() and _block_page_build() cannot be invoked on the
    *   maintenance and install pages, since possibly enabled page layout/block
    *   modules would replace the main page content with configured region
    *   content.
@@ -93,9 +93,9 @@ public static function renderPage($main, $title = '', $theme = 'maintenance', ar
     // Add default properties.
     $page_array += element_info('page');
 
-    // hook_page_build() cannot be invoked on the maintenance and install pages,
-    // because the application is in an unknown or special state.
-    // In particular on the install page, invoking hook_page_build() directly
+    // _block_page_build() cannot be invoked on the maintenance and install
+    // pages, because the application is in an unknown or special state.
+    // In particular on the install page, invoking _block_page_build() directly
     // after e.g. Block module has been installed would *replace* the installer
     // output with the configured blocks of the installer theme (loaded from
     // default configuration of the installation profile).
diff --git a/core/modules/system/src/Tests/Common/PageRenderTest.php b/core/modules/system/src/Tests/Common/PageRenderTest.php
index 09dd9b3..2a2fda9 100644
--- a/core/modules/system/src/Tests/Common/PageRenderTest.php
+++ b/core/modules/system/src/Tests/Common/PageRenderTest.php
@@ -33,24 +33,6 @@ function testHookPageAlter() {
   }
 
   /**
-   * Tests hook_page_build() exceptions, a deprecated hook kept around for BC.
-   */
-  function testHookPageBuildExceptions() {
-    // Also enable the system module, because that module invokes the BC hooks.
-    $this->enableModules(['bc_test', 'system']);
-    $this->assertPageRenderHookExceptions('bc_test', 'hook_page_build');
-  }
-
-  /**
-   * Tests hook_page_alter(), a deprecated hook kept around for BC.
-   */
-  function testHookPageAttachmentsAlter() {
-    // Also enable the system module, because that module invokes the BC hooks.
-    $this->enableModules(['bc_test', 'system']);
-    $this->assertPageRenderHookExceptions('bc_test', 'hook_page_alter');
-  }
-
-  /**
    * Asserts whether expected exceptions are thrown for invalid hook implementations.
    *
    * @param string $module
@@ -61,7 +43,14 @@ function testHookPageAttachmentsAlter() {
   function assertPageRenderHookExceptions($module, $hook) {
     // Assert a valid hook implementation doesn't trigger an exception.
     $page = [];
-    drupal_prepare_page($page);
+    $page = drupal_prepare_page($page);
+    $expected = [
+      'library' => [
+        0 => 'core/foo',
+        2 => 'core/baz',
+      ],
+    ];
+    $this->assertEqual($page['#attached'], $expected);
 
     // Assert an invalid hook implementation doesn't trigger an exception.
     \Drupal::state()->set($module . '.' . $hook . '.descendant_attached', TRUE);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 0d41bba..5f3f898 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -552,28 +552,6 @@ function system_page_attachments(array &$page) {
       )
     );
   }
-
-  // Invoke hook_page_build() for modules and hook_page_alter() for both modules
-  // and themes, for backwards compatibility.
-  $attachments = [];
-  foreach (\Drupal::moduleHandler()->getImplementations('page_build') as $module) {
-    $function = $module . '_page_build';
-    $function($attachments);
-  }
-  if (array_diff(array_keys($attachments), ['#attached', '#post_render_cache']) !== []) {
-    throw new \LogicException('Only #attached and #post_render_cache may be set in hook_page_build().');
-  }
-  \Drupal::moduleHandler()->alter('page', $attachments);
-  \Drupal::theme()->alter('page', $attachments);
-  if (array_diff(array_keys($attachments), ['#attached', '#post_render_cache']) !== []) {
-    throw new \LogicException('Only #attached and #post_render_cache may be set in hook_page_alter().');
-  }
-  if (isset($attachments['#attached'])) {
-    $page['#attached'] = $attachments['#attached'];
-  }
-  if (isset($attachments['#post_render_cache'])) {
-    $page['#post_render_cache'] = $attachments['#post_render_cache'];
-  }
 }
 
 /**
diff --git a/core/modules/system/tests/modules/bc_test/bc_test.info.yml b/core/modules/system/tests/modules/bc_test/bc_test.info.yml
deleted file mode 100644
index 20dbd82..0000000
--- a/core/modules/system/tests/modules/bc_test/bc_test.info.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: 'Backwards Compatibility Test'
-type: module
-description: 'Support module for backwards compatibility tests.'
-package: Testing
-version: VERSION
-core: 8.x
diff --git a/core/modules/system/tests/modules/bc_test/bc_test.module b/core/modules/system/tests/modules/bc_test/bc_test.module
deleted file mode 100644
index 537acb8..0000000
--- a/core/modules/system/tests/modules/bc_test/bc_test.module
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @file
- * Helper module for backwards compatibility (BC) tests.
- */
-
-/**
- * Implements hook_page_build().
- *
- * @see \Drupal\system\Tests\Common\PageRenderTest::assertPageRenderHookExceptions()
- */
-function bc_test_page_build(&$page) {
-  $page['#attached']['library'][] = 'core/jquery';
-
-  if (\Drupal::state()->get('bc_test.hook_page_build.descendant_attached', FALSE)) {
-    $page['content']['#attached']['library'][] = 'core/jquery';
-  }
-
-  if (\Drupal::state()->get('bc_test.hook_page_build.render_array', FALSE)) {
-    $page['something'] = [
-      '#markup' => 'test',
-    ];
-  }
-}
-
-/**
- * Implements hook_page_alter().
- *
- * @see \Drupal\system\Tests\Common\PageRenderTest::assertPageRenderHookExceptions()
- */
-function bc_test_page_alter(&$page) {
-  $page['#attached']['library'][] = 'core/jquery';
-
-  if (\Drupal::state()->get('bc_test.hook_page_alter.descendant_attached', FALSE)) {
-    $page['content']['#attached']['library'][] = 'core/jquery';
-  }
-
-  if (\Drupal::state()->get('bc_test.hook_page_alter.render_array', FALSE)) {
-    $page['something'] = [
-      '#markup' => 'test',
-    ];
-  }
-}
diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module
index 97ff0bf..a1100b4 100644
--- a/core/modules/system/tests/modules/common_test/common_test.module
+++ b/core/modules/system/tests/modules/common_test/common_test.module
@@ -260,7 +260,8 @@ function common_test_post_render_cache_placeholder(array $element, array $contex
  * @see \Drupal\system\Tests\Common\PageRenderTest::assertPageRenderHookExceptions()
  */
 function common_test_page_attachments(array &$page) {
-  $page['#attached']['library'][] = 'core/jquery';
+  $page['#attached']['library'][] = 'core/foo';
+  $page['#attached']['library'][] = 'core/bar';
 
   if (\Drupal::state()->get('common_test.hook_page_attachments.descendant_attached', FALSE)) {
     $page['content']['#attached']['library'][] = 'core/jquery';
@@ -279,7 +280,12 @@ function common_test_page_attachments(array &$page) {
  * @see \Drupal\system\Tests\Common\PageRenderTest::assertPageRenderHookExceptions()
  */
 function common_test_page_attachments_alter(array &$page) {
-  $page['#attached']['library'][] = 'core/jquery';
+  // Remove a library that was added in common_test_page_attachments(), to test
+  // that this hook can do what it claims to do.
+  if (isset($page['#attached']['library']) && ($index = array_search('core/bar', $page['#attached']['library'])) && $index !== FALSE) {
+    unset($page['#attached']['library'][$index]);
+  }
+  $page['#attached']['library'][] = 'core/baz';
 
   if (\Drupal::state()->get('common_test.hook_page_attachments_alter.descendant_attached', FALSE)) {
     $page['content']['#attached']['library'][] = 'core/jquery';
diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php
index 3087c5f..c7bcddb 100644
--- a/core/modules/system/theme.api.php
+++ b/core/modules/system/theme.api.php
@@ -739,60 +739,6 @@ function hook_css_alter(&$css) {
 /**
  * Add attachments (typically assets) to a page before it is rendered.
  *
- * Kept around for backwards compatibility, but now allows only attachments to
- * be added, adding renderable arrays is no longer allowed.
- *
- * @deprecated in Drupal 8.x, will be removed before Drupal 9.0. Successor:
- *   hook_page_attachments(). Is now effectively an alias of that hook.
- *
- * @param $page
- *   The page to which to add attachments.
- *
- * @see hook_page_attachments()
- */
-function hook_page_build(&$page) {
-  $path = drupal_get_path('module', 'foo');
-  // Add JavaScript/CSS assets to all pages.
-  // @see drupal_process_attached()
-  $page['#attached']['js'][$path . '/foo.js'] = array('every_page' => TRUE);
-  $page['#attached']['css'][$path . '/foo.base.css'] = array('every_page' => TRUE);
-  $page['#attached']['css'][$path . '/foo.theme.css'] = array('every_page' => TRUE);
-
-  // Add a special CSS file to a certain page only.
-  if (drupal_is_front_page()) {
-    $page['#attached']['css'][] = $path . '/foo.front.css';
-  }
-}
-
-/**
- * Perform alterations before a page is rendered.
- *
- * Kept around for backwards compatibility, but now allows only attachments to
- * be added, altering the renderable array for the page is no longer allowed.
- *
- * @deprecated in Drupal 8.x, will be removed before Drupal 9.0. Successor:
- *   hook_page_attachments_alter(). Is now effectively an alias of that hook.
- *
- * Use this hook when you want to remove or alter attachments at the page
- * level, or add attachments at the page level that depend on an other module's
- * attachments (this hook runs after hook_page_build().
- *
- * @param $page
- *   An empty renderable array representing the page.
- *
- * @see hook_page_build()
- */
-function hook_page_alter(&$page) {
-  // Conditionally remove an asset.
-  if (in_array('core/jquery', $page['#attached']['library'])) {
-    $index = array_search('core/jquery', $page['#attached']['library']);
-    unset($page['#attached']['library'][$index]);
-  }
-}
-
-/**
- * Add attachments (typically assets) to a page before it is rendered.
- *
  * Use this hook when you want to conditionally add attachments to a page.
  *
  * If you want to alter the attachments added by other modules or if your module
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 02e9f52..4a4accd 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -400,7 +400,7 @@ function views_preprocess_page(&$variables) {
  *   The ID of the display within $view whose contextual links will be added.
  *
  * @see \Drupal\views\Plugin\block\block\ViewsBlock::addContextualLinks()
- * @see views_page_alter()
+ * @see views_preprocess_page()
  * @see template_preprocess_views_view()
  */
 function views_add_contextual_links(&$render_element, $location, ViewExecutable $view, $display_id) {
