Initial stab at the new WPILib.

Change-Id: Id04cc07649959566deb5b4fa637267072a5191ca
diff --git a/third_party/BUILD b/third_party/BUILD
index 3f7352f..20bb7e0 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -1,6 +1,6 @@
 cc_library(
   name = 'wpilib',
-  deps = ['//third_party/allwpilib_2017:wpilib'],
+  deps = ['//third_party/allwpilib_2018:wpilib'],
   visibility = ['//visibility:public'],
   linkstatic = True,
   restricted_to = ['//tools:roborio'],
diff --git a/third_party/allwpilib_2018/BUILD b/third_party/allwpilib_2018/BUILD
new file mode 100644
index 0000000..8254c8a
--- /dev/null
+++ b/third_party/allwpilib_2018/BUILD
@@ -0,0 +1,143 @@
+licenses(['notice'])
+
+genrule(
+  name = 'wpilib_version',
+  outs = ['shared/src/WPILibVersion.cpp'],
+  cmd = '\n'.join([
+    "cat > \"$@\" << EOF",
+    "// Autogenerated file! Do not manually edit this file.",
+    "#include \"WPILibVersion.h\"",
+    "const char* GetWPILibVersion() {",
+    "  return \"2018-frc971\";",
+    "}",
+    "EOF",
+  ]),
+)
+
+_header_dirs = [
+  'wpilibc/src/main/native/include',
+  #'wpilibc/shared/include',
+  #'wpilibc/athena/include',
+  'hal/src/main/native/include',
+  'hal/src/main/native/athena',
+  'hal/src/main/native/include/HAL/cpp',
+  #'hal/include',
+  #'hal/lib/athena',
+]
+
+# Names of WPILib "devices" I don't want to deal with making trivial updates to
+# chop out various ugliness or have to vet for sanity.
+_excluded_devices = [
+  'ADXL345_I2C',
+  'ADXL345_SPI',
+  'ADXL362',
+  'ADXRS450_Gyro',
+  'AnalogAccelerometer',
+  #'AnalogGyro',
+  'AnalogPotentiometer',
+  'CANJaguar',
+  'CANSpeedController',
+  'CANTalon',
+  'CameraServer',
+  'DoubleSolenoid',
+  'GamepadBase',
+  'GearTooth',
+  'GenericHID',
+  #'GyroBase',
+  'IterativeRobot',
+  'Jaguar',
+  'Joystick',
+  'JoystickBase',
+  #'Log',
+  #'MotorSafety',
+  #'MotorSafetyHelper',
+  'OSSerialPort',
+  #'PIDController',
+  #'PIDSource',
+  #'PWMSpeedController',
+  'Potentiometer',
+  'RobotDrive',
+  'SD540',
+  #'SafePWM',
+  #'SerialHelper',
+  #'SerialPort',
+  'Spark',
+  #'SpeedController',
+  'TalonSRX',
+  'Ultrasonic',
+  'Victor',
+  'XboxController',
+  #'visa',
+]
+
+# Whole subdirectories of WPILib we don't want around.
+_excluded_directories = [
+  #'SmartDashboard',
+  #'LiveWindow',
+  #'Commands',
+  #'Buttons',
+  #'Filters',
+  'LabView',
+  'vision',
+]
+
+# Header files we don't want to have.
+_bad_hdrs = ([
+  'wpilibc/src/main/native/include/WPILib.h',
+  'hal/src/main/native/include/HAL/LabVIEW/HAL.h',
+  #'wpilibc/**/Accelerometer.*',
+] + ['**/%s/**' % d for d in _excluded_directories] +
+ ['**/%s.*' % d for d in _excluded_devices])
+_h_hdrs = glob([d + '/**/*.h' for d in _header_dirs], exclude=_bad_hdrs)
+_hpp_hdrs = glob([d + '/**/*.hpp' for d in _header_dirs], exclude=_bad_hdrs)
+
+cc_library(
+  name = 'wpilib',
+  visibility = ['//third_party:__pkg__'],
+  srcs = glob([
+    'wpilibc/src/main/native/cpp/*.cpp',
+    'wpilibc/src/main/native/cpp/interfaces/*.cpp',
+    'wpilibc/src/main/native/cpp/LiveWindow/*.cpp',
+    'wpilibc/src/main/native/cpp/Commands/*.cpp',
+    'wpilibc/src/main/native/cpp/SmartDashboard/*.cpp',
+
+    'hal/src/main/native/athena/*.cpp',
+    'hal/src/main/native/athena/cpp/*.cpp',
+    'hal/src/main/native/athena/ctre/*.cpp',
+    'hal/src/main/native/shared/handles/*.cpp',
+    'wpilibc/src/main/native/cpp/Internal/*.cpp',
+  ], exclude = (
+    ['**/%s/**' % d for d in _excluded_directories] +
+    ['**/%s.*' % d for d in _excluded_devices] + [
+    #'wpilibc/**/Accelerometer.*',
+  ])) + [
+    ':wpilib_version',
+  ],
+  copts = [
+    '-Wno-unused-parameter',
+    '-Wno-switch-enum',
+    '-Wno-attributes',
+    '-Wno-cast-align',
+    '-Wno-cast-qual',
+    '-Wno-deprecated-declarations',
+    '-Wno-error',
+    #'-Wno-unused-const-variable',
+  ],
+  deps = [
+    '//third_party/ntcore_2018:ntcore',
+    '@allwpilib_ni_libraries_repo_2018//:ni-libraries',
+    '//aos/common/logging',
+  ],
+  hdrs = _h_hdrs + _hpp_hdrs + [
+    'wpilibc/src/main/native/include/circular_buffer.inc',
+    'wpilibc/src/main/native/include/SpeedControllerGroup.inc',
+  ],
+  includes = _header_dirs,
+  linkopts = [
+    '-lpthread',
+  ],
+  defines = [
+    'WPILIB2018=1',
+  ],
+  restricted_to = ['//tools:roborio'],
+)
diff --git a/third_party/allwpilib_2018/hal/src/main/native/athena/HAL.cpp b/third_party/allwpilib_2018/hal/src/main/native/athena/HAL.cpp
index 4c65597..faa88b5 100644
--- a/third_party/allwpilib_2018/hal/src/main/native/athena/HAL.cpp
+++ b/third_party/allwpilib_2018/hal/src/main/native/athena/HAL.cpp
@@ -61,7 +61,7 @@
   InitializeI2C();
   InitialzeInterrupts();
   InitializeNotifier();
-  InitializeOSSerialPort();
+  //InitializeOSSerialPort();
   InitializePCMInternal();
   InitializePDP();
   InitializePorts();
@@ -272,6 +272,40 @@
 }
 
 /**
+ * Convert a freestanding lower half to a 64 bit FPGA timestamp
+ *
+ * Note: This is making the assumption that the timestamp being converted is
+ * always in the past.  If you call this with a future timestamp, it probably
+ * will make it in the past.  If you wait over 70 minutes between capturing the
+ * bottom 32 bits of the timestamp and expanding it, you will be off by
+ * multiples of 1<<32 microseconds.
+ *
+ * @return The current time in microseconds according to the FPGA (since FPGA
+ * reset) as a 64 bit number.
+ */
+uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t* status) {
+  // Capture the current FPGA time.  This will give us the upper half of the
+  // clock.
+  uint64_t fpga_time = HAL_GetFPGATime(status);
+  if (*status != 0) return 0;
+
+  // Now, we need to detect the case where the lower bits rolled over after we
+  // sampled.  In that case, the upper bits will be 1 bigger than they should
+  // be.
+
+  // Break it into lower and upper portions.
+  uint32_t lower = fpga_time & ((uint64_t)0xffffffff);
+  uint64_t upper = (fpga_time >> 32) & 0xffffffff;
+
+  // The time was sampled *before* the current time, so roll it back.
+  if (lower < unexpanded_lower) {
+    --upper;
+  }
+
+  return (upper << 32) + static_cast<uint64_t>(unexpanded_lower);
+}
+
+/**
  * Get the state of the "USER" button on the roboRIO
  * @return true if the button is currently pressed down
  */
