Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0275123e authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Todd Kennedy
Browse files

idmap2: initial code drop

idmap2 is a reboot of the idmap project. The project aims to

  - use modern C++
  - greatly improve test and debug support
  - interface towards AssetManager2 (instead of AssetManager)
  - provide a solid foundation to add support for new features

To make it easier to verify correctness, this first version of idmap2 is
feature equivalent to idmap. Later versions will add support for new
features such as <overlayable>.

Bug: 78815803
Test: make idmap2_tests
Change-Id: I1d806dc875a493e730ab55d2fdb027618e586d16
parent 8c12dcd1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
BasedOnStyle: Google
ColumnLimit: 100
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
PointerAlignment: Left

cmds/idmap2/Android.bp

0 → 100644
+191 −0
Original line number Diff line number Diff line
// Copyright (C) 2018 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.

cc_library {
    name: "libidmap2",
    host_supported: true,
    tidy: true,
    tidy_flags: [
        "-system-headers",
        "-warnings-as-errors=*",
    ],
    srcs: [
        "libidmap2/BinaryStreamVisitor.cpp",
        "libidmap2/CommandLineOptions.cpp",
        "libidmap2/FileUtils.cpp",
        "libidmap2/Idmap.cpp",
        "libidmap2/PrettyPrintVisitor.cpp",
        "libidmap2/RawPrintVisitor.cpp",
        "libidmap2/ResourceUtils.cpp",
        "libidmap2/Xml.cpp",
        "libidmap2/ZipFile.cpp",
    ],
    export_include_dirs: ["include"],
    target: {
        android: {
            static: {
                enabled: false,
            },
            shared_libs: [
                "libandroidfw",
                "libbase",
                "libutils",
                "libziparchive",
            ],
        },
        host: {
            shared: {
                enabled: false,
            },
            static_libs: [
                "libandroidfw",
                "libbase",
                "libutils",
                "libziparchive",
            ],
        },
    },
}

cc_test {
    name: "idmap2_tests",
    host_supported: true,
    tidy: true,
    tidy_flags: [
        "-system-headers",
        "-warnings-as-errors=*",
    ],
    srcs: [
        "tests/BinaryStreamVisitorTests.cpp",
        "tests/CommandLineOptionsTests.cpp",
        "tests/FileUtilsTests.cpp",
        "tests/Idmap2BinaryTests.cpp",
        "tests/IdmapTests.cpp",
        "tests/Main.cpp",
        "tests/PrettyPrintVisitorTests.cpp",
        "tests/RawPrintVisitorTests.cpp",
        "tests/ResourceUtilsTests.cpp",
        "tests/XmlTests.cpp",
        "tests/ZipFileTests.cpp",
    ],
    required: [
        "idmap2",
    ],
    static_libs: ["libgmock"],
    target: {
        android: {
            shared_libs: [
                "libandroidfw",
                "libbase",
                "libidmap2",
                "liblog",
                "libutils",
                "libz",
                "libziparchive",
            ],
        },
        host: {
            static_libs: [
                "libandroidfw",
                "libbase",
                "libidmap2",
                "liblog",
                "libutils",
                "libziparchive",
            ],
            shared_libs: [
                "libz",
            ],
        },
    },
    data: ["tests/data/**/*.apk"],
}

cc_binary {
    name: "idmap2",
    host_supported: true,
    tidy: true,
    tidy_flags: [
        "-system-headers",
        "-warnings-as-errors=*",
    ],
    srcs: [
        "idmap2/Create.cpp",
        "idmap2/Dump.cpp",
        "idmap2/Lookup.cpp",
        "idmap2/Main.cpp",
        "idmap2/Scan.cpp",
        "idmap2/Verify.cpp",
    ],
    target: {
        android: {
            shared_libs: [
                "libandroidfw",
                "libbase",
                "libidmap2",
                "libutils",
                "libziparchive",
            ],
        },
        host: {
            static_libs: [
                "libandroidfw",
                "libbase",
                "libidmap2",
                "liblog",
                "libutils",
                "libziparchive",
            ],
            shared_libs: [
                "libz",
            ],
        },
    },
}

cc_binary {
    name: "idmap2d",
    host_supported: false,
    tidy: true,
    tidy_checks: [
        // remove google-default-arguments or clang-tidy will complain about
        // the auto-generated file IIdmap2.cpp
        "-google-default-arguments",
    ],
    tidy_flags: [
        "-system-headers",
        "-warnings-as-errors=*",
    ],
    srcs: [
        ":idmap2_aidl",
        "idmap2d/Idmap2Service.cpp",
        "idmap2d/Main.cpp",
    ],
    shared_libs: [
        "libandroidfw",
        "libbase",
        "libbinder",
        "libcutils",
        "libidmap2",
        "libutils",
        "libziparchive",
    ],
}

filegroup {
    name: "idmap2_aidl",
    srcs: [
        "idmap2d/aidl/android/os/IIdmap2.aidl",
    ],
}
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<configuration description="Config for idmap2_tests">
    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="cleanup" value="true" />
        <option name="push" value="idmap2_tests->/data/local/tmp/idmap2_tests" />
    </target_preparer>
    <option name="test-suite-tag" value="idmap2_tests" />
    <test class="com.android.tradefed.testtype.GTest" >
        <option name="native-test-device-path" value="/data/local/tmp" />
        <option name="module-name" value="idmap2_tests" />
    </test>
</configuration>
+18 −0
Original line number Diff line number Diff line
# Copyright (C) 2018 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.

set noparent
linelength=100
root=..
filter=+build/include_alpha

cmds/idmap2/OWNERS

0 → 100644
+2 −0
Original line number Diff line number Diff line
set noparent
toddke@google.com
Loading