diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

Unable to Build Eclipse Client Platform (ECP) Projects #104

Closed drkstr101 closed 4 years ago

drkstr101 commented 4 years ago

Hello,

I apologize if this is not the correct venue for general questions, but I wasn't sure where to ask this.

I am attempting to migrate a working Gradle build that builds the eclipse modeling projects, (EG hello.model, hello.model.edit, hello.model.editor) where the dependencies are managed explicitly, with the appropriate jars sitting in a libs directory. As I now need to add further dependencies to the project, I am looking towards goomph to manage the dependencies automatically.

I was able to build the first project (hello.model) successfully with the following:

hello.model/build.gradle

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

// we need the maven repo from p2
evaluationDependsOn(':target.p2')

repositories {
    jcenter()
    mavenCentral()
    maven {
        url rootProject.file('target.p2/build/p2asmaven/maven')
    }
}

dependencies {

    compile 'eclipse-deps:org.eclipse.emf.ecore:+',
            'eclipse-deps:org.eclipse.emf.common:+',
            'eclipse-deps:org.eclipse.emf.ecore.xmi:+'

    runtime 'eclipse-deps:org.eclipse.core.runtime:+'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12',
            'org.hamcrest:hamcrest:2.1'
}

target.p2/build.gradle

// Download from eclipse and put it into maven
apply plugin: 'com.diffplug.gradle.p2.asmaven'

p2AsMaven {
    group 'eclipse-deps', {
        repoEclipse '4.12.0'
        feature 'org.eclipse.platform'
        feature 'org.eclipse.platform.source'
        feature 'org.eclipse.emf.ecore'
        //Uncommenting line below throws build error
        //feature 'org.eclipse.emf.ecp'
        repo2runnable()
    }
}

I would now like to build hello.model.edit in the same way. According to (https://eclipsesource.com/blogs/tutorials/getting-started-with-the-emf-client-platform/#product), I need the org.eclipse.emf.ecp feature for the org.eclipse.emf.ecp.edit dependency. However, adding this feature to the target.p2 project throws an error during the build process:

... at com.diffplug.gradle.JavaExecable.main(JavaExecable.java:135) Caused by: C:\Users\drkst\AppData\Local\Temp\goomph-ant-build5456272606421021958.xml:2: Unable to find: Installable Unit [ id=org.eclipse.emf.ecp.feature.group ] at org.eclipse.equinox.p2.internal.repository.tools.tasks.AbstractRepositoryTask.prepareIUs(AbstractRepositoryTask.java:187) at org.eclipse.equinox.p2.internal.repository.tools.tasks.MirrorTask.execute(MirrorTask.java:60) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:352) at org.apache.tools.ant.Target.execute(Target.java:437) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:181) at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseBuildFile(InternalAntRunner.java:392) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:682) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:573) ...

I am wondering if maybe I need to somehow add the ECP update site (http://download.eclipse.org/ecp/releases/releases_121/) to the build configuration, but I'm not sure how to go about doing that, or if this is even the right course of action. Any additional guidance or insight on the matter will be greatly appreciated.

Cheers and Thank You!

PS: Gradle Version 5.6.4

PPS: Javadoc links on the main goomph repo appear to be broken, so perhaps this is covered there already

drkstr101 commented 4 years ago

I was able to solve this after poking around in the source, and a little trial-and-error. Solution posted below.

UPDATE I have included the full solution below in case anyone may find it useful.

target.p2/build.gradle

// Download from eclipse and put it into maven
apply plugin: 'com.diffplug.gradle.p2.asmaven'

p2AsMaven {
    group 'eclipse-deps', {
        repo 'http://download.eclipse.org/releases/2019-06'
        repo 'http://download.eclipse.org/ecp/releases/releases_121/'
        feature 'org.eclipse.platform'
        feature 'org.eclipse.platform.source'
        feature 'org.eclipse.emf.ecore'
        iu 'org.eclipse.emf.ecp.edit'
                iu 'org.eclipse.core.runtime'
        iu 'org.eclipse.emf.edit.ui'
        iu 'org.eclipse.emf.common.ui'
        append true //not required for solution
        repo2runnable()
    }
}

hello.model.edit/build.gradle

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

// we need the maven repo from p2
evaluationDependsOn(':target.p2')

repositories {
    jcenter()
    mavenCentral()
    maven {
        url rootProject.file('target.p2/build/p2asmaven/maven')
    }
}

dependencies {

    implementation project(':hello.model')

    compile 'eclipse-deps:org.eclipse.core.runtime:+',
            'eclipse-deps:org.eclipse.osgi:+',
            'eclipse-deps:org.eclipse.emf.edit:+',
            'eclipse-deps:org.eclipse.emf.ecore.change:+'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12',
            'org.hamcrest:hamcrest:2.1'
}

hello.model.editor

plugins {
   // Apply the java-library plugin to add support for Java Library
   id 'java-library'
}

// we need the maven repo from p2
evaluationDependsOn(':target.p2')

repositories {
    jcenter()
    mavenCentral()
    maven {
        url rootProject.file('target.p2/build/p2asmaven/maven')
    }
}

dependencies {

   implementation project(':hello.model'),
           project(':hello.model.edit')

    //some of these may be redundant, but it works
    compile 'eclipse-deps:org.eclipse.core.runtime:+',
            'eclipse-deps:org.eclipse.core.commands:+',
            'eclipse-deps:org.eclipse.emf.edit.ui:+',
            'eclipse-deps:org.eclipse.emf.common.ui:+',
            'eclipse-deps:org.eclipse.equinox.common:+',
            'eclipse-deps:org.eclipse.core.jobs:+',
            'eclipse-deps:org.eclipse.equinox.registry:+',
            'eclipse-deps:org.eclipse.equinox.preferences:+',
            'eclipse-deps:org.eclipse.core.contenttype:+',
            'eclipse-deps:org.eclipse.equinox.app:+',
            'eclipse-deps:org.eclipse.ui.views:+',
            'eclipse-deps:org.eclipse.ui.workbench:+',
            'eclipse-deps:org.eclipse.e4.ui.workbench3:+',
            'eclipse-deps:org.eclipse.ui:+',
            'eclipse-deps:org.eclipse.swt:+',
            'eclipse-deps:org.eclipse.swt.win32.win32.x86_64:+',
            'eclipse-deps:org.eclipse.jface:+',
            'eclipse-deps:org.eclipse.jface.text:+',
            'eclipse-deps:org.eclipse.text:+'
}
nedtwigg commented 4 years ago

Thanks for heads-up re: broken javadoc. Looks like your issue is resolved?

drkstr101 commented 4 years ago

Indeed, it works like a charm. Looks like we have a winner here! I will be using goomph to manage my eclipse builds from now on. I updated my previous comment with the full solution in case anyone else runs into trouble.

Cheers and thank you!