idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
35,600
public static NarProperties getInstance ( final MavenProject project ) throws MojoFailureException { NarProperties instance = instances . get ( project ) ; if ( instance == null ) { if ( project == null ) { instance = new NarProperties ( project , null , null ) ; } else { String customPropertyLocation = project . getProperties ( ) . getProperty ( CUSTOM_AOL_PROPERTY_KEY ) ; if ( customPropertyLocation == null ) { customPropertyLocation = System . getProperties ( ) . getProperty ( CUSTOM_AOL_PROPERTY_KEY ) ; } File narFile = ( customPropertyLocation != null ) ? new File ( customPropertyLocation ) : new File ( project . getBasedir ( ) , AOL_PROPERTIES ) ; if ( narFile . exists ( ) ) { instance = new NarProperties ( project , narFile , customPropertyLocation ) ; } else { instance = getInstance ( project . getParent ( ) ) ; } } instances . put ( project , instance ) ; } return instance ; }
Retrieve the NarProperties
35,601
public void setClassname ( final String className ) { Object proc = null ; try { final Class < ? > implClass = ProjectDef . class . getClassLoader ( ) . loadClass ( className ) ; try { final Method getInstance = implClass . getMethod ( "getInstance" ) ; proc = getInstance . invoke ( null ) ; } catch ( final Exception ex ) { proc = implClass . newInstance ( ) ; } } catch ( final Exception ex ) { throw new BuildException ( ex ) ; } this . projectWriter = ( ProjectWriter ) proc ; }
Class name for a user - supplied project writer . Use the type attribute to specify built - in project writer implementations .
35,602
public void setOutfile ( final File outfile ) { if ( outfile == null || outfile . toString ( ) . length ( ) > 0 ) { this . outFile = outfile ; } }
Sets the name for the generated project file .
35,603
private File [ ] getSources ( final List < File > sourceList ) { final File [ ] sortedSources = new File [ sourceList . size ( ) ] ; sourceList . toArray ( sortedSources ) ; Arrays . sort ( sortedSources , new Comparator < File > ( ) { public int compare ( final File o1 , final File o2 ) { return o1 . getName ( ) . compareTo ( o2 . getName ( ) ) ; } } ) ; return sortedSources ; }
Get alphabetized array of source files .
35,604
private void writeLinkOptions ( final Writer writer , final boolean isDebug , final List < DependencyDef > dependencies , final String basePath , final TargetInfo linkTarget , final Map < String , TargetInfo > targets ) throws IOException { final StringBuffer baseOptions = new StringBuffer ( 100 ) ; final StringBuffer options = new StringBuffer ( 100 ) ; baseOptions . append ( "# ADD BASE LINK32" ) ; options . append ( "# ADD LINK32" ) ; final ProcessorConfiguration config = linkTarget . getConfiguration ( ) ; if ( config instanceof CommandLineLinkerConfiguration ) { final CommandLineLinkerConfiguration linkConfig = ( CommandLineLinkerConfiguration ) config ; final File [ ] linkSources = linkTarget . getAllSources ( ) ; for ( final File linkSource : linkSources ) { if ( targets . get ( linkSource . getName ( ) ) == null ) { String relPath = linkSource . getName ( ) ; boolean fromDependency = false ; if ( relPath . indexOf ( "." ) > 0 ) { final String baseName = relPath . substring ( 0 , relPath . indexOf ( "." ) ) ; for ( final DependencyDef depend : dependencies ) { if ( baseName . compareToIgnoreCase ( depend . getName ( ) ) == 0 ) { fromDependency = true ; } } } if ( ! fromDependency ) { if ( ! CUtil . isSystemPath ( linkSource ) ) { relPath = CUtil . getRelativePath ( basePath , linkSource ) ; } if ( relPath . indexOf ( ' ' ) > 0 ) { options . append ( " \"" ) ; options . append ( CUtil . toWindowsPath ( relPath ) ) ; options . append ( "\"" ) ; } else { options . append ( ' ' ) ; options . append ( CUtil . toWindowsPath ( relPath ) ) ; } } } } final String [ ] preArgs = linkConfig . getPreArguments ( ) ; for ( final String preArg : preArgs ) { if ( isDebug || ! preArg . equals ( "/DEBUG" ) ) { options . append ( ' ' ) ; options . append ( preArg ) ; baseOptions . append ( ' ' ) ; baseOptions . append ( preArg ) ; } } final String [ ] endArgs = linkConfig . getEndArguments ( ) ; for ( final String endArg : endArgs ) { options . append ( ' ' ) ; options . append ( endArg ) ; baseOptions . append ( ' ' ) ; baseOptions . append ( endArg ) ; } } baseOptions . append ( "\r\n" ) ; options . append ( "\r\n" ) ; writer . write ( baseOptions . toString ( ) ) ; writer . write ( options . toString ( ) ) ; }
Writes link options .
35,605
private void writeMessage ( final Writer writer , final String projectName , final String targtype ) throws IOException { writer . write ( "!MESSAGE This is not a valid makefile. " ) ; writer . write ( "To build this project using NMAKE,\r\n" ) ; writer . write ( "!MESSAGE use the Export Makefile command and run\r\n" ) ; writer . write ( "!MESSAGE \r\n" ) ; writer . write ( "!MESSAGE NMAKE /f \"" ) ; writer . write ( projectName ) ; writer . write ( ".mak\".\r\n" ) ; writer . write ( "!MESSAGE \r\n" ) ; writer . write ( "!MESSAGE You can specify a configuration when running NMAKE\r\n" ) ; writer . write ( "!MESSAGE by defining the macro CFG on the command line. " ) ; writer . write ( "For example:\r\n" ) ; writer . write ( "!MESSAGE \r\n" ) ; writer . write ( "!MESSAGE NMAKE /f \"" ) ; writer . write ( projectName ) ; writer . write ( ".mak\" CFG=\"" ) ; writer . write ( projectName ) ; writer . write ( " - Win32 Debug\"\r\n" ) ; writer . write ( "!MESSAGE \r\n" ) ; writer . write ( "!MESSAGE Possible choices for configuration are:\r\n" ) ; writer . write ( "!MESSAGE \r\n" ) ; final String pattern = "!MESSAGE \"{0} - Win32 {1}\" (based on \"{2}\")\r\n" ; writer . write ( MessageFormat . format ( pattern , new Object [ ] { projectName , "Release" , targtype } ) ) ; writer . write ( MessageFormat . format ( pattern , new Object [ ] { projectName , "Debug" , targtype } ) ) ; writer . write ( "!MESSAGE \r\n" ) ; writer . write ( "\r\n" ) ; }
Writes This is not a makefile warning .
35,606
private void writeSource ( final Writer writer , final String basePath , final File groupMember ) throws IOException { writer . write ( "# Begin Source File\r\n\r\nSOURCE=" ) ; String relativePath = CUtil . getRelativePath ( basePath , groupMember ) ; if ( ! relativePath . startsWith ( "." ) && ! relativePath . contains ( ":" ) && ! relativePath . startsWith ( "\\" ) ) { relativePath = ".\\" + relativePath ; } writer . write ( CUtil . toWindowsPath ( relativePath ) ) ; writer . write ( "\r\n# End Source File\r\n" ) ; }
Writes the entry for one source file in the project .
35,607
private static void encodeVersion ( final StringBuffer buf , final short [ ] version ) { for ( int i = 0 ; i < 3 ; i ++ ) { buf . append ( Short . toString ( version [ i ] ) ) ; buf . append ( ',' ) ; } buf . append ( Short . toString ( version [ 3 ] ) ) ; }
Converts parsed version information into a string representation .
35,608
private static boolean hasSameContent ( final InputStream stream1 , final InputStream stream2 ) throws IOException { int byte1 = - 1 ; int byte2 = - 1 ; do { byte1 = stream1 . read ( ) ; byte2 = stream2 . read ( ) ; } while ( byte1 == byte2 && byte1 != - 1 ) ; return byte1 == byte2 ; }
Compare two input streams for duplicate content
35,609
public static short [ ] parseVersion ( final String version ) { final short [ ] values = new short [ ] { 0 , 0 , 0 , 0 } ; if ( version != null ) { final StringBuffer buf = new StringBuffer ( version ) ; int start = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { int end = version . indexOf ( '.' , start ) ; if ( end <= 0 ) { end = version . length ( ) ; for ( int j = end ; j > start ; j -- ) { final String part = buf . substring ( start , end ) ; try { values [ i ] = Short . parseShort ( part ) ; break ; } catch ( final NumberFormatException ex ) { values [ i ] = 0 ; } } break ; } else { final String part = buf . substring ( start , end ) ; try { values [ i ] = Short . parseShort ( part ) ; start = end + 1 ; } catch ( final NumberFormatException ex ) { break ; } } } } return values ; }
Parse version string into array of four short values .
35,610
public void setDir ( final File dir ) throws BuildException { if ( this . localSet == null ) { this . localSet = new ConditionalFileSet ( ) ; this . owner . appendExceptFileSet ( this . localSet ) ; } this . localSet . setDir ( dir ) ; }
Sets the base - directory
35,611
public void setIncludes ( final String includes ) { if ( this . localSet == null ) { this . localSet = new ConditionalFileSet ( ) ; this . owner . appendExceptFileSet ( this . localSet ) ; } this . localSet . setIncludes ( includes ) ; }
Comma or space separated list of file patterns that should not be compiled using precompiled headers .
35,612
public void setLocal ( final File value ) { if ( value == null ) { throw new NullPointerException ( "value" ) ; } if ( value . exists ( ) && ! value . isDirectory ( ) ) { throw new BuildException ( "local should be a directory" ) ; } this . localName = value ; try { this . canonicalPath = this . localName . getCanonicalPath ( ) ; } catch ( final IOException ex ) { throw new BuildException ( ex ) ; } }
Sets local directory for base of mapping .
35,613
public String toRemote ( final String host , final File localFile ) { if ( this . remoteName != null && ( this . hosts == null || this . hosts . contains ( host ) ) ) { try { final String canonical = localFile . getCanonicalPath ( ) ; if ( canonical . startsWith ( this . canonicalPath ) && isActive ( ) ) { return this . remoteName + canonical . substring ( this . canonicalPath . length ( ) ) . replace ( File . separatorChar , this . remoteSeparator ) ; } } catch ( final IOException ex ) { return null ; } } return null ; }
Converts the local file name to the remote name for the same file .
35,614
public static boolean hasQObject ( final Reader reader ) throws IOException { final MetaObjectParser parser = new MetaObjectParser ( ) ; parser . parse ( reader ) ; return parser . hasQObject ; }
Determines if source file contains Q_OBJECT .
35,615
protected org . eclipse . aether . graph . DependencyNode getVerboseDependencyTree ( ) { CollectRequest collectReq = new CollectRequest ( ) ; Artifact art = getMavenProject ( ) . getArtifact ( ) ; DefaultRepositorySystemSession session = new DefaultRepositorySystemSession ( repoSession ) ; session . setDependencyGraphTransformer ( new NoopDependencyGraphTransformer ( ) ) ; org . eclipse . aether . graph . Dependency dep = new org . eclipse . aether . graph . Dependency ( new org . eclipse . aether . artifact . DefaultArtifact ( art . getGroupId ( ) , art . getArtifactId ( ) , null , art . getVersion ( ) ) , null ) ; collectReq . setRoot ( dep ) ; collectReq . setRepositories ( projectRepos ) ; if ( this instanceof NarTestCompileMojo ) { DependencySelector dependencySelector = new AndDependencySelector ( new OptionalDependencySelector ( ) , new ScopeDependencySelector ( null ) ) ; session . setDependencySelector ( dependencySelector ) ; } try { return repoSystem . collectDependencies ( session , collectReq ) . getRoot ( ) ; } catch ( DependencyCollectionException exception ) { this . getLog ( ) . warn ( "Could not collect dependencies from repo system" , exception ) ; return null ; } }
Gets the project s full dependency tree prior to dependency mediation . This is required if we want to know where to push libraries in the linker line .
35,616
protected DependencyNode getRootNodeDependecyTree ( ) throws MojoExecutionException { try { ArtifactFilter artifactFilter = null ; rootNode = dependencyGraphBuilder . buildDependencyGraph ( getMavenProject ( ) , artifactFilter ) ; } catch ( DependencyGraphBuilderException exception ) { throw new MojoExecutionException ( "Cannot build project dependency graph" , exception ) ; } return rootNode ; }
Get root node of the current Maven project Dependency tree generated by maven . shared dependency graph builder .
35,617
protected static String getIdentifier ( final String [ ] command , final String fallback ) { String identifier = fallback ; try { final String [ ] cmdout = CaptureStreamHandler . run ( command ) ; if ( cmdout . length > 0 ) { identifier = cmdout [ 0 ] ; } } catch ( final Throwable ex ) { identifier = fallback + ":" + ex . toString ( ) ; } return identifier ; }
Determines the identification of a command line processor by capture the first line of its output for a specific command .
35,618
private static String registryGet32StringValue ( com . sun . jna . platform . win32 . WinReg . HKEY root , String key , String value ) throws com . sun . jna . platform . win32 . Win32Exception { com . sun . jna . platform . win32 . WinReg . HKEYByReference phkKey = new com . sun . jna . platform . win32 . WinReg . HKEYByReference ( ) ; int rc = com . sun . jna . platform . win32 . Advapi32 . INSTANCE . RegOpenKeyEx ( root , key , 0 , com . sun . jna . platform . win32 . WinNT . KEY_READ | com . sun . jna . platform . win32 . WinNT . KEY_WOW64_32KEY , phkKey ) ; if ( rc != com . sun . jna . platform . win32 . W32Errors . ERROR_SUCCESS ) { throw new com . sun . jna . platform . win32 . Win32Exception ( rc ) ; } try { return com . sun . jna . platform . win32 . Advapi32Util . registryGetStringValue ( phkKey . getValue ( ) , value ) ; } finally { rc = com . sun . jna . platform . win32 . Advapi32 . INSTANCE . RegCloseKey ( phkKey . getValue ( ) ) ; if ( rc != com . sun . jna . platform . win32 . W32Errors . ERROR_SUCCESS ) { throw new com . sun . jna . platform . win32 . Win32Exception ( rc ) ; } } }
Get a registry REG_SZ value .
35,619
public static UndefineArgument [ ] merge ( final UndefineArgument [ ] base , final UndefineArgument [ ] override ) { if ( base . length == 0 ) { final UndefineArgument [ ] overrideClone = override . clone ( ) ; return overrideClone ; } if ( override . length == 0 ) { final UndefineArgument [ ] baseClone = base . clone ( ) ; return baseClone ; } final Vector < UndefineArgument > unduplicated = new Vector < > ( base . length ) ; for ( final UndefineArgument current : base ) { final String currentName = current . getName ( ) ; boolean match = false ; if ( currentName == null ) { match = true ; } else { for ( final UndefineArgument over : override ) { final String overName = over . getName ( ) ; if ( overName != null && overName . equals ( currentName ) ) { match = true ; break ; } } } if ( ! match ) { unduplicated . addElement ( current ) ; } } final UndefineArgument [ ] combined = new UndefineArgument [ unduplicated . size ( ) + override . length ] ; unduplicated . copyInto ( combined ) ; final int offset = unduplicated . size ( ) ; System . arraycopy ( override , 0 , combined , offset + 0 , override . length ) ; return combined ; }
This method returns an array of UndefineArgument and DefineArgument s by merging a base list with an override list .
35,620
public static String [ ] run ( final String [ ] cmdline ) { final CaptureStreamHandler handler = execute ( cmdline ) ; return handler . getOutput ( ) != null ? handler . getOutput ( ) : new String [ 0 ] ; }
Runs an executable and captures the output in a String array
35,621
public void gatherOutput ( ) { try { final Copier errorCopier = new Copier ( this . processErrorStream ) ; final Copier outputCopier = new Copier ( this . processOutputStream ) ; errorCopier . start ( ) ; outputCopier . start ( ) ; errorCopier . join ( ) ; outputCopier . join ( ) ; this . stderr = new String [ errorCopier . getLines ( ) . size ( ) ] ; errorCopier . getLines ( ) . copyInto ( this . stderr ) ; this . stdout = new String [ outputCopier . getLines ( ) . size ( ) ] ; outputCopier . getLines ( ) . copyInto ( this . stdout ) ; } catch ( final Exception e ) { this . stderr = this . stdout = new String [ 0 ] ; } }
Reads concurrently both the process standard output and standard error . The standard error is copied to the stderr string array field . The standard output is copied to the stdout string array field . Both fields are set to an empty array in case of any error .
35,622
public static File [ ] getEnvironmentPath ( final String toolName , final char switchChar , final String [ ] defaultRelativePath ) { if ( toolName == null ) { throw new NullPointerException ( "toolName" ) ; } if ( defaultRelativePath == null ) { throw new NullPointerException ( "defaultRelativePath" ) ; } String [ ] path = defaultRelativePath ; File exeDir = CUtil . getExecutableLocation ( toolName + ".exe" ) ; if ( exeDir != null ) { final File cfgFile = new File ( exeDir , toolName + ".cfg" ) ; if ( cfgFile . exists ( ) ) { try { final Reader reader = new BufferedReader ( new FileReader ( cfgFile ) ) ; final BorlandCfgParser cfgParser = new BorlandCfgParser ( switchChar ) ; path = cfgParser . parsePath ( reader ) ; reader . close ( ) ; } catch ( final IOException ex ) { } } } else { exeDir = new File ( System . getProperty ( "user.dir" ) ) ; } int nonExistant = 0 ; File [ ] resourcePath = new File [ path . length ] ; for ( int i = 0 ; i < path . length ; i ++ ) { resourcePath [ i ] = new File ( path [ i ] ) ; if ( ! resourcePath [ i ] . isAbsolute ( ) ) { resourcePath [ i ] = new File ( exeDir , path [ i ] ) ; } if ( ! ( resourcePath [ i ] . exists ( ) && resourcePath [ i ] . isDirectory ( ) ) ) { resourcePath [ i ] = null ; nonExistant ++ ; } } if ( nonExistant > 0 ) { final File [ ] culled = new File [ resourcePath . length - nonExistant ] ; int index = 0 ; for ( final File element : resourcePath ) { if ( element != null ) { culled [ index ++ ] = element ; } } resourcePath = culled ; } return resourcePath ; }
This method extracts path information from the appropriate . cfg file in the install directory .
35,623
public String decorateLinkerOption ( final StringBuffer buf , final String arg ) { String decoratedArg = arg ; if ( arg . length ( ) > 1 && arg . charAt ( 0 ) == '-' ) { switch ( arg . charAt ( 1 ) ) { case 'g' : case 'f' : case 'F' : case 'm' : case 'O' : case 'W' : case 'l' : case 'L' : case 'u' : break ; default : boolean known = false ; for ( final String linkerOption : linkerOptions ) { if ( linkerOption . equals ( arg ) ) { known = true ; break ; } } if ( ! known ) { buf . setLength ( 0 ) ; buf . append ( "-Wl," ) ; buf . append ( arg ) ; decoratedArg = buf . toString ( ) ; } break ; } } return decoratedArg ; }
Allows drived linker to decorate linker option . Override by GppLinker to prepend a - Wl to pass option to through gcc to linker .
35,624
public final List getAttachedNarDependencies ( final List narArtifacts , final AOL archOsLinker , final String type ) throws MojoExecutionException , MojoFailureException { boolean noarch = false ; AOL aol = archOsLinker ; if ( aol == null ) { noarch = true ; aol = this . defaultAOL ; } final List artifactList = new ArrayList ( ) ; for ( final Object narArtifact : narArtifacts ) { final Artifact dependency = ( Artifact ) narArtifact ; final NarInfo narInfo = getNarInfo ( dependency ) ; if ( noarch ) { artifactList . addAll ( getAttachedNarDependencies ( dependency , null , NarConstants . NAR_NO_ARCH ) ) ; } final String binding = narInfo . getBinding ( aol , type != null ? type : Library . STATIC ) ; if ( aol . equals ( NarConstants . NAR_NO_ARCH ) ) { artifactList . addAll ( getAttachedNarDependencies ( dependency , null , NarConstants . NAR_NO_ARCH ) ) ; } else { artifactList . addAll ( getAttachedNarDependencies ( dependency , aol , binding ) ) ; } } return artifactList ; }
Returns a list of all attached nar dependencies for a specific binding and noarch but not where local is specified
35,625
public void compile ( final CCTask task , final File outputDir , final String [ ] sourceFiles , final String [ ] args , final String [ ] endArgs , final boolean relentless , final CommandLineCompilerConfiguration config , final ProgressMonitor monitor ) { BuildException exc = null ; final String [ ] thisSource = new String [ 1 ] ; final String [ ] tlbCommand = new String [ args . length + endArgs . length + 6 ] ; tlbCommand [ 0 ] = "xpidl" ; tlbCommand [ 1 ] = "-m" ; tlbCommand [ 2 ] = "typelib" ; final String [ ] headerCommand = new String [ args . length + endArgs . length + 6 ] ; headerCommand [ 0 ] = "xpidl" ; headerCommand [ 1 ] = "-m" ; headerCommand [ 2 ] = "header" ; for ( int i = 0 ; i < args . length ; i ++ ) { tlbCommand [ i + 3 ] = args [ i ] ; headerCommand [ i + 3 ] = args [ i ] ; } tlbCommand [ args . length + 3 ] = "-e" ; headerCommand [ args . length + 3 ] = "-e" ; int tlbIndex = args . length + 6 ; int headerIndex = args . length + 6 ; for ( final String endArg : endArgs ) { tlbCommand [ tlbIndex ++ ] = endArg ; headerCommand [ headerIndex ++ ] = endArg ; } for ( final String sourceFile : sourceFiles ) { tlbIndex = args . length + 4 ; headerIndex = args . length + 4 ; final String [ ] outputFileNames = getOutputFileNames ( sourceFile , null ) ; tlbCommand [ tlbIndex ++ ] = outputFileNames [ 0 ] ; tlbCommand [ tlbIndex ++ ] = sourceFile ; headerCommand [ headerIndex ++ ] = outputFileNames [ 1 ] ; headerCommand [ headerIndex ++ ] = sourceFile ; int retval = runCommand ( task , outputDir , tlbCommand ) ; if ( retval == 0 ) { retval = runCommand ( task , outputDir , headerCommand ) ; } if ( monitor != null ) { thisSource [ 0 ] = sourceFile ; monitor . progress ( thisSource ) ; } if ( retval != 0 && exc == null ) { exc = new BuildException ( this . getCommand ( ) + " failed with return code " + retval , task . getLocation ( ) ) ; if ( ! relentless ) { throw exc ; } } } if ( exc != null ) { throw exc ; } }
Compiles an . idl file into the corresponding . h and . xpt files .
35,626
private String getActivePlatform ( final CCTask task ) { final String osName = System . getProperty ( "os.name" ) . toLowerCase ( Locale . US ) ; if ( osName . contains ( "windows" ) ) { return "win32" ; } return "linux" ; }
Gets active platform .
35,627
private String getBuildType ( final CCTask task ) { final String outType = task . getOuttype ( ) ; if ( "executable" . equals ( outType ) ) { return "exeproject" ; } else if ( "static" . equals ( outType ) ) { return "libraryproject" ; } return "dllproject" ; }
Gets build type from link target .
35,628
private void writeCompileOptions ( final String baseDir , final PropertyWriter writer , final CommandLineCompilerConfiguration compilerConfig ) throws SAXException { boolean isBcc = false ; boolean isUnix = true ; String compileID = "linux.Debug_Build.gnuc++.g++compile" ; if ( compilerConfig . getCompiler ( ) instanceof BorlandCCompiler ) { compileID = "win32.Debug_Build.win32b.bcc32" ; isUnix = false ; isBcc = true ; } final File [ ] includePath = compilerConfig . getIncludePath ( ) ; int includeIndex = 1 ; if ( isUnix ) { writer . write ( compileID , "option.I.arg." + includeIndex ++ , "/usr/include" ) ; writer . write ( compileID , "option.I.arg." + includeIndex ++ , "/usr/include/g++-3" ) ; } for ( final File element : includePath ) { final String relPath = CUtil . getRelativePath ( baseDir , element ) ; writer . write ( compileID , "option.I.arg." + includeIndex ++ , relPath ) ; } if ( includePath . length > 0 ) { writer . write ( compileID , "option.I.enabled" , "1" ) ; } String defineBase = "option.D_MACRO_VALUE" ; if ( isBcc ) { defineBase = "option.D" ; } final String defineOption = defineBase + ".arg." ; int defineIndex = 1 ; int undefineIndex = 1 ; final String [ ] preArgs = compilerConfig . getPreArguments ( ) ; for ( final String preArg : preArgs ) { if ( preArg . startsWith ( "-D" ) ) { writer . write ( compileID , defineOption + defineIndex ++ , preArg . substring ( 2 ) ) ; } else if ( preArg . startsWith ( "-U" ) ) { writer . write ( compileID , "option.U.arg." + undefineIndex ++ , preArg . substring ( 2 ) ) ; } else if ( ! ( preArg . startsWith ( "-I" ) || preArg . startsWith ( "-o" ) ) ) { writer . write ( compileID , "option." + preArg . substring ( 1 ) + ".enabled" , "1" ) ; } } if ( defineIndex > 1 ) { writer . write ( compileID , defineBase + ".enabled" , "1" ) ; } if ( undefineIndex > 1 ) { writer . write ( compileID , "option.U.enabled" , "1" ) ; } }
Writes elements corresponding to compilation options .
35,629
private void writeIlinkArgs ( final PropertyWriter writer , final String linkID , final String [ ] args ) throws SAXException { for ( final String arg : args ) { if ( arg . charAt ( 0 ) == '/' || arg . charAt ( 0 ) == '-' ) { final int equalsPos = arg . indexOf ( '=' ) ; if ( equalsPos > 0 ) { final String option = "option." + arg . substring ( 0 , equalsPos - 1 ) ; writer . write ( linkID , option + ".enabled" , "1" ) ; writer . write ( linkID , option + ".value" , arg . substring ( equalsPos + 1 ) ) ; } else { writer . write ( linkID , "option." + arg . substring ( 1 ) + ".enabled" , "1" ) ; } } } }
Writes ilink32 linker options to project file .
35,630
private void writeLdArgs ( final PropertyWriter writer , final String linkID , final String [ ] preArgs ) throws SAXException { int objnameIndex = 1 ; int libnameIndex = 1 ; int libpathIndex = 1 ; for ( final String preArg : preArgs ) { if ( preArg . startsWith ( "-o" ) ) { writer . write ( linkID , "option.o.arg." + objnameIndex ++ , preArg . substring ( 2 ) ) ; } else if ( preArg . startsWith ( "-l" ) ) { writer . write ( linkID , "option.l.arg." + libnameIndex ++ , preArg . substring ( 2 ) ) ; } else if ( preArg . startsWith ( "-L" ) ) { writer . write ( linkID , "option.L.arg." + libpathIndex ++ , preArg . substring ( 2 ) ) ; } else { writer . write ( linkID , "option." + preArg . substring ( 1 ) + ".enabled" , "1" ) ; } } if ( objnameIndex > 1 ) { writer . write ( linkID , "option.o.enabled" , "1" ) ; } if ( libnameIndex > 1 ) { writer . write ( linkID , "option.l.enabled" , "1" ) ; } if ( libpathIndex > 1 ) { writer . write ( linkID , "option.L.enabled" , "1" ) ; } }
Writes ld linker options to project file .
35,631
private void writeLinkOptions ( final String baseDir , final PropertyWriter writer , final TargetInfo linkTarget ) throws SAXException { if ( linkTarget != null ) { final ProcessorConfiguration config = linkTarget . getConfiguration ( ) ; if ( config instanceof CommandLineLinkerConfiguration ) { final CommandLineLinkerConfiguration linkConfig = ( CommandLineLinkerConfiguration ) config ; if ( linkConfig . getLinker ( ) instanceof BorlandLinker ) { final String linkID = "win32.Debug_Build.win32b.ilink32" ; writeIlinkArgs ( writer , linkID , linkConfig . getPreArguments ( ) ) ; writeIlinkArgs ( writer , linkID , linkConfig . getEndArguments ( ) ) ; writer . write ( linkID , "param.libfiles.1" , "cw32mt.lib" ) ; writer . write ( linkID , "param.libfiles.2" , "import32.lib" ) ; int libIndex = 3 ; final String [ ] libNames = linkConfig . getLibraryNames ( ) ; for ( final String libName : libNames ) { writer . write ( linkID , "param.libfiles." + libIndex ++ , libName ) ; } final String startup = linkConfig . getStartupObject ( ) ; if ( startup != null ) { writer . write ( linkID , "param.objfiles.1" , startup ) ; } } else { final String linkID = "linux.Debug_Build.gnuc++.g++link" ; writeLdArgs ( writer , linkID , linkConfig . getPreArguments ( ) ) ; writeLdArgs ( writer , linkID , linkConfig . getEndArguments ( ) ) ; } } } }
Writes elements corresponding to link options .
35,632
protected final void addImpliedArgs ( final Vector < String > args , final boolean debug , final boolean multithreaded , final boolean exceptions , final LinkType linkType , final Boolean rtti , final OptimizationEnum optimization ) { args . addElement ( "/c" ) ; if ( exceptions ) { args . addElement ( "/xs" ) ; } if ( multithreaded ) { args . addElement ( "/bm" ) ; } if ( debug ) { args . addElement ( "/d2" ) ; args . addElement ( "/od" ) ; args . addElement ( "/d_DEBUG" ) ; } else { if ( optimization != null ) { if ( optimization . isSize ( ) ) { args . addElement ( "/os" ) ; } if ( optimization . isSpeed ( ) ) { args . addElement ( "/ot" ) ; } } args . addElement ( "/dNDEBUG" ) ; } if ( rtti != null && rtti . booleanValue ( ) ) { args . addElement ( "/xr" ) ; } }
Add implied arguments .
35,633
protected final void addWarningSwitch ( final Vector < String > args , final int level ) { OpenWatcomProcessor . addWarningSwitch ( args , level ) ; }
Add warning switch .
35,634
protected final void getDefineSwitch ( final StringBuffer buffer , final String define , final String value ) { OpenWatcomProcessor . getDefineSwitch ( buffer , define , value ) ; }
Get define switch .
35,635
protected final void getUndefineSwitch ( final StringBuffer buffer , final String define ) { OpenWatcomProcessor . getUndefineSwitch ( buffer , define ) ; }
Get undefine switch .
35,636
public static Map < CompilerConfiguration , Vector < TargetInfo > > getTargetsToBuildByConfiguration ( final Map < String , TargetInfo > targets ) { final Map < CompilerConfiguration , Vector < TargetInfo > > targetsByConfig = new HashMap < > ( ) ; for ( final TargetInfo target : targets . values ( ) ) { if ( target . getRebuild ( ) ) { Vector < TargetInfo > targetsForSameConfig = targetsByConfig . get ( target . getConfiguration ( ) ) ; if ( targetsForSameConfig != null ) { targetsForSameConfig . addElement ( target ) ; } else { targetsForSameConfig = new Vector < > ( ) ; targetsForSameConfig . addElement ( target ) ; targetsByConfig . put ( ( CompilerConfiguration ) target . getConfiguration ( ) , targetsForSameConfig ) ; } } } return targetsByConfig ; }
Builds a Hashtable to targets needing to be rebuilt keyed by compiler configuration
35,637
public void addConfiguredCompiler ( final CompilerDef compiler ) { if ( compiler == null ) { throw new NullPointerException ( "compiler" ) ; } compiler . setProject ( getProject ( ) ) ; this . _compilers . addElement ( compiler ) ; }
Adds a compiler definition or reference .
35,638
public void addConfiguredLinker ( final LinkerDef linker ) { if ( linker == null ) { throw new NullPointerException ( "linker" ) ; } linker . setProject ( getProject ( ) ) ; this . _linkers . addElement ( linker ) ; }
Adds a linker definition . The first linker that is not disqualified by its if and unless attributes will perform the link . If no child linker element is active the linker implied by the cc elements name or classname attribute will be used .
35,639
protected int checkForChangedIncludeFiles ( final Map < String , TargetInfo > targets ) { int potentialTargets = 0 ; int definiteTargets = 0 ; Iterator < TargetInfo > targetEnum = targets . values ( ) . iterator ( ) ; while ( targetEnum . hasNext ( ) ) { final TargetInfo target = targetEnum . next ( ) ; if ( ! target . getRebuild ( ) ) { potentialTargets ++ ; } else { definiteTargets ++ ; } } if ( potentialTargets > 0 ) { log ( "Starting dependency analysis for " + Integer . toString ( potentialTargets ) + " files." ) ; final DependencyTable dependencyTable = new DependencyTable ( this . _objDir ) ; try { dependencyTable . load ( ) ; } catch ( final Exception ex ) { log ( "Problem reading dependencies.xml: " + ex . toString ( ) ) ; } targetEnum = targets . values ( ) . iterator ( ) ; while ( targetEnum . hasNext ( ) ) { final TargetInfo target = targetEnum . next ( ) ; if ( ! target . getRebuild ( ) && dependencyTable . needsRebuild ( this , target , this . dependencyDepth ) ) { target . mustRebuild ( ) ; } } dependencyTable . commit ( this ) ; } int currentTargets = 0 ; targetEnum = targets . values ( ) . iterator ( ) ; while ( targetEnum . hasNext ( ) ) { final TargetInfo target = targetEnum . next ( ) ; if ( target . getRebuild ( ) ) { currentTargets ++ ; } } if ( potentialTargets > 0 ) { log ( Integer . toString ( potentialTargets - currentTargets + definiteTargets ) + " files are up to date." ) ; log ( Integer . toString ( currentTargets - definiteTargets ) + " files to be recompiled from dependency analysis." ) ; } log ( Integer . toString ( currentTargets ) + " total files to be compiled." ) ; return currentTargets ; }
Checks all targets that are not forced to be rebuilt or are missing object files to be checked for modified include files
35,640
public void setName ( final CompilerEnum name ) { this . compilerDef . setName ( name ) ; final Processor compiler = this . compilerDef . getProcessor ( ) ; final Linker linker = compiler . getLinker ( this . linkType ) ; this . linkerDef . setProcessor ( linker ) ; }
Sets type of the default compiler and linker .
35,641
public void setNewenvironment ( final boolean newenv ) { this . compilerDef . setNewenvironment ( newenv ) ; for ( int i = 0 ; i < this . _compilers . size ( ) ; i ++ ) { final CompilerDef currentCompilerDef = this . _compilers . elementAt ( i ) ; currentCompilerDef . setNewenvironment ( newenv ) ; } this . linkerDef . setNewenvironment ( newenv ) ; }
Do not propagate old environment when new environment variables are specified .
35,642
public void setOutfile ( final File outfile ) { if ( outfile == null || outfile . toString ( ) . length ( ) > 0 ) { this . _outfile = outfile ; } }
Sets the output file name . If not specified the task will only compile files and not attempt to link . If an extension is not specified the task may use a system appropriate extension and prefix for example outfile = example may result in libexample . so being created .
35,643
public void setProject ( final Project project ) { super . setProject ( project ) ; this . compilerDef . setProject ( project ) ; this . linkerDef . setProject ( project ) ; }
Sets the project .
35,644
public VersionInfo merge ( ) { if ( isReference ( ) ) { final VersionInfo refVersion = ( VersionInfo ) getCheckedRef ( VersionInfo . class , "VersionInfo" ) ; return refVersion . merge ( ) ; } Reference currentRef = this . getExtends ( ) ; if ( currentRef == null ) { return this ; } final Vector < VersionInfo > stack = new Vector < > ( 5 ) ; stack . addElement ( this ) ; while ( currentRef != null ) { final Object obj = currentRef . getReferencedObject ( getProject ( ) ) ; if ( obj instanceof VersionInfo ) { VersionInfo current = ( VersionInfo ) obj ; if ( current . isReference ( ) ) { current = ( VersionInfo ) current . getCheckedRef ( VersionInfo . class , "VersionInfo" ) ; } if ( stack . contains ( current ) ) { throw this . circularReference ( ) ; } stack . addElement ( current ) ; currentRef = current . getExtends ( ) ; } else { throw new BuildException ( "Referenced element " + currentRef . getRefId ( ) + " is not a versioninfo." ) ; } } return new VersionInfo ( stack ) ; }
Returns a VersionInfo that reflects any inherited version information .
35,645
public static String [ ] getOutputFileSwitch ( final String outPath ) { final StringBuffer buf = new StringBuffer ( "/fo=" ) ; if ( outPath . indexOf ( ' ' ) >= 0 ) { buf . append ( '\"' ) ; buf . append ( outPath ) ; buf . append ( '\"' ) ; } else { buf . append ( outPath ) ; } final String [ ] retval = new String [ ] { buf . toString ( ) } ; return retval ; }
Builds command line options to specify the output file names .
35,646
public Linker getLinker ( final LinkType type ) { if ( type . isStaticLibrary ( ) ) { return OpenWatcomLibrarian . getInstance ( ) ; } if ( type . isSharedLibrary ( ) ) { return DLL_LINKER ; } return INSTANCE ; }
Get linker .
35,647
public DistributerMap createMap ( ) { final DistributerMap map = new DistributerMap ( ) ; map . setProject ( getProject ( ) ) ; this . maps . addElement ( map ) ; return map ; }
Local to remote filename maps .
35,648
public String getHosts ( ) { if ( isReference ( ) ) { final DistributerDef refDistributer = ( DistributerDef ) getCheckedRef ( DistributerDef . class , "DistributerDef" ) ; return refDistributer . getHosts ( ) ; } return this . hosts ; }
Gets hosts .
35,649
public DistributerProtocolEnum getProtocol ( ) { if ( isReference ( ) ) { final DistributerDef refDistributer = ( DistributerDef ) getCheckedRef ( DistributerDef . class , "DistributerDef" ) ; return refDistributer . getProtocol ( ) ; } return this . protocol ; }
Gets protocol .
35,650
public int getTcpcork ( ) { if ( isReference ( ) ) { final DistributerDef refDistributer = ( DistributerDef ) getCheckedRef ( DistributerDef . class , "DistributerDef" ) ; return refDistributer . getTcpcork ( ) ; } return this . tcpCork ; }
Gets tcp cork .
35,651
public void link ( final CCTask task , final File outputFile , final String [ ] sourceFiles , final CommandLineLinkerConfiguration config ) throws BuildException { final File parentDir = new File ( outputFile . getParent ( ) ) ; String parentPath ; try { parentPath = parentDir . getCanonicalPath ( ) ; } catch ( final IOException ex ) { parentPath = parentDir . getAbsolutePath ( ) ; } String [ ] execArgs = prepareArguments ( task , parentPath , outputFile . getName ( ) , sourceFiles , config ) ; int commandLength = 0 ; for ( final String execArg : execArgs ) { commandLength += execArg . length ( ) + 1 ; } if ( commandLength >= this . getMaximumCommandLength ( ) ) { try { execArgs = prepareResponseFile ( outputFile , execArgs ) ; } catch ( final IOException ex ) { throw new BuildException ( ex ) ; } } final int retval = runCommand ( task , parentDir , execArgs ) ; if ( retval != 0 ) { throw new BuildException ( getCommandWithPath ( config ) + " failed with return code " + retval , task . getLocation ( ) ) ; } }
Performs a link using a command line linker
35,652
protected String prepareFilename ( final StringBuffer buf , final String outputDir , final String sourceFile ) { if ( isWindows ( ) && sourceFile . length ( ) > this . maxPathLength ) { throw new BuildException ( "Absolute path too long, " + sourceFile . length ( ) + " > " + this . maxPathLength + ": '" + sourceFile ) ; } return quoteFilename ( buf , sourceFile ) ; }
Processes filename into argument form
35,653
public final String [ ] getLibraryPatterns ( final String [ ] libnames , final LibraryTypeEnum libType ) { return OpenWatcomProcessor . getLibraryPatterns ( libnames , libType ) ; }
Get file selectors for libraries .
35,654
public void addConfiguredDefineset ( final DefineSet defs ) { if ( defs == null ) { throw new NullPointerException ( "defs" ) ; } if ( isReference ( ) ) { throw noChildrenAllowed ( ) ; } this . defineSets . addElement ( defs ) ; }
Adds a defineset .
35,655
public IncludePath createIncludePath ( ) { final Project p = getProject ( ) ; if ( p == null ) { throw new java . lang . IllegalStateException ( "project must be set" ) ; } if ( isReference ( ) ) { throw noChildrenAllowed ( ) ; } final IncludePath path = new IncludePath ( p ) ; this . includePaths . addElement ( path ) ; return path ; }
Creates an include path .
35,656
public PrecompileDef createPrecompile ( ) throws BuildException { final Project p = getProject ( ) ; if ( isReference ( ) ) { throw noChildrenAllowed ( ) ; } final PrecompileDef precomp = new PrecompileDef ( ) ; precomp . setProject ( p ) ; this . precompileDefs . addElement ( precomp ) ; return precomp ; }
Specifies precompilation prototype file and exclusions .
35,657
public SystemIncludePath createSysIncludePath ( ) { final Project p = getProject ( ) ; if ( p == null ) { throw new java . lang . IllegalStateException ( "project must be set" ) ; } if ( isReference ( ) ) { throw noChildrenAllowed ( ) ; } final SystemIncludePath path = new SystemIncludePath ( p ) ; this . sysIncludePaths . addElement ( path ) ; return path ; }
Creates a system include path . Locations and timestamps of files located using the system include paths are not used in dependency analysis .
35,658
public void setClassname ( final String classname ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } super . setClassname ( classname ) ; final Processor proc = getProcessor ( ) ; if ( ! ( proc instanceof Compiler ) ) { throw new BuildException ( classname + " does not implement Compiler" ) ; } }
Sets the default compiler adapter . Use the name attribute when the compiler is a supported compiler .
35,659
public void setName ( final CompilerEnum name ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } final Compiler compiler = name . getCompiler ( ) ; setProcessor ( compiler ) ; }
Sets compiler type .
35,660
public void addFileset ( final ConditionalFileSet srcSet ) throws BuildException { if ( isReference ( ) ) { throw noChildrenAllowed ( ) ; } srcSet . setProject ( getProject ( ) ) ; this . srcSets . addElement ( srcSet ) ; }
Adds a source file set .
35,661
public ProcessorConfiguration createConfiguration ( final CCTask task , final LinkType linkType , final ProcessorDef baseDef , final TargetDef targetPlatform , final VersionInfo versionInfo ) { if ( isReference ( ) ) { return ( ( ProcessorDef ) getCheckedRef ( ProcessorDef . class , "ProcessorDef" ) ) . createConfiguration ( task , linkType , baseDef , targetPlatform , versionInfo ) ; } final ProcessorDef [ ] defaultProviders = getDefaultProviders ( baseDef ) ; final Processor proc = getProcessor ( linkType ) ; return proc . createConfiguration ( task , linkType , defaultProviders , this , targetPlatform , versionInfo ) ; }
Creates a configuration
35,662
public boolean getDebug ( final ProcessorDef [ ] defaultProviders , final int index ) { if ( isReference ( ) ) { return ( ( ProcessorDef ) getCheckedRef ( ProcessorDef . class , "ProcessorDef" ) ) . getDebug ( defaultProviders , index ) ; } if ( this . debug != null ) { return this . debug . booleanValue ( ) ; } else { if ( defaultProviders != null && index < defaultProviders . length ) { return defaultProviders [ index ] . getDebug ( defaultProviders , index + 1 ) ; } } return false ; }
Gets boolean indicating debug build
35,663
protected final ProcessorDef [ ] getDefaultProviders ( final ProcessorDef baseDef ) { ProcessorDef extendsDef = getExtends ( ) ; final Vector chain = new Vector ( ) ; while ( extendsDef != null && ! chain . contains ( extendsDef ) ) { chain . addElement ( extendsDef ) ; extendsDef = extendsDef . getExtends ( ) ; } if ( baseDef != null && getInherit ( ) ) { chain . addElement ( baseDef ) ; } final ProcessorDef [ ] defaultProviders = new ProcessorDef [ chain . size ( ) ] ; chain . copyInto ( defaultProviders ) ; return defaultProviders ; }
Creates an chain of objects which provide default values in descending order of significance .
35,664
public ProcessorDef getExtends ( ) throws BuildException { if ( this . extendsRef != null ) { final Object obj = this . extendsRef . getReferencedObject ( getProject ( ) ) ; if ( ! getClass ( ) . isInstance ( obj ) ) { throw new BuildException ( "Referenced object " + this . extendsRef . getRefId ( ) + " not correct type, is " + obj . getClass ( ) . getName ( ) + " should be " + getClass ( ) . getName ( ) ) ; } return ( ProcessorDef ) obj ; } return null ; }
Gets the ProcessorDef specified by the extends attribute
35,665
public boolean getRebuild ( final ProcessorDef [ ] defaultProviders , final int index ) { if ( isReference ( ) ) { return ( ( ProcessorDef ) getCheckedRef ( ProcessorDef . class , "ProcessorDef" ) ) . getRebuild ( defaultProviders , index ) ; } if ( this . rebuild != null ) { return this . rebuild . booleanValue ( ) ; } else { if ( defaultProviders != null && index < defaultProviders . length ) { return defaultProviders [ index ] . getRebuild ( defaultProviders , index + 1 ) ; } } return false ; }
Gets a boolean value indicating whether all targets must be rebuilt regardless of dependency analysis .
35,666
public void setClassname ( final String className ) throws BuildException { Object proc = null ; try { final Class implClass = ProcessorDef . class . getClassLoader ( ) . loadClass ( className ) ; try { final Method getInstance = implClass . getMethod ( "getInstance" ) ; proc = getInstance . invoke ( null ) ; } catch ( final Exception ex ) { proc = implClass . newInstance ( ) ; } } catch ( final Exception ex ) { throw new BuildException ( ex ) ; } setProcessor ( ( Processor ) proc ) ; }
Sets the class name for the adapter . Use the name attribute when the tool is supported .
35,667
protected void setProcessor ( final Processor processor ) throws BuildException , NullPointerException { if ( processor == null ) { throw new NullPointerException ( "processor" ) ; } if ( isReference ( ) ) { throw super . tooManyAttributes ( ) ; } if ( this . env == null && ! this . newEnvironment ) { this . processor = processor ; } else { this . processor = processor . changeEnvironment ( this . newEnvironment , this . env ) ; } }
Sets the processor
35,668
public void setRefid ( final org . apache . tools . ant . types . Reference ref ) { super . setRefid ( ref ) ; }
Specifies that this element should behave as if the content of the element with the matching id attribute was inserted at this location . If specified no other attributes or child content should be specified other than if unless and description .
35,669
public void visitFiles ( final FileVisitor visitor ) { final Project p = getProject ( ) ; if ( p == null ) { throw new java . lang . IllegalStateException ( "project must be set before this call" ) ; } if ( isReference ( ) ) { ( ( ProcessorDef ) getCheckedRef ( ProcessorDef . class , "ProcessorDef" ) ) . visitFiles ( visitor ) ; } final ProcessorDef extendsDef = getExtends ( ) ; if ( extendsDef != null ) { extendsDef . visitFiles ( visitor ) ; } for ( int i = 0 ; i < this . srcSets . size ( ) ; i ++ ) { final ConditionalFileSet srcSet = ( ConditionalFileSet ) this . srcSets . elementAt ( i ) ; if ( srcSet . isActive ( ) ) { final DirectoryScanner scanner = srcSet . getDirectoryScanner ( p ) ; final String [ ] fileNames = scanner . getIncludedFiles ( ) ; final File parentDir = scanner . getBasedir ( ) ; for ( final String currentFile : fileNames ) { visitor . visit ( parentDir , currentFile ) ; } } } }
This method calls the FileVistor s visit function for every file in the processors definition
35,670
public String getDataset ( ) { if ( isReference ( ) ) { final LibrarySet master = ( LibrarySet ) getCheckedRef ( LibrarySet . class , "LibrarySet" ) ; return master . getDataset ( ) ; } return this . dataset ; }
Gets the dataset . Used on OS390 if the libs are in a dataset .
35,671
public LibraryTypeEnum getType ( ) { if ( isReference ( ) ) { final LibrarySet master = ( LibrarySet ) getCheckedRef ( LibrarySet . class , "LibrarySet" ) ; return master . getType ( ) ; } return this . libraryType ; }
Gets preferred library type
35,672
public void setLibs ( final CUtil . StringArrayBuilder libs ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } this . libnames = libs . getValue ( ) ; }
Comma - separated list of library names without leading prefixes such as lib or extensions such as . so or . a .
35,673
public ArchEnum getArch ( ) { if ( isReference ( ) ) { final TargetDef refPlatform = ( TargetDef ) getCheckedRef ( TargetDef . class , "TargetDef" ) ; return refPlatform . getArch ( ) ; } return this . arch ; }
Gets arch .
35,674
public CPUEnum getCpu ( ) { if ( isReference ( ) ) { final TargetDef refPlatform = ( TargetDef ) getCheckedRef ( TargetDef . class , "TargetDef" ) ; return refPlatform . getCpu ( ) ; } return this . cpu ; }
Gets cpu .
35,675
public OSFamilyEnum getOsfamily ( ) { if ( isReference ( ) ) { final TargetDef refPlatform = ( TargetDef ) getCheckedRef ( TargetDef . class , "TargetDef" ) ; return refPlatform . getOsfamily ( ) ; } return this . osFamily ; }
Gets operating system family .
35,676
public void setArch ( final ArchEnum value ) { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } if ( this . cpu != null ) { throw tooManyAttributes ( ) ; } this . arch = value ; }
Sets cpu architecture compiler may use cpu specific instructions .
35,677
public void setOsfamily ( final OSFamilyEnum value ) { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } if ( this . cpu != null ) { throw tooManyAttributes ( ) ; } this . osFamily = value ; }
Sets operating system family .
35,678
public UndefineArgument [ ] getDefines ( ) throws BuildException { if ( isReference ( ) ) { final DefineSet defset = ( DefineSet ) getCheckedRef ( DefineSet . class , "DefineSet" ) ; return defset . getDefines ( ) ; } else { if ( isActive ( ) ) { final UndefineArgument [ ] defs = new UndefineArgument [ this . defineList . size ( ) ] ; this . defineList . copyInto ( defs ) ; return defs ; } else { return new UndefineArgument [ 0 ] ; } } }
Returns the defines and undefines in this set .
35,679
public void setDefine ( final CUtil . StringArrayBuilder defList ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } addDefines ( defList . getValue ( ) , true ) ; }
A comma - separated list of preprocessor macros to define . Use nested define elements to define macro values .
35,680
public void setRefid ( final Reference r ) throws BuildException { if ( ! this . defineList . isEmpty ( ) ) { throw tooManyAttributes ( ) ; } super . setRefid ( r ) ; }
Specifies that this element should behave as if the content of the element with the matching id attribute was inserted at this location . If specified no other attributes or child content should be specified other than description .
35,681
public void setUndefine ( final CUtil . StringArrayBuilder undefList ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } addDefines ( undefList . getValue ( ) , false ) ; }
A comma - separated list of preprocessor macros to undefine .
35,682
public final String [ ] getAttachedNars ( final AOL aol , final String type ) { final String attachedNars = getProperty ( aol , NarConstants . NAR + "." + type ) ; return attachedNars != null ? attachedNars . split ( "," ) : null ; }
FIXME replace with list of AttachedNarArtifacts
35,683
public DependencyInfo getDependencyInfo ( final String sourceRelativeName , final String includePathIdentifier ) { DependencyInfo dependInfo = null ; final DependencyInfo [ ] dependInfos = ( DependencyInfo [ ] ) this . dependencies . get ( sourceRelativeName ) ; if ( dependInfos != null ) { for ( final DependencyInfo dependInfo2 : dependInfos ) { dependInfo = dependInfo2 ; if ( dependInfo . getIncludePathIdentifier ( ) . equals ( includePathIdentifier ) ) { return dependInfo ; } } } return null ; }
This method returns a DependencyInfo for the specific source file and include path identifier
35,684
public boolean needsRebuild ( final CCTask task , final TargetInfo target , final int dependencyDepth ) { boolean mustRebuild = false ; final CompilerConfiguration compiler = ( CompilerConfiguration ) target . getConfiguration ( ) ; final String includePathIdentifier = compiler . getIncludePathIdentifier ( ) ; final File [ ] sources = target . getSources ( ) ; final DependencyInfo [ ] dependInfos = new DependencyInfo [ sources . length ] ; final long outputLastModified = target . getOutput ( ) . lastModified ( ) ; DependencyInfo [ ] stack = new DependencyInfo [ 50 ] ; boolean rebuildOnStackExhaustion = true ; if ( dependencyDepth >= 0 ) { if ( dependencyDepth < 50 ) { stack = new DependencyInfo [ dependencyDepth ] ; } rebuildOnStackExhaustion = false ; } final TimestampChecker checker = new TimestampChecker ( outputLastModified , rebuildOnStackExhaustion ) ; for ( int i = 0 ; i < sources . length && ! mustRebuild ; i ++ ) { final File source = sources [ i ] ; final String relative = CUtil . getRelativePath ( this . baseDirPath , source ) ; DependencyInfo dependInfo = getDependencyInfo ( relative , includePathIdentifier ) ; if ( dependInfo == null ) { task . log ( "Parsing " + relative , Project . MSG_VERBOSE ) ; dependInfo = parseIncludes ( task , compiler , source ) ; } walkDependencies ( task , dependInfo , compiler , stack , checker ) ; mustRebuild = checker . getMustRebuild ( ) ; } return mustRebuild ; }
Determines if the specified target needs to be rebuilt .
35,685
public final void narExecute ( ) throws MojoExecutionException , MojoFailureException { List < AttachedNarArtifact > attachedNarArtifacts = getAttachedNarArtifacts ( libraries ) ; downloadAttachedNars ( attachedNarArtifacts ) ; attachedNarArtifacts = getAttachedNarArtifacts ( libraries ) ; unpackAttachedNars ( attachedNarArtifacts ) ; for ( final Object element : attachedNarArtifacts ) { final Artifact dependency = ( Artifact ) element ; getLog ( ) . debug ( "Assemble from " + dependency ) ; dependency . isSnapshot ( ) ; final File srcDir = getLayout ( ) . getNarUnpackDirectory ( getUnpackDirectory ( ) , getNarManager ( ) . getNarFile ( dependency ) ) ; final File dstDir = getTargetDirectory ( ) ; try { FileUtils . mkdir ( dstDir . getPath ( ) ) ; getLog ( ) . debug ( "SrcDir: " + srcDir ) ; if ( srcDir . exists ( ) ) { FileUtils . copyDirectoryStructureIfModified ( srcDir , dstDir ) ; } } catch ( final IOException ioe ) { throw new MojoExecutionException ( "Failed to copy directory for dependency " + dependency + " from " + srcDir + " to " + dstDir , ioe ) ; } } }
Copies the unpacked nar libraries and files into the projects target area
35,686
public LibrarySet [ ] getActiveLibrarySets ( final LinkerDef [ ] defaultProviders , final int index ) { if ( isReference ( ) ) { return ( ( LinkerDef ) getCheckedRef ( LinkerDef . class , "LinkerDef" ) ) . getActiveUserLibrarySets ( defaultProviders , index ) ; } final Project p = getProject ( ) ; final Vector libsets = new Vector ( ) ; for ( int i = index ; i < defaultProviders . length ; i ++ ) { defaultProviders [ i ] . addActiveUserLibrarySets ( p , libsets ) ; } addActiveUserLibrarySets ( p , libsets ) ; for ( int i = index ; i < defaultProviders . length ; i ++ ) { defaultProviders [ i ] . addActiveSystemLibrarySets ( p , libsets ) ; } addActiveSystemLibrarySets ( p , libsets ) ; final LibrarySet [ ] sets = new LibrarySet [ libsets . size ( ) ] ; libsets . copyInto ( sets ) ; return sets ; }
Returns an array of active library sets for this linker definition .
35,687
public void setName ( final LinkerEnum name ) throws BuildException { if ( isReference ( ) ) { throw tooManyAttributes ( ) ; } final Linker linker = name . getLinker ( ) ; super . setProcessor ( linker ) ; }
Sets linker type .
35,688
public String [ ] getOutputFileNames ( final String inputFile , final VersionInfo versionInfo ) { if ( inputFile . endsWith ( ".cpp" ) ) { return super . getOutputFileNames ( inputFile , versionInfo ) ; } final String baseName = getBaseOutputName ( inputFile ) ; return new String [ ] { "moc_" + baseName + ".cpp" } ; }
Gets output file names .
35,689
private static PBXObjectRef createPBXBuildFile ( final PBXObjectRef fileRef , final Map settings ) { final Map map = new HashMap ( ) ; map . put ( "fileRef" , fileRef ) ; map . put ( "isa" , "PBXBuildFile" ) ; if ( settings != null ) { map . put ( "settings" , settings ) ; } return new PBXObjectRef ( map ) ; }
Create PBXBuildFile .
35,690
private static PBXObjectRef createPBXCopyFilesBuildPhase ( final int buildActionMask , final String dstPath , final String dstSubfolderSpec , final List files , final boolean runOnly ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXCopyFilesBuildPhase" ) ; map . put ( "buildActionMask" , NumberFormat . getIntegerInstance ( Locale . US ) . format ( buildActionMask ) ) ; map . put ( "dstPath" , dstPath ) ; map . put ( "dstSubfolderSpec" , dstSubfolderSpec ) ; map . put ( "files" , files ) ; map . put ( "runOnlyForDeploymentPostprocessing" , toString ( runOnly ) ) ; return new PBXObjectRef ( map ) ; }
Create a build phase that copies files to a destination .
35,691
private static PBXObjectRef createPBXFileReference ( final String sourceTree , final String baseDir , final File file ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXFileReference" ) ; final String relPath = CUtil . toUnixPath ( CUtil . getRelativePath ( baseDir , file ) ) ; map . put ( "path" , relPath ) ; map . put ( "name" , file . getName ( ) ) ; map . put ( "sourceTree" , sourceTree ) ; return new PBXObjectRef ( map ) ; }
Create PBXFileReference .
35,692
private static PBXObjectRef createPBXFrameworksBuildPhase ( final int buildActionMask , final List files , final boolean runOnly ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXFrameworksBuildPhase" ) ; map . put ( "buildActionMask" , NumberFormat . getIntegerInstance ( Locale . US ) . format ( buildActionMask ) ) ; map . put ( "files" , files ) ; map . put ( "runOnlyForDeploymentPostprocessing" , toString ( runOnly ) ) ; return new PBXObjectRef ( map ) ; }
Create PBXFrameworksBuildPhase .
35,693
private static PBXObjectRef createPBXGroup ( final String name , final String sourceTree , final List children ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXGroup" ) ; map . put ( "name" , name ) ; map . put ( "sourceTree" , sourceTree ) ; map . put ( "children" , children ) ; return new PBXObjectRef ( map ) ; }
Create PBXGroup .
35,694
private static PBXObjectRef createPBXNativeTarget ( final String name , final PBXObjectRef buildConfigurationList , final List buildPhases , final List buildRules , final List dependencies , final String productInstallPath , final String productName , final PBXObjectRef productReference , final String productType ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXNativeTarget" ) ; map . put ( "buildConfigurationList" , buildConfigurationList ) ; map . put ( "buildPhases" , buildPhases ) ; map . put ( "buildRules" , buildRules ) ; map . put ( "dependencies" , dependencies ) ; map . put ( "name" , name ) ; map . put ( "productInstallPath" , productInstallPath ) ; map . put ( "productName" , productName ) ; map . put ( "productReference" , productReference ) ; map . put ( "productType" , productType ) ; return new PBXObjectRef ( map ) ; }
Create PBXNativeTarget .
35,695
private static PBXObjectRef createPBXProject ( final PBXObjectRef buildConfigurationList , final PBXObjectRef mainGroup , final String projectDirPath , final String projectRoot , final List targets ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXProject" ) ; map . put ( "buildConfigurationList" , buildConfigurationList . getID ( ) ) ; map . put ( "hasScannedForEncodings" , "0" ) ; map . put ( "mainGroup" , mainGroup . getID ( ) ) ; map . put ( "projectDirPath" , projectDirPath ) ; map . put ( "targets" , targets ) ; map . put ( "projectRoot" , projectRoot ) ; return new PBXObjectRef ( map ) ; }
Create PBXProject .
35,696
private static PBXObjectRef createPBXSourcesBuildPhase ( final int buildActionMask , final List files , final boolean runOnly ) { final Map map = new HashMap ( ) ; map . put ( "buildActionMask" , String . valueOf ( buildActionMask ) ) ; map . put ( "files" , files ) ; map . put ( "isa" , "PBXSourcesBuildPhase" ) ; map . put ( "runOnlyForDeploymentPostprocessing" , toString ( runOnly ) ) ; return new PBXObjectRef ( map ) ; }
Create PBXSourcesBuildPhase .
35,697
private static PBXObjectRef createXCBuildConfiguration ( final String name , final Map < String , ? > buildSettings ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "XCBuildConfiguration" ) ; map . put ( "buildSettings" , buildSettings ) ; map . put ( "name" , name ) ; return new PBXObjectRef ( map ) ; }
Create XCBuildConfiguration .
35,698
private static PBXObjectRef createXCConfigurationList ( final List buildConfigurations ) { final Map map = new HashMap ( ) ; map . put ( "isa" , "XCConfigurationList" ) ; map . put ( "buildConfigurations" , buildConfigurations ) ; return new PBXObjectRef ( map ) ; }
Create XCConfigurationList .
35,699
private PBXObjectRef addDependency ( final Map objects , final PBXObjectRef project , final List mainGroupChildren , final String baseDir , final DependencyDef dependency ) { if ( dependency . getFile ( ) != null ) { final File xcodeDir = new File ( dependency . getFile ( ) . getAbsolutePath ( ) + ".xcodeproj" ) ; if ( xcodeDir . exists ( ) ) { final PBXObjectRef xcodePrj = createPBXFileReference ( "SOURCE_ROOT" , baseDir , xcodeDir ) ; mainGroupChildren . add ( xcodePrj ) ; objects . put ( xcodePrj . getID ( ) , xcodePrj . getProperties ( ) ) ; final int proxyType = 2 ; final PBXObjectRef proxy = createPBXContainerItemProxy ( xcodePrj , proxyType , dependency . getName ( ) ) ; objects . put ( proxy . getID ( ) , proxy . getProperties ( ) ) ; final PBXObjectRef referenceProxy = createPBXReferenceProxy ( proxy , dependency ) ; objects . put ( referenceProxy . getID ( ) , referenceProxy . getProperties ( ) ) ; final PBXObjectRef buildFile = createPBXBuildFile ( referenceProxy , Collections . emptyMap ( ) ) ; objects . put ( buildFile . getID ( ) , buildFile . getProperties ( ) ) ; final List productsChildren = new ArrayList ( ) ; productsChildren . add ( referenceProxy ) ; final PBXObjectRef products = createPBXGroup ( "Products" , "<group>" , productsChildren ) ; objects . put ( products . getID ( ) , products . getProperties ( ) ) ; final Map projectReference = new HashMap ( ) ; projectReference . put ( "ProductGroup" , products ) ; projectReference . put ( "ProjectRef" , xcodePrj ) ; List projectReferences = ( List ) project . getProperties ( ) . get ( "ProjectReferences" ) ; if ( projectReferences == null ) { projectReferences = new ArrayList ( ) ; project . getProperties ( ) . put ( "ProjectReferences" , projectReferences ) ; } projectReferences . add ( projectReference ) ; return buildFile ; } } return null ; }
Adds a dependency to the object graph .