• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xcode 3.1 and Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode 3.1 and Java


  • Subject: Re: Xcode 3.1 and Java
  • From: Greg Guerin <email@hidden>
  • Date: Fri, 19 Sep 2008 14:56:44 -0700

Chris Goedde wrote:

(1) Right now, to add or delete files to the src folder in the project, the only thing I've figured out is to close the project, drag files into or out of the folder in the Finder, then reopen the project. Surely there's a better way?

First, confirm that your src folder in Xcode's Groups & Files list is blue. If it's yellow, it's only a group, and will want it to be a folder (blue).


You can create files in Xcode, directly in your src folder. There are menu items and contextual menu items that Add a file.

You might find it more useful to use the Project Organizer window. Choose it under the Window menu. There's more info on it in Xcode's help and builtin docs.


(2) What build settings can be set in Xcode proper and what setting require editing of build.xml? For example, if I switch the build configuration for a Java applet from Debug to Release, does that actually do anything? Or do I have to edit the <property name="compile.debug" value="true"/> line in build.xml?

For the default case, i.e. Xcode's default Ant-based Java project template, you have to edit build.xml.


However, your Xcode project might already be set up to pass more information to Ant. Or you could set it up so it does.

First, you should probably read the Xcode docs about using external build tools. Ant is an external build tool, and 'make' is another one. The basic idea is that there's an external tool with some kind of build-file (build.xml for ant, makefile for make). The external tool knows how to interpret the build-file; Xcode doesn't. What Xcode DOES know how to do is build a target.

Under the Targets item in Groups & Files, double-click your current project's target. It should open a Target Info window. On the left, select Build Tool Configuration under Settings. (I'm using the Xcode 3.0 wording, so Xcode 3.1 may be different.)

Notice the path to the external build tool, and the arguments. Now, if you know how to use Ant from the command-line, it should be clear that you can add arguments here, such as predefined symbols, JVM options, and so on.

Next, notice the $(ACTION) in the default arguments. This will be the value "clean" if you tell Xcode to Clean or Clean All your project. Xcode will do that substitution before invoking ant, so ant will see an arg of "clean".

For a normal build, $(ACTION) is "install", IIRC. This is documented in the Xcode docs, so look up keywords: build action.

Now, the particular build configuration (e.g. Debug or Release) is another substitutable parameter, named $(CONFIGURATION). So you can use that information, along with knowledge of ant's command-line args, to setup different build parameters in the Build Tool Configuration.

Also be aware that there is a separate setup under Build Tool Configuration for each named target configuration. You choose the one you're editing using the popup labeled "Settings show <Debug> configuration" near the top of the Target info window. Because these are separate setups, you don't necessarily have to use $ (CONFIGURATION). You can just edit the args to ant directly.

The other thing Xcode will do is put settings into environment variables, so they can be accessible to external tools it runs. So if Ant has env access, you can use that. You can see the env-vars if you look at the detailed build transcript in the Build Results window.

So using either the $(SETTING_NAME) form in the args to the build tool, or the environment variables, you can set, edit, or change build settings in Xcode's normal build-settings pane and they will be reflected in your builds.

Yes, you have to set this all up yourself. However, once done, you can use that project as a template in the future.

As I understand it, when Ant support was added to Xcode, it was mainly intended for importing existing projects that were already Ant- based. That is, the typical scenario was likely to be someone with an existing Ant-based build (i.e. existing build.xml, existing ant properties files, existing src tree, etc.) who wanted to build it under Xcode. For that scenario, it's pretty straightforward. You just create the basic Java project, then swap in your own src dir, your own build.xml, your own lib dir, etc. Because the Target Info window has separate configs for Debug and Release, you just type the ant command-line args straight into the little text-box: one set of args for Debug and another set for Release.

Also, the docs on doing Antish stuff in Xcode used to be better. I think they got sidelined due to lack of demand or itnerest. You might find some older stuff in the links at the following URL.

  http://developer.apple.com/java/

  -- GG

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Custom component fails to load images by name in a IBPlugin
  • Next by Date: Problems with deployment target when building with xcodebuild
  • Previous by thread: Re: Xcode 3.1 and Java
  • Next by thread: "CFAllocatorCreate(): Shouldn't be called when GC is enabled!"
  • Index(es):
    • Date
    • Thread