Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hi Mikhail,

I already do so, when getSelectedConfiguration returns null.
See my code:

|  IConfiguration config = info.getSelectedConfiguration();
|  
|  if(config == null)
|    config = info.getDefaultConfiguration();

But according to what you say, I could complete drop the call to getSelectedConfiguration and should only call getDefaultConfiguration, should not I?

Nils

-----Ursprüngliche Nachricht-----
Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Sennikovsky, Mikhail
Gesendet: Freitag, 11. Mai 2007 14:32
An: CDT General developers list.
Betreff: RE: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hi Nils,

Yes, you should use the ManagedBuildManager API for getting this info.

One additional thing I noticed is that you are using IManagedBuildInfo.getSelectedConfiguration(). You might want to use the 
IManagedBuildInfo.getDefaultConfiguration() instead.
The getSelectedConfiguration was used by UI in the old times and should be actually deprecated now.

Mikhail

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Hagge, Nils
Sent: Friday, May 11, 2007 4:16 PM
To: CDT General developers list.
Subject: AW: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Thanks, Mikhail!

It works! I did it this way:

------
private static boolean isCygwin(IProject project)
{
  boolean found = false;
  IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
  IConfiguration config = info.getSelectedConfiguration();
  
  if(config == null)
    config = info.getDefaultConfiguration();
  
  if(config != null)
    for(IToolChain tc = config.getToolChain(); tc != null && !found; tc = tc.getSuperClass())
      found = "cdt.managedbuild.toolchain.gnu.cygwin.base".equals(tc.getId());
  
  return found;
}
------

Is my understanding correct, that it is not possible to get this information directly from attributes from the "ICProject", i.e. without the help from the ManagedBuildManager?

Nils


-----Ursprüngliche Nachricht-----
Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Sennikovsky, Mikhail
Gesendet: Freitag, 11. Mai 2007 11:18
An: CDT General developers list.
Betreff: RE: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hi Nils,

All cygwin tool-chain definition in the 4.0 are based upon the toolchain
of id "cdt.managedbuild.toolchain.gnu.cygwin.base", so to check whether
the tool-chain is a cygwin one you can check whether one of its
superclasses has this ID

Mikhail

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Hagge, Nils
Sent: Friday, May 11, 2007 1:00 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hello! 

In order to find out, if the build is based on the cygwin toolchain, I
use the following code snippet:

-----
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo mbi =
 
org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getBuildInfo(pro
ject);

String s = mbi.getManagedProject().getBaseId();
boolean isCygwin = s.contains("cygwin");
-----

Is there a better way to do that under CDT 4.0.0?

Regards,
Nils
_______________________________________________
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