# Path: artman/utils/lang_params.py
# class LanguageParams:
# class JavaParams(LanguageParams):
# class PhpParams(LanguageParams):
#     def code_root(self, base_dir):
#     def code_root(self, base_dir):
#     def code_root(self, base_dir):
# LANG_PARAMS_MAP = {
#     'python': LanguageParams(),
#     'ruby': LanguageParams(),
#     'nodejs': LanguageParams(),
#     'java': JavaParams(),
#     'go': LanguageParams(),
#     'csharp': LanguageParams(),
#     'php': PhpParams(),
# }
# 
# Path: artman/utils/task_utils.py
# def get_java_tool_path(toolkit_path, tool_name):
# def gapic_gen_task(toolkit_path, task_args):
# def run_gradle_task(toolkit_path, task_name, task_args=()):
# def api_full_name(api_name, api_version, organization_name):
# def is_output_gcloud(language, gapic_code_dir):
# def instantiate_tasks(task_class_list, inject):
# 
# Path: artman/utils/logger.py
# OUTPUT = 22
# SUCCESS = 25
# COLORS = {
#     'DEBUG': 'blue',
#     'INFO': 'cyan',
#     'OUTPUT': 'white',
#     'SUCCESS': 'green',
#     'WARNING': 'yellow',
#     'ERROR': 'red',
#     'CRITICAL': 'red,bold',
# }
# class Logger(logging.getLoggerClass()):
#     def __init__(self, name, level=logging.NOTSET):
#     def output(self, message, *args, **kwargs):
#     def success(self, message, *args, **kwargs):
# def setup_logging(level=logging.DEBUG):  # pragma: no cover
# def setup_logger(name, level, colors=COLORS,
#                  format_string="%(purple)s%(name)s> %(log_color)s%(message)s"):


import collections.abc
import io
import os
import re
import subprocess
import types
import sys
import six
from artman.utils import lang_params
from artman.utils import task_utils
from artman.utils.logger import logger
def protoc_common_resources_params(root_dir, common_resources=None):
    resources = common_resources
    if resources is None:
        default = os.path.join("google", "cloud", "common_resources.proto")
        resources = [default]

    common_resources_includes = []
    common_resources_paths = []
    for res in resources:
        path = os.path.join(root_dir, res)
        if os.path.exists(path):
            common_resources_paths.append(path)
            common_resources_includes.append("-I{}={}".format(res, path))
        else:
            logger.warn("Could not find resources file at: {}".format(path))
    return (common_resources_includes, common_resources_paths)


def find_google_dir_index(src_proto_path):
    matches = list(re.finditer('(?:\\A|[/\\\\])(google|grafeas)(?=\\Z|[/\\\\])',
                               src_proto_path))
    if len(matches) == 0:
        raise ValueError('src_proto_path did not contain "google" '
                         'in path as expected. src_proto_path: '
                         '"{}"'.format(src_proto_path))
    return matches[-1].start(1)


def pkg_root_dir(output_dir, api_name, api_version, organization_name,
                 language, prefix=None):

# Path: artman/utils/lang_params.py
# class LanguageParams:
# class JavaParams(LanguageParams):
# class PhpParams(LanguageParams):
#     def code_root(self, base_dir):
#     def code_root(self, base_dir):
#     def code_root(self, base_dir):
# LANG_PARAMS_MAP = {
#     'python': LanguageParams(),
#     'ruby': LanguageParams(),
#     'nodejs': LanguageParams(),
#     'java': JavaParams(),
#     'go': LanguageParams(),
#     'csharp': LanguageParams(),
#     'php': PhpParams(),
# }
# 
# Path: artman/utils/task_utils.py
# def get_java_tool_path(toolkit_path, tool_name):
# def gapic_gen_task(toolkit_path, task_args):
# def run_gradle_task(toolkit_path, task_name, task_args=()):
# def api_full_name(api_name, api_version, organization_name):
# def is_output_gcloud(language, gapic_code_dir):
# def instantiate_tasks(task_class_list, inject):
# 
# Path: artman/utils/logger.py
# OUTPUT = 22
# SUCCESS = 25
# COLORS = {
#     'DEBUG': 'blue',
#     'INFO': 'cyan',
#     'OUTPUT': 'white',
#     'SUCCESS': 'green',
#     'WARNING': 'yellow',
#     'ERROR': 'red',
#     'CRITICAL': 'red,bold',
# }
# class Logger(logging.getLoggerClass()):
#     def __init__(self, name, level=logging.NOTSET):
#     def output(self, message, *args, **kwargs):
#     def success(self, message, *args, **kwargs):
# def setup_logging(level=logging.DEBUG):  # pragma: no cover
# def setup_logger(name, level, colors=COLORS,
#                  format_string="%(purple)s%(name)s> %(log_color)s%(message)s"):


# Path: artman/utils/protoc_utils.py
import collections.abc
import io
import os
import re
import subprocess
import types
import sys
import six
from artman.utils import lang_params
from artman.utils import task_utils
from artman.utils.logger import logger

def protoc_common_resources_params(root_dir, common_resources=None):
    resources = common_resources
    if resources is None:
        default = os.path.join("google", "cloud", "common_resources.proto")
        resources = [default]

    common_resources_includes = []
    common_resources_paths = []
    for res in resources:
        path = os.path.join(root_dir, res)
        if os.path.exists(path):
            common_resources_paths.append(path)
            common_resources_includes.append("-I{}={}".format(res, path))
        else:
            logger.warn("Could not find resources file at: {}".format(path))
    return (common_resources_includes, common_resources_paths)


def find_google_dir_index(src_proto_path):
    matches = list(re.finditer('(?:\\A|[/\\\\])(google|grafeas)(?=\\Z|[/\\\\])',
                               src_proto_path))
    if len(matches) == 0:
        raise ValueError('src_proto_path did not contain "google" '
                         'in path as expected. src_proto_path: '
                         '"{}"'.format(src_proto_path))
    return matches[-1].start(1)


def pkg_root_dir(output_dir, api_name, api_version, organization_name,
                 language, prefix=None):

    pkg_name = task_utils.api_full_name(