Bug 289704 - Please avoid using the project name in .cproject to simplify project renames
Summary: Please avoid using the project name in .cproject to simplify project renames
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 6.0   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
: 309225 461957 (view as bug list)
Depends on: 280677
Blocks:
  Show dependency tree
 
Reported: 2009-09-17 05:08 EDT by Jens Seidel CLA
Modified: 2020-09-04 15:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Seidel CLA 2009-09-17 05:08:30 EDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.13) Gecko/2009082006 Iceweasel/3.0.12 (Debian-3.0.12-1)
Build Identifier: 3.5

Currently the autotools plugin write a few times the current project name into .cproject.

Examples:
<configuration artifactExtension="" artifactName="myProject" ...>

buildPath="${workspace_loc:/myProject/debug}"

At least for references to directories it is probably not yet possible to avoid this as there exists no variable to access the absolute source directory. Stuff such as ${workspace_loc:/${ProjName}/debug}" is known to be fragile (found once a bug report for CDT?) and is parsed to "${ProjName}/debug}" IIRC.

Nevertheless you probably agree that it is  good idea to avoid using the project name in the file to simplify renaming.

Reproducible: Always




Autotools version: 0.3.0
Comment 1 Jeff Johnston CLA 2009-09-30 17:46:36 EDT
(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.13)
> Gecko/2009082006 Iceweasel/3.0.12 (Debian-3.0.12-1)
> Build Identifier: 3.5
> 
> Currently the autotools plugin write a few times the current project name into
> .cproject.
> 
> Examples:
> <configuration artifactExtension="" artifactName="myProject" ...>
> 
> buildPath="${workspace_loc:/myProject/debug}"
> 
> At least for references to directories it is probably not yet possible to avoid
> this as there exists no variable to access the absolute source directory. Stuff
> such as ${workspace_loc:/${ProjName}/debug}" is known to be fragile (found once
> a bug report for CDT?) and is parsed to "${ProjName}/debug}" IIRC.
> 
> Nevertheless you probably agree that it is  good idea to avoid using the
> project name in the file to simplify renaming.
> 

The build path specification in the .cproject file is done by the upstream CDT code and not part of the Autotools plugin.  I am forwarding this on to the CDT folks.  If you have a rename scenario that is failing, please add details here.
Comment 2 Jeff Johnston CLA 2009-09-30 17:47:30 EDT
Correcting the CDT version number of the bug.
Comment 3 Andrew Gvozdev CLA 2009-09-30 18:14:49 EDT
(In reply to comment #0)
> <configuration artifactExtension="" artifactName="myProject" ...>
bug 230165 was fixed - using ${ProjName} for artifact name now.

> buildPath="${workspace_loc:/myProject/debug}"

> At least for references to directories it is probably not yet possible to avoid
> this as there exists no variable to access the absolute source directory. Stuff
> such as ${workspace_loc:/${ProjName}/debug}" is known to be fragile (found once
> a bug report for CDT?) and is parsed to "${ProjName}/debug}" IIRC.

There was a bug 237448 which was fixed at least for include paths and it seems to be working for build directory too. Not sure about source folders though.
Comment 4 Jens Seidel CLA 2010-04-09 11:35:22 EDT
I renamed again a project using Eclipse but the buildLocation did not change properly:

.project:

<projectDescription>
  <buildSpec>
     <buildCommand>
      <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
      <arguments>
        <dictionary>
          <key>org.eclipse.cdt.make.core.buildLocation</key>
          <value>${workspace_loc:/myProject}/debug</value>

I expected to see myProjectNew instead of myProject.

The problem with buildPath= in .cproject remains open as well.

There is also the following entry in .cproject:
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
    <project id="myProject.org.eclipse.linuxtools.cdt.autotools.core.projectType.1504544154" name="GNU Autotools" projectType="org.eclipse.linuxtools.cdt.autotools.core.projectType"/>
  </storageModule>

Since I don't want to contain it the old name myProject I changed it. The corresponding file in my workspace (.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.managedbuilder.core.prefs) seems not to contain important settings and I hope it will be filled with defaults for the new project name. I would much prefer having it in .settings/ as other stuff and assume it's just unimportant!

CDT 3.6 M6
Autotools: daily snapshot
Comment 5 Jeff Johnston CLA 2010-04-14 17:11:58 EDT
(In reply to comment #4)
> I renamed again a project using Eclipse but the buildLocation did not change
> properly:
> 
> .project:
> 
> <projectDescription>
>   <buildSpec>
>      <buildCommand>
>       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
>       <arguments>
>         <dictionary>
>           <key>org.eclipse.cdt.make.core.buildLocation</key>
>           <value>${workspace_loc:/myProject}/debug</value>
> 
> I expected to see myProjectNew instead of myProject.
> 
> The problem with buildPath= in .cproject remains open as well.
> 

The previous two problems exist in the CDT.  They occur for a regular ManagedMake project.  I have opened an upstream bug: 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=309225

> There is also the following entry in .cproject:
> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
>     <project
> id="myProject.org.eclipse.linuxtools.cdt.autotools.core.projectType.1504544154"
> name="GNU Autotools"
> projectType="org.eclipse.linuxtools.cdt.autotools.core.projectType"/>
>   </storageModule>
> 

This data is also written by the CDT (not Autotools).  We just happen to have a project type defined in the build definition.

> Since I don't want to contain it the old name myProject I changed it. The
> corresponding file in my workspace
> (.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.managedbuilder.core.prefs)
> seems not to contain important settings and I hope it will be filled with
> defaults for the new project name. I would much prefer having it in .settings/
> as other stuff and assume it's just unimportant!
> 
> CDT 3.6 M6
> Autotools: daily snapshot
Comment 6 Andrew Gvozdev CLA 2010-04-17 09:20:14 EDT
*** Bug 309225 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Gvozdev CLA 2010-04-17 09:30:00 EDT
I think that we should shoot for using ${ProjName} in those. Changing build directory to ${workspace_loc:/${ProjName}/Debug} when a project is created should be pretty straightforward (and I believe it works by now) if anybody wants to take a shot. Other places could be tricky.
Comment 8 Dani Megert CLA 2019-06-06 04:35:07 EDT
*** Bug 461957 has been marked as a duplicate of this bug. ***