Home Download Buy Blog Forum Support

run external tools (ant)

run external tools (ant)

Postby corvette on Mon Jan 31, 2011 12:39 am

how can I run an external ant build from the root of a project directory?
corvette
 
Posts: 2
Joined: Mon Jan 31, 2011 12:34 am

Re: run external tools (ant)

Postby jps on Mon Jan 31, 2011 8:39 am

I'll include an ant build system in the next version, but in the mean time you can create one yourself. Save this:

Code: Select all
{
   "cmd": ["ant"],
   "file_regex": "^ *\\[javac\\] (.+):([0-9]+):() (.*)$",
   "working_dir": "${project_path:${folder}}",
   "selector": "source.java"
}


as Packages/Java/Ant.sublime-build, and restart. The location of the Packages directory varies based on operating system; you can navigate to it via Preferences/Browse Packages.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: run external tools (ant)

Postby corvette on Mon Jan 31, 2011 5:56 pm

awesome thanks.

I've tried to adapt the specified code for Android, but Sublime is smarter than I am apparently.

For the simplest cases, when you build an Android app via ant, you can target "compile", "debug", "install", and "release". For instance:
Code: Select all
ant compile

will build any missing classes (such as R.java) and compile your code

Code: Select all
ant debug

as above, and will build an unsigned version of your app

Code: Select all
ant install

same as "ant debug", but will also install the app on a default emulator or physical device


Code: Select all
ant release

create a signed version of your app, assuming you have a keystore specified in your build.properties (which exists in your project root)

So I tried this:

Code: Select all
{
   "cmd": ["ant compile"],
   "working_dir": "${project_path:${folder}}"
}


but I get an error message
Code: Select all
[Errno 2] No such file or directory
[Finished]


How can I fix this? Also, should I be creating a new "build system" for each of the ant targets (compile, debug,install,release)?

tia!
corvette
 
Posts: 2
Joined: Mon Jan 31, 2011 12:34 am

Re: run external tools (ant)

Postby jps on Mon Jan 31, 2011 7:28 pm

The command needs to be entered as ["ant", "compile"] - there's some documentation on build systems at http://sublimetext.info/docs/core/build_systems.html
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: run external tools (ant)

Postby Incendium on Mon Jan 31, 2011 10:26 pm

You could, alternatively, insert a new task in your build file that does all 4 actions.

Code: Select all
<target name="all" depends="compile, debug, install, release" description="Build android application." />


Just drop that in anywhere in the root element (<project>).
Incendium
 
Posts: 10
Joined: Wed Nov 25, 2009 7:06 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 28 guests