|
NetKernel News Volume 3 Issue 10
January 6th 2012
What's new this week?
- Repository Updates
- NetKernel Services - Scheduled Maintenance
- Tom's Blog
- NetKernel Gradle Plugin - Getting Started
- ROCing the Twin Cities
Catch up on last week's news here
Repository Updates
The following update is available in the NKSE and NKEE repositories...
- lang-ruby-1.2.1.nkp.jar
- A tweak to the JRuby loader to load libraries in the jruby/ path from the jruby.jar (Thanks to Tom Geudens for this)
NetKernel Services - Scheduled Maintenance
We have some scheduled maintenance planned for our servers this weekend. This will involve physical server upgrades with a planned loss of service for 30-60 minutes on Sunday 8th January after 8pm UTC. The upgrades will affect the following services:
- Apposite Repository
- NetKernel Downloads
- 1060 Research Site
- NK4UM
- NetKernel Doc Server
We hope to keep down-time to a minimum but please be aware that there is the possibility of temporary disruption of service at any time over the weekend as we prepare-for and undertake the upgrades.
Tom's Blog
Here's the latest from Tom. This week two-blog entries for the price of one. Please also don't forget that it would be really great if you can lend Tom some time to read/review the current draft of the Practical NetKernel Book.
We all started the New Year ROC-ing of course. So here is a little something to jumpstart the brains.
http://practical-netkernel.blogspot.com/2012/01/give-me-tools.html
And in case you missed last year's final entry, here is the link.
http://practical-netkernel.blogspot.com/2011/12/dont-know-much-about-technology.html
NetKernel Gradle Plugin - Getting Started
In the last news letter, I made a brief announcement of Brian Sletten's NetKernel plugin for gradle. But if you aren't familiar with gradle it would be hard to go from Brian's git repository to actually having a powerful and very simple development tool. So here's a step-by-step guide to getting started with the current snapshot of the plugin.
When you've followed these steps you will have a development environment in which all you'll need to do to build modules, package (and also publish to an apposite repository - but that's not covered today) is just one very simple declarative build desciption that can be readily automated.
The really cool part is that the plugin will automatically find and build against the NK core libraries *and* discover and link against any module imports that your module might be using - meaning you truly only have to point to the modules and describe the packages.
Here's the follow-along steps to get set up...
Step-By-Step
1. Download Gradle. To install just add its bin/ directory to your path. Test the install with
gradle -v2. Clone Brian's NetKernel plugin git repository
git clone git://github.com/bsletten/nk-gradle-plugin.git3. Change directory to the newly created nk-gradle-plugin/ dir.
4. Use gradle to build and install the plugin with...
gradle clean install
You now have gradle installed and the nk-plugin can be resolved from the local maven repository - all that's required to use it is to create a file called build.gradle in the directory root where your modules are located. For example if your modules are located in '/home/pjr/workspace/modules/xxxxxxxxxx' (where xxxx are the directories of your modules), you'd create a file called build.gradle at '/home/pjr/workspace/modules/build.gradle'
Here's an example build.gradle that sets up the necessary boilerplate and defines one NK package containing one module...
////////////// //Boilerplate - to use and set up classpath for the NK-plugin ////////////// allprojects { apply plugin: 'netkernel' dependencies { groovy localGroovy() } } buildscript { repositories { mavenLocal() } dependencies { //Adds the NK-plugin to the classpath from the local maven repo classpath 'net.bosatsu.gradle:nk-gradle-plugin:0.0.12' } } ////////////// //The NetKernel Plug-in Main Event ////////////// nkconfig { definePackage( //Package Metadata - version number is definitive for a build name: 'pjr-test-ncode-demo', description: 'Simple nCoDE Demo', version: '1.1.1', //The modules to be packaged are listed here and will be built as needed... modules: ['urn.ncode.demo'], //Publish to a repository (to be discussed at a future date) repo: 'PJR-Test', repoversion: '1.0.0', set: 'main' ) //You can have as many definePackage() as needed }
You must also provide a secondary file called settings.gradle - this is a declaration of the modules that should be considered for building. Here's an example...
//Include module directories that should be considered in the build
include 'urn.ncode.demo'
include 'urn.ncode.playpen'
include 'urn.test.ncode.tests'
You can now do a full build of the modules and have them packaged with this one command (notice you need to tell the plugin where your NK install is located so that it can use its libraries and modules to build against)...
gradle -Pnetkernelroot=/home/pjr/NKEE-5.1.1/ clean jar nkpackage
Here's an example of the output...
pjr@pjr-l630:~/workspace/install/modules$ gradle -Pnetkernelroot=/home/pjr/NKEE-5.1.1/ clean jar nkpackage Found a NetKernel installation at: /home/pjr/NKEE-5.1.1/ Configuring Core Dependencies Configuring Module Lib Dependencies Configuring Repositories Found a NetKernel installation at: /home/pjr/NKEE-5.1.1/ The SourceSet.setClassesDir() method is deprecated and will be removed in the next version of Gradle. You should use the getOutput().setClassesDir() method instead. Configuring Core Dependencies Configuring Module Lib Dependencies Investigating dependencies for urn:ncode:demo Checking urn:org:netkernel:lang:ncode Selecting version: modules/urn.org.netkernel.lang.ncode-0.15.0.jar Checking urn:org:netkernel:ext:layer1 Selecting version: modules/urn.org.netkernel.ext.layer1-1.36.26/ Adding Dependency: urn:org:netkernel:ext:layer1(/home/pjr/NKEE-5.1.1/modules/ urn.org.netkernel.ext.layer1-1.36.26/) to project ':urn.ncode.demo' Configuring Repositories Found a NetKernel installation at: /home/pjr/NKEE-5.1.1/ Configuring Core Dependencies Configuring Module Lib Dependencies Investigating dependencies for urn:ncode:playpen Checking urn:org:netkernel:lang:ncode Selecting version: modules/urn.org.netkernel.lang.ncode-0.15.0.jar Checking urn:org:netkernel:ext:layer1 Selecting version: modules/urn.org.netkernel.ext.layer1-1.36.26/ Adding Dependency: urn:org:netkernel:ext:layer1(/home/pjr/NKEE-5.1.1/modules/ urn.org.netkernel.ext.layer1-1.36.26/) to project ':urn.ncode.playpen' Configuring Repositories Found a NetKernel installation at: /home/pjr/NKEE-5.1.1/ Configuring Core Dependencies Configuring Module Lib Dependencies Investigating dependencies for urn:test:ncode:tests Checking urn:org:netkernel:lang:ncode Selecting version: modules/urn.org.netkernel.lang.ncode-0.15.0.jar Checking urn:org:netkernel:ext:layer1 Selecting version: modules/urn.org.netkernel.ext.layer1-1.36.26/ Adding Dependency: urn:org:netkernel:ext:layer1(/home/pjr/NKEE-5.1.1/modules/ urn.org.netkernel.ext.layer1-1.36.26/) to project ':urn.test.ncode.tests' Configuring Repositories Publishing: nkpublish-pjr-test-ncode-demo :clean :urn.ncode.demo:clean :urn.ncode.playpen:clean :urn.test.ncode.tests:clean :compileJava UP-TO-DATE :compileGroovy UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar :urn.ncode.demo:compileJava UP-TO-DATE :urn.ncode.demo:compileGroovy UP-TO-DATE :urn.ncode.demo:processResources UP-TO-DATE :urn.ncode.demo:classes UP-TO-DATE :urn.ncode.demo:jar :urn.ncode.playpen:compileJava UP-TO-DATE :urn.ncode.playpen:compileGroovy UP-TO-DATE :urn.ncode.playpen:processResources UP-TO-DATE :urn.ncode.playpen:classes UP-TO-DATE :urn.ncode.playpen:jar :urn.test.ncode.tests:compileJava UP-TO-DATE :urn.test.ncode.tests:compileGroovy UP-TO-DATE :urn.test.ncode.tests:processResources UP-TO-DATE :urn.test.ncode.tests:classes UP-TO-DATE :urn.test.ncode.tests:jar :nkpackage-pjr-test-ncode-demo-manifest :nkpackage-pjr-test-ncode-demo-module :nkpackage-pjr-test-ncode-demo :nkpackage :urn.ncode.demo:nkpackage UP-TO-DATE :urn.ncode.playpen:nkpackage UP-TO-DATE :urn.test.ncode.tests:nkpackage UP-TO-DATE BUILD SUCCESSFUL Total time: 6.985 secs
Here's the cool bit. Notice that the plugin inspects the module.xml of each module and automatically locates and adds any imported modules to the build path (should they be needed). Notice that it also builds both Java and Groovy classes.
When the build is done each built module will contain a build/ directory containing the jarred build of the module. Also the main root directory will now contain a build/ directory containing the packages you defined.
Feedback and Suggestions
While the plugin already constitutes a valuable development tool for building modules and packages, Brian is also close to completing a full Apposite repository publishing capability that will take the packages and automatically publish them into a full Apposite repo for production deployment.
Brian would welcome community feedback and contributions to the plugin project. You probably know how to reach him, but if not his details are published on his github profile.
ROCing the Twin Cities
I'm going to be in the Twin Cities area again next week from the 14th January - there's a rumour I'll be giving a talk at the local Java User Group (details to follow). But if you'd like to get together ping me on twitter (@pjr1060).
Have a great weekend...
Comments
Please feel free to comment on the NetKernel Forum
Follow on Twitter:
@pjr1060 for day-to-day NK/ROC updates
@netkernel for announcements
@tab1060 for the hard-core stuff
To subscribe for news and alerts
Join the NetKernel Portal to get news, announcements and extra features.