| <!-- |
| 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 name="edgent.platform.java7" default="all" |
| xmlns:jacoco="antlib:org.jacoco.ant" |
| > |
| <description> |
| Create Java 7 versions of selected jars in java8 |
| by running retrolambda against them. |
| </description> |
| |
| <property environment="env"/> |
| |
| <property name="edgent" location="../.."/> |
| <property name="edgent8.target" location="${edgent}/target/java8"/> |
| <property name="edgent7.target" location="${edgent}/target/java7"/> |
| |
| <property name="input.dir" location="classes.in"/> |
| <property name="output.dir" location="classes.out"/> |
| <property name="ext.dir" location="${edgent}/ext"/> |
| |
| <property name="slf4j.version" value="1.7.12"/> |
| <property name="gson.version" value="2.2.4"/> |
| <property name="metrics.version" value="3.1.2"/> |
| <property name="retrolambda.version" value="2.1.0"/> |
| |
| <property name="slf4j.ext.dir" value="slf4j-${slf4j.version}/"/> |
| <property name="gson.ext.dir" value="google-gson-${gson.version}/"/> |
| <property name="metrics.ext.dir" value="metrics-${metrics.version}/"/> |
| <property name="retrolambda.jar" location="ext/retrolambda-${retrolambda.version}.jar"/> |
| |
| <property name="android.sdk.platform.jar" value=""/> |
| <!-- |
| <condition property="android.sdk.platform.jar" value="env.ANDROID_SDK_PLATFORM_JAR"> |
| <isset property="env.ANDROID_SDK_PLATFORM_JAR" /> |
| </condition> |
| --> |
| |
| <path id="edgent.classpath"> |
| <pathelement location="${ext.dir}/${slf4j.ext.dir}slf4j-api-${slf4j.version}.jar"/> |
| <pathelement location="${ext.dir}/${gson.ext.dir}gson-${gson.version}.jar"/> |
| <pathelement location="${ext.dir}/${metrics.ext.dir}metrics-core-${metrics.version}.jar"/> |
| </path> |
| <property name="qcp" refid="edgent.classpath"/> |
| |
| <target name="init"> |
| <mkdir dir="${edgent7.target}"/> |
| </target> |
| |
| <macrodef name="retro7"> |
| <attribute name="qjar"/> |
| <attribute name="qdir" default="lib" /> |
| <sequential> |
| <delete dir="${input.dir}"/> |
| <delete dir="${output.dir}"/> |
| |
| <mkdir dir="${input.dir}"/> |
| <mkdir dir="${output.dir}"/> |
| |
| <unzip dest="${input.dir}" src="${edgent8.target}/@{qdir}/@{qjar}"/> |
| |
| <exec executable="java" failonerror="true"> |
| <arg value="-Dretrolambda.inputDir=${input.dir}"/> |
| <arg value="-Dretrolambda.classpath=${edgent8.target}/@{qdir}/@{qjar}:${qcp}"/> |
| <arg value="-Dretrolambda.outputDir=${output.dir}"/> |
| <arg value="-Dretrolambda.defaultMethods=false"/> |
| <arg value="-jar"/> |
| <arg value="${retrolambda.jar}"/> |
| </exec> |
| <mkdir dir="${edgent7.target}/@{qdir}"/> |
| <jar destfile="${edgent7.target}/@{qdir}/@{qjar}" |
| filesonly="true" |
| manifest="${input.dir}/META-INF/MANIFEST.MF" |
| > |
| <fileset dir="${output.dir}"/> |
| </jar> |
| |
| <delete dir="${input.dir}"/> |
| <delete dir="${output.dir}"/> |
| </sequential> |
| </macrodef> |
| |
| <target name="all" depends="clean" |
| description="Compile Edgent and produce Java 7 jars using retrolambda. Must be run with a Java 8 virtual machine." |
| > |
| <ant dir="${edgent}" inheritAll="false"> |
| <target name="clean"/> |
| <target name="all"/> |
| </ant> |
| <antcall target="retro7"/> |
| </target> |
| |
| <target name="retro7" > |
| <antcall target="retro7.edgent"/> |
| <antcall target="retro7.edgent.android"/> |
| </target> |
| |
| <!-- |
| This contains the set of jars that are converted |
| to work on Java 7. |
| |
| Matching tests must also be added to test7.setup |
| and test7.run |
| --> |
| <target name="retro7.edgent" > |
| <retro7 qjar="edgent.api.function.jar" /> |
| <retro7 qjar="edgent.api.execution.jar" /> |
| <retro7 qjar="edgent.api.graph.jar" /> |
| <retro7 qjar="edgent.api.window.jar" /> |
| <retro7 qjar="edgent.api.oplet.jar" /> |
| <retro7 qjar="edgent.api.topology.jar" /> |
| <retro7 qjar="edgent.spi.graph.jar" /> |
| <retro7 qjar="edgent.spi.topology.jar" /> |
| <retro7 qjar="edgent.runtime.etiao.jar" /> |
| <retro7 qjar="edgent.runtime.appservice.jar" /> |
| <retro7 qjar="edgent.runtime.jmxcontrol.jar" /> |
| <retro7 qjar="edgent.runtime.jsoncontrol.jar" /> |
| <retro7 qjar="edgent.runtime.jobregistry.jar" /> |
| |
| <retro7 qjar="edgent.utils.metrics.jar" qdir="utils/metrics/lib" /> |
| <!-- utils/streamscope - why not java7? --> |
| <retro7 qjar="edgent.providers.direct.jar" /> |
| <!-- providers/development - why not java7? --> |
| <retro7 qjar="edgent.connectors.common.jar" qdir="connectors/common/lib" /> |
| <retro7 qjar="edgent.connectors.iot.jar" qdir="connectors/iot/lib" /> |
| <retro7 qjar="edgent.connectors.iotp.jar" qdir="connectors/iotp/lib" /> |
| <retro7 qjar="edgent.connectors.http.jar" qdir="connectors/http/lib" /> |
| <retro7 qjar="edgent.connectors.pubsub.jar" qdir="connectors/pubsub/lib" /> |
| <!-- connectors/command - why not java7? --> |
| <!-- connectors/csv - why not java7? --> |
| <!-- connectors/file - why not java7? --> |
| <!-- connectors/jdbc - why not java7? --> |
| <!-- connectors/mqtt - why not java7? --> |
| <!-- connectors/kafka - why not java7? --> |
| <!-- connectors/wsclient - why not java7? --> |
| <!-- connectors/javax.websocket-client - why not java7? --> |
| <retro7 qjar="edgent.apps.iot.jar" qdir="apps/iot/lib" /> |
| <retro7 qjar="edgent.apps.runtime.jar" qdir="apps/runtime/lib" /> |
| <!-- analytics/math3 - why not java7? --> |
| <retro7 qjar="edgent.providers.iot.jar" /> |
| <retro7 qjar="edgent.analytics.sensors.jar" qdir="analytics/sensors/lib" /> |
| |
| <retro7 qjar="edgent.samples.apps.jar" qdir="samples/lib" /> |
| <retro7 qjar="edgent.samples.connectors.jar" qdir="samples/lib" /> |
| <retro7 qjar="edgent.samples.console.jar" qdir="samples/lib" /> |
| <retro7 qjar="edgent.samples.scenarios.jar" qdir="samples/lib" /> |
| <retro7 qjar="edgent.samples.topology.jar" qdir="samples/lib" /> |
| <retro7 qjar="edgent.samples.utils.jar" qdir="samples/lib" /> |
| |
| <mkdir dir="${edgent7.target}/ext"/> |
| <copy todir="${edgent7.target}/ext"> |
| <fileset dir="${edgent8.target}/ext"/> |
| </copy> |
| |
| <mkdir dir="${edgent7.target}/connectors/iotp/ext"/> |
| <copy todir="${edgent7.target}/connectors/iotp/ext"> |
| <fileset dir="${edgent8.target}/connectors/iotp/ext"/> |
| </copy> |
| <mkdir dir="${edgent7.target}/connectors/http/ext"/> |
| <copy todir="${edgent7.target}/connectors/http/ext"> |
| <fileset dir="${edgent8.target}/connectors/http/ext"/> |
| </copy> |
| <!-- why mqtt/ext when connectors/mqtt not included above? --> |
| <mkdir dir="${edgent7.target}/connectors/mqtt/ext"/> |
| <copy todir="${edgent7.target}/connectors/mqtt/ext"> |
| <fileset dir="${edgent8.target}/connectors/mqtt/ext"/> |
| </copy> |
| <!-- why math3/ext when analytics/math3 not included above? --> |
| <mkdir dir="${edgent7.target}/analytics/math3/ext"/> |
| <copy todir="${edgent7.target}/analytics/math3/ext"> |
| <fileset dir="${edgent8.target}/analytics/math3/ext"/> |
| </copy> |
| |
| </target> |
| <target name="retro7.edgent.android" if="android.sdk.platform.jar"> |
| <retro7 qjar="edgent.android.topology.jar" qdir="android/topology/lib" /> |
| <retro7 qjar="edgent.android.hardware.jar" qdir="android/hardware/lib" /> |
| </target> |
| |
| <path id="tc.classpath"> |
| <dirset dir="${edgent}"> |
| <include name="**/test.classes"/> |
| </dirset> |
| </path> |
| <property name="tccp" refid="tc.classpath"/> |
| |
| <macrodef name="retro7.test.setup"> |
| <attribute name="tdir"/> |
| <attribute name="ldir" default="lib"/> |
| <sequential> |
| <echo message="Testing Setup: @{tdir}"/> |
| <delete dir="${edgent}/@{tdir}/test7.classes"/> |
| <mkdir dir="${edgent}/@{tdir}/test7.classes"/> |
| |
| <!-- <echo message="#### qcp7 ${qcp7}"/> --> |
| <!-- <echo message="#### qcp ${qcp}"/> --> |
| <!-- <echo message="#### tccp ${tccp}"/> --> |
| <exec executable="java" failonerror="true"> |
| <arg value="-Dretrolambda.inputDir=${edgent}/@{tdir}/test.classes"/> |
| <arg value="-Dretrolambda.classpath=${qcp7}:${qcp}:${tccp}"/> |
| <arg value="-Dretrolambda.outputDir=${edgent}/@{tdir}/test7.classes"/> |
| <arg value="-Dretrolambda.defaultMethods=true"/> |
| <arg value="-jar"/> |
| <arg value="${retrolambda.jar}"/> |
| </exec> |
| <delete dir="${edgent}/@{tdir}/test.classes"/> |
| <move file="${edgent}/@{tdir}/test7.classes" |
| tofile="${edgent}/@{tdir}/test.classes"/> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="retro7.test.run"> |
| <attribute name="tdir"/> |
| <attribute name="ldir" default="lib"/> |
| <sequential> |
| <echo message="Testing: @{tdir}"/> |
| <ant dir="${edgent}/@{tdir}" target="test.run" inheritAll="false"> |
| <property name="lib" location="${edgent7.target}/@{ldir}"/> |
| <property name="edgent.lib" location="${edgent7.target}/lib"/> |
| <property name="edgent.utils" location="${edgent7.target}/utils"/> |
| <property name="edgent.connectors" location="${edgent7.target}/connectors"/> |
| </ant> |
| </sequential> |
| </macrodef> |
| |
| <target name="verify.java7.built"> |
| <fail message="Java 7 jars not built!"> |
| <condition> |
| <not> |
| <available file="${edgent7.target}/lib" type="dir"/> |
| </not> |
| </condition> |
| </fail> |
| </target> |
| |
| <!-- |
| This is the set of tests that are converted |
| to be used with Java 7 |
| --> |
| <!-- Ensure previous separate build steps built the Java 7 jars --> |
| <target name="test7.setup" depends="verify.java7.built" |
| description="Setup Edgent tests for the Java 7.Must be run with Java 8 to run retrolambda." |
| > |
| <path id="edgent.java7.classpath"> |
| <fileset dir="${edgent7.target}/lib"> |
| <include name="*.jar"/> |
| </fileset> |
| <fileset dir="${edgent7.target}/connectors"> |
| <include name="*/lib/*.jar"/> |
| </fileset> |
| <fileset dir="${edgent7.target}/utils"> |
| <include name="*/lib/*.jar"/> |
| </fileset> |
| <fileset dir="${edgent7.target}/analytics"> |
| <include name="*/lib/*.jar"/> |
| </fileset> |
| </path> |
| <property name="qcp7" refid="edgent.java7.classpath"/> |
| <retro7.test.setup tdir="api/function"/> |
| <retro7.test.setup tdir="api/execution"/> |
| <retro7.test.setup tdir="api/graph" /> |
| <retro7.test.setup tdir="api/window" /> |
| <retro7.test.setup tdir="api/oplet" /> |
| <retro7.test.setup tdir="api/topology" /> |
| <retro7.test.setup tdir="spi/graph" /> |
| <retro7.test.setup tdir="spi/topology" /> |
| <retro7.test.setup tdir="runtime/appservice" /> |
| <retro7.test.setup tdir="runtime/etiao" /> |
| <retro7.test.setup tdir="runtime/jmxcontrol" /> |
| <retro7.test.setup tdir="runtime/jsoncontrol" /> |
| <retro7.test.setup tdir="runtime/jobregistry" /> |
| <retro7.test.setup tdir="utils/metrics" ldir="utils/metrics/lib"/> |
| <retro7.test.setup tdir="providers/direct" /> |
| <retro7.test.setup tdir="connectors/common" ldir="connectors/common/lib"/> |
| <retro7.test.setup tdir="connectors/iot" ldir="connectors/iot/lib"/> |
| <retro7.test.setup tdir="connectors/iotp" ldir="connectors/iotp/lib"/> |
| <retro7.test.setup tdir="connectors/http" ldir="connectors/http/lib"/> |
| <retro7.test.setup tdir="connectors/pubsub" ldir="connectors/pubsub/lib"/> |
| <retro7.test.setup tdir="apps/iot" ldir="apps/iot/lib"/> |
| <retro7.test.setup tdir="apps/runtime" ldir="apps/runtime/lib"/> |
| <retro7.test.setup tdir="analytics/sensors" ldir="analytics/sensors/lib"/> |
| </target> |
| |
| <!-- |
| This is the set of tests that are converted |
| to be used with Java 7 |
| --> |
| <!-- this must be preceeded by test7.setup (run with a Java 8 vm) --> |
| <target name="test7.run" depends="verify.java7.built" |
| description="Run Edgent tests for the Java 7. Should be run with JAVA_HOME pointing to a Java 7 virtual machine, though can also be run with Java 8" |
| > |
| <retro7.test.run tdir="api/function"/> |
| <retro7.test.run tdir="api/execution"/> |
| <retro7.test.run tdir="api/graph" /> |
| <retro7.test.run tdir="api/window" /> |
| <retro7.test.run tdir="api/oplet" /> |
| <retro7.test.run tdir="api/topology" /> |
| <retro7.test.run tdir="spi/graph" /> |
| <retro7.test.run tdir="spi/topology" /> |
| <retro7.test.run tdir="runtime/appservice" /> |
| <retro7.test.run tdir="runtime/etiao" /> |
| <retro7.test.run tdir="runtime/jmxcontrol" /> |
| <retro7.test.run tdir="runtime/jsoncontrol" /> |
| <retro7.test.run tdir="runtime/jobregistry" /> |
| <retro7.test.run tdir="utils/metrics" ldir="utils/metrics/lib"/> |
| <retro7.test.run tdir="providers/direct" /> |
| <retro7.test.run tdir="connectors/common" ldir="connectors/common/lib"/> |
| <retro7.test.run tdir="connectors/iot" ldir="connectors/iot/lib"/> |
| <retro7.test.run tdir="connectors/iotp" ldir="connectors/iotp/lib"/> |
| <retro7.test.run tdir="connectors/http" ldir="connectors/http/lib"/> |
| <retro7.test.run tdir="connectors/pubsub" ldir="connectors/pubsub/lib"/> |
| <retro7.test.run tdir="apps/iot" ldir="apps/iot/lib"/> |
| <retro7.test.run tdir="apps/runtime" ldir="apps/runtime/lib"/> |
| <retro7.test.run tdir="analytics/sensors" ldir="analytics/sensors/lib"/> |
| </target> |
| |
| <target name="clean"> |
| <delete dir="${input.dir}"/> |
| <delete dir="${output.dir}"/> |
| <delete dir="${edgent7.target}"/> |
| </target> |
| |
| </project> |