Example #1
0
def update(project):
    try:
        project.makepath = os.path.abspath(
            os.path.expanduser(Settings.get('make_path')))
    except:
        project.makepath = ""
    # make sure theres a make step after cmake

    make_step = Plugin("steps", "make", "makefile")
    conf_step = Plugin("steps", "make", "configure")
    project.clean_commands = [
        "%s clean" % os.path.join(project.makepath, "make")
    ]
    clean_step = Plugin("steps", "clean", "clean")
    if make_step in project.steps:
        project.steps.remove(make_step)
    if clean_step in project.steps:
        project.steps.remove(clean_step)
    if conf_step in project.steps:
        project.steps.remove(conf_step)

    i = 0
    for s in project.steps:
        if s.type == "make" and s.name == "cmake":
            # TODO: check for user support (because of -r flag)
            if clean.clean.compatible(project) & Support.USER:
                project.steps.insert(i, clean_step)
                project.steps.insert(i + 2, make_step)
            else:
                project.steps.insert(i + 1, make_step)
            break
        i += 1
def update(project):
    project.clean += [
        "%s/%s.jar" % (project.output_path, project.name),
        "%s/**.class" % project.classdir
    ]
    #project.steps = [Plugin("steps","clean","clean")] + project.steps

    added = False

    # if signing is supported by the user, attempt it automatically
    if sign.jarsigner.compatible(project) & Support.USER and not steps.ignored(
            "sign"):
        # if project needs to be obfuscated, add signing after that
        #  otherwise add it after compilation (this step)
        i = 0
        for s in project.steps:
            if s.type == "obfuscate":
                project.steps.insert(i + 1, Plugin("steps", "sign",
                                                   "jarsigner"))
                added = True
            i += 1

        if not added:
            i = 0
            for s in project.steps:
                if s.type == "make" and s.name == "javac":
                    project.steps.insert(i + 1,
                                         Plugin("steps", "sign", "jarsigner"))
                    added = True
                i += 1
Example #3
0
def update(project):
    try:
        project.generate
    except:
        project.generate = []
    
    if "premake" in project.generate:
        generate(project) # can throw
    
    try:
        project.makepath = os.path.abspath(os.path.expanduser(Settings.get('make_path')))
    except:
        project.makepath = ""
    # make sure theres a make step after premake

    make_step = Plugin("steps", "make", "makefile")
    conf_step = Plugin("steps", "make", "configure")
    if os.name == "nt":
        msb_step = Plugin("steps", "make", "msbuild")
    project.clean_commands = ["%s clean" % os.path.join(project.makepath,"make")]
    try:
        project.makefile_params
    except:
        project.makefile_params = []
    
    if Args.option("debug"):
        project.makefile_params += ["config=debug"]
    else:
        project.makefile_params += ["config=release"]
    
    clean_step = Plugin("steps", "clean", "clean")
    if make_step in project.steps:
        project.steps.remove(make_step)
    if conf_step in project.steps:
        project.steps.remove(conf_step)
    if os.name == "nt":
        if msb_step in project.steps:
            project.steps.remove(msb_step)
    if clean_step in project.steps:
        project.steps.remove(clean_step)

    i = 0
    
    if os.name == "nt":
        make_step = msb_step
        
    for s in project.steps:
        if s.type == "make" and s.name == "premake":
            # TODO: check for user support (because of -r flag)
            if clean.clean.compatible(project) & Support.USER:
                project.steps.insert(i, clean_step)
                project.steps.insert(i+2, make_step)
            else:
                project.steps.insert(i+1, make_step)
            break
        i += 1

    make_step.call("update", project)
Example #4
0
def event(plugin_type, args):
    r = []
    try:
        for plugin in events.events[plugin_type]:
            e = Plugin("events", plugin_type, plugin)
            r += [e.call(plugin_type, None, args)]
    except TypeError:
        pass
    return r
Example #5
0
def event(plugin_type, args):
    r = []
    try:
        for plugin in events.events[plugin_type]:
            e = Plugin("events", plugin_type, plugin)
            r += [e.call(plugin_type, None, args)]
    except TypeError:
        pass
    return r
Example #6
0
def detect_project():
    """
    Detects the projects build steps and checks for step support
    """

    #for plugin in steps.base.values():
    #    try:
    #        if plugin.Project.compatible():
    #            return plugin.Project()
    #    except:
    #        pass

    project = Project()

    # Run all detection steps
    for plugin in steps.steps["detect"]:
        if not Plugin("steps", "detect", plugin).call("detect",project):
            return None
        #if not steps.step("detect", plugin, project):

    # Add required steps to project
    for plugin_type in steps.steps.iterkeys():
        if plugin_type == "detect":
            continue
        for plugin in steps.steps[plugin_type]:
            #if steps.compatible(plugin_type, plugin, project) & Support.MASK == Support.MASK:
            plugin = Plugin("steps", plugin_type, plugin)
            if plugin.call("compatible", project) == Support.MASK:
                project.steps += [plugin]
        
    project.events = {}
    for plugin_type in events.events.iterkeys():
        project.events[plugin_type] = []
        for plugin in events.events[plugin_type]:
            plugin = Plugin("events", plugin_type, plugin)
            if plugin.call("compatible", project) == Support.MASK:
                project.events[plugin_type] += [plugin]

    # check if project meets standards for a sgmake project
    if is_project(project):
        return project
    
    # otherwise, no project detected
    return None
