Esempio n. 1
0
def create_sample(options):
    if options.language == 'c':
        if options.type == 'executable':
            create_exe_c_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_c_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    elif options.language == 'cpp':
        if options.type == 'executable':
            create_exe_cpp_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_cpp_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    elif options.language == 'd':
        if options.type == 'executable':
            create_exe_d_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_d_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    elif options.language == 'fortran':
        if options.type == 'executable':
            create_exe_fortran_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_fortran_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    elif options.language == 'rust':
        if options.type == 'executable':
            create_exe_rust_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_rust_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    elif options.language == 'objc':
        if options.type == 'executable':
            create_exe_objc_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_objc_sample(options.name, options.version)
        else:
            raise RuntimeError('Unreachable code')
    else:
        raise RuntimeError('Unreachable code')
    print(info_message)
Esempio n. 2
0
def create_sample(options) -> None:
    '''
    Based on what arguments are passed we check for a match in language
    then check for project type and create new Meson samples project.
    '''
    if options.language == 'c':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_c_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_c_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'cpp':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_cpp_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_cpp_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'cs':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_cs_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_cs_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'cuda':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_cuda_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_cuda_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'd':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_d_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_d_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'fortran':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_fortran_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_fortran_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'rust':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_rust_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_rust_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'objc':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_objc_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_objc_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'objcpp':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_objcpp_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_objcpp_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    elif options.language == 'java':
        if options.type == DEFAULT_TYPES['EXE'].value:
            create_exe_java_sample(options.name, options.version)
        elif options.type == DEFAULT_TYPES['LIB'].value:
            create_lib_java_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE_ERROR)
    else:
        raise RuntimeError(UNREACHABLE_CODE_ERROR)
    print(INFO_MESSAGE)
Esempio n. 3
0
def create_sample(options):
    '''
    Based on what arguments are passed we check for a match in language
    then check for project type and create new Meson samples project.
    '''
    if options.language == 'c':
        if options.type == 'executable':
            create_exe_c_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_c_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'cpp':
        if options.type == 'executable':
            create_exe_cpp_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_cpp_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'cs':
        if options.type == 'executable':
            create_exe_cs_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_cs_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'cuda':
        if options.type == 'executable':
            create_exe_cuda_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_cuda_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'd':
        if options.type == 'executable':
            create_exe_d_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_d_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'fortran':
        if options.type == 'executable':
            create_exe_fortran_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_fortran_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'rust':
        if options.type == 'executable':
            create_exe_rust_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_rust_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'objc':
        if options.type == 'executable':
            create_exe_objc_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_objc_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'objcpp':
        if options.type == 'executable':
            create_exe_objcpp_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_objcpp_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    elif options.language == 'java':
        if options.type == 'executable':
            create_exe_java_sample(options.name, options.version)
        elif options.type == 'library':
            create_lib_java_sample(options.name, options.version)
        else:
            raise RuntimeError(UNREACHABLE_CODE)
    else:
        raise RuntimeError(UNREACHABLE_CODE)
    print(info_message)