[Fix][Build System] Include necessary header files in archive distrubution (#24596)

closes #24590 

Some header files were listed as sources and vice versa.

I took the liberty of rearranging more than just the one allocator.h, so
if there's some context I should have been aware of I'd be happy to
revert whatever necessary.

---------

Signed-off-by: Mike Interlandi <43190101+Minterl@users.noreply.github.com>
diff --git a/build_tools/github_actions/build_dist.py b/build_tools/github_actions/build_dist.py
index 3d9048b..0dc5140 100644
--- a/build_tools/github_actions/build_dist.py
+++ b/build_tools/github_actions/build_dist.py
@@ -43,6 +43,9 @@
 
 
 That is not a perfect approximation but is close.
+
+To build without the compiler (primarily for the purposes of debugging this script),
+use --without-compiler
 """
 
 import json
@@ -118,7 +121,7 @@
     subprocess.check_call([sys.executable, CONFIGURE_BAZEL_PY])
 
 
-def build_main_dist():
+def build_main_dist(build_compiler=True):
     """Builds the main distribution binaries.
 
     Additional packages that are installable as part of a full build and do not
@@ -143,7 +146,7 @@
             # consistency in built packages, so hard-code it.
             "-DCMAKE_INSTALL_LIBDIR=lib",
             f"-DCMAKE_BUILD_TYPE=Release",
-            f"-DIREE_BUILD_COMPILER=ON",
+            f"-DIREE_BUILD_COMPILER=" + ("ON" if build_compiler else "OFF"),
             f"-DIREE_BUILD_PYTHON_BINDINGS=OFF",
             f"-DIREE_BUILD_SAMPLES=OFF",
         ],
@@ -226,7 +229,11 @@
 
 command = sys.argv[1]
 if command == "main-dist":
-    build_main_dist()
+    if len(sys.argv) > 2 and sys.argv[2] == "--without-compiler":
+        print(f"*** NOT building compiler ***")
+        build_main_dist(build_compiler=False)
+    else:
+        build_main_dist()
 elif command == "py-tf-compiler-tools-pkg":
     build_py_tf_compiler_tools_pkg()
 else:
diff --git a/runtime/src/iree/base/BUILD.bazel b/runtime/src/iree/base/BUILD.bazel
index d42b31e..a6bde6e 100644
--- a/runtime/src/iree/base/BUILD.bazel
+++ b/runtime/src/iree/base/BUILD.bazel
@@ -23,31 +23,33 @@
     name = "base",
     srcs = [
         "allocator.c",
-        "allocator.h",
-        "assert.h",
         "bitfield.c",
-        "bitfield.h",
         "bitmap.c",
-        "bitmap.h",
         "printf.c",
-        "printf.h",
         "status.c",
-        "status.h",
-        "status_cc.h",
-        "status_payload.h",
         "status_stack_trace.c",
         "string_builder.c",
-        "string_builder.h",
         "string_view.c",
-        "string_view.h",
         "time.c",
         "wait_source.c",
-        "wait_source.h",
     ] + defaulting_select({
         "//build_tools/bazel:iree_allocator_system_custom": [],
         "//conditions:default": ["allocator_libc.c"],
     }),
