Difference between revisions of "ApCoCoA-1:HowTo:Tips for developing (Ap)CoCoA with Eclipse"

From ApCoCoAWiki
(Added Mercurial section)
m (Bot: Replacing category HowTo with HowTo Old)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
=Building (Ap)CoCoALib in Eclipse=
 +
*Get Eclipse with the  Eclipse C/C++ Development plug-in's (e.g. download from http://www.eclipse.org/downloads/)
 +
*Uncheck <code>Project > Build automatically</code>, otherwise, every time you save a modified file your project is rebuilt.
 +
*Get (http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html) and unzip CoCoALib in your workspace. (You should currently rename the folder CoCoALib-0.99xx to CoCoALib-0.99)
 +
*Create a new C++ project (e.g., File > New > C++ Project >Makefile Project > Empty Project)
 +
*Add the <code>include</code> directory to the C++ Include directories (Project > Properties > C/C++ General > Paths and Symbols)
 +
*Run <code>./configure</code>, either from the console or with the following Ant code:
 +
 +
 +
<?xml version="1.0"?>
 +
<project name="Demo" basedir="." default="configure">
 +
  <property name="root.dir" value="." />
 +
  <path id="classpath">
 +
    <pathelement location="." />
 +
  </path>
 +
  <target name="configure">
 +
    <exec executable="./configure" dir="${root.dir}">
 +
      &lt;!-- Only needed for ApCoCoA: --&gt;
 +
      <arg value="--with-libconfig=lib.config" />
 +
    </exec>
 +
  </target>
 +
</project>
 +
 +
 +
If Eclipse calls <code>make all</code> before it starts <code>configure</code>, right-click <code>build.xml</code>
 +
and uncheck "Build before launch" under "Run As > External Tools Configuration... > Build".
 +
*Now build the CoCoALib project
 +
*To build ApCoCoALib, follow the same steps as above. To get the latest sources from the Mercurial repository,
 +
# install the Mercurial plug-in (Help > Software Updates > Available Software > Add site... :  http://www.vectrace.com/eclipse-update/)
 +
# Create a new project with the Mercurial "Clone..." wizard.
 +
# Convert the newly cloned project to a C / C++ Project
 +
# Add the <code>include</code> directories from CoCoALib and ApCoCoALib.
 +
# Run <code>configure</code> and build the project as above.
 +
 
=Code completion troubleshooting=
 
=Code completion troubleshooting=
 
==Code completion does not work and my editor window has a gray background==
 
==Code completion does not work and my editor window has a gray background==
 
In this case it could be that you are currently working within a <code>#ifdef SOME_SYMBOL</code> block and the symbol <code>SOME_SYMBOL</code> has not been declared within your Eclipse project. Symbols can be declared by clicking on Project -> Properties -> C/C++ General -> Paths and Symbols -> Symbols. Be sure to declare the symbol for the correct programming language (e.g. "GNU C++").
 
In this case it could be that you are currently working within a <code>#ifdef SOME_SYMBOL</code> block and the symbol <code>SOME_SYMBOL</code> has not been declared within your Eclipse project. Symbols can be declared by clicking on Project -> Properties -> C/C++ General -> Paths and Symbols -> Symbols. Be sure to declare the symbol for the correct programming language (e.g. "GNU C++").
 +
==General search and completion issues
 +
*Make sure to have a CoCoALib project in addition to your ApCoCoA project and set
 +
 +
=Accessing the subversion repository from Eclipse=
 +
==Step 1: Install subversive==
 +
(As for 2012-06-14, Eclipse Indigo)
 +
* <code>Help > Install New Software</code>
 +
* Select to '''Work with''' the Eclipse download site (currently Indigo)
 +
* Under '''Collaboration''' you will find the '''Subversive Team Provider'''
 +
* Install, accept license, restart platform...
 +
* When you use the plugin for the first time, you will be ask to install a connector plug-in. Select at least the latest SVNKit.
 +
 +
 +
(As for 2009-06-10, Eclipse Ganymede SR2)
 +
