Update on building .NET

Sometime back now I posted an article on building .NET and dependency management.

I have come to learn that there are several ways. Here are my favorites.

  1. Build your own maven plugin to build .NET projects. Package 3rd party products as zips and put them in maven. Write a plugin that reads solution and project files and calls MSBuild with the appropriate flags.  Advantage, maximum flexibility.  Disadvantage, lots of effort.
  2. Use the existing maven-dotnet-plugin.  Advantage, does a lot for you including various types of test and coverage systems, plus it can run sonar.  Disadvantage, Hard to get it to work on complex silverlight projects. In fact hard full stop.  The docs are not great.
  3. Use NuGet.  Advantages, it has .NET pedigree and Microsoft Backing.  Adoption amongst .net developers is probably an easier sell than a java utility.  Disadvantages, Very early days for the project, as yet unproven.
  4. Finally npanday.  Advantages, nice integration with Visual Studio.  Disadvantages, very hard to get it to work with silverlight.  Impossible in fact as MS have kindly removed the command line baml compile utility.
So in summary.  There are ways to do this now.  There is hope for .NET dependency management!
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

The power of XMLUnit with google Predicate

I have been interested in XMLUnit and google collections predicate system for awhile now and recently wrote the following as part of a test.  I have removed some of the test and left just the bits that illustrate this point.

The test needs to perform a check that the result of transforming some xml is correct.  A reference file is available so we can use XMLUnit to perform a difference.  In my file there is a seconds attribute and because seconds vary with each parse we choose to ignore the value.  There are other ways to achieve this, but its more complex and uses more XMLUnit code. Using a google predicate simplifies this check.

First produce your output file and load the sample and output into strings. Normally for a test I produce a smaller sample xml file. Then using XMLUnit difference engine get all differences.

    Diff d = new Diff(expectedAsString, outputAsString);
    DetailedDiff dd = new DetailedDiff(d);
    List listOfDifferences = dd.getAllDifferences();

Next call a function to check that the only differences found are within the seconds attribute. This uses a predicates from google to perform the matching.

    assertTrue(onlyDiffsMatchThisAttributeName("seconds",listOfDifferences));
    }

    private static boolean onlyDiffsMatchThisAttributeName(final String attrName, Iterable it) {

    Iterable filtered = Iterables.filter(it, new Predicate() {

        @Override
        public boolean apply(Difference input) {

                final NodeDetail testNodeDetail = input.getTestNodeDetail();
                if (nodeDetail == null) return false;

                final Node node = nodeDetail.getNode();
                if (node == null) return false;

                final String nodeName = node.getNodeName();
                if (nodeName == null) return false;

                return !nodeName.equals(attrName);
            }
        });
        return (newArrayList(filtered).isEmpty());
    }

Note that what is happening here is the predicate is filtering away all the seconds matches. If anything remains in the list false is returned. Neat huh! :-)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

The idea of non backward compatible Java?

I have not been blogging much, but I have been reading. Java is somewhat disappointing of late for various reasons.  Then I stumbled across this: the_next_big_jvm_language1 from Stephen Colebourne.  It seems like an interesting idea to me.  It would take some doing, but the advantages could be huge.  It could encompass some of the best ideas and leave behind some of the old ideas we still struggle to shrug off.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Building software with .NET dependencies in 2010

I come from a Java background. So over the last decade I have moved away from managing dependencies on projects using jars in shared folders. Most professional java programmers have used Maven or Ivy. Recently I looked at Groovy and Gradle.  All well and good.  What do programmers use for .NET, WPF and Silverlite?  I have been trying to find out and there are mixed opinions.  Some write scripts to copy .dll files, others rely on the Visual Studio solutions.  None of these solutions are scalable.  I found this project: npanday Has anyone used it on a large project?  I would love to hear your views or review.  What does microsoft do?  What do you do?

Please comment here I am very interested in hearing what other programmers do for .NET dependency management.

Links for the Java world of dependency management

http://maven.apache.org/

http://ant.apache.org/ivy/

http://www.gradle.org/

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)