testforstephen / vscode-pde

VSCode extension to support Eclipse PDE
18 stars 4 forks source link

"Go to definition" for SDK in local p2 repository #23

Closed mikadou closed 4 years ago

mikadou commented 4 years ago

Hi, I'm not sure if what I want to achieve can be done with vscode-pde. I'm still new to PDE, OSGI and all this stuff. I have a ordinary (non-OSGI) Java command line application. The application depends on some jar-files in a local directory which is defined in the Gradle build. Everything builds and works as expected.

Now, I would like to navigate the code in VSCode including the dependencies. The sources of the dependencies are located in a local p2 repository. At least that is what I think it is. It is a directory that contains artifacts.jar, content.jar and subdirectories with src.zip files.

Here is what I have tried so far:

  1. Installed vscode-pde extension
  2. Added a target.target file to my project folder. It is pointing to the p2 repository
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <?pde version="3.8"?>
    <target name="RTC-Server-SDK">
    <locations>
        <location path="D:\workbench\rtc-extension-workshop\installs\rtc-server-sdk" type="Profile"/>
    </locations>
    </target>
  3. Adapted Gradle build to modify .classpath
    eclipse {
    classpath {
        containers 'org.eclipse.pde.core.requiredPlugins'
    }
    }

    After updating the project configuration the .classpath file contains the classpathentry

    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
    <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
  4. Right-click on the target.target file and execute Reload Target Platform

Is there something I am missing in order to get this to work?

BTW I tried to figure out by myself how Reload Target Platform works behind the scenes, but I failed to understand where java.pde.reloadTargetPlatform is defined. It is executed in this line.

mikadou commented 4 years ago

Ok, I solved my problem. The error was on my end and had nothing to do with vscode-pde. First, I had to modify the build.gradle script to add the org.eclipse.pde.PluginNature to the .project file. Second, I had to add a META-INF\MANIFEST.MF file which lists dependencies under the Required-Bundle entry.

testforstephen commented 4 years ago

Good to see you fixing it yourself.