Repository: incubator-edgent Updated Branches: refs/heads/master a62eb24a0 -> bd71ad824
[WIP] [ci-skip] Edgent-251 adapt Eclipse to not use 3rd-party repo jars - add 'setupExternalJars' gradle task - change .classpath files to reference ext jars in build/distribution/... Note, the changes DO NOT include removal of the 3rd party jars from our repo (though in my workspace I removed them and Eclipse builds/test of Edgent worked fine). A separate issue/PR will be used to remove them. This approach has the same characteristics as the current Eclipse/ant build environments: separate project dependency specifications, separate class file locations, Eclipse builds/tests don't use the ant/gradle built Edgent jars. My initial experience trying to use the Buildship gradle/Eclipse integration came up short. The way it created/updated .classpath files as a result of the way dependencies are expressed in our build.gradle files was problematic. So, I scoped back to the approach here to get to the end-goal (removal of dependency of 3rd party jars in the repo) asap. Should revisit the buildship env later to see if things can be made to work. Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/9fe77e7f Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/9fe77e7f Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/9fe77e7f Branch: refs/heads/master Commit: 9fe77e7f4a2a6156822664c505950fc61f7fcf45 Parents: b0d44b5 Author: Dale LaBossiere <dlab...@us.ibm.com> Authored: Thu Sep 29 13:41:26 2016 -0400 Committer: Dale LaBossiere <dlab...@us.ibm.com> Committed: Thu Sep 29 13:42:01 2016 -0400 ---------------------------------------------------------------------- DEVELOPMENT.md | 12 ++++++-- analytics/.classpath | 2 +- build.gradle | 49 +++++++++++++++++++++---------- connectors/.classpath | 72 +++++++++++++++++++++++----------------------- console/.classpath | 18 ++++++------ ext/.classpath | 8 +++--- samples/.classpath | 1 - 7 files changed, 94 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/DEVELOPMENT.md ---------------------------------------------------------------------- diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index aa48537..c5e4594 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -313,9 +313,13 @@ Notes with the above PR merge directions: ### Using Eclipse -The repo contains Eclipse project definitions for the top-level directories that +The Edgent git repository contains Eclipse project definitions for the top-level directories that contain code, such as api, runtime, connectors. +*The repository does not include the 3rd party jars that Edgent depends on +and Eclipse builds of Edgent projects will fail until a gradle task is run +to make them available in your workspace. See the steps below.* + Using the plugin Eclipse Git Team Provider allows you to import these projects into your Eclipse workspace directly from your fork. @@ -327,7 +331,11 @@ into your Eclipse workspace directly from your fork. 1. Select the branch, usually master and click Next 1. Set the directory where your local clone will be stored and click Next (the directory edgent under this directory is where you can build and run tests using the Ant targets) 1. Select Import existing Eclipse projects and click Next -1. In the Import Projects window, make sure that the Search for nested projects checkbox is selected. Click Finish to bring in all Edgent projects +1. In the Import Projects window, make sure that the Search for nested projects checkbox is selected. Click Finish to bring in all Edgent projects. *Expect build failures until you...* +1. Run a gradle task to make all of the dependant 3rd party jars available to Eclipse. +``` sh +$ ./gradlew setupExternalJars +``` The project `_edgent` exists to make the top level artifacts such as `build.xml` manageable via Eclipse. Unfortunately folders for the http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/analytics/.classpath ---------------------------------------------------------------------- diff --git a/analytics/.classpath b/analytics/.classpath index ea484a1..e013749 100644 --- a/analytics/.classpath +++ b/analytics/.classpath @@ -4,7 +4,7 @@ <classpathentry kind="src" path="math3/src/test/java"/> <classpathentry kind="src" path="sensors/src/main/java"/> <classpathentry kind="src" path="sensors/src/test/java"/> - <classpathentry exported="true" kind="lib" path="math3/ext/commons-math3-3.4.1/commons-math3-3.4.1.jar"/> + <classpathentry exported="true" kind="lib" path="../build/distributions/java8/analytics/math3/ext/commons-math3-3.4.1.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry combineaccessrules="false" kind="src" path="/api"/> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 2657beb..60ee8f6 100644 --- a/build.gradle +++ b/build.gradle @@ -354,6 +354,34 @@ subprojects { addTargetDirExtJarDependency 'runtime', 'slf4j-jdk14-1.7.12.jar' } } + + ext.copyProjectExtJarsFn = { + // Copy the project jar's "private" external dependencies (transitively) + // into the project's ext dir in the target-dir. + + // If our project's jar task lacks any actions (e.g., platform:android) + // there's nothing to do. + if (!jar.actions) + return + + // FYI we're getting more transitive ext deps than the ant build + // in some cases - e.g., for watson iot we "knew" we only needed a subset + // of all watson iot deps known to maven + + def projectExtDir = project.targetRelProjExtDir + def nonCommonExtFiles = getProjectNonCommonExtDepFiles(project) + logger.info "$project.path copying projExtDepFiles jars: "+nonCommonExtFiles.collect { it.getName() } + copy { + from nonCommonExtFiles + includeEmptyDirs = false + into "$target_java8_dir/$projectExtDir" + } + } + + task copyProjectExtJars << { + // Helper for setupExternalJars task + copyProjectExtJarsFn() + } jar { // adjust jar task config and also augment the task to do our additional processing @@ -373,21 +401,7 @@ subprojects { } doLast { - // Copy the project jar's "private" external dependencies (transitively) - // into the project's ext dir in the target-dir. - - // FYI we're getting more transitive ext deps than the ant build - // in some cases - e.g., for watson iot we "knew" we only needed a subset - // of all watson iot deps known to maven - - def projectExtDir = targetRelProjExtDir - def nonCommonExtFiles = getProjectNonCommonExtDepFiles(project) - logger.info "$project.path copying projExtDepFiles jars: "+nonCommonExtFiles.collect { it.getName() } - copy { - from nonCommonExtFiles - includeEmptyDirs = false - into "$target_java8_dir/$projectExtDir" - } + copyProjectExtJarsFn() } } @@ -674,6 +688,11 @@ build { reports.mustRunAfter filteredSubprojects.build } +task setupExternalJars { + description = 'Add all of the dependant external jars to the target-dir (make available to Eclipse, etc)' + dependsOn copyCommonExtJars, filteredSubprojects.copyProjectExtJars +} + task wrapper(type: Wrapper) { jarFile = rootProject.file('.gradle-wrapper/gradle-wrapper.jar') } http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/connectors/.classpath ---------------------------------------------------------------------- diff --git a/connectors/.classpath b/connectors/.classpath index 97114a7..cae5a4e 100644 --- a/connectors/.classpath +++ b/connectors/.classpath @@ -28,42 +28,42 @@ <classpathentry kind="src" path="wsclient-javax.websocket/src/main/java"/> <classpathentry kind="src" path="wsclient-javax.websocket/src/test/java"/> <classpathentry kind="src" path="javax.websocket-client/src/main/resources"/> - <classpathentry kind="lib" path="http/ext/commons-codec-1.10.jar"/> - <classpathentry kind="lib" path="http/ext/commons-logging-1.2.jar"/> - <classpathentry kind="lib" path="http/ext/httpclient-4.5.1.jar"/> - <classpathentry kind="lib" path="http/ext/httpcore-4.4.4.jar"/> - <classpathentry kind="lib" path="iotp/ext/watson-iot-0.1.1.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/common-lang3.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/commons-codec-1.10.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/commons-logging-1.2.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/commons-net-3.3.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/httpclient-4.5.1.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/httpcore-4.4.4.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/joda-time-2.9.2.jar"/> - <classpathentry kind="lib" path="iotp/ext/lib/org.eclipse.paho.client.mqttv3-1.0.3-20150818.040635-202.jar"/> - <classpathentry kind="lib" path="kafka/ext/kafka_2.10-0.8.2.2.jar"/> - <classpathentry kind="lib" path="kafka/ext/kafka-clients-0.8.2.2.jar"/> - <classpathentry kind="lib" path="kafka/ext/log4j-1.2.16.jar"/> - <classpathentry kind="lib" path="kafka/ext/metrics-core-2.2.0.jar"/> - <classpathentry kind="lib" path="kafka/ext/scala-library-2.10.4.jar"/> - <classpathentry kind="lib" path="kafka/ext/zkclient-0.3.jar"/> - <classpathentry kind="lib" path="kafka/ext/zookeeper-3.4.6.jar"/> - <classpathentry kind="lib" path="mqtt/ext/org.eclipse.paho.client.mqttv3-1.0.2.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/javax-websocket-client-impl-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/javax.websocket-api-1.0.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/jetty-util-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/websocket-api-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/websocket-client-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-client/ext/websocket-common-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/javax-websocket-server-impl-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/jetty-http-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/jetty-io-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/jetty-security-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/jetty-server-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/jetty-servlet-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/servlet-api-3.1.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/websocket-server-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="javax.websocket-server/ext/websocket-servlet-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/http/ext/commons-codec-1.9.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/http/ext/commons-logging-1.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/http/ext/httpclient-4.5.1.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/http/ext/httpcore-4.4.4.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/watson-iot-0.1.5.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/commons-lang3-3.4.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/commons-codec-1.10.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/commons-logging-1.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/commons-net-3.3.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/httpclient-4.5.1.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/httpcore-4.4.3.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/joda-time-2.9.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/iotp/ext/org.eclipse.paho.client.mqttv3-1.1.0.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/kafka_2.10-0.8.2.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/kafka-clients-0.8.2.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/log4j-1.2.16.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/metrics-core-2.2.0.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/scala-library-2.10.4.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/zkclient-0.3.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/kafka/ext/zookeeper-3.4.6.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/mqtt/ext/org.eclipse.paho.client.mqttv3-1.0.2.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/javax-websocket-client-impl-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/javax.websocket-api-1.0.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/jetty-util-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/websocket-api-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/websocket-client-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-client/ext/websocket-common-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/javax-websocket-server-impl-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/jetty-http-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/jetty-io-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/jetty-security-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/jetty-server-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/jetty-servlet-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/javax.servlet-api-3.1.0.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/websocket-server-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/connectors/javax.websocket-server/ext/websocket-servlet-9.3.6.v20151106.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry combineaccessrules="false" kind="src" path="/api"/> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/console/.classpath ---------------------------------------------------------------------- diff --git a/console/.classpath b/console/.classpath index 0053b83..07eb4d8 100644 --- a/console/.classpath +++ b/console/.classpath @@ -3,15 +3,15 @@ <classpathentry kind="src" path="server/src/main/java"/> <classpathentry kind="src" path="server/src/test/java"/> <classpathentry kind="src" path="servlets/src/main/java"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-http-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-io-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-security-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-server-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-servlet-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-util-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-webapp-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/jetty-xml-9.3.6.v20151106.jar"/> - <classpathentry kind="lib" path="server/ext/jetty-9.3.6/servlet-api-3.1.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-http-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-io-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-security-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-server-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-servlet-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-util-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-webapp-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/jetty-xml-9.3.6.v20151106.jar"/> + <classpathentry kind="lib" path="../build/distributions/java8/console/server/ext/javax.servlet-api-3.1.0.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry combineaccessrules="false" kind="src" path="/ext"/> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/ext/.classpath ---------------------------------------------------------------------- diff --git a/ext/.classpath b/ext/.classpath index 1aff7c0..2541ec5 100644 --- a/ext/.classpath +++ b/ext/.classpath @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry exported="true" kind="lib" path="google-gson-2.2.4/gson-2.2.4.jar" sourcepath="google-gson-2.2.4/gson-2.2.4-sources.jar"/> - <classpathentry exported="true" kind="lib" path="metrics-3.1.2/metrics-core-3.1.2.jar" sourcepath="metrics-3.1.2/metrics-core-3.1.2-sources.jar"/> - <classpathentry exported="true" kind="lib" path="slf4j-1.7.12/slf4j-api-1.7.12.jar"/> - <classpathentry exported="true" kind="lib" path="slf4j-1.7.12/slf4j-jdk14-1.7.12.jar"/> + <classpathentry exported="true" kind="lib" path="../build/distributions/java8/ext/gson-2.2.4.jar"/> + <classpathentry exported="true" kind="lib" path="../build/distributions/java8/ext/metrics-core-3.1.2.jar"/> + <classpathentry exported="true" kind="lib" path="../build/distributions/java8/ext/slf4j-api-1.7.12.jar"/> + <classpathentry exported="true" kind="lib" path="../build/distributions/java8/ext/slf4j-jdk14-1.7.12.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/9fe77e7f/samples/.classpath ---------------------------------------------------------------------- diff --git a/samples/.classpath b/samples/.classpath index 60f029f..d864d95 100644 --- a/samples/.classpath +++ b/samples/.classpath @@ -3,7 +3,6 @@ <classpathentry kind="src" path="apps/src/main/java"/> <classpathentry kind="src" path="connectors/src/main/java"/> <classpathentry kind="src" path="console/src/main/java"/> - <classpathentry excluding="org/apache/edgent/samples/scenarios/iotp/range/sensor/" kind="src" path="scenarios/src/main/java"/> <classpathentry kind="src" path="topology/src/main/java"/> <classpathentry kind="src" path="utils/src/main/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>