[ 
http://jira.codehaus.org/browse/MOJO-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251047#action_251047
 ] 

Clément Igonet edited comment on MOJO-1416 at 1/10/11 11:00 AM:
----------------------------------------------------------------

Maven native BCC plugin does not find any ".res" file. I don't know why.
Here is my final code in org.codehaus.mojo.natives.bcc.BCCLinker.java:
{code}
    protected Commandline createLinkerCommandLine( List objectFiles, 
LinkerConfiguration config )
            throws NativeBuildException
    {
        Commandline cl = new Commandline();

        cl.setWorkingDirectory( config.getWorkingDirectory().getPath() );

        String executable = DEFAULT_EXECUTABLE;

        /**
         *Turbo Incremental Link 5.68 Copyright (c) 1997-2005 Borland
         *Syntax: ILINK32 options objfiles, exefile, mapfile, libfiles, 
deffile, resfiles        
         * 
         */
        if ( config.getExecutable() != null && 
config.getExecutable().trim().length() != 0 )
        {
            executable = config.getExecutable();
        }

        cl.createArg().setValue( executable );

        cl.addArguments( config.getStartOptions() );

        //objfiles
        for ( int i = 0; i < objectFiles.size(); ++i )
        {
            File objFile = ( File ) objectFiles.get( i );

            cl.createArg().setValue( objFile.getPath() );
        }

        for ( Iterator iter = config.getExternalLibFileNames().iterator(); 
iter.hasNext(); )
        {
            String fileName = ( String ) iter.next();

            if ( !FileUtils.getExtension( fileName ).toLowerCase().equals( 
"res" ) )
            {
                cl.createArg().setFile( new File( 
config.getExternalLibDirectory(), fileName ) );
            }
        }

        //ouput file
        cl.createArg().setValue( "," + config.getOutputFile() );

        //map files + system lib, and def file to be given by user in middle 
options
        //  a comma is required between map, lib, and def 
        cl.createArg().setValue( "," );
        cl.addArguments( config.getMiddleOptions() );

        // 2011-01-10: commented code
//        cl.createArg().setValue( "," );
//        //res fil
//        for ( Iterator iter = config.getExternalLibFileNames().iterator(); 
iter.hasNext(); )
//        {
//            String fileName = ( String ) iter.next();
//
//            if ( FileUtils.getExtension( fileName ).toLowerCase().equals( 
"res" ) )
//            {
//                cl.createArg().setFile( new File( 
config.getExternalLibDirectory(), fileName ) );
//            }
//        }
        // 2011-01-10: temporary hack
        cl.addArguments( config.getEndOptions() );

        return cl;
    }
{code}
and my pom.xml:
{code}

                    <linkerStartOptions>
                        <linkerStartOption>${LFLAGS} 
-L${LIBPATH}</linkerStartOption>
                    </linkerStartOptions>

                    <linkerMiddleOptions>
                        <linkerMiddleOption>, ${ALLLIB},,</linkerMiddleOption>
                    </linkerMiddleOptions>

                    <linkerEndOptions>
                        <linkerEndOption>${ALLRES}</linkerEndOption>
                    </linkerEndOptions>
{code}
where ${ALLRES} are my resource files, as defined in makefile created by 
B.C++Builder

      was (Author: clement.igonet):
    Maven native BCC plugin does not find any ".res" file. I don't know why.
Here is my final code in org.codehaus.mojo.natives.bcc.BCCLinker.java:
{code}
    protected Commandline createLinkerCommandLine( List objectFiles, 
LinkerConfiguration config )
            throws NativeBuildException
    {
        Commandline cl = new Commandline();

        cl.setWorkingDirectory( config.getWorkingDirectory().getPath() );

        String executable = DEFAULT_EXECUTABLE;

        /**
         *Turbo Incremental Link 5.68 Copyright (c) 1997-2005 Borland
         *Syntax: ILINK32 options objfiles, exefile, mapfile, libfiles, 
deffile, resfiles        
         * 
         */
        if ( config.getExecutable() != null && 
config.getExecutable().trim().length() != 0 )
        {
            executable = config.getExecutable();
        }

        cl.createArg().setValue( executable );

        cl.addArguments( config.getStartOptions() );

        //objfiles
        for ( int i = 0; i < objectFiles.size(); ++i )
        {
            File objFile = ( File ) objectFiles.get( i );

            cl.createArg().setValue( objFile.getPath() );
        }

        for ( Iterator iter = config.getExternalLibFileNames().iterator(); 
iter.hasNext(); )
        {
            String fileName = ( String ) iter.next();

            if ( !FileUtils.getExtension( fileName ).toLowerCase().equals( 
"res" ) )
            {
                cl.createArg().setFile( new File( 
config.getExternalLibDirectory(), fileName ) );
            }
        }

        //ouput file
        cl.createArg().setValue( "," + config.getOutputFile() );

        //map files + system lib, and def file to be given by user in middle 
options
        //  a comma is required between map, lib, and def 
        cl.createArg().setValue( "," );
        cl.addArguments( config.getMiddleOptions() );

        // 2011-01-10: commented code
//        cl.createArg().setValue( "," );
//        //res fil
//        for ( Iterator iter = config.getExternalLibFileNames().iterator(); 
iter.hasNext(); )
//        {
//            String fileName = ( String ) iter.next();
//
//            if ( FileUtils.getExtension( fileName ).toLowerCase().equals( 
"res" ) )
//            {
//                cl.createArg().setFile( new File( 
config.getExternalLibDirectory(), fileName ) );
//            }
//        }
        // 2011-01-10: temporary hack
        cl.addArguments( config.getEndOptions() );

        return cl;
    }
{code}
and my pom.xml:
{code}
                    <linkerStartOptions>
                        <linkerStartOption>${LFLAGS} 
