On Wed, May 9, 2018 at 4:42 PM, Nash, George <george.n...@intel.com> wrote:

>
>
>
>
> *From:* Gregg Reynolds [mailto:d...@mobileink.com]
> *Sent:* Wednesday, May 9, 2018 1:19 PM
> *To:* Nash, George <george.n...@intel.com>
> *Cc:* Mats Wichmann <m...@wichmann.us>; iotivity-dev <
> iotivity-dev@lists.iotivity.org>
> *Subject:* Re: [dev] [iotivity-1.3.0] Windows "Java" Build Fails
>
>
>
>
>
> On Wed, May 9, 2018, 2:09 PM George Nash <george.n...@intel.com> wrote:
>
>
>
> [geo] I have not had a chance to use Bazel yet but the simple fact that it
> handles Java and Android makes it tempting. There are a lot of little hacks
> in the SCons scripts to handle Java and Android. Java feels like it has not
> received a lot of love from the SCons developers. Android is basically not
> supported which is why we are using Gradle to build Android sample code
> instead of SCons.
>
>
>
Ok, just pushed a draft with Bazel support for Java and Android target:
https://gerrit.iotivity.org/gerrit/#/c/25165/.

This is proof of concept, it only builds the JNI C++ and Java libraries (I
cannot get the scons build to work on OS X, so I don't have an Iotivity
build to work with).

Notable features:


   - A third-party lib deals transparently with Boost
   - javah automation - add, change, delete native methods and the headers
   are automatically regenerated. They go into a build-time directory, which
   makes sense (as generated files they need not be checked into version
   control).  If you wanted to go in this direction you would want to adjust
   the current headers - e.g. #include "org_iotivity_base_OcResource.h" rather
   than embedding it in JniOcResource.h.
   - To select features, pass params, e.g. bazel build java:IotivityDroid
   --define with_cloud=true.  See the config_setting stuff in config/BUILD.
   - Uses the most recent SDK/NDK.  The scons logic is very outdated with
   respect to the NDK.  The Bazel logic just does the right thing.  See the
   WORKSPACE file.

I have only tested it on OS X, but it should not be too difficult to get it
working on Linux. Windows might be slightly harder, but Bazel does support
Windows and I have built OpenOCF with Bazel on Windows, so it should be
doable.  Platform-specific config_settings must be defined in config/BUILD,
and appropriate "select" clauses added to BUILD and java/BUILD.

Enjoy,

Gregg

Reply via email to