diff --git a/third_party/allwpilib_2018/hal/src/main/native/athena/Interrupts.cpp b/third_party/allwpilib_2018/hal/src/main/native/athena/Interrupts.cpp
index afc6ec0..c8c38df 100644
--- a/third_party/allwpilib_2018/hal/src/main/native/athena/Interrupts.cpp
+++ b/third_party/allwpilib_2018/hal/src/main/native/athena/Interrupts.cpp
@@ -14,6 +14,7 @@
 #include "DigitalInternal.h"
 #include "HAL/ChipObject.h"
 #include "HAL/Errors.h"
+#include "HAL/HAL.h"
 #include "HAL/cpp/make_unique.h"
 #include "HAL/handles/HandlesInternal.h"
 #include "HAL/handles/LimitedHandleResource.h"
@@ -174,9 +175,9 @@
 /**
  * Return the timestamp for the rising interrupt that occurred most recently.
  * This is in the same time domain as GetClock().
- * @return Timestamp in seconds since boot.
+ * @return Timestamp in microseconds since boot.
  */
-double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
+uint64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
                                         int32_t* status) {
   auto anInterrupt = interruptHandles->Get(interruptHandle);
   if (anInterrupt == nullptr) {
@@ -184,7 +185,7 @@
     return 0;
   }
   uint32_t timestamp = anInterrupt->anInterrupt->readRisingTimeStamp(status);
-  return timestamp * 1e-6;
+  return HAL_ExpandFPGATime(timestamp, status);
 }
 
 /**
@@ -192,7 +193,7 @@
  * This is in the same time domain as GetClock().
  * @return Timestamp in seconds since boot.
  */
