pmt: Improvements for developers

- Android.bp was written to be included in ROMs/recoveries etc. in Android build system.
 - Macros have been added to simplify feature creation.
 - Some bug fixes (for JSON and pmt).
This commit is contained in:
2025-08-27 15:50:40 +03:00
parent 631c735a9a
commit e0f0b5b484
18 changed files with 200 additions and 109 deletions

110
Android.bp Normal file
View File

@@ -0,0 +1,110 @@
//
// Copyright 2025 Yağız Zengin
//
// 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.
//
// Partition manager tool source list
filegroup {
name: "pmt_srcs",
srcs: [
"src/FunctionManager.cpp",
"src/Main.cpp",
"src/PartitionManager.cpp",
"src/functions/BackupFunction.cpp",
"src/functions/EraseFunction.cpp",
"src/functions/FlashFunction.cpp",
"src/functions/InfoFunction.cpp",
"src/functions/MemoryTestFunction.cpp",
"src/functions/PartitionSizeFunction.cpp",
"src/functions/RealPathFunction.cpp",
"src/functions/RebootFunction.cpp",
"src/functions/TypeFunction.cpp",
],
}
// libhelper source list
filegroup {
name: "libhelper_srcs",
srcs: [
"srclib/libhelper/src/Checkers.cpp",
"srclib/libhelper/src/Classes.cpp",
"srclib/libhelper/src/FileUtil.cpp",
"srclib/libhelper/src/Sha256.cpp",
"srclib/libhelper/src/Utilities.cpp",
],
}
// libpartition_map source list
filegroup {
name: "libpartition_map_srcs",
srcs: [
"srclib/libpartition_map/src/Getters.cpp",
"srclib/libpartition_map/src/Magic.cpp",
"srclib/libpartition_map/src/PartitionMap.cpp",
"srclib/libpartition_map/src/Type.cpp",
],
}
// Default configurations of pmt
cc_defaults {
name: "pmt_defaults",
recovery_available: true,
cflags: [
"-Wall",
"-Werror",
"-Wno-deprecated-declarations",
"-Os",
"-fexceptions",
"-DANDROID_BUILD",
],
ldflags: ["-Wl,-s"],
local_include_dirs: [
"include",
"srclib/libhelper/include",
"srclib/libpartition_map/include",
],
export_include_dirs: [
"include",
"srclib/libhelper/include",
"srclib/libpartition_map/include",
],
shared_libs: ["libbase"],
}
// Build libhelper library
cc_library_shared {
name: "libhelper",
defaults: ["pmt_defaults"],
srcs: [":libhelper_srcs"],
}
// Build libpartition_map library
cc_library_shared {
name: "libpartition_map",
defaults: ["pmt_defaults"],
srcs: [":libpartition_map_srcs"],
shared_libs: ["libhelper"],
static_libs: ["libc++fs"],
}
// Build pmt
cc_binary {
name: "pmt",
defaults: ["pmt_defaults"],
srcs: [":pmt_srcs"],
shared_libs: [
"libhelper",
"libpartition_map",
],
}