Here's something I picked up from Cafe's site. It's a macro designed to be run from
the IDE to produce a makefile. Given some work, it can be adjusted to create
build.xml files. If you're interested, I'm interested in making it a project to
eventually distribute to other Cafe developers. If interested, please respond to me
directly.
[EMAIL PROTECTED]
.....
import com.symantec.itools.vcafe.macro.VisualCafeCommand;
import com.symantec.itools.vcafe.openapi.*;
import java.io.*;
/** Simple macro to generate a makefile on the current project
*
* @author David Bustin (Symantec)
* @version 0.1 (February 15th 1999)
*
* Fixes needed (change to creat an Ant build.xml):
*
* -- doesn't correctly..start from scratch
* -- unlike ant all directories are one
* -- use ECS to create build.xml
*
* $build.dir = . -- allows these to be reset as you move across environs
* $src.dir = .
* $base.dir = .
*
*
*/
public class GenerateMakeFile
{
public GenerateMakeFile() {}
public void write(String s)
{
try {
makefile.write(s, 0, s.length());
}
catch(IOException e)
{
System.out.println("IOException " + e.toString());
}
}
private String getClassName(String s)
{
int i = s.indexOf(".java");
return new String(s.substring(0,i));
}
public void run()
{
VisualProject project = VisualCafe.getVisualCafe().getTargetProject();
fullProjectName = project.getProjectName();
System.out.println("Generating makefile for project [" + fullProjectName +
"]");
int lastbs = fullProjectName.lastIndexOf(new String("\\"));
lastbs++;
projectDir = fullProjectName.substring(0, lastbs);
makefileName = projectDir + "makefile";
int lastDot = fullProjectName.lastIndexOf(new String(".vep"));
projectName = fullProjectName.substring(lastbs,lastDot);
try {
makefile = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(makefileName)));
write("# makefile for project " + fullProjectName);
write("\n\n");
write("DIR="+ projectDir + "\n\n");
ProjectFile projectFiles[] =
project.getProjectFiles(ProjectFile.USER_ADDED);
// Write Source files
write("SOURCE_FILES = ");
for (int i = 0; i < projectFiles.length; i++)
{
String fileName = projectFiles[i].getSourceFile().getName().toString();
if (fileName.indexOf(".java") == -1)
continue;
write("$(DIR)\\" + fileName + " ");
}
write("\n\n");
// Write Class files
write("CLASS_FILES = ");
for (int i = 0; i < projectFiles.length; i++)
{
String fileName = projectFiles[i].getSourceFile().getName().toString();
if (fileName.indexOf(".java") == -1)
continue;
write("$(DIR)\\" + getClassName(fileName) + ".class ");
}
write("\n\n");
// write COMPILE and FLAGS line
write("FLAGS=-g -cdb " + projectName + ".cdb -make\n\n");
write("COMPILE=sj\n\n");
// write main rule
write("all: $(CLASS_FILES)\n");
write("\t$(COMPILE) $(FLAGS) $(SOURCE_FILES)\n\n");
// write clean rule
write("clean:\n");
write("\tdel *.class\n\n");
// Write source file dependencies
for (int i = 0; i < projectFiles.length; i++)
{
String fileName = projectFiles[i].getSourceFile().getName().toString();
if (fileName.indexOf(".java") == -1)
continue;
String className = getClassName(fileName);
write("$(DIR)\\" + className + ".class: $(DIR)\\" + className +
".java\n");
}
write("\n");
makefile.close();
System.out.println("Generated makefile [" + makefileName + "]");
}
catch(IOException e) {
System.out.println("IOException: " + e.toString());
}
}
private BufferedWriter makefile;
private String projectDir;
private String fullProjectName;
private String projectName;
private String makefileName;
}
---------- Original Message ----------------------------------
From: Ross Johnson <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Tue, 20 Feb 2001 07:38:12 -0800 (PST)
>Hello everyone -
>
>I'm in the processing of creating a semi-standardized Ant-based build
>environment for my company's developers, and in the "make the case"
>section of my documentation, I'm trying to make that point that Ant
>commands can be integrated into many IDE's. I, for one, use Kawa, and
>I have added several Ant commands to my menus. I know someone else
>who's doing this with UltaEdit, as well.
>
>So I'm just curious how many other people have done similar things with
>other editors/IDE's, and also which IDE's won't support such external
>commands? For instance, I couldn't figure out how to insert
>commandline calls into Visual Cafe.
>
>Any experiences you're willing to share are appreciated.
>
>-Ross
>
>
>__________________________________________________
>Do You Yahoo!?
>Get personalized email addresses from Yahoo! Mail - only $35
>a year! http://personal.mail.yahoo.com/
>