Beispiel #1
0
	def execute(self, task, build_environment):
		if len(self.container) == 0:
			task.logger.info('nothing to be done')
			return
		
		argument_list = []
		
		if self.options['shared']:
			argument_list.append('-Bshareable')
		if self.options['output']:
			argument_list.append('-o')
			argument_list.append(escape(str(self.options['output'])))
		argument_list.extend(['-l%s' % escape(str(library)) for library in self.options['libraries']])
		
		argument_list.extend([str(location) for location in self.container])
		
		ld = Command(build_environment, self.executable, argument_list)
		try:
			if ld.execute() != 0:
				raise LinkError('Linker execution failed')
		except OSError, ose:
			raise LinkError('Linker execution failed', ose)
Beispiel #2
0
	def execute(self, task, build_environment):
		if len(self.container) == 0:
			task.logger.info('nothing to be done')
			return
		
		argument_list = []
		argument_list.append('-c')
		
		if self.options['pedantic']:
			argument_list.append('-pedantic')
		if self.options['warnings_as_errors']:
			argument_list.append('-Werror')
		if self.options['pic']:
			argument_list.append('-fPIC')
		for name, value in self.options['macro_assignments'].iteritems():
			if value and value != True:
				argument_list.append('-D%s=%s' % (escape(name), escape(value)))
			elif value == True:
				argument_list.append('-D%s' % escape(name))
		argument_list.extend(['-I%s' % str(include) for include in self.options['include']])
		
		# For C builds, compile each file independently.
		for location, output in self.options['output'].map(self.container).iteritems():
			location_argument_list = copy.copy(argument_list)
			
			location_argument_list.append('-o')
			location_argument_list.append(escape(str(output)))
			
			# hax
			#location_argument_list.extend('-pedantic -std=c99 -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Werror -fPIC -D _LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 -D _XOPEN_SOURCE=600'.split())
			
			location_argument_list.append(escape(str(location)))
			
			cc = Command(build_environment, self.executable, location_argument_list)
			try:
				if cc.execute() != 0:
					raise CompileError('C compiler execution failed')
			except OSError, ose:
				raise CompileError('C compiler execution failed', ose)
Beispiel #3
0
    def execute(self, task, build_environment):
        if len(self.container) == 0:
            task.logger.info("nothing to be done")
            return

        argument_list = []

        if self.options["debug"] & self.DEBUG_ALL:
            argument_list.append("-g")
        elif self.options["debug"] == self.DEBUG_NONE:
            argument_list.append("-g:none")
        else:
            if self.options["debug"] & self.DEBUG_LINES:
                argument_list.append("-g:lines")
            if self.options["debug"] & self.DEBUG_VARS:
                argument_list.append("-g:vars")
            if self.options["debug"] & self.DEBUG_SOURCE:
                argument_list.append("-g:source")
        if self.options["no_warning"]:
            argument_list.append("-nowarn")
        if self.options["verbose"]:
            argument_list.append("-verbose")
        if self.options["deprecation"]:
            argument_list.append("-deprecation")
        if len(self.options["class_path"]) > 0:
            argument_list.append("-classpath")
            argument_list.append(escape(":".join([str(class_path) for class_path in self.options["class_path"]])))
        if len(self.options["source_path"]) > 0:
            argument_list.append("-sourcepath")
            argument_list.append(escape(":".join([str(source_path) for source_path in self.options["source_path"]])))
        if len(self.options["boot_class_path"]) > 0:
            argument_list.append("-bootclasspath")
            argument_list.append(
                escape(":".join([str(boot_class_path) for boot_class_path in self.options["boot_class_path"]]))
            )
        if len(self.options["extension_directories"]) > 0:
            argument_list.append("-extdirs")
            argument_list.append(
                escape(
                    ":".join(
                        [str(extension_directory) for extension_directory in self.options["extension_directories"]]
                    )
                )
            )
        if len(self.options["endorsed_directories"]) > 0:
            argument_list.append("-endorseddirs")
            argument_list.append(
                escape(
                    ":".join([str(endorsed_directory) for endorsed_directory in self.options["endorsed_directories"]])
                )
            )
        if self.options["annotation_processing"] == self.PROC_NONE:
            argument_list.append("-proc:none")
        elif self.options["annotation_processing"] == self.PROC_ONLY:
            argument_list.append("-proc:only")
        if len(self.options["annotation_processors"]) > 0:
            argument_list.append("-processor")
            argument_list.append(escape(",".join(self.options["annotation_processors"])))
        if len(self.options["annotation_processor_path"]) > 0:
            argument_list.append("-bootclasspath")
            argument_list.append(
                escape(
                    ":".join(
                        [
                            str(annotation_processor_path)
                            for annotation_processor_path in self.options["annotation_processor_path"]
                        ]
                    )
                )
            )
        if self.options["class_destination"]:
            argument_list.append("-d")
            argument_list.append(escape(str(self.options["class_destination"])))
        if self.options["source_destination"]:
            argument_list.append("-s")
            argument_list.append(escape(str(self.options["source_destination"])))
        if self.options["implicit"] == self.IMPLICIT_NONE:
            argument_list.append("-implicit:none")
        if self.options["implicit"] == self.IMPLICIT_CLASS:
            argument_list.append("-implicit:class")
        if self.options["encoding"]:
            argument_list.append("-encoding")
            argument_list.append(escape(self.options["encoding"]))
        if self.options["compatibility"]:
            argument_list.append("-source")
            argument_list.append(escape(self.options["encoding"]))
        if self.options["target"]:
            argument_list.append("-target")
            argument_list.append(escape(self.options["target"]))
        for name, value in self.options["annotation_options"].iteritems():
            if value and value != True:
                argument_list.append("-A%s=%s" % (escape(name), escape(value)))
            elif value == True:
                argument_list.append("-A%s" % escape(name))
        argument_list.extend(["-J%s" % option for option in self.options["runtime_options"]])

        argument_list.extend([str(location) for location in self.container])

        javac = Command(build_environment, self.executable, argument_list)
        try:
            if javac.execute() != 0:
                raise CompileError("Java compiler execution failed")
        except OSError, ose:
            raise CompileError("Java compiler execution failed", ose)