rework get-edgent-jars.sh, add get-edgent-jars-project The new approach uses the same maven "distribution" mechanism that as the source release's "mvn package -Pdistribution". The commonality of the generated bundles is goodness and the included DEPENDENCIES (licensing doc) file is valuable for users. At this time the original script is retained as old-get-edgent-jars.sh. Updated relevant doc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/commit/fdc2723c Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/tree/fdc2723c Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/diff/fdc2723c Branch: refs/heads/develop Commit: fdc2723cfc27896c69b5fc6ec1fe1c1eca0a1b1c Parents: e1812af Author: Dale LaBossiere <dlab...@us.ibm.com> Authored: Tue Oct 17 13:59:03 2017 -0400 Committer: Dale LaBossiere <dlab...@us.ibm.com> Committed: Tue Oct 17 13:59:03 2017 -0400 ---------------------------------------------------------------------- .gitignore | 3 - APPLICATION_DEVELOPMENT.md | 59 +---- get-edgent-jars-project/.gitignore | 6 + get-edgent-jars-project/README.md | 54 ++++ get-edgent-jars-project/get-edgent-jars.sh | 226 +++++++++++++++++ get-edgent-jars-project/old-get-edgent-jars.sh | 254 +++++++++++++++++++ get-edgent-jars-project/pom.xml.template | 148 +++++++++++ .../src/assembly/distribution.xml | 81 ++++++ .../src/main/resources/README | 12 + get-edgent-jars.sh | 254 ------------------- template/README.md | 7 + 11 files changed, 797 insertions(+), 307 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index ea30b70..128a2d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -# get-edgent-jars generated outout -get-edgent-jars-project - *.class # Local developers toolchain http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/APPLICATION_DEVELOPMENT.md ---------------------------------------------------------------------- diff --git a/APPLICATION_DEVELOPMENT.md b/APPLICATION_DEVELOPMENT.md index 44e3230..3166931 100644 --- a/APPLICATION_DEVELOPMENT.md +++ b/APPLICATION_DEVELOPMENT.md @@ -17,8 +17,6 @@ # Edgent Application Development, Packaging and Execution. -This file is a work-in-progress. - To develop Edgent applications you will utilize the Edgent SDK/runtime jars and package your application artifacts for deploying to an edge device for execution. @@ -78,9 +76,8 @@ that users can use to create an application project template. If you can't or don't want to use maven-repository-enabled tooling you will need to get a local copy of the Edgent jars and their -dependencies and add them to your compile classpath. -The Edgent supplied `get-edgent-jars.sh` tool can be used to -get copies of the jars from a maven repository. +dependencies and add them to your compile classpath. This case +is covered in the following sections. ## Packaging and Execution @@ -109,7 +106,8 @@ The uber jar contains the application's classes and the application's dependent Edgent classes and their transitive dependencies. -The Edgent samples poms contain configuration information +The Edgent samples template project's pom and +the Edgent samples poms contain configuration information that generates an uber jar in addition to the standard application jar. Eclipse can also export an uber jar. @@ -142,46 +140,8 @@ binary bundle containing all of the Edgent jars and their dependencies. The binary artifacts are only released to maven central. -The Edgent supplied get-edgent-jars.sh tool supports this mode. - -## get-edgent-jars.sh - -The `get-edgent-jars.sh` script copies the Edgent runtime jars and their -dependencies from a local or remote maven repository into a local folder. - -The user may then directly use the jars in CLASSPATH specifications -for Edgent application compilation or execution. -A `classpath.sh` script is generated to assist with this. - -By default the script retrieves the Edgent java8 platform jars for the -script's default Edgent version. - -The script creates and builds a small maven project as -part of its execution. - -``` sh -get-edgent-jars.sh --version 1.2.0-SNAPSHOT # retrieve the Edgent 1.2.0-SNAPSHOT java8 jars -This command downloads the Apache Edgent jars and their transitive external dependencies. -The external dependencies have their own licensing term that you should review. -A summary of the external dependencies can be found here <TODO URL>. -Continue? [y/n] y -##### Generating maven project get-edgent-jars-project... -##### Generating dependency decls... -##### Adding dependency decls to pom... -##### Retrieving jars into local maven repo... -... -##### Copying jars... -##### Generating classpath.sh... -##### The Edgent jars are in get-edgent-jars-project/edgent-jars -##### The external jars are in get-edgent-jars-project/ext-jars -##### CLASSPATH may be set by copying get-edgent-jars-project/java8/classpath.sh and using it like: -##### export CLASSPATH=`classpath.sh path-to-parent-of-edgent-jars-dir` -``` - -For more usage information: -``` sh -get-edgent-jars.sh -h -``` +See `samples/get-edgent-jars-project` for a tool +to get a copy of the Edgent jars. ## package-app.sh @@ -198,14 +158,13 @@ The application's pom specified Edgent runtime jars and their dependencies are retrieved from a local or remote maven repository. -If the application was built using java8, complied against -the java8 Edgent jars, and the execution environment is +If the application's execution environment is java7 or android, use the appropriate script options to retrieve the appropriate Edgent platform jars for execution. -The run-app.sh script configures the CLASSPATH and runs -the application. +The generated run-app.sh script configures the CLASSPATH +and runs the application. E.g., http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/.gitignore ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/.gitignore b/get-edgent-jars-project/.gitignore new file mode 100644 index 0000000..574159f --- /dev/null +++ b/get-edgent-jars-project/.gitignore @@ -0,0 +1,6 @@ + +# generated from pom.xml.template +pom.xml + +# old-get-edgent-jars.sh generated outout +tmp-get-edgent-jars-project http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/README.md ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/README.md b/get-edgent-jars-project/README.md new file mode 100644 index 0000000..ad176b9 --- /dev/null +++ b/get-edgent-jars-project/README.md @@ -0,0 +1,54 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +The `get-edgent-jars-project` can be used to copy Apache Edgent jars +and their transitive dependencies from a local or remote maven +repository into bundles under `target`. + +Use `get-edgent-jars.sh` to create bundles containing the jars. +The script also creates `target/classpath.sh` for composing a classpath +to use the Edgent jars. + +By default the script retrieves the Edgent java8 platform jars for the +project's default Edgent version. + +``` sh +cd get-edgent-jars-project +./get-edgent-jars.sh --version 1.2.0-SNAPSHOT # retrieve the Edgent 1.2.0-SNAPSHOT java8 jars +##### Generating dependency decls... +##### Generating pom.xml... +... +##### Generating the bundles... +... +##### Generating classpath.sh... +##### Bundle LICENSING information: +... +##### Using a bundle: + + copy a bundle from target and unpack it + copy target/classpath.sh and use it to compose a classpath: + + export CLASSPATH=`./classpath.sh --add-slf4j-jdk <path-to-unpacked-bundle>` + + Omit "--add-slf4j-jdk" to omit an slf4j-jdk* implementation jar from the classpath. +``` + + +For more usage information: +``` sh +get-edgent-jars.sh -h +``` http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/get-edgent-jars.sh ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/get-edgent-jars.sh b/get-edgent-jars-project/get-edgent-jars.sh new file mode 100755 index 0000000..4b4194a --- /dev/null +++ b/get-edgent-jars-project/get-edgent-jars.sh @@ -0,0 +1,226 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +## Get the Apache Edgent jars and their transitive external dependencies. +## +## By default get the Edgent java8 platform jars for the script's default Edgent version. +## +## --platform {java8|java7|android} get the specified target platform jars +## --version edgent-version get the specified version's jars (e.g., 1.2.0-SNAPSHOT) +## --artifacts csv-gav-list get only the specified artifacts. Not restricted to Edgent jars. +## The Edgent version is substituted for all instances of '{EV}' +## --file gav-file get only the specified artifacts. Not restricted to Edgent jars. +## The Edgent version is substituted for all instances of '{EV}' +## Lines that begin with '#' are ignored. +## --mvn mvn-cmd use mvn-cmd instead of "./mvnw" +## +## Creates bundles and classpath.sh in the target dir. + +USAGE="usage: [--platform {java8|java7|android}] [--version edgent-version] [--artifacts csv-gav-list] [--file gav-file] [--mvn mvn-cmd]" + +set -e + +# project dir is whereever this script resides +PROJ_DIR=`(cd $(dirname $0); pwd)` + +SAMPLES_DIR=`(cd $(dirname $0); pwd)`/.. +MVN_CMD=${SAMPLES_DIR}/mvnw + +EDGENT_PLATFORM=java8 +EDGENT_VERSION= +SLF4J_VERSION=1.7.12 + +if [ "$1" = "--platform" -a $# -gt 1 ]; then + EDGENT_PLATFORM=$2; shift; shift +fi +if [ "$1" = "--version" -a $# -gt 1 ]; then + EDGENT_VERSION=$2; shift; shift +fi +OPT_GAVS= +if [ "$1" = "--artifacts" -a $# -gt 1 ]; then + OPT_CSV_GAVS=$2; shift; shift + OPT_GAVS=`echo "${OPT_CSV_GAVS}" | sed -e 's/,/ /g'` +fi +if [ "$1" = "--file" -a $# -gt 1 ]; then + OPT_GAVS_FILE=$2; shift; shift + OPT_GAVS=`sed -e '/^#/d' < ${OPT_GAVS_FILE}` +fi +if [ "$1" = "--mvn" -a $# -gt 1 ]; then + MVN_CMD=$2; shift; shift +fi +if [ $# != 0 ]; then + echo "$USAGE" + exit 1 +fi + +# only declare "top level" Edgent components that a user +# would directly declare/use and let these components +# (most typically the provider) pull in the rest of the +# Edgent jars (and their dependencies) +# +# Explicitly add edgent-connectors-websocket-jetty +# as there's not a direct dependency on it from connectors-websocket. +# +# Hmm... consider adding org.apache.edgent.console:edgent-console-servlets:{EV}:war +# It's bundled in edgent-console-server.jar. Having it separately available +# would enable having the "console" in a Servler engine of the user's choosing. +# If added, may want to put it in a directory other than edgent-jars. +# +DEFAULT_GAVS=`cat << EOF +org.slf4j:slf4j-jdk14:${SLF4J_VERSION} +org.apache.edgent.analytics:edgent-analytics-math3:{EV} +org.apache.edgent.analytics:edgent-analytics-sensors:{EV} +org.apache.edgent.connectors:edgent-connectors-command:{EV} +org.apache.edgent.connectors:edgent-connectors-csv:{EV} +org.apache.edgent.connectors:edgent-connectors-file:{EV} +org.apache.edgent.connectors:edgent-connectors-http:{EV} +org.apache.edgent.connectors:edgent-connectors-iot:{EV} +org.apache.edgent.connectors:edgent-connectors-iotp:{EV} +org.apache.edgent.connectors:edgent-connectors-jdbc:{EV} +org.apache.edgent.connectors:edgent-connectors-kafka:{EV} +org.apache.edgent.connectors:edgent-connectors-mqtt:{EV} +org.apache.edgent.connectors:edgent-connectors-pubsub:{EV} +org.apache.edgent.connectors:edgent-connectors-serial:{EV} +org.apache.edgent.connectors:edgent-connectors-websocket:{EV} +org.apache.edgent.connectors:edgent-connectors-websocket-jetty:{EV} +org.apache.edgent.providers:edgent-providers-development:{EV} +org.apache.edgent.providers:edgent-providers-direct:{EV} +org.apache.edgent.providers:edgent-providers-iot:{EV} +org.apache.edgent.utils:edgent-utils-metrics:{EV} +org.apache.edgent.utils:edgent-utils-streamscope:{EV} +EOF +` +if [ "${EDGENT_PLATFORM}" != "java8" ]; then + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "s/apache.edgent/apache.edgent.${EDGENT_PLATFORM}/"` +fi +if [ "${EDGENT_PLATFORM}" == "android" ]; then + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "/edgent-providers-development/d"` + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-hardware:{EV}"` + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-topology:{EV}"` +fi + + +function confirm () { # [$1: question] + while true; do + # call with a prompt string or use a default + /bin/echo -n "${1:-Are you sure?}" + read -r -p " [y/n] " response + case $response in + [yY]) return `true` ;; + [nN]) return `false` ;; + *) echo "illegal response '$response'" ;; + esac + done +} + +########################### +echo +echo "##### Generating dependency decls..." +ARTIFACT_GAVS="${OPT_GAVS:-${DEFAULT_GAVS}}" +mkdir -p target +DEP_DECLS_FILE=target/tmp-dep-decls +rm -f ${DEP_DECLS_FILE} +for i in ${ARTIFACT_GAVS}; do + echo $i | awk -F : '{ type=""; if ($3 == "{EV}") $3="${edgent.core.version}"; if ($4 != "") type=" <type>" $4 "</type>\n"; printf "<dependency>\n <groupId>%s</groupId>\n <artifactId>%s</artifactId>\n <version>%s</version>\n%s</dependency>\n", $1, $2, $3, type }' >> ${DEP_DECLS_FILE} +done +DEP_DECLS=`cat ${DEP_DECLS_FILE}` + +########################### +echo +echo "##### Generating pom.xml..." +cd ${PROJ_DIR} +cp pom.xml.template pom.xml +ed -s pom.xml <<EOF +/INJECT_DEPENDENCIES_HERE +a +${DEP_DECLS} +. +wq +EOF + +########################### +echo +echo "##### Generating the bundles..." +EDGENT_VERSION_PROPERTY= +if [ "${EDGENT_VERSION}" ]; then + EDGENT_VERSION_PROPERTY=-Dedgent.core.version=${EDGENT_VERSION} +fi +PLATFORM_PROFILE= +if [ ${EDGENT_PLATFORM} != "java8" ]; then + PLATFORM_PROFILE="-Pplatform-${EDGENT_PLATFORM}" +fi +${MVN_CMD} clean package ${EDGENT_VERSION_PROPERTY} ${PLATFORM_PROFILE} + + +########################### +echo +echo "##### Generating classpath.sh..." +cat << 'EOF' > ${PROJ_DIR}/target/classpath.sh +#!/bin/sh +USAGE="usage: classpath.sh [--add-slf4j-jdk] <path-to-unpacked-bundle>" +set -e +if [ "${1}" == "--add-slf4j-jdk" ]; then + ADD_SLF4J_IMPL=slf4j-jdk + shift +fi +if [ $# != 1 ] || [[ ${1} == -* ]] ; then + echo "${USAGE}" + exit 1 +fi +BASEDIR=${1} +cd ${BASEDIR} +SEP= +CP= +if [ "`ls libs 2>/dev/null`" != "" ]; then + for i in libs/*; do + CP="${CP}${SEP}${BASEDIR}/${i}" + SEP=":" + done +fi +if [ "`ls ext 2>/dev/null`" != "" ]; then + for i in ext/*; do + if [[ ${i} == */slf4j-* ]] && [[ ${i} != */slf4j-api-* ]] ; then + # it's an slf4j impl + if [[ "${ADD_SLF4J_IMPL}" == "" ]] || [[ ${i} != */${ADD_SLF4J_IMPL}* ]] ; then + continue + fi + fi + CP="${CP}${SEP}${BASEDIR}/${i}" + SEP=":" + done +fi +echo "${CP}" +EOF +chmod +x target/classpath.sh + +########################### +echo +echo "##### Bundle LICENSING information:" +echo +cat ${PROJ_DIR}/src/main/resources/README +echo +cat <<'EOF' +##### Using a bundle: + + copy a bundle from target and unpack it + copy target/classpath.sh and use it to compose a classpath: + + export CLASSPATH=`./classpath.sh --add-slf4j-jdk <path-to-unpacked-bundle>` + + Omit "--add-slf4j-jdk" to omit an slf4j-jdk* implementation jar from the classpath. +EOF http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/old-get-edgent-jars.sh ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/old-get-edgent-jars.sh b/get-edgent-jars-project/old-get-edgent-jars.sh new file mode 100755 index 0000000..fffb747 --- /dev/null +++ b/get-edgent-jars-project/old-get-edgent-jars.sh @@ -0,0 +1,254 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +## Get the Apache Edgent jars and their transitive external dependencies. +## +## By default get the Edgent java8 platform jars for the script's default Edgent version. +## +## --platform {java8|java7|android} get the specified target platform jars +## --version edgent-version get the specified version's jars (e.g., 1.2.0-SNAPSHOT) +## --artifacts csv-gav-list get only the specified artifacts. Not restricted to Edgent jars. +## The Edgent version is substituted for all instances of '{EV}' +## --file gav-file get only the specified artifacts. Not restricted to Edgent jars. +## The Edgent version is substituted for all instances of '{EV}' +## Lines that begin with '#' are ignored. +## --mvn mvn-cmd use mvn-cmd instead of "./mvnw" +## +## Creates the directory get-edgent-jars-project and a maven project in it + +USAGE="usage: [--platform {java8|java7|android}] [--version edgent-version] [--artifacts csv-gav-list] [--file gav-file] [--mvn mvn-cmd]" + +set -e + +SAMPLES_DIR=`(cd $(dirname $0); pwd)` +MVN_CMD=${SAMPLES_DIR}/mvnw + +EDGENT_PLATFORM=java8 +EDGENT_VERSION=1.2.0 +SLF4J_VERSION=1.7.12 + +PROJ_DIR=tmp-get-edgent-jars-project + +if [ "$1" = "--platform" -a $# -gt 1 ]; then + EDGENT_PLATFORM=$2; shift; shift +fi +if [ "$1" = "--version" -a $# -gt 1 ]; then + EDGENT_VERSION=$2; shift; shift +fi +OPT_GAVS= +if [ "$1" = "--artifacts" -a $# -gt 1 ]; then + OPT_CSV_GAVS=$2; shift; shift + OPT_GAVS=`echo "${OPT_CSV_GAVS}" | sed -e 's/,/ /g'` +fi +if [ "$1" = "--file" -a $# -gt 1 ]; then + OPT_GAVS_FILE=$2; shift; shift + OPT_GAVS=`sed -e '/^#/d' < ${OPT_GAVS_FILE}` +fi +if [ "$1" = "--mvn" -a $# -gt 1 ]; then + MVN_CMD=$2; shift; shift +fi +if [ $# != 0 ]; then + echo "$USAGE" + exit 1 +fi + +# only declare "top level" Edgent components that a user +# would directly declare/use and let these components +# (most typically the provider) pull in the rest of the +# Edgent jars (and their dependencies) +# +# Explicitly add edgent-connectors-websocket-jetty +# as there's not a direct dependency on it from connectors-websocket. +# +# Hmm... consider adding org.apache.edgent.console:edgent-console-servlets:{EV}:war +# It's bundled in edgent-console-server.jar. Having it separately available +# would enable having the "console" in a Servler engine of the user's choosing. +# If added, may want to put it in a directory other than edgent-jars. +# +DEFAULT_GAVS=`cat << EOF +org.slf4j:slf4j-jdk14:${SLF4J_VERSION} +org.apache.edgent.analytics:edgent-analytics-math3:{EV} +org.apache.edgent.analytics:edgent-analytics-sensors:{EV} +org.apache.edgent.connectors:edgent-connectors-command:{EV} +org.apache.edgent.connectors:edgent-connectors-csv:{EV} +org.apache.edgent.connectors:edgent-connectors-file:{EV} +org.apache.edgent.connectors:edgent-connectors-http:{EV} +org.apache.edgent.connectors:edgent-connectors-iot:{EV} +org.apache.edgent.connectors:edgent-connectors-iotp:{EV} +org.apache.edgent.connectors:edgent-connectors-jdbc:{EV} +org.apache.edgent.connectors:edgent-connectors-kafka:{EV} +org.apache.edgent.connectors:edgent-connectors-mqtt:{EV} +org.apache.edgent.connectors:edgent-connectors-pubsub:{EV} +org.apache.edgent.connectors:edgent-connectors-serial:{EV} +org.apache.edgent.connectors:edgent-connectors-websocket:{EV} +org.apache.edgent.connectors:edgent-connectors-websocket-jetty:{EV} +org.apache.edgent.providers:edgent-providers-development:{EV} +org.apache.edgent.providers:edgent-providers-direct:{EV} +org.apache.edgent.providers:edgent-providers-iot:{EV} +org.apache.edgent.utils:edgent-utils-metrics:{EV} +org.apache.edgent.utils:edgent-utils-streamscope:{EV} +EOF +` +if [ "${EDGENT_PLATFORM}" != "java8" ]; then + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "s/apache.edgent/apache.edgent.${EDGENT_PLATFORM}/"` +fi +if [ "${EDGENT_PLATFORM}" == "android" ]; then + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "/edgent-providers-development/d"` + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-hardware:{EV}"` + DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-topology:{EV}"` +fi + + +function confirm () { # [$1: question] + while true; do + # call with a prompt string or use a default + /bin/echo -n "${1:-Are you sure?}" + read -r -p " [y/n] " response + case $response in + [yY]) return `true` ;; + [nN]) return `false` ;; + *) echo "illegal response '$response'" ;; + esac + done +} + +########################### +cat <<EOF +This command downloads the Apache Edgent jars and their transitive external dependencies. +The external dependencies have their own licensing term that you should review. +A summary of the external dependencies can be found here <TODO URL>. +EOF +confirm "Continue?" || exit + +########################### +if [ ! -d ${PROJ_DIR} ]; then + echo "##### Generating maven project ${PROJ_DIR}..." + # ensure a standalone pom (no parent) to avoid unwanted inherited deps + TMP_PROJ=${PROJ_DIR}-tmp + mkdir ${TMP_PROJ} + cd ${TMP_PROJ} + ${MVN_CMD} -B archetype:generate \ + -DarchetypeGroupId=org.apache.maven.archeTypes \ + -DarchetypeArtifactId=maven-archetype-quickstart \ + -DgroupId=org.apache.edgent.tools \ + -DartifactId=${PROJ_DIR} \ + -Dversion=1.0 + cd .. + mv ${TMP_PROJ}/${PROJ_DIR} ${PROJ_DIR} + rmdir ${TMP_PROJ} + cp ${PROJ_DIR}/pom.xml ${PROJ_DIR}/pom.xml.orig +else + cp ${PROJ_DIR}/pom.xml.orig ${PROJ_DIR}/pom.xml +fi + +########################### + +cd ${PROJ_DIR} + +########################### + +########################### +echo +echo "##### Generating dependency decls..." +ARTIFACT_GAVS="${OPT_GAVS:-${DEFAULT_GAVS}}" +ARTIFACT_GAVS=`echo "${ARTIFACT_GAVS}" | sed -e "s/{EV}/${EDGENT_VERSION}/g"` +mkdir -p target +DEP_DECLS_FILE=target/tmp-dep-decls +rm -f ${DEP_DECLS_FILE} +for i in ${ARTIFACT_GAVS}; do + echo $i | awk -F : '{ type=""; if ($4 != "") type=" <type>" $4 "</type>\n"; printf "<dependency>\n <groupId>%s</groupId>\n <artifactId>%s</artifactId>\n <version>%s</version>\n%s</dependency>\n", $1, $2, $3, type }' >> ${DEP_DECLS_FILE} +done +DEP_DECLS=`cat ${DEP_DECLS_FILE}` + +########################### +echo +echo "##### Adding dependency decls to pom..." +ed pom.xml <<EOF +/<dependencies> +a +${DEP_DECLS} +. +wq +EOF + +########################### +echo +echo "##### Retrieving jars into local maven repo..." +${MVN_CMD} clean compile + +########################### +echo +echo "##### Copying jars..." +# if someone screws up j7 or android deps, uncomment the following and +# it will help identify wrong jars that are getting included / copied +# (and otherwise overwriting each other). +#DEBUG_DEPS=-Dmdep.prependGroupId=true +${MVN_CMD} dependency:copy-dependencies -DincludeScope=runtime ${DEBUG_DEPS} + +DEPS_SRC_DIR=target/dependency +EDGENT_DEPS_DIR=${EDGENT_PLATFORM}/edgent-jars +EXT_DEPS_DIR=${EDGENT_PLATFORM}/ext-jars + +rm -rf "${EDGENT_DEPS_DIR}"; mkdir -p ${EDGENT_DEPS_DIR} +rm -rf "${EXT_DEPS_DIR}"; mkdir -p ${EXT_DEPS_DIR} + +cp ${DEPS_SRC_DIR}/* ${EXT_DEPS_DIR} + +for i in `find ${EXT_DEPS_DIR} -name '*edgent-*.*ar'`; do + mv $i ${EDGENT_DEPS_DIR} +done + +########################### +echo +echo "##### Generating classpath.sh..." +cat << 'EOF' > ${EDGENT_PLATFORM}/classpath.sh +#!/bin/sh +set -e +if [ "${1}" = "" -o "${1}" = "-?" -o "${1}" = "-help" ]; then + echo "usage: classpath.sh <path-to-parent-of-edgent-jars-dir>" + exit 1 +fi +BASEDIR=${1} +cd ${BASEDIR} +SEP= +CP= +if [ "`ls edgent-jars 2>/dev/null`" != "" ]; then + for i in edgent-jars/*; do + CP="${CP}${SEP}${BASEDIR}/${i}" + SEP=":" + done +fi +if [ "`ls ext-jars 2>/dev/null`" != "" ]; then + for i in ext-jars/*; do + if [[ ${i} == */slf4j-* ]] && [[ ${i} != */slf4j-api-* ]] ; then + continue + fi + CP="${CP}${SEP}${BASEDIR}/${i}" + SEP=":" + done +fi +echo "${CP}" +EOF +chmod +x ${EDGENT_PLATFORM}/classpath.sh + +########################### +echo +echo "##### The Edgent jars are in ${PROJ_DIR}/${EDGENT_DEPS_DIR}" +echo "##### The external jars are in ${PROJ_DIR}/${EXT_DEPS_DIR}" +echo "##### CLASSPATH may be set by copying ${PROJ_DIR}/${EDGENT_PLATFORM}/classpath.sh and using it like:" +echo '##### export CLASSPATH=`classpath.sh path-to-parent-of-edgent-jars-dir`' http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/pom.xml.template ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/pom.xml.template b/get-edgent-jars-project/pom.xml.template new file mode 100644 index 0000000..bae3613 --- /dev/null +++ b/get-edgent-jars-project/pom.xml.template @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <!-- standalone project --> + <!--parent> + <groupId>org.apache.edgent</groupId> + <artifactId>edgent-parent</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent--> + + <groupId>org.apache.edgent.get-edgent-jars</groupId> + <artifactId>get-edgent-jars</artifactId> + <version>1.2.0-SNAPSHOT</version> + + <name>Apache Edgent get-edgent-jars ${samples.projname.platform}</name> + + <properties> + <samples.projname.platform> (Java 8)</samples.projname.platform> <!-- tweaked by -Pplatform-* --> + <edgent.platform>java8</edgent.platform> <!-- tweaked by -Pplatform-* --> + <edgent.groupId.platform/> <!-- tweaked by -Pplatform-* --> + <edgent.base.groupId>org.apache.edgent${edgent.groupId.platform}</edgent.base.groupId> + <!-- at least for now, the samples version is lockstep with the core + so default to using the same core as the this project. + get-edgent-jars.sh overrides via -Dedgent.core.version=... + --> + <edgent.core.version>${project.version}</edgent.core.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.5.3</version> + <configuration> + <finalName>edgent-${edgent.platform}-jars-${edgent.core.version}</finalName> + </configuration> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-remote-resources-plugin</artifactId> + <version>1.5</version><!--$NO-MVN-MAN-VER$--> + <executions> + <execution> + <id>process-resource-bundles</id> + <goals> + <goal>process</goal> + </goals> + <configuration> + <resourceBundles> + <!-- Will generate META-INF/{DEPENDENCIES,LICENSE,NOTICE} --> + <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle> + <!-- Will generate META-INF/DISCLAIMER (incubator version) --> + <resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.1</resourceBundle> + </resourceBundles> + <!-- Content in this directory will be appended to generated resources --> + <appendedResourcesDirectory>${remote-resources-maven-plugin.remote-resources.dir}</appendedResourcesDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptor>src/assembly/distribution.xml</descriptor> + </configuration> + <executions> + <execution> + <id>create-archive</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- We don't need any jars as output in this module --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>default</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>platform-java7</id> + <properties> + <edgent.platform>java7</edgent.platform> + <edgent.groupId.platform>.${edgent.platform}</edgent.groupId.platform> + <platform.java7>true</platform.java7> + <samples.projname.platform> (Java 7)</samples.projname.platform> + </properties> + </profile> + <profile> + <id>platform-android</id> + <properties> + <edgent.platform>android</edgent.platform> + <edgent.groupId.platform>.${edgent.platform}</edgent.groupId.platform> + <platform.android>true</platform.android> + <samples.projname.platform> (Android)</samples.projname.platform> + </properties> + </profile> + </profiles> + + <dependencies> +<!-- INJECT_DEPENDENCIES_HERE --> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/src/assembly/distribution.xml ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/src/assembly/distribution.xml b/get-edgent-jars-project/src/assembly/distribution.xml new file mode 100644 index 0000000..843bbf5 --- /dev/null +++ b/get-edgent-jars-project/src/assembly/distribution.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + + <!-- + NOTE: each platform (platforms/java7 and platforms/android) have their + own distribution project and a copy of this configuration file that + must be manually kept in sync. + --> + + <id>bin</id> + + <formats> + <format>tar.gz</format> + <format>tar.bz2</format> + <format>zip</format> + </formats> + + <fileSets> + <fileSet> + <directory>${project.build.outputDirectory}/META-INF</directory> + <includes> + <include>DISCLAIMER</include> + <include>DEPENDENCIES</include> + </includes> + <outputDirectory/> + </fileSet> + + <fileSet> + <directory>${project.build.outputDirectory}</directory> + <includes> + <include>README</include> + </includes> + <outputDirectory/> + </fileSet> + + </fileSets> + + <dependencySets> + <!-- Any edgent libs --> + <dependencySet> + <outputDirectory>libs</outputDirectory> + <scope>runtime</scope> + <includes> + <include>org.apache.edgent*</include> + </includes> + <excludes> + <exclude>org.apache.edgent.get-edgent-jars*</exclude> + </excludes> + </dependencySet> + + <!-- All other libs are treated as external libs --> + <dependencySet> + <outputDirectory>ext</outputDirectory> + <scope>runtime</scope> + <excludes> + <exclude>org.apache.edgent*</exclude> + </excludes> + </dependencySet> + </dependencySets> + +</assembly> http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars-project/src/main/resources/README ---------------------------------------------------------------------- diff --git a/get-edgent-jars-project/src/main/resources/README b/get-edgent-jars-project/src/main/resources/README new file mode 100644 index 0000000..d91c7ff --- /dev/null +++ b/get-edgent-jars-project/src/main/resources/README @@ -0,0 +1,12 @@ +This bundle includes a number of artifacts with separate +copyright notices and license terms. Your use of an artifact +is subject to that artifactâs licensing terms and conditions. + +The Apache Edgent artifacts (everything in lib) all have the +license âApache License Version 2.0â. + +Edgentâs dependent artifacts in âextâ have all been evaluated +to be compatible with Edgentâs license. + +A bundled artifact's advertised license information may be +found in the DEPENDENCIES file in this bundle. http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/get-edgent-jars.sh ---------------------------------------------------------------------- diff --git a/get-edgent-jars.sh b/get-edgent-jars.sh deleted file mode 100755 index 46a2bbf..0000000 --- a/get-edgent-jars.sh +++ /dev/null @@ -1,254 +0,0 @@ -#!/bin/sh -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -## Get the Apache Edgent jars and their transitive external dependencies. -## -## By default get the Edgent java8 platform jars for the script's default Edgent version. -## -## --platform {java8|java7|android} get the specified target platform jars -## --version edgent-version get the specified version's jars (e.g., 1.2.0-SNAPSHOT) -## --artifacts csv-gav-list get only the specified artifacts. Not restricted to Edgent jars. -## The Edgent version is substituted for all instances of '{EV}' -## --file gav-file get only the specified artifacts. Not restricted to Edgent jars. -## The Edgent version is substituted for all instances of '{EV}' -## Lines that begin with '#' are ignored. -## --mvn mvn-cmd use mvn-cmd instead of "./mvnw" -## -## Creates the directory get-edgent-jars-project and a maven project in it - -USAGE="usage: [--platform {java8|java7|android}] [--version edgent-version] [--artifacts csv-gav-list] [--file gav-file] [--mvn mvn-cmd]" - -set -e - -SAMPLES_DIR=`(cd $(dirname $0); pwd)` -MVN_CMD=${SAMPLES_DIR}/mvnw - -EDGENT_PLATFORM=java8 -EDGENT_VERSION=1.2.0 -SLF4J_VERSION=1.7.12 - -PROJ_DIR=get-edgent-jars-project - -if [ "$1" = "--platform" -a $# -gt 1 ]; then - EDGENT_PLATFORM=$2; shift; shift -fi -if [ "$1" = "--version" -a $# -gt 1 ]; then - EDGENT_VERSION=$2; shift; shift -fi -OPT_GAVS= -if [ "$1" = "--artifacts" -a $# -gt 1 ]; then - OPT_CSV_GAVS=$2; shift; shift - OPT_GAVS=`echo "${OPT_CSV_GAVS}" | sed -e 's/,/ /g'` -fi -if [ "$1" = "--file" -a $# -gt 1 ]; then - OPT_GAVS_FILE=$2; shift; shift - OPT_GAVS=`sed -e '/^#/d' < ${OPT_GAVS_FILE}` -fi -if [ "$1" = "--mvn" -a $# -gt 1 ]; then - MVN_CMD=$2; shift; shift -fi -if [ $# != 0 ]; then - echo "$USAGE" - exit 1 -fi - -# only declare "top level" Edgent components that a user -# would directly declare/use and let these components -# (most typically the provider) pull in the rest of the -# Edgent jars (and their dependencies) -# -# Explicitly add edgent-connectors-websocket-jetty -# as there's not a direct dependency on it from connectors-websocket. -# -# Hmm... consider adding org.apache.edgent.console:edgent-console-servlets:{EV}:war -# It's bundled in edgent-console-server.jar. Having it separately available -# would enable having the "console" in a Servler engine of the user's choosing. -# If added, may want to put it in a directory other than edgent-jars. -# -DEFAULT_GAVS=`cat << EOF -org.slf4j:slf4j-jdk14:${SLF4J_VERSION} -org.apache.edgent.analytics:edgent-analytics-math3:{EV} -org.apache.edgent.analytics:edgent-analytics-sensors:{EV} -org.apache.edgent.connectors:edgent-connectors-command:{EV} -org.apache.edgent.connectors:edgent-connectors-csv:{EV} -org.apache.edgent.connectors:edgent-connectors-file:{EV} -org.apache.edgent.connectors:edgent-connectors-http:{EV} -org.apache.edgent.connectors:edgent-connectors-iot:{EV} -org.apache.edgent.connectors:edgent-connectors-iotp:{EV} -org.apache.edgent.connectors:edgent-connectors-jdbc:{EV} -org.apache.edgent.connectors:edgent-connectors-kafka:{EV} -org.apache.edgent.connectors:edgent-connectors-mqtt:{EV} -org.apache.edgent.connectors:edgent-connectors-pubsub:{EV} -org.apache.edgent.connectors:edgent-connectors-serial:{EV} -org.apache.edgent.connectors:edgent-connectors-websocket:{EV} -org.apache.edgent.connectors:edgent-connectors-websocket-jetty:{EV} -org.apache.edgent.providers:edgent-providers-development:{EV} -org.apache.edgent.providers:edgent-providers-direct:{EV} -org.apache.edgent.providers:edgent-providers-iot:{EV} -org.apache.edgent.utils:edgent-utils-metrics:{EV} -org.apache.edgent.utils:edgent-utils-streamscope:{EV} -EOF -` -if [ "${EDGENT_PLATFORM}" != "java8" ]; then - DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "s/apache.edgent/apache.edgent.${EDGENT_PLATFORM}/"` -fi -if [ "${EDGENT_PLATFORM}" == "android" ]; then - DEFAULT_GAVS=`echo "${DEFAULT_GAVS}" | sed -e "/edgent-providers-development/d"` - DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-hardware:{EV}"` - DEFAULT_GAVS=`echo "${DEFAULT_GAVS}"; echo "org.apache.edgent.android.android:edgent-android-topology:{EV}"` -fi - - -function confirm () { # [$1: question] - while true; do - # call with a prompt string or use a default - /bin/echo -n "${1:-Are you sure?}" - read -r -p " [y/n] " response - case $response in - [yY]) return `true` ;; - [nN]) return `false` ;; - *) echo "illegal response '$response'" ;; - esac - done -} - -########################### -cat <<EOF -This command downloads the Apache Edgent jars and their transitive external dependencies. -The external dependencies have their own licensing term that you should review. -A summary of the external dependencies can be found here <TODO URL>. -EOF -confirm "Continue?" || exit - -########################### -if [ ! -d ${PROJ_DIR} ]; then - echo "##### Generating maven project ${PROJ_DIR}..." - # ensure a standalone pom (no parent) to avoid unwanted inherited deps - TMP_PROJ=${PROJ_DIR}-tmp - mkdir ${TMP_PROJ} - cd ${TMP_PROJ} - ${MVN_CMD} -B archetype:generate \ - -DarchetypeGroupId=org.apache.maven.archeTypes \ - -DarchetypeArtifactId=maven-archetype-quickstart \ - -DgroupId=org.apache.edgent.tools \ - -DartifactId=${PROJ_DIR} \ - -Dversion=1.0 - cd .. - mv ${TMP_PROJ}/${PROJ_DIR} ${PROJ_DIR} - rmdir ${TMP_PROJ} - cp ${PROJ_DIR}/pom.xml ${PROJ_DIR}/pom.xml.orig -else - cp ${PROJ_DIR}/pom.xml.orig ${PROJ_DIR}/pom.xml -fi - -########################### - -cd ${PROJ_DIR} - -########################### - -########################### -echo -echo "##### Generating dependency decls..." -ARTIFACT_GAVS="${OPT_GAVS:-${DEFAULT_GAVS}}" -ARTIFACT_GAVS=`echo "${ARTIFACT_GAVS}" | sed -e "s/{EV}/${EDGENT_VERSION}/g"` -mkdir -p target -DEP_DECLS_FILE=target/tmp-dep-decls -rm -f ${DEP_DECLS_FILE} -for i in ${ARTIFACT_GAVS}; do - echo $i | awk -F : '{ type=""; if ($4 != "") type=" <type>" $4 "</type>\n"; printf "<dependency>\n <groupId>%s</groupId>\n <artifactId>%s</artifactId>\n <version>%s</version>\n%s</dependency>\n", $1, $2, $3, type }' >> ${DEP_DECLS_FILE} -done -DEP_DECLS=`cat ${DEP_DECLS_FILE}` - -########################### -echo -echo "##### Adding dependency decls to pom..." -ed pom.xml <<EOF -/<dependencies> -a -${DEP_DECLS} -. -wq -EOF - -########################### -echo -echo "##### Retrieving jars into local maven repo..." -${MVN_CMD} clean compile - -########################### -echo -echo "##### Copying jars..." -# if someone screws up j7 or android deps, uncomment the following and -# it will help identify wrong jars that are getting included / copied -# (and otherwise overwriting each other). -#DEBUG_DEPS=-Dmdep.prependGroupId=true -${MVN_CMD} dependency:copy-dependencies -DincludeScope=runtime ${DEBUG_DEPS} - -DEPS_SRC_DIR=target/dependency -EDGENT_DEPS_DIR=${EDGENT_PLATFORM}/edgent-jars -EXT_DEPS_DIR=${EDGENT_PLATFORM}/ext-jars - -rm -rf "${EDGENT_DEPS_DIR}"; mkdir -p ${EDGENT_DEPS_DIR} -rm -rf "${EXT_DEPS_DIR}"; mkdir -p ${EXT_DEPS_DIR} - -cp ${DEPS_SRC_DIR}/* ${EXT_DEPS_DIR} - -for i in `find ${EXT_DEPS_DIR} -name '*edgent-*.*ar'`; do - mv $i ${EDGENT_DEPS_DIR} -done - -########################### -echo -echo "##### Generating classpath.sh..." -cat << 'EOF' > ${EDGENT_PLATFORM}/classpath.sh -#!/bin/sh -set -e -if [ "${1}" = "" -o "${1}" = "-?" -o "${1}" = "-help" ]; then - echo "usage: classpath.sh <path-to-parent-of-edgent-jars-dir>" - exit 1 -fi -BASEDIR=${1} -cd ${BASEDIR} -SEP= -CP= -if [ "`ls edgent-jars 2>/dev/null`" != "" ]; then - for i in edgent-jars/*; do - CP="${CP}${SEP}${BASEDIR}/${i}" - SEP=":" - done -fi -if [ "`ls ext-jars 2>/dev/null`" != "" ]; then - for i in ext-jars/*; do - if [[ ${i} == */slf4j-* ]] && [[ ${i} != */slf4j-api-* ]] ; then - continue - fi - CP="${CP}${SEP}${BASEDIR}/${i}" - SEP=":" - done -fi -echo "${CP}" -EOF -chmod +x ${EDGENT_PLATFORM}/classpath.sh - -########################### -echo -echo "##### The Edgent jars are in ${PROJ_DIR}/${EDGENT_DEPS_DIR}" -echo "##### The external jars are in ${PROJ_DIR}/${EXT_DEPS_DIR}" -echo "##### CLASSPATH may be set by copying ${PROJ_DIR}/${EDGENT_PLATFORM}/classpath.sh and using it like:" -echo '##### export CLASSPATH=`classpath.sh path-to-parent-of-edgent-jars-dir`' http://git-wip-us.apache.org/repos/asf/incubator-edgent-samples/blob/fdc2723c/template/README.md ---------------------------------------------------------------------- diff --git a/template/README.md b/template/README.md index 2c7d300..a0763fd 100644 --- a/template/README.md +++ b/template/README.md @@ -36,3 +36,10 @@ Adjust the main class name and application jar path below for your application. PLATFORM= # add "--platform java7" or "--platform android" as appropriate ../package-app.sh $PLATFORM --mainClass com.mycompany.app.TemplateApp --appjar target/my-app-1.0-SNAPSHOT.jar ``` + +# Using get-edgent-jars-project + +If you don't want to use the generated uber jar or `package-app.sh` +approaches, you can copy the application's standard jar and a +`get-edgent-jars-project` generated jar bundle to the edge device. +See `samples/get-edgent-jars-project`.