# Path: artman/tasks/task_base.py
# class TaskBase(Task):
# class EmptyTask(TaskBase):
#     def __init__(self, *args, **kwargs):
#     def log(self, msg, logger=artman_logger, level=logging.INFO):
#     def exec_command(self, args):
#     def execute(self):
#     def validate(self):
# 
# 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):


import os
import glob
from ruamel import yaml
from artman.tasks import task_base
from artman.utils import task_utils
            return [sample_path]
        elif os.path.isdir(sample_path):
            sample_paths = []
            for root, dirnames, filenames in os.walk(sample_path):
                for filename in filenames:
                    if filename.endswith('.yaml'):
                        sample_paths.append(os.path.join(root, filename))
            return sample_paths
        else:
            raise ValueError('GapicCodeGenTask: `--samples` directory or file does not exist.')

class DiscoGapicCodeGenTask(task_base.TaskBase):
    """Generates GAPIC wrappers from a Discovery document"""
    default_provides = 'gapic_code_dir'

    def execute(self, language, toolkit_path, discovery_doc,
        gapic_yaml, package_metadata_yaml,
        gapic_code_dir, api_name, api_version, organization_name, root_dir):
        existing = glob.glob('%s/*' % gapic_code_dir)
        if existing:
            self.exec_command(['rm', '-r'] + existing)
        gapic_args = ['--gapic_yaml=' + os.path.abspath(gapic_yaml)]
        args = [
                   '--discovery_doc=' + os.path.join(root_dir, discovery_doc),
                   '--package_yaml2=' + os.path.abspath(package_metadata_yaml),
                   '--output=' + os.path.abspath(gapic_code_dir),
                   '--language=' + language,
                   ] + gapic_args

        self.exec_command(

# Path: artman/tasks/task_base.py
# class TaskBase(Task):
# class EmptyTask(TaskBase):
#     def __init__(self, *args, **kwargs):
#     def log(self, msg, logger=artman_logger, level=logging.INFO):
#     def exec_command(self, args):
#     def execute(self):
#     def validate(self):
# 
# 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/tasks/gapic_tasks.py
import os
import glob
from ruamel import yaml
from artman.tasks import task_base
from artman.utils import task_utils

            return [sample_path]
        elif os.path.isdir(sample_path):
            sample_paths = []
            for root, dirnames, filenames in os.walk(sample_path):
                for filename in filenames:
                    if filename.endswith('.yaml'):
                        sample_paths.append(os.path.join(root, filename))
            return sample_paths
        else:
            raise ValueError('GapicCodeGenTask: `--samples` directory or file does not exist.')

class DiscoGapicCodeGenTask(task_base.TaskBase):
    """Generates GAPIC wrappers from a Discovery document"""
    default_provides = 'gapic_code_dir'

    def execute(self, language, toolkit_path, discovery_doc,
        gapic_yaml, package_metadata_yaml,
        gapic_code_dir, api_name, api_version, organization_name, root_dir):
        existing = glob.glob('%s/*' % gapic_code_dir)
        if existing:
            self.exec_command(['rm', '-r'] + existing)
        gapic_args = ['--gapic_yaml=' + os.path.abspath(gapic_yaml)]
        args = [
                   '--discovery_doc=' + os.path.join(root_dir, discovery_doc),
                   '--package_yaml2=' + os.path.abspath(package_metadata_yaml),
                   '--output=' + os.path.abspath(gapic_code_dir),
                   '--language=' + language,
                   ] + gapic_args

        self.exec_command(

            task_utils.gapic_gen_task(toolkit_path, ['LEGACY_DISCOGAPIC_AND_PACKAGE'] + args))