Add Rust D-Bus bindings.

BUG=chromium:1007474
TEST=cargo build, sudo emerge tlsdate_dbus

Change-Id: Ib5ee7691cf139ff7e7da39b5382adc7d836017b1
Reviewed-on: https://chromium-review.googlesource.com/1835597
Tested-by: Allen Webb <allenwebb@google.com>
Commit-Ready: Allen Webb <allenwebb@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/.gitignore b/.gitignore
index 09b6df1..72ad546 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@
 TAGS
 config.h
 config.in
+src/bindings
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..e541c85
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "tlsdate_dbus"
+version = "0.24.52"
+authors = ["The Chromium OS Authors"]
+edition = "2018"
+exclude = ["*"]
+include = ["Cargo.toml", "build.rs", "src/lib.rs", "src/bindings/*"]
+
+[build-dependencies]
+chromeos_dbus_bindings = { path = "../../platform2/chromeos-dbus-bindings"} # provided by ebuild
+
+[dependencies]
+dbus = "0.6"
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..271a26b
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,19 @@
+// Copyright 2019 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Generates the Rust D-Bus bindings for tlsdate.
+
+use std::path::Path;
+
+use chromeos_dbus_bindings::{self, generate_module};
+
+const SOURCE_DIR: &str = ".";
+
+// (<module name>, <relative path to source xml>)
+const BINDINGS_TO_GENERATE: &[(&str, &str)] =
+    &[("org_torproject_tlsdate", "dbus/org.torproject.tlsdate.xml")];
+
+fn main() {
+    generate_module(Path::new(SOURCE_DIR), BINDINGS_TO_GENERATE).unwrap();
+}
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..5b490f2
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,7 @@
+// Copyright 2019 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Imports the Rust D-Bus bindings for tlsdate.
+
+include!(concat!(env!("OUT_DIR"), "/include_modules.rs"));