Author: lcorneliussen
Date: Wed Apr 25 13:21:12 2012
New Revision: 1330270
URL: http://svn.apache.org/viewvc?rev=1330270&view=rev
Log:
[NPANDAY-499] Make configuration for compiler-plugins and executable-plugins
more flexible
o ignore known patch versions when comparing framework versions 2.0 == 2.0.50727
Added:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/VersionComparer.java
Modified:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
Modified:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java?rev=1330270&r1=1330269&r2=1330270&view=diff
==============================================================================
---
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
(original)
+++
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
Wed Apr 25 13:21:12 2012
@@ -118,24 +118,14 @@ public final class CompilerPluginsReposi
if (vendor != null &&
!vendorInfo.getVendor().getVendorName().toLowerCase().equals(
vendor.toLowerCase() ))
continue;
- // TODO: check with version range!
- if (vendorVersion != null &&
!vendorInfo.getVendorVersion().equals( vendorVersion ))
+ if ( VersionComparer.isVendorVersionMissmatch(vendorVersion,
vendorInfo.getVendorVersion()) )
{
continue;
}
- if (frameworkVersions != null && frameworkVersions.size() > 0)
+ if (
VersionComparer.isFrameworkVersionMissmatch(frameworkVersions,
vendorInfo.getFrameworkVersion()) )
{
- if (!Iterables.any( frameworkVersions, new Predicate<String>()
- {
- public boolean apply( @Nullable String frameworkVersion )
- {
- return vendorInfo.getFrameworkVersion().equals(
frameworkVersion );
- }
- } ))
- {
- continue;
- }
+ continue;
}
List platforms = plugin.getPlatforms();
Modified:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java?rev=1330270&r1=1330269&r2=1330270&view=diff
==============================================================================
---
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
(original)
+++
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
Wed Apr 25 13:21:12 2012
@@ -140,26 +140,14 @@ public final class ExecutablePluginsRepo
continue;
}
- // TODO: check with version range!
- if ( vendorVersion != null &&
!vendorInfo.getVendorVersion().equals( vendorVersion ) )
+ if ( VersionComparer.isVendorVersionMissmatch(vendorVersion,
vendorInfo.getVendorVersion()) )
{
continue;
}
- if ( frameworkVersions != null && frameworkVersions.size() > 0 )
+ if (
VersionComparer.isFrameworkVersionMissmatch(frameworkVersions,
vendorInfo.getFrameworkVersion()) )
{
- if ( !Iterables.any(
- frameworkVersions, new Predicate<String>()
- {
- public boolean apply( @Nullable String frameworkVersion )
- {
- return vendorInfo.getFrameworkVersion().equals(
frameworkVersion );
- }
- }
- ) )
- {
- continue;
- }
+ continue;
}
// TODO: since the platform is fix here, we could already strip it
down to those actually available
Added:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/VersionComparer.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/VersionComparer.java?rev=1330270&view=auto
==============================================================================
---
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/VersionComparer.java
(added)
+++
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/VersionComparer.java
Wed Apr 25 13:21:12 2012
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package npanday.executable.impl;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:[email protected]>Lars Corneliussen, Faktum
Software</a>
+ */
+public class VersionComparer
+{
+ public static boolean isVendorVersionMissmatch( String capability, String
requirement )
+ {
+ return capability != null && !requirement.equals( capability );
+ }
+
+ public static boolean isFrameworkVersionMissmatch( List<String>
capability, final String requirement )
+ {
+ if ( capability != null && capability.size() > 0 )
+ {
+ if ( !Iterables.any(
+ capability, new Predicate<String>()
+ {
+ public boolean apply( @Nullable String frameworkVersion )
+ {
+ return normalize(requirement).equals(
normalize(frameworkVersion) );
+ }
+ }
+ ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static String normalize( String version )
+ {
+ if ( version.equals( "1.0.3705") )
+ {
+ return "1.0";
+ }
+
+ if ( version.equals( "1.1.4322") )
+ {
+ return "1.1";
+ }
+
+ if ( version.equals( "2.0.50727") )
+ {
+ return "2.0";
+ }
+
+ if ( version.equals( "v4.0.30319") )
+ {
+ return "4.0";
+ }
+
+ return version;
+ }
+}