-double HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
+uint64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
                                          int32_t* status) {
   auto anInterrupt = interruptHandles->Get(interruptHandle);
   if (anInterrupt == nullptr) {
@@ -200,7 +201,7 @@
     return 0;
   }
   uint32_t timestamp = anInterrupt->anInterrupt->readFallingTimeStamp(status);
-  return timestamp * 1e-6;
+  return HAL_ExpandFPGATime(timestamp, status);
 }
 
 void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
diff --git a/third_party/allwpilib_2018/hal/src/main/native/include/HAL/HAL.h b/third_party/allwpilib_2018/hal/src/main/native/include/HAL/HAL.h
index 2b765e5..ea396ca 100644
--- a/third_party/allwpilib_2018/hal/src/main/native/include/HAL/HAL.h
+++ b/third_party/allwpilib_2018/hal/src/main/native/include/HAL/HAL.h
@@ -68,6 +68,7 @@
 HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
 
 uint64_t HAL_GetFPGATime(int32_t* status);
+uint64_t HAL_ExpandFPGATime(uint32_t unexpanded_lower, int32_t *status);
 
 HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode);
 
diff --git a/third_party/allwpilib_2018/hal/src/main/native/include/HAL/Interrupts.h b/third_party/allwpilib_2018/hal/src/main/native/include/HAL/Interrupts.h
index db522f9..dbd7200 100644
--- a/third_party/allwpilib_2018/hal/src/main/native/include/HAL/Interrupts.h
+++ b/third_party/allwpilib_2018/hal/src/main/native/include/HAL/Interrupts.h
@@ -28,10 +28,10 @@
 void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status);
 void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
                            int32_t* status);
-double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
-                                        int32_t* status);
-double HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
-                                         int32_t* status);
+uint64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
+                                          int32_t *status);
+uint64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
+                                           int32_t *status);
 void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
                            HAL_Handle digitalSourceHandle,
                            HAL_AnalogTriggerType analogTriggerType,
