summaryrefslogtreecommitdiff
path: root/profcollectd
diff options
context:
space:
mode:
authorDennis Shen <dzshen@google.com>2023-05-30 14:55:44 +0000
committerDennis Shen <dzshen@google.com>2023-06-01 13:35:18 +0000
commitf4195458cdf8f677ea6cf51d12cd7dc1037cbc0c (patch)
tree399bc417a56e56a0a2ea7a7c9fb5aeee07e8b79d /profcollectd
parent0d3ef1008bbee31124d493de5ad52f63d1a05f13 (diff)
downloadextras-f4195458cdf8f677ea6cf51d12cd7dc1037cbc0c.tar.gz
remove libprofcollect_libflags_rust and replace with libflags_rust
Bug: b/284096062 Test: m libprofcollectd Change-Id: Ibe0f92cc93cdc5cd505ceb6fe282482c2ea223e1
Diffstat (limited to 'profcollectd')
-rw-r--r--profcollectd/libprofcollectd/Android.bp2
-rw-r--r--profcollectd/libprofcollectd/bindings/libflags/Android.bp51
-rw-r--r--profcollectd/libprofcollectd/bindings/libflags/get_flags.cpp25
-rw-r--r--profcollectd/libprofcollectd/bindings/libflags/get_flags.hpp21
-rw-r--r--profcollectd/libprofcollectd/bindings/libflags/lib.rs38
-rw-r--r--profcollectd/libprofcollectd/config.rs2
6 files changed, 2 insertions, 137 deletions
diff --git a/profcollectd/libprofcollectd/Android.bp b/profcollectd/libprofcollectd/Android.bp
index ed383569..39177ec4 100644
--- a/profcollectd/libprofcollectd/Android.bp
+++ b/profcollectd/libprofcollectd/Android.bp
@@ -56,7 +56,7 @@ rust_library {
"libzip",
],
rlibs: [
- "libprofcollect_libflags_rust",
+ "libflags_rust",
"libsimpleperf_profcollect_rust",
],
shared_libs: ["libsimpleperf_profcollect"],
diff --git a/profcollectd/libprofcollectd/bindings/libflags/Android.bp b/profcollectd/libprofcollectd/bindings/libflags/Android.bp
deleted file mode 100644
index fb846678..00000000
--- a/profcollectd/libprofcollectd/bindings/libflags/Android.bp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Copyright (C) 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "system_extras_profcollectd_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["system_extras_profcollectd_license"],
-}
-
-cc_library_static {
- name: "libprofcollect_libflags",
- srcs: ["get_flags.cpp"],
- generated_headers: ["cxx-bridge-header"],
- generated_sources: ["libprofcollect_libflags_bridge_code"],
-}
-
-genrule {
- name: "libprofcollect_libflags_bridge_code",
- tools: ["cxxbridge"],
- cmd: "$(location cxxbridge) $(in) >> $(out)",
- srcs: ["lib.rs"],
- out: ["libprofcollect_libflags_cxx_generated.cc"],
-}
-
-rust_library {
- name: "libprofcollect_libflags_rust",
- crate_name: "profcollect_libflags_rust",
- srcs: ["lib.rs"],
- rustlibs: ["libcxx"],
- static_libs: ["libprofcollect_libflags"],
- shared_libs: [
- "libc++",
- "server_configurable_flags",
- ],
-}
diff --git a/profcollectd/libprofcollectd/bindings/libflags/get_flags.cpp b/profcollectd/libprofcollectd/bindings/libflags/get_flags.cpp
deleted file mode 100644
index d8bab841..00000000
--- a/profcollectd/libprofcollectd/bindings/libflags/get_flags.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../../../../../server_configurable_flags/libflags/include/server_configurable_flags/get_flags.h"
-#include "get_flags.hpp"
-
-rust::String GetServerConfigurableFlag(rust::Str experiment_category_name,
- rust::Str experiment_flag_name, rust::Str default_value) {
- return server_configurable_flags::GetServerConfigurableFlag(std::string(experiment_category_name),
- std::string(experiment_flag_name),
- std::string(default_value));
-}
diff --git a/profcollectd/libprofcollectd/bindings/libflags/get_flags.hpp b/profcollectd/libprofcollectd/bindings/libflags/get_flags.hpp
deleted file mode 100644
index a42c52e8..00000000
--- a/profcollectd/libprofcollectd/bindings/libflags/get_flags.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "rust/cxx.h"
-
-rust::String GetServerConfigurableFlag(rust::Str, rust::Str, rust::Str);
diff --git a/profcollectd/libprofcollectd/bindings/libflags/lib.rs b/profcollectd/libprofcollectd/bindings/libflags/lib.rs
deleted file mode 100644
index c6435bbd..00000000
--- a/profcollectd/libprofcollectd/bindings/libflags/lib.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (C) 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-//! This module implements safe wrappers for GetServerConfigurableFlag method
-//! from libflags.
-
-pub use ffi::GetServerConfigurableFlag;
-
-#[cxx::bridge]
-mod ffi {
- unsafe extern "C++" {
- include!("get_flags.hpp");
-
- /// Use the category name and flag name registered in SettingsToPropertiesMapper.java
- /// to query the experiment flag value. This method will return default_value if
- /// querying fails.
- /// Note that for flags from Settings.Global, experiment_category_name should
- /// always be global_settings.
- fn GetServerConfigurableFlag(
- experiment_category_name: &str,
- experiment_flag_name: &str,
- default_value: &str,
- ) -> String;
- }
-}
diff --git a/profcollectd/libprofcollectd/config.rs b/profcollectd/libprofcollectd/config.rs
index 2888aab7..46cd7f25 100644
--- a/profcollectd/libprofcollectd/config.rs
+++ b/profcollectd/libprofcollectd/config.rs
@@ -115,7 +115,7 @@ where
T::Err: Error + Send + Sync + 'static,
{
let default_value = default_value.to_string();
- let config = profcollect_libflags_rust::GetServerConfigurableFlag(
+ let config = flags_rust::GetServerConfigurableFlag(
PROFCOLLECT_CONFIG_NAMESPACE,
key,
&default_value,