<commit_before>#!/usr/bin/env python

import argparse
import json
import logging
import os

logging_format = '[%(levelname)s] %(message)s'
logging.basicConfig(level=logging.INFO, format=logging_format)

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
REPO_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, "../.."))


def get_files_to_compile(json_data):
    files_to_compile = []
    for element in json_data:
        filename = element["file"]
        if not filename.endswith("tests.cpp") and \
                not filename.endswith("benchmarks.cpp") and \
                "third-party" not in filename and \
                "example" not in filename and \
                "generated/gen" not in filename and \
                "test_util" not in filename:
            base = filename.rfind("osquery/")
            filename = filename[base + len("osquery/"):]
            base_generated = filename.rfind("generated/")
            if base_generated >= 0:
                filename = filename[base_generated:]
            files_to_compile.append(filename)
    return files_to_compile

TARGETS_PREAMBLE = """
# DO NOT EDIT
# Automatically generated: make sync

thrift_library(
  name="if",
  languages=[
    "cpp",
    "py",
  ],
  thrift_srcs={
    "extensions/osquery.thrift": ["Extension", "ExtensionManager"],
  },
)

cpp_library(
  name="osquery_sdk",
  srcs=["""

TARGETS_POSTSCRIPT = """  ],
  deps=[
    "@/thrift/lib/cpp/concurrency:concurrency",
    ":if-cpp",
  ],
  external_deps=[
    "boost",
    "glog",
    "gflags",
    "gtest",
    "rocksdb",
    "libuuid",
  ],
  compiler_flags=[
    "-Wno-unused-function",
    "-Wno-non-virtual-dtor",
    "-Wno-address",<commit_msg>Use libuuid from e2fsprogs for codegen TARGETS (#2213)<commit_after>#!/usr/bin/env python

import argparse
import json
import logging
import os

logging_format = '[%(levelname)s] %(message)s'
logging.basicConfig(level=logging.INFO, format=logging_format)

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
REPO_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, "../.."))


def get_files_to_compile(json_data):
    files_to_compile = []
    for element in json_data:
        filename = element["file"]
        if not filename.endswith("tests.cpp") and \
                not filename.endswith("benchmarks.cpp") and \
                "third-party" not in filename and \
                "example" not in filename and \
                "generated/gen" not in filename and \
                "test_util" not in filename:
            base = filename.rfind("osquery/")
            filename = filename[base + len("osquery/"):]
            base_generated = filename.rfind("generated/")
            if base_generated >= 0:
                filename = filename[base_generated:]
            files_to_compile.append(filename)
    return files_to_compile

TARGETS_PREAMBLE = """
# DO NOT EDIT
# Automatically generated: make sync

thrift_library(
  name="if",
  languages=[
    "cpp",
    "py",
  ],
  thrift_srcs={
    "extensions/osquery.thrift": ["Extension", "ExtensionManager"],
  },
)

cpp_library(
  name="osquery_sdk",
  srcs=["""

TARGETS_POSTSCRIPT = """  ],
  deps=[
    "@/thrift/lib/cpp/concurrency:concurrency",
    ":if-cpp",
  ],
  external_deps=[
    "boost",
    "glog",
    "gflags",
    "gtest",
    "rocksdb",
    ("e2fsprogs", None, "uuid"),
  ],
  compiler_flags=[
    "-Wno-unused-function",
    "-Wno-non-virtual-dtor",
    "-Wno-address",
{'fraction_non_alphanumeric': 0.1426917510853835, 'fraction_numerical': 0.0023154848046309695, 'mean_word_length': 2.7321814254859613, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '490206', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1127, 'n_words': 216}