Repository: incubator-edgent
Updated Branches:
  refs/heads/master 12fa8d787 -> 48376b4ac


Edgent-270 can't use pi4j in build, etc

Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/48376b4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/48376b4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/48376b4a

Branch: refs/heads/master
Commit: 48376b4acc00effb2314a18cc554e8eed82571d9
Parents: 12fa8d7
Author: Dale LaBossiere <[email protected]>
Authored: Mon Oct 10 15:15:48 2016 -0400
Committer: Dale LaBossiere <[email protected]>
Committed: Mon Oct 10 15:15:48 2016 -0400

----------------------------------------------------------------------
 legal/binary-release-bundled-dependencies       |  6 ------
 samples/scenarios/build.gradle                  | 21 +++++++++++++++++++-
 .../scenarios/iotp/range/sensor/README.md       |  9 ++++++---
 3 files changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/48376b4a/legal/binary-release-bundled-dependencies
----------------------------------------------------------------------
diff --git a/legal/binary-release-bundled-dependencies 
b/legal/binary-release-bundled-dependencies
index f3cc9d2..3578764 100644
--- a/legal/binary-release-bundled-dependencies
+++ b/legal/binary-release-bundled-dependencies
@@ -174,9 +174,3 @@ connectors/javax.websocket-client/ext
   javax.websocket-api-1.0.jar         javax.websocket:javax.websocket-api:1.0
         LICENSE: CDDL-2 and GPL       <jar>/meta-inf/manifest.mf
         NOTICE:  none  
-    
---------------------------------
-samples/scenarios/ext
-  pi4j-core-1.0.jar         com.pi4j:pi4j-core:1.0                             
      
-        LICENSE: LGPL-3.0  <jar>/LICENSE.txt
-        NOTICE:  <jar>/NOTICE.txt

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/48376b4a/samples/scenarios/build.gradle
----------------------------------------------------------------------
diff --git a/samples/scenarios/build.gradle b/samples/scenarios/build.gradle
index c1f26aa..50a5b7e 100644
--- a/samples/scenarios/build.gradle
+++ b/samples/scenarios/build.gradle
@@ -11,6 +11,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+sourceSets {
+  main {
+    java {
+      if (System.env.PI4J_LIB == null) {
+        exclude "**/scenarios/iotp/range/sensor/**"
+        logger.lifecycle 'PI4J_LIB ev not set. Omitting 
scenarios/iotp/range/sensor/.'
+      } 
+    }
+  }
+}
+
 dependencies {
   // N.B. common dependencies are set in root build.gradle
 
@@ -19,7 +31,14 @@ dependencies {
   addTargetDirProjectJarDependency 'compile', ':providers:iot'
   addTargetDirProjectJarDependency 'compile', ':connectors:iot'
   addTargetDirProjectJarDependency 'compile', ':connectors:iotp'
-  addProjectExtDependency 'compile', 'com.pi4j:pi4j-core:1.0'
+  
+  // N.B. pi4J is strictly LGPL and hence incompatible with ASF licensing.
+  // Users will have to download it themselves and build the sample.
+  // addProjectExtDependency 'compile', 'com.pi4j:pi4j-core:1.0'
+  if (System.env.PI4J_LIB != null) {
+    // addProjectExtDependency 'compile', 
files("$System.env.PI4J_LIB/pi4j-core.jar")
+    compile files("$System.env.PI4J_LIB/pi4j-core.jar")
+  }
 
   // N.B. root project adds test common dependencies
 }

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/48376b4a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/README.md
----------------------------------------------------------------------
diff --git 
a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/README.md
 
b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/README.md
index 3207147..de23cc6 100644
--- 
a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/README.md
+++ 
b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/README.md
@@ -3,18 +3,21 @@
 See the Recipe this was created for 
[here](https://developer.ibm.com/recipes/tutorials/apache-quarks-on-pi-to-watson-iot-foundation/).
  If that link doesn't work, try 
[here](https://developer.ibm.com/recipes/tutorials/apache-edgent-on-pi-to-watson-iot-foundation/).
 
 
 ## Requirements: 
-* You must have Edgent downloaded and built. The sample uses Pi4J. It is 
included with the built sample under `samples/ext`.
+* You must have Pi4J installed on the device (if you are running outside of a 
Raspberry Pi, you will have to download the JARs and include them in your 
classpath)
+* You must have Edgent downloaded and built
 * You will need to have an HC-SR04 Range sensor hooked up with your EchoPin 
set to pin 18 and your TripPin at pin 16 (see these instructions on hardware 
setup: 
http://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi).
 To use a simulated sensor, pass in true as your second argument. 
 * You will need to have an LED hooked up to pin 12 (See these instructions to 
set up an LED, however use pin 12 as your control pin: 
https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/).
 To use a simulated LED, pass in true as your third argument. 
 * You will need to have your device registered with Watson IoTF and a 
device.cfg file, or you can use a quickstart version by passing in "quickstart" 
as your first argument.
  
-To compile:
+To compile, export your Edgent install and PI4J libraries (on Raspberry Pi, 
the default Pi4J location is `/opt/pi4j/lib`):
 
 `$ EDGENT=<edgent-root-dir>`
 
+`$ export PI4J_LIB=<Pi4J-libs>  # directory where pi4j-core.jar resides`
+
 `$ cd $EDGENT`
 
-`$ ./gradlew`
+`$ ./gradlew  # builds the range sensor sample only if the PI4J_LIB 
environment variable is set`
 
 To run: 
  

Reply via email to