diff --git a/third_party/allwpilib_2018/wpilibc/src/main/native/cpp/InterruptableSensorBase.cpp b/third_party/allwpilib_2018/wpilibc/src/main/native/cpp/InterruptableSensorBase.cpp
index 5c9d448..0a11bbe 100644
--- a/third_party/allwpilib_2018/wpilibc/src/main/native/cpp/InterruptableSensorBase.cpp
+++ b/third_party/allwpilib_2018/wpilibc/src/main/native/cpp/InterruptableSensorBase.cpp
@@ -152,10 +152,23 @@
  * @return Timestamp in seconds since boot.
  */
 double InterruptableSensorBase::ReadRisingTimestamp() {
+  return static_cast<double>(ReadRisingTimestampMicroseconds()) * 1e-6;
+}
+
+/**
+ * Return the timestamp for the rising interrupt that occurred most recently.
+ *
+ * This is in the same time domain as GetClock().
+ * The rising-edge interrupt should be enabled with
+ * {@link #DigitalInput.SetUpSourceEdge}
+ *
+ * @return Timestamp in microseconds since boot.
+ */
+uint64_t InterruptableSensorBase::ReadRisingTimestampMicroseconds() {
   if (StatusIsFatal()) return 0.0;
   wpi_assert(m_interrupt != HAL_kInvalidHandle);
   int32_t status = 0;
-  double timestamp = HAL_ReadInterruptRisingTimestamp(m_interrupt, &status);
+  uint64_t timestamp = HAL_ReadInterruptRisingTimestamp(m_interrupt, &status);
   wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
   return timestamp;
 }
@@ -170,10 +183,23 @@
  * @return Timestamp in seconds since boot.
  */
 double InterruptableSensorBase::ReadFallingTimestamp() {
+  return static_cast<double>(ReadFallingTimestampMicroseconds()) * 1e-6;
+}
+
+/**
+ * Return the timestamp for the falling interrupt that occurred most recently.
+ *
+ * This is in the same time domain as GetClock().
+ * The falling-edge interrupt should be enabled with
+ * {@link #DigitalInput.SetUpSourceEdge}
+ *
+ * @return Timestamp in microseconds since boot.
+ */
+uint64_t InterruptableSensorBase::ReadFallingTimestampMicroseconds() {
   if (StatusIsFatal()) return 0.0;
   wpi_assert(m_interrupt != HAL_kInvalidHandle);
   int32_t status = 0;
-  double timestamp = HAL_ReadInterruptFallingTimestamp(m_interrupt, &status);
+  uint64_t timestamp = HAL_ReadInterruptFallingTimestamp(m_interrupt, &status);
   wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
   return timestamp;
 }
diff --git a/third_party/allwpilib_2018/wpilibc/src/main/native/include/InterruptableSensorBase.h b/third_party/allwpilib_2018/wpilibc/src/main/native/include/InterruptableSensorBase.h
index 267353a..4d5c1ba 100644
--- a/third_party/allwpilib_2018/wpilibc/src/main/native/include/InterruptableSensorBase.h
+++ b/third_party/allwpilib_2018/wpilibc/src/main/native/include/InterruptableSensorBase.h
@@ -50,9 +50,11 @@
 
   // Return the timestamp for the rising interrupt that occurred.
   virtual double ReadRisingTimestamp();
+  virtual uint64_t ReadRisingTimestampMicroseconds();
 
   // Return the timestamp for the falling interrupt that occurred.
   virtual double ReadFallingTimestamp();
+  virtual uint64_t ReadFallingTimestampMicroseconds();
 
   virtual void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
 
diff --git a/third_party/allwpilib_2018/wpilibc/src/main/native/include/Utility.h b/third_party/allwpilib_2018/wpilibc/src/main/native/include/Utility.h
index 616f4e3..007f8be 100644
--- a/third_party/allwpilib_2018/wpilibc/src/main/native/include/Utility.h
+++ b/third_party/allwpilib_2018/wpilibc/src/main/native/include/Utility.h
@@ -59,7 +59,7 @@
 int GetFPGAVersion();
 WPI_DEPRECATED("Use RobotController static class method")
 int64_t GetFPGARevision();
-WPI_DEPRECATED("Use RobotController static class method")
+//WPI_DEPRECATED("Use RobotController static class method")
 uint64_t GetFPGATime();
 WPI_DEPRECATED("Use RobotController static class method")
 bool GetUserButton();