-L${LIBPATH}</linkerStartOption>
                    </linkerStartOptions>

                    <linkerMiddleOptions>
                        <linkerMiddleOption>, ${ALLLIB},,</linkerMiddleOption>
                    </linkerMiddleOptions>

                    <linkerEndOptions>
                        <linkerEndOption>${ALLRES}</linkerEndOption>
                    </linkerEndOptions>
{code}
where ${ALLRES} are my resource files, as defined in makefile created by 
B.C++Builder
  
> using the Bcc compile provider placed all dependant .jar file on linker path 
> causing failure
> --------------------------------------------------------------------------------------------
>
>                 Key: MOJO-1416
>                 URL: http://jira.codehaus.org/browse/MOJO-1416
>             Project: Mojo
>          Issue Type: Bug
>          Components: native
>         Environment: Windows XP
>            Reporter: Damon Jacobsen
>            Priority: Critical
>
> Using this POM
> <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
>       <modelVersion>4.0.0</modelVersion>
>       <groupId>com.lifetouch.utility</groupId>
>       <artifactId>ImagenomicPortraturePluginDLL</artifactId>
>       <packaging>dll</packaging>
>       <version>0.0.1-SNAPSHOT</version>
>       <dependencies>
>               <dependency>
>                       <groupId>com.lifetouch.utility</groupId>
>                       <artifactId>ImagenomicPortraturePlugin</artifactId>
>                       <version>0.0.1-SNAPSHOT</version>
>               </dependency>
>       </dependencies>
>       <build>
>               <plugins>
>                       <plugin>
>                               <groupId>org.codehaus.mojo</groupId>
>                               <artifactId>native-maven-plugin</artifactId>
>                               <extensions>true</extensions>
>                               <configuration>
>                               <compilerProvider>generic</compilerProvider>
>                               <compilerExecutable>bcc32</compilerExecutable>
>                               <linkerExecutable>bcc32</linkerExecutable>
>                               <linkerStartOptions></linkerStartOptions>
>                               <linkerMiddleOptions></linkerMiddleOptions>
>                               <linkerEndOptions></linkerEndOptions>
>                                       <!--
>                                               | Add jdk include directories 
> to system include path | Override
>                                               ${jkdIncludePath} If your jdk 
> does not conform to Sun JDK layout
>                                       -->
>                                       <javahOS>win32</javahOS>
>                               </configuration>
>                               <!--
>                                       Generate JNI header files based on a 
> list of class name on the
>                                       classpath
>                               -->
>                               <!--
>                                       The generated include directory is 
> automatically added to include
>                                       path at compile phase
>                               -->
>                               <!-- Ensure to have appropriate denpendency jar 
> file(s) in your pom -->
>                               <executions>
>                                       <execution>
>                                               <id>javah</id>
>                                               <phase>generate-sources</phase>
>                                               <configuration>
>                                                       <!--
>                                                               | Note: | 1. 
> Without classNames, javah mojo will search for all
>                                                               JNI classes | 
> in your dependency list.
>                                                       -->
>                                               </configuration>
>                                               <goals>
>                                                       <goal>javah</goal>
>                                               </goals>
>                                       </execution>
>                               </executions>
>                       </plugin>
>               </plugins>
>       </build>
> </project>
> I get the results 
> [INFO] ilink32 "C:\Documents and 
> Settings\djacobsen\workspace\ImagenomicPortratu
> rePluginDLL\target\lib\ImagenomicPortraturePlugin.jar" ",C:\Documents and 
> Settin
> gs\djacobsen\workspace\ImagenomicPortraturePluginDLL\target\ImagenomicPortrature
> PluginDLL.dll" , ,
> Turbo Incremental Link 5.64 Copyright (c) 1997-2002 Borland
> Error: 'C:\DOCUMENTS AND 
> SETTINGS\DJACOBSEN\WORKSPACE\IMAGENOMICPORTRATUREPLUGIN
> DLL\TARGET\LIB\IMAGENOMICPORTRATUREPLUGIN.JAR' contains invalid OMF record, 
> type
>  0x50
> Notice the jar file being passed to the linker.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to