-    hdrs = ["api.h"],
+    hdrs = [
+        "allocator.h",
+        "api.h",
+        "assert.h",
+        "bitfield.h",
+        "bitmap.h",
+        "printf.h",
+        "status.h",
+        "status_cc.h",
+        "status_payload.h",
+        "string_builder.h",
+        "string_view.h",
+        "wait_source.h",
+    ],
     defines = defaulting_select({
         "//build_tools/bazel:iree_allocator_system_custom": [],
         "//conditions:default": [
diff --git a/runtime/src/iree/base/CMakeLists.txt b/runtime/src/iree/base/CMakeLists.txt
index 2e80aac..65cc26f 100644
--- a/runtime/src/iree/base/CMakeLists.txt
+++ b/runtime/src/iree/base/CMakeLists.txt
@@ -54,28 +54,28 @@
     base
   HDRS
     "api.h"
-  SRCS
-    "allocator.c"
     "allocator.h"
     "assert.h"
-    "bitfield.c"
     "bitfield.h"
-    "bitmap.c"
     "bitmap.h"
-    "printf.c"
     "printf.h"
-    "status.c"
     "status.h"
     "status_cc.h"
     "status_payload.h"
+    "string_builder.h"
+    "string_view.h"
+    "wait_source.h"
+  SRCS
+    "allocator.c"
+    "bitfield.c"
+    "bitmap.c"
+    "printf.c"
+    "status.c"
     "status_stack_trace.c"
     "string_builder.c"
-    "string_builder.h"
     "string_view.c"
-    "string_view.h"
     "time.c"
     "wait_source.c"
-    "wait_source.h"
     ${_IREE_ALLOCATOR_SYSTEM_SRCS}
   COPTS
     ${_IREE_ALLOCATOR_SYSTEM_COPTS}
diff --git a/runtime/src/iree/base/internal/BUILD.bazel b/runtime/src/iree/base/internal/BUILD.bazel
index d09f2d0..58828a3 100644
--- a/runtime/src/iree/base/internal/BUILD.bazel
+++ b/runtime/src/iree/base/internal/BUILD.bazel
@@ -26,14 +26,13 @@
 
 iree_runtime_cc_library(
     name = "internal",
-    srcs = [
+    srcs = [],
+    hdrs = [
+        "atomics.h",
         "atomics_clang.h",
         "atomics_disabled.h",
         "atomics_gcc.h",
         "atomics_msvc.h",
-    ],
-    hdrs = [
-        "atomics.h",
         "debugging.h",
         "inline_array.h",
         "math.h",
diff --git a/runtime/src/iree/base/internal/CMakeLists.txt b/runtime/src/iree/base/internal/CMakeLists.txt
index 1ac2463..17db3a4 100644
--- a/runtime/src/iree/base/internal/CMakeLists.txt
+++ b/runtime/src/iree/base/internal/CMakeLists.txt
@@ -15,14 +15,13 @@
     internal
   HDRS
     "atomics.h"
-    "debugging.h"
-    "inline_array.h"
-    "math.h"
-  SRCS
     "atomics_clang.h"
     "atomics_disabled.h"
     "atomics_gcc.h"
     "atomics_msvc.h"
+    "debugging.h"
+    "inline_array.h"
+    "math.h"
   DEPS
     iree::base::core_headers
   PUBLIC
diff --git a/runtime/src/iree/hal/BUILD.bazel b/runtime/src/iree/hal/BUILD.bazel
index 6fc52bc..021b83a 100644
--- a/runtime/src/iree/hal/BUILD.bazel
+++ b/runtime/src/iree/hal/BUILD.bazel
@@ -37,70 +37,70 @@
     name = "hal",
     srcs = [
         "allocator.c",
-        "allocator.h",
         "allocator_heap.c",
         "buffer.c",
-        "buffer.h",
         "buffer_heap.c",
-        "buffer_heap_impl.h",
         "buffer_transfer.c",
-        "buffer_transfer.h",
         "buffer_view.c",
-        "buffer_view.h",
         "buffer_view_util.c",
-        "buffer_view_util.h",
         "channel.c",
-        "channel.h",
         "channel_provider.c",
-        "channel_provider.h",
         "command_buffer.c",
-        "command_buffer.h",
         "command_buffer_validation.c",
+        "device.c",
+        "device_group.c",
+        "driver.c",
+        "driver_registry.c",
+        "event.c",
+        "executable.c",
+        "executable_cache.c",
+        "fence.c",
+        "file.c",
+        "pool.c",
+        "pool_set.c",
+        "profile_metrics.c",
+        "profile_options.c",
+        "profile_sink.c",
+        "semaphore.c",
+        "string_util.c",
+        "topology.c",
+        "topology_builder.c",
+    ],
+    hdrs = [
+        "allocator.h",
+        "api.h",
+        "buffer.h",
+        "buffer_heap_impl.h",
+        "buffer_transfer.h",
+        "buffer_view.h",
+        "buffer_view_util.h",
+        "channel.h",
+        "channel_provider.h",
+        "command_buffer.h",
         "command_buffer_validation.h",
         "detail.h",
-        "device.c",
         "device.h",
-        "device_group.c",
         "device_group.h",
-        "driver.c",
         "driver.h",
-        "driver_registry.c",
         "driver_registry.h",
-        "event.c",
         "event.h",
-        "executable.c",
         "executable.h",
-        "executable_cache.c",
         "executable_cache.h",
-        "fence.c",
         "fence.h",
-        "file.c",
         "file.h",
-        "pool.c",
         "pool.h",
-        "pool_set.c",
         "pool_set.h",
-        "profile_metrics.c",
         "profile_metrics.h",
-        "profile_options.c",
         "profile_options.h",
         "profile_schema.h",
-        "profile_sink.c",
         "profile_sink.h",
         "queue.h",
         "resource.h",
-        "semaphore.c",
         "semaphore.h",
-        "string_util.c",
         "string_util.h",
-        "topology.c",
         "topology.h",
-        "topology_builder.c",
         "topology_builder.h",
     ],
-    hdrs = [
-        "api.h",
-    ],
     textual_hdrs = [
         "profile_metrics.inc",
     ],
diff --git a/runtime/src/iree/hal/CMakeLists.txt b/runtime/src/iree/hal/CMakeLists.txt
index ad24c7f..a6b2e95 100644
--- a/runtime/src/iree/hal/CMakeLists.txt
+++ b/runtime/src/iree/hal/CMakeLists.txt
@@ -14,71 +14,71 @@
   NAME
     hal
   HDRS
+    "allocator.h"
     "api.h"
+    "buffer.h"
+    "buffer_heap_impl.h"
+    "buffer_transfer.h"
+    "buffer_view.h"
+    "buffer_view_util.h"
+    "channel.h"
+    "channel_provider.h"
+    "command_buffer.h"
+    "command_buffer_validation.h"
+    "detail.h"
+    "device.h"
+    "device_group.h"
+    "driver.h"
+    "driver_registry.h"
+    "event.h"
+    "executable.h"
+    "executable_cache.h"
+    "fence.h"
+    "file.h"
+    "pool.h"
+    "pool_set.h"
+    "profile_metrics.h"
+    "profile_options.h"
+    "profile_schema.h"
+    "profile_sink.h"
+    "queue.h"
+    "resource.h"
+    "semaphore.h"
+    "string_util.h"
+    "topology.h"
+    "topology_builder.h"
   TEXTUAL_HDRS
     "profile_metrics.inc"
   SRCS
     "allocator.c"
-    "allocator.h"
     "allocator_heap.c"
     "buffer.c"
-    "buffer.h"
     "buffer_heap.c"
-    "buffer_heap_impl.h"
     "buffer_transfer.c"
-    "buffer_transfer.h"
     "buffer_view.c"
-    "buffer_view.h"
     "buffer_view_util.c"
-    "buffer_view_util.h"
     "channel.c"
-    "channel.h"
     "channel_provider.c"
-    "channel_provider.h"
     "command_buffer.c"
-    "command_buffer.h"
     "command_buffer_validation.c"
-    "command_buffer_validation.h"
-    "detail.h"
     "device.c"
-    "device.h"
     "device_group.c"
-    "device_group.h"
     "driver.c"
-    "driver.h"
     "driver_registry.c"
-    "driver_registry.h"
     "event.c"
-    "event.h"
     "executable.c"
-    "executable.h"
     "executable_cache.c"
-    "executable_cache.h"
     "fence.c"
-    "fence.h"
     "file.c"
-    "file.h"
     "pool.c"
-    "pool.h"
     "pool_set.c"
-    "pool_set.h"
     "profile_metrics.c"
-    "profile_metrics.h"
     "profile_options.c"
-    "profile_options.h"
-    "profile_schema.h"
     "profile_sink.c"
-    "profile_sink.h"
-    "queue.h"
-    "resource.h"
     "semaphore.c"
-    "semaphore.h"
     "string_util.c"
-    "string_util.h"
     "topology.c"
-    "topology.h"
     "topology_builder.c"
-    "topology_builder.h"
   DEPS
     iree::async
     iree::base