diff --git a/third_party/allwpilib_2018/wpilibj/src/main/native/cpp/InterruptJNI.cpp b/third_party/allwpilib_2018/wpilibj/src/main/native/cpp/InterruptJNI.cpp
index 6150116..dc17f7b 100644
--- a/third_party/allwpilib_2018/wpilibj/src/main/native/cpp/InterruptJNI.cpp
+++ b/third_party/allwpilib_2018/wpilibj/src/main/native/cpp/InterruptJNI.cpp
@@ -232,7 +232,9 @@
   INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
 
   int32_t status = 0;
-  jdouble timeStamp = HAL_ReadInterruptRisingTimestamp((HAL_InterruptHandle)interruptHandle, &status);
+  jdouble timeStamp = static_cast<jdouble>(HAL_ReadInterruptRisingTimestamp(
+                          (HAL_InterruptHandle)interruptHandle, &status)) *
+                      1e-6;
 
   INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
   CheckStatus(env, status);
diff --git a/third_party/gperftools/BUILD b/third_party/gperftools/BUILD
index 3fa0ab3..3310c78 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/BUILD
@@ -5,6 +5,7 @@
 
 common_copts = [
   # Stuff from their Makefile.
+  '-Wno-cast-align',
   '-Wno-sign-compare',
   '-fno-builtin-malloc',
   '-fno-builtin-free',
diff --git a/third_party/ntcore_2018/BUILD b/third_party/ntcore_2018/BUILD
new file mode 100644
index 0000000..4a6341c
--- /dev/null
+++ b/third_party/ntcore_2018/BUILD
@@ -0,0 +1,31 @@
+licenses(['notice'])
+
+cc_library(
+  name = 'ntcore',
+  visibility = ['//visibility:public'],
+  srcs = glob([
+    'src/main/**/*.cpp',
+    'src/main/**/*.h',
+  ], exclude = [
+    #'src/main/native/cpp/networktables/**',
+    'src/main/native/cpp/jni/**',
+  ]),
+  copts = [
+    '-Wno-switch-enum',
+    '-Wno-cast-align',
+  ],
+  hdrs = glob([
+    'src/main/native/include/**/*.h',
+    'src/main/native/include/**/*.inl',
+  ]),
+  includes = [
+    'src/main/native/include',
+  ],
+  linkopts = [
+    '-lpthread',
+  ],
+  deps = [
+    '//third_party/wpiutil_2018:wpiutil',
+  ],
+  restricted_to = ['//tools:roborio'],
+)
diff --git a/third_party/ntcore_2018/src/main/native/cpp/ConnectionNotifier.h b/third_party/ntcore_2018/src/main/native/cpp/ConnectionNotifier.h
index 4d3cc92..4950ae3 100644
--- a/third_party/ntcore_2018/src/main/native/cpp/ConnectionNotifier.h
+++ b/third_party/ntcore_2018/src/main/native/cpp/ConnectionNotifier.h
@@ -22,8 +22,8 @@
  public:
   explicit ConnectionNotifierThread(int inst) : m_inst(inst) {}
 
-  bool Matches(const ListenerData& listener,
-               const ConnectionNotification& data) {
+  bool Matches(const ListenerData& /*listener*/,
+               const ConnectionNotification& /*data*/) {
     return true;
   }
 
diff --git a/third_party/ntcore_2018/src/main/native/cpp/RpcServer.h b/third_party/ntcore_2018/src/main/native/cpp/RpcServer.h
index 2b80db7..347c7d5 100644
--- a/third_party/ntcore_2018/src/main/native/cpp/RpcServer.h
+++ b/third_party/ntcore_2018/src/main/native/cpp/RpcServer.h
@@ -44,11 +44,11 @@
   RpcServerThread(int inst, wpi::Logger& logger)
       : m_inst(inst), m_logger(logger) {}
 
-  bool Matches(const RpcListenerData& listener, const RpcNotifierData& data) {
+  bool Matches(const RpcListenerData& /*listener*/, const RpcNotifierData& data) {
     return !data.name.empty() && data.send_response;
   }
 
-  void SetListener(RpcNotifierData* data, unsigned int listener_uid) {
+  void SetListener(RpcNotifierData* data, unsigned int /*listener_uid*/) {
     unsigned int local_id = Handle{data->entry}.GetIndex();
     unsigned int call_uid = Handle{data->call}.GetIndex();
     RpcIdPair lookup_uid{local_id, call_uid};
diff --git a/third_party/ntcore_2018/src/main/native/cpp/Storage.cpp b/third_party/ntcore_2018/src/main/native/cpp/Storage.cpp
index 8bb37f8..e291458 100644
--- a/third_party/ntcore_2018/src/main/native/cpp/Storage.cpp
+++ b/third_party/ntcore_2018/src/main/native/cpp/Storage.cpp
@@ -310,7 +310,7 @@
 }
 
 void Storage::ProcessIncomingExecuteRpc(
-    std::shared_ptr<Message> msg, INetworkConnection* conn,
+    std::shared_ptr<Message> msg, INetworkConnection* /*conn*/,
     std::weak_ptr<INetworkConnection> conn_weak) {
   std::unique_lock<wpi::mutex> lock(m_mutex);
   if (!m_server) return;  // only process on server
@@ -350,7 +350,7 @@
 }
 
 void Storage::ProcessIncomingRpcResponse(std::shared_ptr<Message> msg,
-                                         INetworkConnection* conn) {
+                                         INetworkConnection* /*conn*/) {
   std::unique_lock<wpi::mutex> lock(m_mutex);
   if (m_server) return;  // only process on client
   unsigned int id = msg->id();
@@ -387,7 +387,7 @@
 
 void Storage::ApplyInitialAssignments(
     INetworkConnection& conn, llvm::ArrayRef<std::shared_ptr<Message>> msgs,
-    bool new_server, std::vector<std::shared_ptr<Message>>* out_msgs) {
+    bool /*new_server*/, std::vector<std::shared_ptr<Message>>* out_msgs) {
   std::unique_lock<wpi::mutex> lock(m_mutex);
   if (m_server) return;  // should not do this on server
 
diff --git a/third_party/ntcore_2018/src/main/native/cpp/ntcore_c.cpp b/third_party/ntcore_2018/src/main/native/cpp/ntcore_c.cpp
index 35ebbc5..7c62d3c 100644
--- a/third_party/ntcore_2018/src/main/native/cpp/ntcore_c.cpp
+++ b/third_party/ntcore_2018/src/main/native/cpp/ntcore_c.cpp
@@ -761,7 +761,7 @@
   str->len = 0;
 }
 
-void NT_DisposeEntryArray(NT_Entry* arr, size_t count) { std::free(arr); }
+void NT_DisposeEntryArray(NT_Entry* arr, size_t /*count*/) { std::free(arr); }
 
 void NT_DisposeConnectionInfoArray(NT_ConnectionInfo* arr, size_t count) {
   for (size_t i = 0; i < count; i++) DisposeConnectionInfo(&arr[i]);
diff --git a/third_party/wpiutil_2018/BUILD b/third_party/wpiutil_2018/BUILD
new file mode 100644
index 0000000..41822f6
--- /dev/null
+++ b/third_party/wpiutil_2018/BUILD
@@ -0,0 +1,27 @@
+licenses(['notice'])
+
+cc_library(
+  name = 'wpiutil',
+  visibility = ['//visibility:public'],
+  srcs = glob([
+    'src/main/native/cpp/**/*.cpp',
+    'src/main/native/cpp/**/*.h',
+    'src/main/native/cpp/**/*.inc',
+  ]),
+  copts = [
+    #'-Wno-switch-enum',
+    '-Wno-cast-align',
+    #'-Ithird_party/wpiutil_2018/
+    '-Wno-unused-parameter',
+  ],
+  hdrs = glob([
+    'src/main/native/include/**/*',
+  ]),
+  includes = [
+    'src/main/native/include',
+  ],
+  linkopts = [
+    '-lpthread',
+  ],
+  restricted_to = ['//tools:roborio'],
+)