When building generic_java stop using gradle.
Gradle is required to build aar and apk files
for android but scons is capable of building
the java code without using gradle.
This also has the side effect that we can add
a more complete manifest file that makes running
the samples simpler. We no longer need to run
long commandline java commands to start the
samples.
example:
cd <ouput_dir>/java
java -Djava.library.path=.. -jar simplerserver.jar
See IOT-2419 for SECURED=1 build
Bug: Bug: https://jira.iotivity.org/browse/IOT-2419
Bug: https://jira.iotivity.org/browse/IOT-2533
Change-Id: I8bf5228173745d26114e612a0d82d1f28060d801
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21965
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Larry Sachs <larry.j.sachs@intel.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
env.AppendUnique(CPPDEFINES=['__JAVA__'])
if target_os in ['windows', 'winrt']:
env.AppendUnique(CPPPATH=[
- java_home + '/include',
- java_home + '/include/win32'
+ java_home + '/include',
+ java_home + '/include/win32'
])
+ env.AppendENVPath('PATH', java_home + '/bin')
else:
env.AppendUnique(CPPPATH=[
- java_home + '/include',
- java_home + '/include/' + target_os
- ])
+ java_home + '/include',
+ java_home + '/include/' + target_os
+ ])
else:
msg = "Error: BUILD_JAVA requires JAVA_HOME to be set for target '%s'" % target_os
Exit(msg)
src_dir = env.get('SRC_DIR')
-help_vars = Variables()
-if env.get('BUILD_JAVA') == True:
- if not env.get('ANDROID_GRADLE'):
- SConscript('../../extlibs/android/gradle/SConscript')
- help_vars.Add(
- PathVariable('ANDROID_GRADLE',
- 'Android Gradle directory',
- default=os.path.join(
- src_dir, 'extlibs', 'android',
- 'gradle', 'gradle-2.2.1/bin/gradle')))
-
- if env.get('ANDROID_GRADLE'):
- android_gradle = env.get('ANDROID_GRADLE')
- else:
- print '''
-*************************************** Info **********************************
-* Android Gradle path is not set, the default will be used. You can set
-* environment variable ANDROID_GRADLE or add it on the command line as:
-* # scons ANDROID_GRADLE=<path to android GRADLE> ...
-*******************************************************************************
-'''
- android_gradle = os.path.join(
- src_dir, 'extlibs', 'android', 'gradle', 'gradle-2.2.1', 'bin', 'gradle')
-
-help_vars.Update(env)
-Help(help_vars.GenerateHelpText(env))
-
# Add the default lib directory
build_dir = env.get('BUILD_DIR')
env.AppendUnique(LIBPATH=[build_dir])
% (solutionfile, configuration, platform, outdir)
env.Execute(msbuild_cmd)
-help_vars = Variables()
-if env.get('BUILD_JAVA') == True:
- if not env.get('ANDROID_GRADLE'):
- SConscript('../../extlibs/android/gradle/SConscript')
- help_vars.Add(
- PathVariable('ANDROID_GRADLE',
- 'Android Gradle directory',
- default=os.path.join(
- src_dir, 'extlibs', 'android',
- 'gradle', 'gradle-2.2.1/bin/gradle')))
-
- if env.get('ANDROID_GRADLE'):
- android_gradle = env.get('ANDROID_GRADLE')
- else:
- print(
-'''
-*************************************** Info **********************************
-* Android Gradle path is not set, the default will be used. You can set
-* environment variable ANDROID_GRADLE or add it on the command line as:
-* # scons ANDROID_GRADLE=<path to android GRADLE> ...
-*******************************************************************************
-''')
- android_gradle = os.path.join(
- src_dir, 'extlibs', 'android', 'gradle', 'gradle-2.2.1', 'bin', 'gradle')
-
-help_vars.Update(env)
-Help(help_vars.GenerateHelpText(env))
-
if env.get('MSVC_UWP_APP') == '1':
# Create an MSBuilder that uses a generator to generate the MSBuild actions
MSBuilder = Builder(generator = MSBuildGenerator)
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Copyright 2017 Intel Corporation All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+import SCons
import os
import platform
+import subprocess
+from distutils.version import StrictVersion
Import('env')
PROJECT_VERSION = env.get('PROJECT_VERSION')
if 'NFC' in TARGET_TRANSPORT:
TRANSPORT_NFC = 1
-if target_os == "android":
+if target_os in ['android']:
android_home = env.get('ANDROID_HOME')
os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
def ensure_libs(target, source, env):
if platform.system() == 'Windows':
- return target, [source, env.get('BUILD_DIR') + 'ca-interface.dll',
+ return target, [source, env.get('BUILD_DIR') + 'ca-interface.dll',
env.get('BUILD_DIR') + 'ocstack-jni.dll']
else:
return target, [source, env.get('BUILD_DIR') + 'libca-interface.so',
env.get('BUILD_DIR') + 'libocstack-jni.so']
+def find_scons_java_version(env):
+ '''
+ Attempt to find the version of the javac tool that will be used to build
+ the java code.
+ This will return a string that SHOULD be placed into SCons' JAVAVERSION
+ environment variable.
+ If a version can not be determined return None
+ '''
+ possible_versions = ['1.8', '1.7', '1.6', '1.5']
+ # This command is used to get the java version used.
+ # Then walk through the output line by line to see if it has one of the
+ # expected java version. Note older versions of SCons do not support newer
+ # versions of Java. Since the way java code is compiled by SCons has not
+ # changed significantly since Java 1.6 we just tell SCons to use the
+ # maximum version of Java that was supported for by SCons for a given
+ # release
+ # SCons 2.1.0 Java 1.6 support (older versions of SCons were not investigated)
+ # SCons 2.3.0 Java 1.7 support added
+ # SCons 2.3.3 Java 1.8 support added
+ # Support for Java 1.9 not yet added. At this time JDK1.9 has not be released
+ # Until support for Java 1.9 is officially added to SCons this script will
+ # use the the 1.8 for the JAVAVERSION.
+ javac_cmd = os.path.join(env['JAVA_HOME'], 'bin', 'javac')
+ java_ver = subprocess.check_output([javac_cmd, '-version'], stderr=subprocess.STDOUT)
+ print('Trying to discover the version of Java used for compilation')
+ scons_version = SCons.__version__
+ if StrictVersion(scons_version) < StrictVersion('2.1.0'):
+ print('\t***** Version of SCons older than 2.0.0 detected. *****')
+ print('\t***** Java build will likely fail or have errors in the build output. *****')
+ print('\t***** Recommend updating to the latest version of SCons *****')
+ return None
+ for line in java_ver.split('\n'):
+ # handle building with versions of Java not supported by SCons
+ if ' 1.9' in line:
+ print('\tJava version 1.9 found.')
+ if StrictVersion(scons_version) <= StrictVersion('2.2.0'):
+ print('\tJava 1.9 not supported in SCons ' + scons_version + ', max supported Java 1.6.')
+ print('\tSetting JAVAVERSION to 1.6')
+ return '1.6'
+ if StrictVersion(scons_version) <= StrictVersion('2.3.2'):
+ print('\tJava 1.9 not supported in SCons ' + scons_version + ', max supported Java 1.7.')
+ print('\tSetting JAVAVERSION to 1.7')
+ return '1.7'
+ if StrictVersion(scons_version) > StrictVersion('2.5.1'):
+ # only printing this if Java 1.9 is found. Newer versions of
+ # scons should be able to handle older versions of Java
+ print('\t***** Unrecognized version of SCons found in java version Check. Build script may need to be updated *****')
+ # drop through to the next if statement.
+ if StrictVersion(scons_version) > StrictVersion('2.3.2'):
+ print('\tJava 1.9 not supported in SCons ' + scons_version + ', max supported Java 1.8.')
+ print('\tSetting JAVAVERSION to 1.8')
+ return '1.8'
+ if ' 1.8' in line:
+ print('\tJava version 1.8 found.')
+ if StrictVersion(scons_version) <= StrictVersion('2.2.0'):
+ print('\tJava 1.8 not supported in SCons ' + scons_version + ', max supported Java 1.6.')
+ print('\tSetting JAVAVERSION to 1.6')
+ return '1.6'
+ if StrictVersion(scons_version) <= StrictVersion('2.3.2'):
+ print('\tJava 1.8 not supported in SCons ' + scons_version + ', max supported Java 1.7.')
+ print('\tSetting JAVAVERSION to 1.7')
+ return '1.7'
+ if ' 1.7' in line:
+ print('\tJava version 1.7 found.')
+ if StrictVersion(scons_version) <= StrictVersion('2.2.0'):
+ print('\tJava 1.7 not supported in SCons ' + scons_version + ', max supported Java 1.6.')
+ print('\tSetting JAVAVERSION to 1.6')
+ return '1.6'
+ # handle versions supported by SCons
+ for v in possible_versions:
+ if (' ' + v) in line:
+ print('\tSetting JAVAVERSION to ' + v)
+ return v
+ print('\tJava version NOT found!')
+ return None
jniOut = SConscript('jni/SConscript')
if target_os == 'android':
target_variant = "android"
-jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(
- action=env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') +
- '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace'
- % (target_variant, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC,
- TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB,
- MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')),
- emitter=ensure_libs)
-jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildApi = jdk_env.Gradle(
- target="base/objs",
- source="common/src/main/java/org/iotivity/base/OcResource.java")
-
-jdk_env['BUILDERS']['Gradle'] = Builder(
- action=env.get('ANDROID_GRADLE') + ' build -b ' +
- 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace'
- % (target_variant, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE,
- TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD,
- RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER,
- env.get('BUILD_DIR')))
-#cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (target_variant, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (target_variant, ))
-cmdBuildExamples = jdk_env.Gradle(
- target="examples-%s/simpleclient/jar" % (target_variant, ),
- source=
- "examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java"
- % (target_variant, ))
-
-if target_os != 'android':
- exampleAclFiles = jdk_env.Install(
- '#java/examples-java/simpleserver/build/libs/',
- 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
- exampleAclFiles += jdk_env.Install(
- '#java/examples-java/simpleclientserver/build/libs/',
- 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
- Depends(exampleAclFiles, cmdBuildExamples)
-
-Depends(cmdBuildExamples, cmdBuildApi)
-Depends(cmdBuildExamples, jniOut)
+jdk_env = None
+if target_os in ['android']:
+ # IOT-2559 Why does Gradle build require importing the os.environ
+ jdk_env = Environment(ENV=os.environ)
+else:
+ jdk_env = env.Clone()
+
+
+cmdBuildApi = []
+cmdBuildExamples = []
+if target_os in ['android']:
+ jdk_env['BUILDERS']['Gradle'] = Builder(
+ action=env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') +
+ '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace'
+ % (target_variant, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC,
+ TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB,
+ MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')),
+ emitter=ensure_libs)
+ jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
+
+ cmdBuildApi = jdk_env.Gradle(
+ target="base/objs",
+ source="common/src/main/java/org/iotivity/base/OcResource.java")
+
+ jdk_env.NoClean(cmdBuildApi)
+ jdk_env['BUILDERS']['Gradle'] = Builder(
+ action=env.get('ANDROID_GRADLE') + ' build -b ' +
+ 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace'
+ % (target_variant, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE,
+ TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD,
+ RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER,
+ env.get('BUILD_DIR')))
+ #cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (target_variant, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (target_variant, ))
+ cmdBuildExamples = jdk_env.Gradle(
+ target="examples-%s/simpleclient/jar" % (target_variant, ),
+ source=
+ "examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java"
+ % (target_variant, ))
+ jdk_env.NoClean(cmdBuildExamples)
+
+ if target_os != 'android':
+ exampleAclFiles = jdk_env.Install(
+ '.',
+ 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
+ exampleAclFiles += jdk_env.Install(
+ '.',
+ 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
+ Depends(exampleAclFiles, cmdBuildExamples)
+
+ Depends(cmdBuildExamples, cmdBuildApi)
+ Depends(cmdBuildExamples, jniOut)
+else:
+ # Build iotivity.jar
+ # TODO At this time we expect this build flag is required for i18n support
+ # need to do additional testing to verify this assumption.
+ jdk_env.Append(JAVACFLAGS=['-encoding', 'UTF-8'])
+ java_v = find_scons_java_version(jdk_env)
+ if java_v != None:
+ jdk_env.Append(JAVAVERSION=java_v)
+ jdk_env.Append(JAVASOURCEPATH=['java/iotivity-java/src/main/java', 'java/common/src/main/java'])
+ java_class_out = jdk_env.Java(target='classes', source=['iotivity-java/src/main/java', 'common/src/main/java'])
+ cmdBuildApi = jdk_env.Jar(target='iotivity.jar', source=java_class_out)
+
+ # Build examples
+ jdk_env.SConscript('examples-java/SConscript', exports='jdk_env')
if target_os == 'android':
jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-android/build/')
'#/java/examples-android/simpleclientserver/build/')
jdk_env.Clean(cmdBuildExamples,
'#/java/examples-android/simpleserver/build/')
-else:
- jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-linux/build/')
- jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/build/')
- jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclient/build/')
- jdk_env.Clean(cmdBuildExamples,
- '#/java/examples-java/simpleclientserver/build/')
- jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleserver/build/')
env.AppendUnique(baseAAR=cmdBuildApi)
--- /dev/null
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Copyright 2017 Intel Corporation All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('jdk_env')
+
+# Build examples
+
+# Build simplerserver sample
+jdk_env.SConscript('simpleserver/SConscript', exports='jdk_env')
+
+# Build simpleclient sample
+jdk_env.SConscript('simpleclient/SConscript', exports='jdk_env')
+
+# Build simpleclientserver sample
+jdk_env.SConscript('simpleclientserver/SConscript', exports='jdk_env')
\ No newline at end of file
+++ /dev/null
-// Top-level build file where you can add configuration options common to all sub-projects/modules.\r
-\r
-buildscript {\r
- repositories {\r
- jcenter()\r
- }\r
- dependencies {\r
-\r
- // NOTE: Do not place your application dependencies here; they belong\r
- // in the individual module build.gradle files\r
- }\r
-}\r
-\r
-allprojects {\r
- apply plugin: 'java'\r
- repositories {\r
- jcenter()\r
- }\r
- dependencies {\r
- compile fileTree(dir: "../../iotivity-java/build/libs/", include: '*.jar')\r
- }\r
-}\r
+++ /dev/null
-#
-# //******************************************************************
-# //
-# // Copyright 2015 Intel Corporation.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed 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-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-TARGET_ARCH=armeabi
-RELEASE=release
-SECURED=1
-ERROR_MSG="if building examples from android-studio, you might need to modify the default TARGET_ARCH\
- and RELEASE in <iotivity>/android/examples/gradle.properties,\
- if your aar file has different values for TARGET_ARCH and RELEASE"
-
+++ /dev/null
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+++ /dev/null
-@if "%DEBUG%" == "" @echo off\r
-@rem ##########################################################################\r
-@rem\r
-@rem Gradle startup script for Windows\r
-@rem\r
-@rem ##########################################################################\r
-\r
-@rem Set local scope for the variables with windows NT shell\r
-if "%OS%"=="Windows_NT" setlocal\r
-\r
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
-set DEFAULT_JVM_OPTS=\r
-\r
-set DIRNAME=%~dp0\r
-if "%DIRNAME%" == "" set DIRNAME=.\r
-set APP_BASE_NAME=%~n0\r
-set APP_HOME=%DIRNAME%\r
-\r
-@rem Find java.exe\r
-if defined JAVA_HOME goto findJavaFromJavaHome\r
-\r
-set JAVA_EXE=java.exe\r
-%JAVA_EXE% -version >NUL 2>&1\r
-if "%ERRORLEVEL%" == "0" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:findJavaFromJavaHome\r
-set JAVA_HOME=%JAVA_HOME:"=%\r
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
-\r
-if exist "%JAVA_EXE%" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:init\r
-@rem Get command-line arguments, handling Windowz variants\r
-\r
-if not "%OS%" == "Windows_NT" goto win9xME_args\r
-if "%@eval[2+2]" == "4" goto 4NT_args\r
-\r
-:win9xME_args\r
-@rem Slurp the command line arguments.\r
-set CMD_LINE_ARGS=\r
-set _SKIP=2\r
-\r
-:win9xME_args_slurp\r
-if "x%~1" == "x" goto execute\r
-\r
-set CMD_LINE_ARGS=%*\r
-goto execute\r
-\r
-:4NT_args\r
-@rem Get arguments from the 4NT Shell from JP Software\r
-set CMD_LINE_ARGS=%$\r
-\r
-:execute\r
-@rem Setup the command line\r
-\r
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
-\r
-@rem Execute Gradle\r
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
-\r
-:end\r
-@rem End local scope for the variables with windows NT shell\r
-if "%ERRORLEVEL%"=="0" goto mainEnd\r
-\r
-:fail\r
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
-rem the _cmd.exe /c_ return code!\r
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
-exit /b 1\r
-\r
-:mainEnd\r
-if "%OS%"=="Windows_NT" endlocal\r
-\r
-:omega\r
+++ /dev/null
-include ':simpleserver', ':simpleclient', ':simpleclientserver'//, ':fridgeserver', ':fridgeclient', ':guiclient', ':provisioningclient', ':presenceserver', ':presenceclient', ':devicediscoveryclient', ':devicediscoveryserver', ':groupclient', ':groupserver', ':fridgegroupclient', ':fridgegroupserver'
--- /dev/null
+Manifest-Version: 1.0\r
+Class-Path: iotivity.jar\r
+Main-Class: org.iotivity.base.examples.SimpleClient\r
--- /dev/null
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Copyright 2017 Intel Corporation All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('jdk_env')
+
+# Build simpleclient sample
+simpleclient_classes = jdk_env.Java(target='classes', source=['src/main/java'])
+example_jar = jdk_env.Jar(target='simpleclient.jar', source=[simpleclient_classes, 'MANIFEST.MF'])
+jdk_env.Install("../..", example_jar)
\ No newline at end of file
--- /dev/null
+Manifest-Version: 1.0\r
+Class-Path: iotivity.jar\r
+Main-Class: org.iotivity.base.examples.SimpleClientServer\r
--- /dev/null
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Copyright 2017 Intel Corporation All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('jdk_env')
+
+# Build simpleclientserver sample
+simpleclientserver_classes = jdk_env.Java(target='classes', source=['src/main/java'])
+# jdk_env.Jar(target='simpleclientserver.jar',
+# source=[simpleclientserver_classes, 'MANIFEST.MF'])
+# SCons is incorrectly calculating the output classes for simpleclientserver sample.
+# The following is a work around for the build command above. The unfortunate
+# side effect of this work around results in a larger output.
+example_jar =jdk_env.Jar(target='simpleclientserver.jar',
+ source=['classes','MANIFEST.MF'],
+ JARCHDIR='$SOURCE')
+jdk_env.Install("../..", example_jar)
\ No newline at end of file
--- /dev/null
+Manifest-Version: 1.0\r
+Class-Path: iotivity.jar\r
+Main-Class: org.iotivity.base.examples.SimpleServer\r
--- /dev/null
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Copyright 2017 Intel Corporation All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('jdk_env')
+
+# Build simplerserver sample
+simpleserver_classes = jdk_env.Java(target='classes',
+ source=['src/main/java'])
+# jdk_env.Jar(target='simpleserver.jar',
+# source=[simpleserver_classes, 'MANIFEST.MF'])
+# SCons is incorrectly calculating the output classes for simpleserver sample.
+# The following is a work around for the build command above. The unfortunate
+# side effect of this work around results in a larger output.
+example_jar = jdk_env.Jar(target='simpleserver.jar',
+ source=['classes', 'MANIFEST.MF'],
+ JARCHDIR='$SOURCE')
+jdk_env.Install("../..", example_jar)
\ No newline at end of file
+++ /dev/null
-/*\r
- * //******************************************************************\r
- * //\r
- * // Copyright 2015 Intel Corporation.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- * //\r
- * // Licensed under the Apache License, Version 2.0 (the "License");\r
- * // you may not use this file except in compliance with the License.\r
- * // You may obtain a copy of the License at\r
- * //\r
- * // http://www.apache.org/licenses/LICENSE-2.0\r
- * //\r
- * // Unless required by applicable law or agreed to in writing, software\r
- * // distributed under the License is distributed on an "AS IS" BASIS,\r
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * // See the License for the specific language governing permissions and\r
- * // limitations under the License.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- */\r
-\r
-\r
-apply plugin: 'java'\r
-\r
-sourceSets {\r
- main {\r
- java {\r
- srcDirs 'src/main/java', '../common/src/main/java'\r
- }\r
- }\r
-}\r
-\r
-\r
-dependencies {\r
- compile fileTree(dir: 'libs', include: ['*.jar'])\r
-}\r
+++ /dev/null
-/*
- *******************************************************************
- *
- * Copyright 2017 Intel Corporation.
- *
- *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- *
- * Licensed 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.
- *
- *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- */
-
- rootProject.name='iotivity'
\ No newline at end of file