meson library and dependency cleanup

Change-Id: I09e3c514dfc67b701bf09a6e079ad3a5d9344fca
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 092a759..191e9aa 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -1,6 +1,3 @@
-# dependency to link sdbusplus support
-sdbusplus = dependency('sdbusplus', version : '>=1.0')
-
 # gather analyzer sources to be used here and elsewhere if needed
 analyzer_src = files(
     'analyzer_main.cpp',
@@ -9,10 +6,17 @@
     '../util/temporary_file.cpp',
 )
 
+# Library dependencies.
+analyzer_deps = [
+    dbus_interfaces_dep,
+    libhei_dep,
+    sdbusplus_dep,
+]
+
 # Create hardware error analyzer library
 analyzer = static_library('analyzer',
                           analyzer_src,
                           include_directories : incdir,
-                          dependencies : [ libhei_dep, sdbusplus ],
+                          dependencies : analyzer_deps,
                           cpp_args : test_arg,
                           install : false)
diff --git a/attn/meson.build b/attn/meson.build
index f75bd60..294644f 100644
--- a/attn/meson.build
+++ b/attn/meson.build
@@ -3,9 +3,6 @@
               '-DBOOST_ERROR_CODE_HEADER_ONLY',
               '-DBOOST_SYSTEM_NO_DEPRECATED']
 
-# dependency to link sdbusplus support
-sdbusplus = dependency('sdbusplus', version : '>=1.0')
-
 # dependency to link gpiod support
 libgpiod = dependency('libgpiod', version : '>=1.4.1')
 
@@ -38,6 +35,6 @@
 attn = static_library('attn_handler',
                       attn_src,
                       include_directories : incdir,
-                      dependencies : [libpdbg, sdbusplus, libgpiod],
+                      dependencies : [libpdbg, sdbusplus_dep, libgpiod],
                       cpp_args : [boost_args, test_arg],
                       install : true)
diff --git a/meson.build b/meson.build
index 891b3b5..9ddfa45 100644
--- a/meson.build
+++ b/meson.build
@@ -12,6 +12,9 @@
 # not, default to the subproject.
 libhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep'])
 
+sdbusplus_dep       = dependency('sdbusplus', version : '>=1.0')
+dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
+
 incdir = include_directories('.')
 
 # See if phosphor-logging is available, if not use test case logging code. This
diff --git a/test/end2end/meson.build b/test/end2end/meson.build
index 6897469..7508ae4 100644
--- a/test/end2end/meson.build
+++ b/test/end2end/meson.build
@@ -1,11 +1,28 @@
+# Source files specific to end2end test.
+end2end_src = [
+    'bp_handler.cpp',
+    'logging.cpp',
+    'main.cpp',
+    'ti_handler.cpp',
+]
+
+# Additional source files needed for test.
+additional_src = [
+    '../../cli.cpp',
+]
+
+# Link with the analyzer and attention handler static libraries.
+end2end_libs = [
+    analyzer,
+    attn,
+]
+
 # create openpower-hw-diags executable for local testing
 end2end = executable('openpower-hw-diags-test',
-            'main.cpp', 'logging.cpp', 'bp_handler.cpp', 'ti_handler.cpp',
-            '../../analyzer/analyzer_main.cpp', '../../cli.cpp',
-            link_with : [analyzer, attn],
+            end2end_src, additional_src,
+            link_with : end2end_libs,
             include_directories : incdir,
-            dependencies : libhei_dep,
             cpp_args : test_arg,
             install : false)
 
-#test('openpower-hw-diags-test', end2end)
+test('openpower-hw-diags-test', end2end)