FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

anttasks patch

 
Post new topic   Reply to topic     Forum Index -> Descent
View previous topic :: View next topic  
Author Message
yoda.guo



Joined: 27 Apr 2009
Posts: 2

PostPosted: Mon Apr 27, 2009 10:09 pm    Post subject: anttasks patch Reply with quote

use dmd.exe to link application instead of link.exe,
so can use sc.ini configuration data.
tested with eclipse3.4+dmd1.043+tango+dwt2+ddbi
Code:

Index: src/descent/ant/tasks/DmdWindows.java
===================================================================
--- src/descent/ant/tasks/DmdWindows.java   (revision 1338)
+++ src/descent/ant/tasks/DmdWindows.java   (working copy)
@@ -181,101 +181,43 @@
          if ( dTask.destfile == null ) throw new BuildException("You must specify a target name for your executable via 'destfile' property");
          
          LinkedList<String> cmdline = new LinkedList<String>();
-         cmdline.add( getLinker() );
+         cmdline.add( getCompiler() );
          
-         StringBuilder objectBuilder = new StringBuilder();
-         
-         for( String objName : objFiles ){
-            objectBuilder.append( objName + "+");
-         
-         }
-         
-//          strip off the last '+'
-         if ( objectBuilder.charAt(objectBuilder.length() - 1 ) == '+'){
-            objectBuilder.delete(objectBuilder.length() - 1   , objectBuilder.length());
-         }
-         
          if ( dTask.destfile != null )   {
             try {
-               objectBuilder.append("," + WindowsFilenameConverter.checkForSpaces(dTask.destfile.getParentFile().getAbsolutePath() ) + File.separator + dTask.destfile.getName() );
+               cmdline.add("-of" + WindowsFilenameConverter.checkForSpaces(dTask.destfile.getParentFile().getAbsolutePath() ) + File.separator + dTask.destfile.getName() );
             } catch (FileNotFoundException e) {
                throw new BuildException( "Cannot find the directory for the destfile" );
             }
          }
-         else {
-            objectBuilder.append(",");
-         }
          
+         for( String objName : objFiles ){
+            cmdline.add(objName);      
+         }      
+         
          if ( dTask.mapfile != null ) {
-            objectBuilder.append("," + dTask.mapfile );
+            cmdline.add(dTask.mapfile );
          }
-         else {
-            objectBuilder.append(",");
-         }
          
-         objectBuilder.append(",user32+kernel32+");
-         
          for (LinkLib lib : dTask.linkLibs) {
-            objectBuilder.append(lib.name + "+");
+            cmdline.add(lib.name);
          }
          
-//          strip off the last '+'
-         if ( objectBuilder.charAt(objectBuilder.length() - 1 ) == '+') {
-            objectBuilder.delete(objectBuilder.length() - 1   , objectBuilder.length());
-         }
-         
-         objectBuilder.append("/noi;");
-         
          if ( dTask.deffile != null ) {
-            objectBuilder.append("," + dTask.deffile );
+            cmdline.add(dTask.deffile);
             
          }
-         else objectBuilder.append(",");
          
          if ( dTask.resfile != null) {
-            objectBuilder.append("," + dTask.resfile);
+            cmdline.add(dTask.resfile);
          }
-         else {
-            objectBuilder.append(",");
-         }
          
-         if ( dTask.linkflags.size() > 0 ) {
-            objectBuilder.append("/");
-         }
-      
          for( LinkFlag flag : dTask.linkflags ){
-            objectBuilder.append(flag.value + ";");
+            cmdline.add(flag.value);
          }
 
-         // strip off the last ';'
-         
-         if ( objectBuilder.charAt(objectBuilder.length() - 1 ) == ';') {
-            objectBuilder.delete(objectBuilder.length() - 1   , objectBuilder.length());
-         }
-               
-         cmdline.add(objectBuilder.toString());
-         
-         
-         StringBuilder sb = new StringBuilder();
-         for( String s : cmdline ){
-            sb.append( " " + s );
-         }
-         String libraryPath = dTask.compilerdir + "\\..\\lib;" + dTask.compilerdir + "\\..\\..\\dm\\lib";
-         
-         dTask.log( String.format("Setting Library path to : %s", libraryPath) , Project.MSG_INFO );
-         String[] libOpts = new String[1];
-         libOpts[0] = "LIB=" + libraryPath ;
-          
-         Execute exec = new Execute();
-         exec.setEnvironment(libOpts);
-         
          dTask.log( "Calling linker " + cmdline.toString() , Project.MSG_INFO );
-         exec.setCommandline(cmdline.toArray(new String[0]));
-         try {
-            exec.execute();
-         } catch (IOException e) {
-            throw new BuildException( "Linker can't be started" );
-         }
+         Execute.runCommand(dTask, cmdline.toArray(new String[0]));
          dTask.log( String.format("Built %s", dTask.destfile.getAbsolutePath()), Project.MSG_INFO );
       }
 
@@ -284,8 +226,8 @@
          if ( dTask.destfile == null ) throw new BuildException("You must specify a target name for your library via 'destfile' property");
          
          LinkedList<String> cmdline = new LinkedList<String>();
-         cmdline.add( dTask.compilerdir + "dm\\bin\\lib.exe");
-         cmdline.add("-c");
+         cmdline.add( getCompiler() );
+         cmdline.add("-lib");
          cmdline.add(dTask.destfile.getName());
          
          for( LinkFlag flag : dTask.linkflags ){
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Descent All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group