* <code>Help > Software Updates ... > </code> Tab ''Available Software'' <code>> Add Site...</code>
 +
* For '''subversive''' (http://eclipse.org/subversive/) you will have to add two sites:
 +
** Add site http://download.eclipse.org/technology/subversive/0.7/update-site/ and install at least the Subversive SVN Team Provider plug-in. <br/> Note: In Galileo, you will find the Team Provider in the section Collaboration Tools. It is not necessary to add the site.
 +
** Add site http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/ and install Subversive SVN Connectors and one of the optional implementations (SVNKit or JavaHL). To just get started, choose SVNKit.
 +
* For '''subclipse''' (http://subclipse.tigris.org/)
 +
** Add site http://subclipse.tigris.org/update_1.4.x
 +
** Select at least 'Subclipse'
 +
* Install, accept license, restart platform...
 +
 +
==Step 2: Set up==
 +
* <code> File > New... </code>
 +
* In the wizard selector, select 'Checkout Projects from SVN'
 +
* Next, select ''Create a new repository location''
 +
* The Url for the ApCoCoALib is svn://apcocoa.org/ApCoCoALib, the Url for ApCoCoAPackages is svn://apcocoa.org/ApCoCoAPackages
 +
* Select <code>trunk</code>, Next
 +
* Select ''Check out as a project configured using the New Project Wizard''. This gives you the opportunity to select a C++ project type for the ApCoCoALib and the "standard project type" for the ApCoCoAPackages. Moreover, in most cases, you simply want to check out the HEAD revision. Finish.
 +
* Select the appropriate project type and name the project
 +
* If the project is created, exclude the files <code>.project</code> and <code>.cproject</code> from version control:
 +
** Open the Navigator view (<code>Window > Show View > Navigator</code>
 +
** Right click on the respective files > Team > Add to svn:ignore
 +
 +
==Step 3: Edit your sources and commit your work==
 +
* Edit...
 +
* Right click on the edited resources or folders containing them or the project root > Team > Commit...
 +
* ... 'to be completed'
  
 
=Mercurial plugin troubleshooting=
 
=Mercurial plugin troubleshooting=
 +
'''Please note that the ApCoCoA Mercurial repositories will no longer be maintained.''' The sources are now kept in a Subversion repository; see also [[#Accessing the subversion repository from Eclipse]].
 +
 
==Linux specific problems==
 
==Linux specific problems==
 
In at least one case, it was not possible to push changes into a repository if Eclipse had not been started from a shell. The reason for this was that the password  entered into the password form of the Eclipse Mercurial plugin was ignored and had to been entered manually in the shell instead. It might be worth noting that the password entered in Eclipse was shown in clear text in the shell as well.
 
In at least one case, it was not possible to push changes into a repository if Eclipse had not been started from a shell. The reason for this was that the password  entered into the password form of the Eclipse Mercurial plugin was ignored and had to been entered manually in the shell instead. It might be worth noting that the password entered in Eclipse was shown in clear text in the shell as well.
Line 11: Line 86:
 
*Using a ssh connection: Eclipse has not been started from a shell under Linux. Please see section above. (?)
 
*Using a ssh connection: Eclipse has not been started from a shell under Linux. Please see section above. (?)
 
*Wrong path to repository. In this case the Eclipse error message is very precise.
 
*Wrong path to repository. In this case the Eclipse error message is very precise.
[[Category:HowTo|{{PAGENAME}}]]
+
 
 +
[[Category:HowTo Old]]

Latest revision as of 09:43, 29 October 2020

Building (Ap)CoCoALib in Eclipse

  • Get Eclipse with the Eclipse C/C++ Development plug-in's (e.g. download from http://www.eclipse.org/downloads/)
  • Uncheck Project > Build automatically, otherwise, every time you save a modified file your project is rebuilt.
  • Get (http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html) and unzip CoCoALib in your workspace. (You should currently rename the folder CoCoALib-0.99xx to CoCoALib-0.99)
  • Create a new C++ project (e.g., File > New > C++ Project >Makefile Project > Empty Project)
  • Add the include directory to the C++ Include directories (Project > Properties > C/C++ General > Paths and Symbols)
  • Run ./configure, either from the console or with the following Ant code:


<?xml version="1.0"?>
<project name="Demo" basedir="." default="configure">
 <property name="root.dir" value="." />
 <path id="classpath">
   <pathelement location="." />
 </path>
 <target name="configure">
   <exec executable="./configure" dir="${root.dir}">
     <!-- Only needed for ApCoCoA: -->
     <arg value="--with-libconfig=lib.config" />
   </exec>
 </target>
</project>


If Eclipse calls make all before it starts configure, right-click build.xml and uncheck "Build before launch" under "Run As > External Tools Configuration... > Build".

  • Now build the CoCoALib project
  • To build ApCoCoALib, follow the same steps as above. To get the latest sources from the Mercurial repository,
  1. install the Mercurial plug-in (Help > Software Updates > Available Software > Add site... : http://www.vectrace.com/eclipse-update/)
  2. Create a new project with the Mercurial "Clone..." wizard.
  3. Convert the newly cloned project to a C / C++ Project
  4. Add the include directories from CoCoALib and ApCoCoALib.
  5. Run configure and build the project as above.

Code completion troubleshooting

Code completion does not work and my editor window has a gray background

In this case it could be that you are currently working within a #ifdef SOME_SYMBOL block and the symbol SOME_SYMBOL has not been declared within your Eclipse project. Symbols can be declared by clicking on Project -> Properties -> C/C++ General -> Paths and Symbols -> Symbols. Be sure to declare the symbol for the correct programming language (e.g. "GNU C++"). ==General search and completion issues

  • Make sure to have a CoCoALib project in addition to your ApCoCoA project and set

Accessing the subversion repository from Eclipse

Step 1: Install subversive

(As for 2012-06-14, Eclipse Indigo)

  • Help > Install New Software
  • Select to Work with the Eclipse download site (currently Indigo)
  • Under Collaboration you will find the Subversive Team Provider
  • Install, accept license, restart platform...
  • When you use the plugin for the first time, you will be ask to install a connector plug-in. Select at least the latest SVNKit.


(As for 2009-06-10, Eclipse Ganymede SR2)

Step 2: Set up

  • File > New...
  • In the wizard selector, select 'Checkout Projects from SVN'
  • Next, select Create a new repository location
  • The Url for the ApCoCoALib is svn://apcocoa.org/ApCoCoALib, the Url for ApCoCoAPackages is svn://apcocoa.org/ApCoCoAPackages
  • Select trunk, Next
  • Select Check out as a project configured using the New Project Wizard. This gives you the opportunity to select a C++ project type for the ApCoCoALib and the "standard project type" for the ApCoCoAPackages. Moreover, in most cases, you simply want to check out the HEAD revision. Finish.
  • Select the appropriate project type and name the project
  • If the project is created, exclude the files .project and .cproject from version control:
    • Open the Navigator view (Window > Show View > Navigator
    • Right click on the respective files > Team > Add to svn:ignore

Step 3: Edit your sources and commit your work

  • Edit...
  • Right click on the edited resources or folders containing them or the project root > Team > Commit...
  • ... 'to be completed'

Mercurial plugin troubleshooting

Please note that the ApCoCoA Mercurial repositories will no longer be maintained. The sources are now kept in a Subversion repository; see also #Accessing the subversion repository from Eclipse.

Linux specific problems

In at least one case, it was not possible to push changes into a repository if Eclipse had not been started from a shell. The reason for this was that the password entered into the password form of the Eclipse Mercurial plugin was ignored and had to been entered manually in the shell instead. It might be worth noting that the password entered in Eclipse was shown in clear text in the shell as well.

Push fails

There are several (unconfirmed) reasons why this might happen.

  • Using a ssh connection: Eclipse has not been started from a shell under Linux. Please see section above. (?)
  • Wrong path to repository. In this case the Eclipse error message is very precise.