More work on translating GYP build information to Bazel.
Change-Id: If770ebeb54ddc4ca1af2e971734ad243c608cd45
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/WORKSPACE
diff --git a/aos/common/BUILD b/aos/common/BUILD
index 919c2a0..ccb9191 100644
--- a/aos/common/BUILD
+++ b/aos/common/BUILD
@@ -21,7 +21,7 @@
'//aos/common/logging',
':once',
'//aos/linux_code/ipc_lib:shared_mem',
- ':mutex',
+ '//aos/linux_code/ipc_lib:mutex',
],
)
@@ -35,14 +35,32 @@
],
deps = [
'//aos/common/logging:logging_interface',
- ':mutex',
+ '//aos/linux_code/ipc_lib:mutex',
],
)
+genrule(
+ name = 'gen_queue_primitives',
+ visibility = ['//visibility:private'],
+ tools = ['//aos/build/queues:queue_primitives'],
+ outs = ['queue_primitives.h'],
+ cmd = '$(location //aos/build/queues:queue_primitives) $@',
+)
+
+genrule(
+ name = 'gen_print_field',
+ visibility = ['//visibility:private'],
+ tools = ['//aos/build/queues:print_field'],
+ outs = ['print_field.cc'],
+ cmd = '$(location //aos/build/queues:print_field) $@',
+)
+
cc_library(
name = 'queue_types',
srcs = [
'queue_types.cc',
+ ':gen_queue_primitives',
+ ':gen_print_field',
],
hdrs = [
'queue_types.h',
@@ -51,7 +69,7 @@
'//aos/common/logging:logging_interface',
'//aos/linux_code/ipc_lib:shared_mem',
'//aos/linux_code/ipc_lib:core_lib',
- ':mutex',
+ '//aos/linux_code/ipc_lib:mutex',
':time',
],
)
@@ -182,7 +200,7 @@
],
deps = [
'//third_party/gtest',
- ':mutex',
+ '//aos/linux_code/ipc_lib:mutex',
':die',
'//aos/common/logging',
'//aos/common/util:death_test_log_implementation',
@@ -215,13 +233,12 @@
':condition',
'//aos/common/util:thread',
':time',
- ':mutex',
+ '//aos/linux_code/ipc_lib:mutex',
'//aos/common/logging',
':queue_testutils',
'//aos/linux_code/ipc_lib:core_lib',
'//aos/linux_code/ipc_lib:aos_sync',
':die',
- '//aos/common/util:thread',
],
)
diff --git a/aos/common/logging/BUILD b/aos/common/logging/BUILD
index db7f365..82aaf16 100644
--- a/aos/common/logging/BUILD
+++ b/aos/common/logging/BUILD
@@ -41,3 +41,30 @@
'//third_party/eigen',
],
)
+
+cc_library(
+ name = 'logging_interface',
+ srcs = [
+ 'logging_interface.cc',
+ ],
+ deps = [
+ '//aos/linux_code/logging:linux_interface',
+ '//aos/common:die',
+ '//aos/common/libc:aos_strerror',
+ ],
+)
+
+cc_library(
+ name = 'logging',
+ srcs = [
+ 'logging_impl.cc',
+ 'linux_logging.cc',
+ ],
+ deps = [
+ '//aos/linux_code/logging:linux_logging',
+ '//aos/common:time',
+ '//aos/common:once',
+ ':logging_interface',
+ '//aos/common:queue_types',
+ ],
+)
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index c511968..75e3d95 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -103,3 +103,37 @@
':queue',
],
)
+
+cc_library(
+ name = 'condition',
+ srcs = [
+ 'condition.cc',
+ ],
+ deps = [
+ ':mutex',
+ ':aos_sync',
+ '//aos/common/logging:logging_interface',
+ ],
+)
+
+cc_library(
+ name = 'mutex',
+ srcs = [
+ 'mutex.cc',
+ ],
+ deps = [
+ ':aos_sync',
+ '//aos/common/logging:logging_interface',
+ ],
+)
+
+cc_library(
+ name = 'event',
+ srcs = [
+ 'event.cc',
+ ],
+ deps = [
+ ':aos_sync',
+ '//aos/common/logging:logging_interface',
+ ],
+)
diff --git a/aos/linux_code/logging/BUILD b/aos/linux_code/logging/BUILD
index a35cd0e..29c6d78 100644
--- a/aos/linux_code/logging/BUILD
+++ b/aos/linux_code/logging/BUILD
@@ -70,3 +70,27 @@
'//aos/common/logging',
],
)
+
+cc_library(
+ name = 'linux_interface',
+ visibility = ['//aos/common/logging:__pkg__'],
+ srcs = [
+ 'linux_interface.cc',
+ ],
+ deps = [
+ '//aos/linux_code:complex_thread_local',
+ '//aos/common:die',
+ ],
+)
+
+cc_library(
+ name = 'linux_logging',
+ visibility = ['//aos/common/logging:__pkg__'],
+ srcs = [
+ 'linux_logging.cc',
+ ],
+ deps = [
+ '//aos/linux_code/ipc_lib:queue',
+ '//aos/common:time',
+ ],
+)
diff --git a/doc/TODO.bazel b/doc/TODO.bazel
index 379792a..e7d3020 100644
--- a/doc/TODO.bazel
+++ b/doc/TODO.bazel
@@ -4,12 +4,9 @@
//y2015:http_status needs to be finished.
-//aos/common:queue_types needs to be finished.
-
Actually write //aos:prime_binaries.
Contents come from aos/build/aos_all.gyp.
//aos/linux_code/starter needs to copy starter.sh.
-//aos/common:{condition,mutex,event} need their actual targets moved to
- //aos/linux_code/ipc_lib where they belong and everything expects them.
+Need to get tcmalloc hooked in.
diff --git a/doc/gyp_to_bazel.py b/doc/gyp_to_bazel.py
index 85f7835..aa30eb9 100755
--- a/doc/gyp_to_bazel.py
+++ b/doc/gyp_to_bazel.py
@@ -184,11 +184,15 @@
self.__tags.append(tag)
def attrs(self):
+ unique_deps = []
+ for dep in self.__deps:
+ if dep not in unique_deps:
+ unique_deps.append(dep)
r = super(CcBuildTarget, self).attrs();
r['srcs'] = self.__srcs
r['hdrs'] = self.__hdrs
r['tags'] = self.__tags
- r['deps'] = self.__deps
+ r['deps'] = unique_deps
return r
'''Represents a filegroup target.'''
diff --git a/y2014/wpilib/BUILD b/y2014/wpilib/BUILD
index ac2c1cf..a80ab2d 100644
--- a/y2014/wpilib/BUILD
+++ b/y2014/wpilib/BUILD
@@ -21,7 +21,6 @@
'//aos/common/logging:queue_logging',
'//aos/common/messages:robot_state',
'//aos/common/util:phased_loop',
- '//aos/common/messages:robot_state',
'//frc971/wpilib:hall_effect',
'//frc971/wpilib:joystick_sender',
'//frc971/wpilib:loop_output_handler',
diff --git a/y2015/BUILD b/y2015/BUILD
index 1219e63..22a0300 100644
--- a/y2015/BUILD
+++ b/y2015/BUILD
@@ -34,6 +34,7 @@
'//y2015/control_loops/drivetrain:drivetrain_queue',
'//y2015/control_loops/fridge:fridge_queue',
'//y2015:constants',
+ '//y2015/autonomous:auto_queue',
'//frc971/autonomous:auto_queue',
'//y2015/actors:stack_action_lib',
'//y2015/actors:stack_and_lift_action_lib',
diff --git a/y2015/autonomous/BUILD b/y2015/autonomous/BUILD
index 997c54f..352015a 100644
--- a/y2015/autonomous/BUILD
+++ b/y2015/autonomous/BUILD
@@ -1,5 +1,7 @@
package(default_visibility = ['//visibility:public'])
+load('/aos/build/queues', 'queue_library')
+
cc_library(
name = 'auto_lib',
srcs = [
@@ -24,6 +26,7 @@
'//y2015/actors:stack_action_lib',
'//y2015/actors:held_to_lift_action_lib',
'//y2015/actors:pickup_action_lib',
+ ':auto_queue',
],
)
@@ -38,3 +41,10 @@
':auto_lib',
],
)
+
+queue_library(
+ name = 'auto_queue',
+ srcs = [
+ 'auto.q',
+ ],
+)
diff --git a/y2015/wpilib/BUILD b/y2015/wpilib/BUILD
index d25c424..61d5c62 100644
--- a/y2015/wpilib/BUILD
+++ b/y2015/wpilib/BUILD
@@ -14,13 +14,13 @@
'//y2015/control_loops/drivetrain:drivetrain_queue',
'//y2015/control_loops/fridge:fridge_queue',
'//y2015/control_loops/claw:claw_queue',
+ '//y2015/autonomous:auto_queue',
'//aos/common/controls:control_loop',
'//aos/common/util:log_interval',
'//aos/common:time',
'//aos/common/logging:queue_logging',
'//aos/common/messages:robot_state',
'//aos/common/util:phased_loop',
- '//aos/common/messages:robot_state',
'//frc971/wpilib:hall_effect',
'//frc971/wpilib:joystick_sender',
'//frc971/wpilib:loop_output_handler',