def CreateCleanMethod(compiler_type):

    # ----------------------------------------------------------------------
    @CommandLine.EntryPoint
    @CommandLine.Constraints(
        output_dir=CommandLine.DirectoryTypeInfo(),
        output_stream=None,
    )
    def Clean(
        output_dir,
        output_stream=sys.stdout,
    ):
        """Cleans previously compiled output."""
        return CommandLineClean(output_dir, output_stream)

    # ----------------------------------------------------------------------

    return Clean
    filter_unsupported_extensions=CommandLine.EntryPoint.Parameter(
        "Ignore extensions that aren't supported; by default, unsupported extensions will generate an error"
    ),
    filter_unsupported_attributes=CommandLine.EntryPoint.Parameter(
        "Ignore element attributes that aren't supported; by default, unsupported attributes will generate an error"
    ),
    plugin_arg=CommandLine.EntryPoint.Parameter(
        "Argument passes directly to the plugin"),
    force=CommandLine.EntryPoint.Parameter("Force generation"),
    verbose=CommandLine.EntryPoint.Parameter(
        "Generate verbose output during generation"),
)
@CommandLine.Constraints(
    plugin=_PluginTypeInfo,
    output_name=CommandLine.StringTypeInfo(),
    output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False, ),
    input=CommandLine.FilenameTypeInfo(
        match_any=True,
        arity="+",
    ),
    include=CommandLine.StringTypeInfo(arity="*", ),
    exclude=CommandLine.StringTypeInfo(arity="*", ),
    output_data_filename_prefix=CommandLine.StringTypeInfo(arity="?", ),
    plugin_arg=CommandLine.DictTypeInfo(
        require_exact_match=False,
        arity="*",
    ),
    output_stream=None,
)
def Generate(
    plugin,
示例#3
0
inflect                                     = inflect_mod.engine()

# ----------------------------------------------------------------------

BUILD_FILENAME                              = "Build.py"
BUILD_FILENAME_IGNORE                       = "{}-ignore".format(BUILD_FILENAME)

BUILD_LOG_TEMPLATE                          = "Build.{mode}.log"

COMPLETE_CONFIGURATION_NAME                 = "Complete"

# ----------------------------------------------------------------------
@CommandLine.EntryPoint( mode=CommandLine.EntryPoint.Parameter('Defaults to [ "clean", "build", ]'),
                       )
@CommandLine.Constraints( root_dir=CommandLine.DirectoryTypeInfo(),
                          output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
                          mode=CommandLine.StringTypeInfo(arity='*'),
                          output_stream=None,
                        )
def Execute( root_dir,
             output_dir,
             mode=None,
             debug_only=False,
             release_only=False,
             output_stream=sys.stdout,
             verbose=False,
           ):
    """Recursively calls Build files with the desired mode(s)"""

    assert os.path.isdir(root_dir), root_dir
from CommonEnvironment.StreamDecorator import StreamDecorator
from CommonEnvironment import StringHelpers

# ----------------------------------------------------------------------
_script_fullpath = os.path.abspath(
    __file__) if "python" in sys.executable.lower() else sys.executable
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

inflect = inflect_mod.engine()


# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    root_dir=CommandLine.DirectoryTypeInfo(),
    output_stream=None,
)
def EntryPoint(
    root_dir,
    output_stream=sys.stdout,
):
    with StreamDecorator(output_stream).DoneManager(
            line_prefix='',
            prefix="\nResults: ",
            suffix='\n',
    ) as dm:
        repositories = []

        dm.stream.write(
            "\nSearching for repositories in '{}'...".format(root_dir))
示例#5
0
from CommonEnvironment.StreamDecorator import StreamDecorator

# ----------------------------------------------------------------------
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

CONFIGURATIONS                              = ["Debug", "Release"]
JSON_FILENAME                               = "Microsoft MLFeaturizers.FileAttributes.json"

# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    configuration=CommandLine.EnumTypeInfo(CONFIGURATIONS),
    output_dir=CommandLine.DirectoryTypeInfo(
        ensure_exists=False,
    ),
    prerelease_build_name=CommandLine.StringTypeInfo(
        arity="?",
    ),
    cmake_generator=CommandLine.StringTypeInfo(
        arity="?",
    ),
    output_stream=None,
)
def Build(
    configuration,
    output_dir,
    release_build=False,
    prerelease_build_name=None,
    no_build_info=False,
from CommonEnvironment.StreamDecorator import StreamDecorator
from CommonEnvironment import TaskPool

# ----------------------------------------------------------------------
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------


@CommandLine.EntryPoint
@CommandLine.Constraints(
    generator=CommandLine.StringTypeInfo(
        arity="?",
    ),
    working_dir=CommandLine.DirectoryTypeInfo(
        arity="?",
    ),
    cmake_param=CommandLine.StringTypeInfo(
        arity="*",
    ),
    output_stream=None,
)
def Generate(
    working_dir=os.getcwd(),
    generator=(
        None
        if os.getenv("DEVELOPMENT_ENVIRONMENT_CPP_USE_DEFAULT_CMAKE_GENERATOR")
        else "Ninja"
    ),
    cmake_param=None,
    force=False,
def CreateCompileMethod(compiler_type):

    # ----------------------------------------------------------------------
    @CommandLine.EntryPoint
    @CommandLine.Constraints(
        input=CommandLine.FilenameTypeInfo(arity='+'),
        output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
        output_name=CommandLine.StringTypeInfo(arity='?'),
        build_type=CommandLine.EnumTypeInfo([
            "console",
            "windows",
        ],
                                            arity='?'),
        manifest_filename=CommandLine.FilenameTypeInfo(arity='?'),
        icon_filename=CommandLine.FilenameTypeInfo(arity='?'),
        path=CommandLine.DirectoryTypeInfo(arity='*'),
        include_module=CommandLine.StringTypeInfo(arity='*'),
        exclude_module=CommandLine.StringTypeInfo(arity='*'),
        package=CommandLine.StringTypeInfo(arity='*'),
        distutil_arg=CommandLine.StringTypeInfo(arity='*'),
        comments=CommandLine.StringTypeInfo(arity='?'),
        company_name=CommandLine.StringTypeInfo(arity='?'),
        file_description=CommandLine.StringTypeInfo(arity='?'),
        internal_name=CommandLine.StringTypeInfo(arity='?'),
        copyright=CommandLine.StringTypeInfo(arity='?'),
        trademark=CommandLine.StringTypeInfo(arity='?'),
        name=CommandLine.StringTypeInfo(arity='?'),
        version=CommandLine.StringTypeInfo(arity='?'),
        output_stream=None,
    )
    def Compile(
        input,
        output_dir,
        output_name=None,
        build_type="console",
        include_tcl=False,
        no_optimize=False,
        no_bundle=False,
        manifest_filename=None,
        icon_filename=None,
        path=None,
        include_module=None,
        exclude_module=None,
        package=None,
        distutil_arg=None,
        comments=None,
        company_name=None,
        file_description=None,
        internal_name=None,
        trademark=None,
        copyright=None,
        name=None,
        version=None,
        preserve_temp_dir=False,
        output_stream=sys.stdout,
        no_verbose=False,
    ):
        """Creates an executable from one or more python files."""

        if build_type == "console":
            build_type = DistutilsCompilerImpl.BuildType_Console
        elif build_type == "windows":
            build_type = DistutilsCompilerImpl.BuildType_Windows
        else:
            assert False, build_type

        return CommandLineCompile(
            compiler_type,
            input,
            output_stream,
            verbose=not no_verbose,

            # Generate compiler options
            output_dir=output_dir,

            # This compiler options
            preserve_temp_dir=preserve_temp_dir,
            build_type=build_type,
            include_tcl=include_tcl,
            no_optimize=no_optimize,
            no_bundle=no_bundle,
            manifest_filename=manifest_filename,
            icon_filename=icon_filename,
            paths=path,
            includes=include_module,
            excludes=exclude_module,
            packages=package,
            distutil_args=distutil_arg,
            output_name=output_name,
            comments=comments,
            company_name=company_name,
            file_description=file_description,
            internal_name=internal_name,
            copyright=copyright,
            trademark=trademark,
            name=name,
            version=version,
        )

    # ----------------------------------------------------------------------

    return Compile
示例#8
0
def _GenerateRebuild(build_func, clean_func, config):
    assert build_func
    assert clean_func
    assert config

    # ----------------------------------------------------------------------
    def Impl(configuration, output_dir, build_func, clean_func):
        result = clean_func(configuration, output_dir)
        if result is not None and result != 0:
            return result

        if config.RequiresOutputDir and not os.path.isdir(output_dir):
            os.makedirs(output_dir)

        result = build_func(configuration, output_dir)
        if result is not None and result != 0:
            return result

        return 0

    # ----------------------------------------------------------------------

    if config.Configurations:
        if config.RequiresOutputDir:
            # ----------------------------------------------------------------------
            @CommandLine.EntryPoint
            @CommandLine.Constraints( configuration=CommandLine.EnumTypeInfo(config.Configurations),
                                      output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
                                    )
            def Rebuild(configuration, output_dir):
                return Impl(configuration, output_dir, build_func, clean_func)

            # ----------------------------------------------------------------------
        else:
            # ----------------------------------------------------------------------
            @CommandLine.EntryPoint
            @CommandLine.Constraints( configuration=CommandLine.EnumTypeInfo(config.Configurations),
                                    )
            def Rebuild(configuration):
                return Impl( configuration,
                             None,
                             lambda cfg, output_dir: build_func(cfg),
                             lambda cfg, output_dir: clean_func(cfg),
                           )

            # ----------------------------------------------------------------------

    else:
        if config.RequiresOutputDir:
            # ----------------------------------------------------------------------
            @CommandLine.EntryPoint
            @CommandLine.Constraints( output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
                                    )
            def Rebuild(output_dir):
                return Impl( None,
                             output_dir,
                             lambda cfg, output_dir: build_func(output_dir),
                             lambda cfg, output_dir: clean_func(output_dir),
                           )

            # ----------------------------------------------------------------------
        else:
            # ----------------------------------------------------------------------
            @CommandLine.EntryPoint
            def Rebuild():
                return Impl( None,
                             None,
                             lambda cfg, output_dir: build_func(),
                             lambda cfg, output_dir: clean_func(),
                           )

            # ----------------------------------------------------------------------

    return Rebuild
from CommonEnvironment import Process
from CommonEnvironment.Shell.All import CurrentShell
from CommonEnvironment.StreamDecorator import StreamDecorator

# ----------------------------------------------------------------------
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

inflect                                     = inflect_mod.engine()

# ----------------------------------------------------------------------
@CommandLine.EntryPoint()
@CommandLine.Constraints(
    bin_dir=CommandLine.DirectoryTypeInfo(
        arity="*",
    ),
    output_dir=CommandLine.DirectoryTypeInfo(
        ensure_exists=False,
        arity="?",
    ),
    output_filename=CommandLine.StringTypeInfo(
        arity="?",
    ),
    type=CommandLine.StringTypeInfo(
        arity="?",
    ),
    output_stream=None,
)
def Lcov(
    bin_dir=None,