gradle Execution order - groovy

i'm new to gradle. If i'm not using the either doFirst() or doLast(). In which order the lines in a plugin(say) are executed. i can observe that they are not executed sequentially?
Can somebody explain the execution flow of a gradle file?
Thanks

The Gradle build lifecycle is documented here.
It can be summarized by "ICE": Initialization, Configuration, Execution.
Your question is focused on Execution. For a single-project build, it is described in section "48.5. Configuration and execution of a single project build" at the above link.
For plugins, the task dependency graph will depend on the plugin specifics. For example, see the Java plugin for a list of its tasks and dependencies.

Related

Cucumber Predefined steps usage

I have a project where I have written some per-defined steps and implemented.
Now I like to use the per-defined steps in another project in eclipse. Kindly let me know how could I do that?
Cucumber only knows how to read and execute your feature files because of the step definition files usually defined with in a steps directory. That is where your feature statements are captured by regular expressions and translated to Java code
The steps Cucumber will search for just live in a package, or a sub-package from the runner.
Suggestion would be to copy the step definitions from Project 2 into your steps directory in Project 1.
Also there is way to re-use steps is therefore to package the steps in a jar and add that jar as a dependency. You can use Maven for creating the jar.

How to use Cobertura maven plugin, so that the bytecode is not altered?

I recently tried to include cobertura plugin for our project. But I ran to a strange problem. Now, if I try to do this:
mvn clean package cobertura:check-integration-test
My project assembles just fine. But after deploy here is what I get as a message:
java.lang.NoClassDefFoundError:
net/sourceforge/cobertura/coveragedata/LightClassmapListener
This happens, as I understand, because cobertura alters the bytecode of my classes. So, how should I proceed with making checks and building the code? Right now I come up with the following solution for teamcity:
First step runs cobertura:
mvn clean package cobertura:check-integration-test
After that second step runs the normal assembly:
mvn clean package
This seems to work, but it seems kind of strange, that I have to run the process of packaging twice (this takes double time), just in order to make a clean build with bytecode unaffected by cobertura plugin.
If you use qualinsight-mojo-cobertura, your classes will backuped at instrumentation time, then restored at reporting time (which will in turn result in having non-instrumented classes in the generated package).
Between intrumentation and reporting you run your tests (be it UTs, ITs) as you want (unlike maven-cobertura-plugin, qualinsight-mojo-cobertura does not run tests). For more information, check the project page (especially the Maven phases the plugin is bound to by default.)

Jenkins Workflow Plugin: How to create a job from groovy DSL?

I'm evaluating https://wiki.jenkins-ci.org/display/JENKINS/Workflow+Plugin and very like its concept of Groovy DSL in Jenkinsfile under version control. I tried to create different build steps, nodes and stages.
I have a multi-module project and want to have a kind of separate "job" for each module. Each module should have it's own Junit, Findbugs, Checkstyle reports.
However when I tried to collect Junit report it was attached to Workflow job, not it's node or stage.
Question:
Is it possible to create (and update dynamically) a job from Jenkins Workflow plugin DSL? If not, is there any analogue of job that can handle several reports within single workflow?
Since Workflow flow scripts can access the Jenkins model I suspect they can update a job configuration (is that what you mean by the first question?), but don't know if that's its strong suit. That would be a task for Job DSL plugin.
Build steps can invoke other jobs--search for build job in that page--and each of those can have its own publish steps. That might get what you need.
JENKINS-27395 (and analogues for other publishers) would be needed to fully support this use case in one Workflow job. Currently reports from different parts of the build are simply aggregated.

Run jenkins groovy postbuild plugin functions in build stage

The Groovy Postbuild Plugin has methods for adding badges and labels to the builds, but as the name suggests this can only be run after the main build stage.
Is it possible to get access to the methods provided by the plug-in such as addShortText from within a plain groovy command executed in Jenkins (Add build step - Execute Groovy Script)?
I want to show these labels from the start of the build process, as they are known from the parameters passed when triggering the build. This makes tracking the specific build which is currently being executed easier.
It's possible, it's called Groovy plugin
There is also another very useful plugin called Any Step plugin, that allows to use publishers as build steps, and build steps as post-build actions

Gallio Integration with NANT and CruiseControl.NET

In our build process we're currently using MBUnit 2.x tests, called from an NAnt task, called from CruiseControl.NET. I've uprgaded to Gallio and MBUnit 3.x locally and am able to run tests from VS2008. I'm having trouble getting our build process upgraded. It looks like we have two options, either run the tests from CruiseControl.net or from NAnt. Based on this, I have two questions:
With all other things being equal, where should these tests be run, NAnt or CruiseControl.net, or does it really matter at all?
If you like doing this sort of thing in NAnt, do you have any documentation or examples of how to implement it? I've found documentation for the CC.NET soution in my Gallio\extra\CCNet directory in the Gallio installation.
Thanks
Your options for running tests as part of your build with Gallio are similar to what they were with MbUnit v2.
I recommend running the tests from your NAnt or MSBuild scripts using the provided tasks in Gallio.NAntTasks.dll and Gallio.MSBuildTasks.dll.
However, if you want to run the tests directly from the CCNet configuration, then you can add a CCNet task to execute the Gallio.Echo.exe program.
Here's a bit more info on the NAnt task that someone else blogged about. Some of the details have changed in recent releases but it should get you on the right track.
http://testdrivendevelopment.wordpress.com/2008/12/01/use-nant-to-run-mbunit-tests-using-gallio/

Resources