SF.net SVN: ant-contrib: [147] cpptasks/trunk/src

[email protected] Tue, 29 Jan 2008 21:19:46 -0800
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Revision: 147
          http://ant-contrib.svn.sourceforge.net/ant-contrib/?rev=147&view=rev
Author:   carnold
Date:     2008-01-29 21:19:46 -0800 (Tue, 29 Jan 2008)

Log Message:
-----------
Add projectRoot that XCode 3 keeps asking for

Modified Paths:
--------------
    cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java
    cpptasks/trunk/src/samples/hello/build.xml
    cpptasks/trunk/src/samples/hello/src/main/c/hello.c

Modified: cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java
===================================================================
--- cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java	2007-09-22 18:17:58 UTC (rev 146)
+++ cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java	2008-01-30 05:19:46 UTC (rev 147)
@@ -169,8 +169,13 @@
         //
         //    add project to property list
         //
+        //
+        //   Calculate path (typically several ../..) of the root directory
+        //        (where build.xml lives) relative to the XCode project directory.
+        //         XCode 3.0 will now prompt user to supply the value if not specified.
+        String projectRoot = CUtil.getRelativePath(basePath, projectDef.getProject().getBaseDir());
         PBXObjectRef project = createPBXProject(compilerConfigurations, mainGroup,
-                projectDirPath, projectTargets);
+                projectDirPath, projectRoot, projectTargets);
         objects.put(project.getID(), project.getProperties());
 
 
@@ -564,11 +569,13 @@
      * @param mainGroup main group.
      * @param projectDirPath project directory path.
      * @param targets targets.
+     * @param projectRoot projectRoot directory relative to 
      * @return project.
      */
     private static PBXObjectRef createPBXProject(final PBXObjectRef buildConfigurationList,
                                        final PBXObjectRef mainGroup,
                                        final String projectDirPath,
+                                       final String projectRoot,
                                        final List targets) {
         Map map = new HashMap();
         map.put("isa", "PBXProject");
@@ -577,6 +584,7 @@
         map.put("mainGroup", mainGroup.getID());
         map.put("projectDirPath", projectDirPath);
         map.put("targets", targets);
+        map.put("projectRoot", projectRoot);
         return new PBXObjectRef(map);
     }
 

Modified: cpptasks/trunk/src/samples/hello/build.xml
===================================================================
--- cpptasks/trunk/src/samples/hello/build.xml	2007-09-22 18:17:58 UTC (rev 146)
+++ cpptasks/trunk/src/samples/hello/build.xml	2008-01-30 05:19:46 UTC (rev 147)
@@ -19,8 +19,9 @@
     <taskdef resource="cpptasks.tasks"/>
     <target name="compile">
         <mkdir dir="target/main/obj"/>
-        <cc outtype="executable" subsystem="console" outfile="target/hello" objdir="target/main/obj">
+        <cc outtype="static" subsystem="console" outfile="target/hello" objdir="target/main/obj">
            <fileset dir="src/main/c" includes="*.c"/>
+           <project type="xcode" outfile="hello" overwrite="true"/>
         </cc>
     </target>
 </project>

Modified: cpptasks/trunk/src/samples/hello/src/main/c/hello.c
===================================================================
--- cpptasks/trunk/src/samples/hello/src/main/c/hello.c	2007-09-22 18:17:58 UTC (rev 146)
+++ cpptasks/trunk/src/samples/hello/src/main/c/hello.c	2008-01-30 05:19:46 UTC (rev 147)
@@ -21,5 +21,5 @@
 
 int main(int argc, const char** argv) {
    puts("Hello, World.");
-   return 1;
+   return 0;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/