﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
209	objective-c scanner for #import dependencies	chrisweed@…	somebody	"boost-build does not have a scanner for objective-c files (*.m, *.mm, *.mm) to follow #import dependenies. I have used the following in builtin.jam to some success. This is basically the c-scanner code with ""include"" replaced with ""import"" and then registering the scanner with the objective-c file types.
Chris

class m-scanner : scanner
{
import path ;
import regex ;
import scanner ;
import sequence ;
import virtual-target ;

rule __init__ ( includes * )
{
scanner.__init__ ;

for local i in $(includes)
{
self.includes += [ sequence.transform path.native
: [ regex.split $(i:G=) ""&&"" ] ] ;
}
}

rule pattern ( )
{
return ""#[ \t]*import[ ]*(<(.*)>|\""(.*)\"")"" ;
}

rule process ( target : matches * : binding )
{
local angle = [ regex.transform $(matches) : ""<(.*)>"" ] ;
local quoted = [ regex.transform $(matches) : ""\""(.*)\"""" ] ;

# CONSIDER: the new scoping rule seem to defeat ""on target"" variables.
local g = [ on $(target) return $(HDRGRIST) ] ;
local b = [ NORMALIZE_PATH $(binding:D) ] ;

# Attach binding of including file to included targets. When a target is
# directly created from virtual target this extra information is
# unnecessary. But in other cases, it allows us to distinguish between
# two headers of the same name included from different places. We do not
# need this extra information for angle includes, since they should not
# depend on including file (we can not get literal ""."" in include path).
local g2 = $(g)""#""$(b) ;

angle = $(angle:G=$(g)) ;
quoted = $(quoted:G=$(g2)) ;

local all = $(angle) $(quoted) ;

INCLUDES $(target) : $(all) ;
NOCARE $(all) ;
SEARCH on $(angle) = $(self.includes:G=) ;
SEARCH on $(quoted) = $(b) $(self.includes:G=) ;

# Just propagate the current scanner to includes in hope that includes
# do not change scanners.
scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ;

ISFILE $(angle) $(quoted) ;
}
}

scanner.register m-scanner : include ;

type.set-scanner OBJECTIVE_C : m-scanner ;
type.set-scanner OBJECTIVE_CPP : m-scanner ;
type.set-scanner OBJECTIVE_C : c-scanner ;
type.set-scanner OBJECTIVE_CPP : c-scanner ;"	defect	new	minor		component1				
