//
// 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_defaults {
    name: "libprofile_defaults",
    defaults: ["art_defaults"],
    host_supported: true,
    srcs: [
        "profile/profile_compilation_info.cc",
    ],
    target: {
        android: {
            static_libs: [
                // ZipArchive support, the order matters here to get all symbols.
                "libziparchive",
                "libz",
            ],
	    shared_libs: [
	        // For android::FileMap used by libziparchive.
                "libutils",
	    ],
        },
        host: {
            shared_libs: [
                "libziparchive",
                "libz",
            ],
        },
    },
    //generated_sources: ["art_libartbase_operator_srcs"],
    cflags: ["-DBUILDING_LIBART=1"],
    shared_libs: [
        "libartbase",
        "libdexfile",
        "libartbase",
	// For atrace.
        "libcutils",
    ],
    export_include_dirs: ["."],
    // ART's macros.h depends on libbase's macros.h.
    // Note: runtime_options.h depends on cmdline. But we don't really want to export this
    //       generically. dex2oat takes care of it itself.
    export_shared_lib_headers: ["libbase"],
}

art_cc_library {
    name: "libprofile",
    defaults: ["libprofile_defaults"],
    // Leave the symbols in the shared library so that stack unwinders can
    // produce meaningful name resolution.
    strip: {
        keep_symbols: true,
    },
    shared_libs: [
        "libbase",
        "libziparchive",
    ],
    export_shared_lib_headers: ["libbase"],
}

art_cc_library {
    name: "libprofiled",
    defaults: [
        "art_debug_defaults",
        "libprofile_defaults",
    ],
    shared_libs: [
        "libbase",
        "libziparchive",
    ],
    export_shared_lib_headers: ["libbase"],
}

// For now many of these tests still use CommonRuntimeTest, almost universally because of
// ScratchFile and related.
// TODO: Remove CommonRuntimeTest dependency from these tests.
art_cc_test {
    name: "art_libprofile_tests",
    defaults: [
        "art_gtest_defaults",
    ],
    srcs: [
        "profile/profile_compilation_info_test.cc",
    ],
    shared_libs: [
        "libartbased",
        "libdexfiled",
        "libartbased",
        "libziparchive",
    ],
}
