Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to create a Std make project ?

Thanks for the reply
 But this does not solve my problem. My problem is not about creating the cproject . It gets created. But when I set build command , binary parser etc information  ,those  things are not getting saved ( both programatically and using the cdt UI).
 
Thanks
Shaiju

On Dec 17, 2007 10:39 AM, 安立君 <lijun@xxxxxxxxxxxxxxx> wrote:

dear Shaiju,
 void createCProject(IProject project){
                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                IProjectDescription description = workspace
                                .newProjectDescription(project.getName());

                NullProgressMonitor Monitor = new NullProgressMonitor();
               
                IProject newProject = CCorePlugin.getDefault ().createCProject(
                                description, newProjectHandle, Monitor, getProjectID());

                // Add the managed build nature and builder
                try {
                        addNature(new SubProgressMonitor(Monitor, 2), newProject);
                } catch (CoreException e) {
                        e.printStackTrace();
                }
                // for c++ project
                if (cfg.getCPPProject()) {
                        CCProjectNature.addCCNature(newProject, Monitor);
                }
                // Add the ManagedProject to the project
                ...
                ManagedBuildManager.saveBuildInfo(newProject, true);

Best regards
                    Lijun
------------------------------------------------------------------
SUNNORTH TECHNOLOGY CO.,LTD.



"Shaiju P Nair" <shaijup.tensilica@xxxxxxxxx>
Sent by: cdt-dev-bounces@xxxxxxxxxxx

2007-12-17 12:31

Please respond to
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>


To
cdt-dev@xxxxxxxxxxx
cc
Subject
[cdt-dev] How to create a Std make project ?





Hello
  I  am trying to create  std make project  programatically .   I created the IProject and  placed necessary natures for it, then I want to create cproject file. I am trying to do that the follwing way, it  creates the cproject file but it does not have the intented information in  it like  the build command, binary parser etc.  Once the project got created I tried to set  those using the CDT UI.  I typed in the build command  , I can see that in UI but the cproject is not getting updated .  Is there anything wrong with the  way in which I create the  project ?
 
 
 void createCProject(IProject project){
  ICProjectDescription des = CoreModel.getDefault().createProjectDescription(project, true);
  ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
  ManagedProject mProj = new ManagedProject(des);
  info.setManagedProject(mProj);
  Configuration cfg = new Configuration(mProj, null, ManagedBuildManager.calculateChildId("0", null), "Default");
  IBuilder bld = cfg.getEditableBuilder();
  if (bld != null) {
   if(bld.isInternalBuilder()){
    IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration (false);
    IBuilder prefBuilder = prefCfg.getBuilder();
    cfg.changeBuilder (prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
    bld = cfg.getEditableBuilder();
    bld.setBuildPath(null);
   }
   bld.setManagedBuildOn(false);
  }
  cfg.setArtifactName((project.getName().trim()));//

    bld.setCommand("elf-make");
   String binErrParserIds[] ={"com.parser.elf"};//need to remove hard code
  cfg.setErrorParserList(binErrParserIds);
  CoreModel.getDefault().setProjectDescription(project, des);

 
}
 
Thanks
Shaiju.P
 _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top