def update(project):
    try:
        project.qmake
    except:
        project.qmake = "qmake"
    #project.qmake = Settings.get('qmake')
    #if not project.qmake:
    #    project.qmake = "qmake"

    project.qmakepath = Settings.get('qmake_path')
    if project.qmakepath:
        project.qmakepath = os.path.abspath(project.qmakepath)
    else:
        project.qmakepath = ""

    make_step = Plugin("steps", "make", "makefile")

    try:
        project.makepath
    except:
        project.makepath = ""

    project.clean_commands = [
        "%s clean" % os.path.join(project.makepath, "make")
    ]
    clean_step = Plugin("steps", "clean", "clean")
    if make_step in project.steps:
        project.steps.remove(make_step)
    if clean_step in project.steps:
        project.steps.remove(clean_step)

    i = 0
    for s in project.steps:
        if s.type == "make" and s.name == "qmake":
            # TODO: check for user support (because of -r flag)
            if clean.clean.compatible(project) & Support.USER:
                project.steps.insert(i, clean_step)
                project.steps.insert(i + 2, make_step)
            else:
                project.steps.insert(i + 1, make_step)
            break
        i += 1
def update(project):
    configure_step = Plugin("steps", "make", "configure")
    make_step = Plugin("steps", "make", "makefile")
    clean_step = Plugin("steps", "clean", "clean")
    remove_steps = [configure_step, make_step, clean_step]

    for s in remove_steps:
        if s in project.steps:
            project.steps.remove(s)

    i = 0

    for s in project.steps:
        if s.type == "make" and s.name == "autogen":
            if clean.clean.compatible(project) & Support.USER:
                project.steps.insert(i, clean_step)
                project.steps.insert(i + 2, configure_step)
                project.steps.insert(i + 4, make_step)
            else:
                project.steps.insert(i + 1, configure_step)
                project.steps.insert(i + 3, make_step)
        i += 1
Example #9
0
def detect_project():
    """
    Detects the projects build steps and checks for step support
    """

    #for plugin in steps.base.values():
    #    try:
    #        if plugin.Project.compatible():
    #            return plugin.Project()
    #    except:
    #        pass

    project = Project()

    # Run all detection steps
    for plugin in steps.steps["detect"]:
        if not Plugin("steps", "detect", plugin).call("detect", project):
            return None
        #if not steps.step("detect", plugin, project):

    # Add required steps to project
    for plugin_type in steps.steps.iterkeys():
        if plugin_type == "detect":
            continue
        for plugin in steps.steps[plugin_type]:
            #if steps.compatible(plugin_type, plugin, project) & Support.MASK == Support.MASK:
            plugin = Plugin("steps", plugin_type, plugin)
            if plugin.call("compatible", project) == Support.MASK:
                project.steps += [plugin]

    project.events = {}
    for plugin_type in events.events.iterkeys():
        project.events[plugin_type] = []
        for plugin in events.events[plugin_type]:
            plugin = Plugin("events", plugin_type, plugin)
            if plugin.call("compatible", project) == Support.MASK:
                project.events[plugin_type] += [plugin]

    # check if project meets standards for a sgmake project
    if is_project(project):
        return project

    # otherwise, no project detected
    return None
def update(project):
    try:
        project.generate
    except:
        project.generate = []

    if "premake" in project.generate:
        generate(project)  # can throw

    try:
        project.makepath = os.path.abspath(
            os.path.expanduser(Settings.get('make_path')))
    except:
        project.makepath = ""
    # make sure theres a make step after premake

    make_step = Plugin("steps", "make", "makefile")
    conf_step = Plugin("steps", "make", "configure")
    if os.name == "nt":
        msb_step = Plugin("steps", "make", "msbuild")
    project.clean_commands = [
        "%s clean" % os.path.join(project.makepath, "make")
    ]
    try:
        project.makefile_params
    except:
        project.makefile_params = []

    if Args.option("debug"):
        project.makefile_params += ["config=debug"]
    else:
        project.makefile_params += ["config=release"]

    clean_step = Plugin("steps", "clean", "clean")
    if make_step in project.steps:
        project.steps.remove(make_step)
    if conf_step in project.steps:
        project.steps.remove(conf_step)
    if os.name == "nt":
        if msb_step in project.steps:
            project.steps.remove(msb_step)
    if clean_step in project.steps:
        project.steps.remove(clean_step)

    i = 0

    if os.name == "nt":
        make_step = msb_step

    for s in project.steps:
        if s.type == "make" and s.name == "premake":
            # TODO: check for user support (because of -r flag)
            if clean.clean.compatible(project) & Support.USER:
                project.steps.insert(i, clean_step)
                project.steps.insert(i + 2, make_step)
            else:
                project.steps.insert(i + 1, make_step)
            break
        i += 1

    make_step.call("update", project)