You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/10/04 03:07:51 UTC

svn commit: r293479 - in /maven/components/trunk: maven-model/ maven-plugin-registry/ maven-profile/ maven-profile/src/main/java/org/apache/maven/profiles/ maven-project/src/main/java/org/apache/maven/profiles/activation/ maven-settings/ maven-settings...

Author: jdcasey
Date: Mon Oct  3 18:07:36 2005
New Revision: 293479

URL: http://svn.apache.org/viewcvs?rev=293479&view=rev
Log:
Resolving: MNG-934, MNG-669

o Changed default value for usePluginRegistry to 'false' in settings.mdo
o Changed default value for updateInterval to 'never' in plugin-registry.mdo
o Added ActivationOS in settings.mdo, profiles.mdo, maven.mdo
o Added code to the conversion utilities for Settings and Profiles to corresponding maven-model classes for ActivationOS
o Added OS activator for profiles which allows architecture, name, family, and version (with '!' negation of any of these)
o Added ActivationFile to settings.mdo, along with conversion code in the Settings->Model conversion utility
o Added packageWithVersion configuration to the modello plugin definition in maven-settings (this is apparently required now)


Added:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java   (with props)
Modified:
    maven/components/trunk/maven-model/maven.mdo
    maven/components/trunk/maven-plugin-registry/plugin-registry.mdo
    maven/components/trunk/maven-profile/profiles.mdo
    maven/components/trunk/maven-profile/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java
    maven/components/trunk/maven-settings/pom.xml
    maven/components/trunk/maven-settings/settings.mdo
    maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java

Modified: maven/components/trunk/maven-model/maven.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-model/maven.mdo (original)
+++ maven/components/trunk/maven-model/maven.mdo Mon Oct  3 18:07:36 2005
@@ -2655,6 +2655,16 @@
           ]]></description>
         </field>
         <field>
+          <name>os</name>
+          <version>4.0.0</version>
+          <description><![CDATA[
+            Specifies that this profile will be activated when matching OS attributes are detected.
+          ]]></description>
+          <association>
+            <type>ActivationOS</type>
+          </association>
+        </field>
+        <field>
           <name>property</name>
           <version>4.0.0</version>
           <description><![CDATA[
@@ -2697,6 +2707,40 @@
           <version>4.0.0</version>
           <type>String</type>
           <description>The value of the property to be used to activate a profile</description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>ActivationOS</name>
+      <version>4.0.0</version>
+      <description><![CDATA[
+        This is an activator which will detect an operating system's attributes in order to activate
+        its profile.
+      ]]></description>
+      <fields>
+        <field>
+          <name>name</name>
+          <version>4.0.0</version>
+          <type>String</type>
+          <description>The name of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>family</name>
+          <version>4.0.0</version>
+          <type>String</type>
+          <description>The general family of the OS to be used to activate a profile (e.g. 'windows')</description>
+        </field>
+        <field>
+          <name>arch</name>
+          <version>4.0.0</version>
+          <type>String</type>
+          <description>The architecture of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>version</name>
+          <version>4.0.0</version>
+          <type>String</type>
+          <description>The version of the OS to be used to activate a profile</description>
         </field>
       </fields>
     </class>

Modified: maven/components/trunk/maven-plugin-registry/plugin-registry.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-registry/plugin-registry.mdo?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-registry/plugin-registry.mdo (original)
+++ maven/components/trunk/maven-plugin-registry/plugin-registry.mdo Mon Oct  3 18:07:36 2005
@@ -64,7 +64,7 @@
           <name>updateInterval</name>
           <version>1.0.0</version>
           <type>String</type>
-          <defaultValue>interval:1d</defaultValue>
+          <defaultValue>never</defaultValue>
           <description><![CDATA[
             Specifies how often to check for plugin updates. Valid values are: never, always, interval:XXX.
             For the interval specification, XXX denotes a terse interval specification, such as 4h.

Modified: maven/components/trunk/maven-profile/profiles.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/profiles.mdo?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-profile/profiles.mdo (original)
+++ maven/components/trunk/maven-profile/profiles.mdo Mon Oct  3 18:07:36 2005
@@ -127,6 +127,16 @@
           ]]></description>
         </field>
         <field>
+          <name>os</name>
+          <version>1.0.0</version>
+          <description><![CDATA[
+            Specifies that this profile will be activated when matching OS attributes are detected.
+          ]]></description>
+          <association>
+            <type>ActivationOS</type>
+          </association>
+        </field>
+        <field>
           <name>property</name>
           <version>1.0.0</version>
           <description><![CDATA[
@@ -325,6 +335,40 @@
           <version>1.0.0</version>
           <type>String</type>
           <description>The name of the file that should exist to activate a profile</description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>ActivationOS</name>
+      <version>1.0.0</version>
+      <description><![CDATA[
+        This is an activator which will detect an operating system's attributes in order to activate
+        its profile.
+      ]]></description>
+      <fields>
+        <field>
+          <name>name</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The name of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>family</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The general family of the OS to be used to activate a profile (e.g. 'windows')</description>
+        </field>
+        <field>
+          <name>arch</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The architecture of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>version</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The version of the OS to be used to activate a profile</description>
         </field>
       </fields>
     </class>

Modified: maven/components/trunk/maven-profile/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-profile/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java (original)
+++ maven/components/trunk/maven-profile/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java Mon Oct  3 18:07:36 2005
@@ -61,6 +61,19 @@
                 activation.setProperty( prop );
             }
 
+            
+            ActivationOS profileOs = profileActivation.getOs();
+            
+            if ( profileOs != null )
+            {
+                org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS();
+
+                os.setArch( profileOs.getArch() );
+                os.setFamily( profileOs.getFamily() );
+                os.setName( profileOs.getName() );
+                os.setVersion( profileOs.getVersion() );
+            }
+            
             org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile();
 
             if ( profileFile != null )

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java?rev=293479&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java Mon Oct  3 18:07:36 2005
@@ -0,0 +1,130 @@
+package org.apache.maven.profiles.activation;
+
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.ActivationOS;
+import org.apache.maven.model.Profile;
+import org.codehaus.plexus.util.Os;
+
+public class OperatingSystemProfileActivator
+    implements ProfileActivator
+{
+
+    public boolean canDetermineActivation( Profile profile )
+    {
+        Activation activation = profile.getActivation();
+        return activation != null && activation.getOs() != null;
+    }
+
+    public boolean isActive( Profile profile )
+    {
+        Activation activation = profile.getActivation();
+        ActivationOS os = activation.getOs();
+        
+        boolean hasNonNull = ensureAtLeastOneNonNull( os );
+        
+        boolean isFamily = determineFamilyMatch( os.getFamily() );
+        boolean isName = determineNameMatch( os.getName() );
+        boolean isArch = determineArchMatch( os.getArch() );
+        boolean isVersion = determineVersionMatch( os.getVersion() );
+        
+        return hasNonNull && isFamily && isName && isArch && isVersion;
+    }
+    
+    private boolean ensureAtLeastOneNonNull( ActivationOS os )
+    {
+        return os.getArch() != null || os.getFamily() != null || os.getName() != null || os.getVersion() != null;
+    }
+
+    private boolean determineVersionMatch( String version )
+    {
+        String test = version;
+        boolean reverse = false;
+        
+        if ( test.startsWith( "!" ) )
+        {
+            reverse = true;
+            test = test.substring( 1 );
+        }
+        
+        boolean result = Os.isVersion( test );
+        
+        if ( reverse )
+        {
+            return !result;
+        }
+        else
+        {
+            return result;
+        }
+    }
+
+    private boolean determineArchMatch( String arch )
+    {
+        String test = arch;
+        boolean reverse = false;
+        
+        if ( test.startsWith( "!" ) )
+        {
+            reverse = true;
+            test = test.substring( 1 );
+        }
+        
+        boolean result = Os.isArch( test );
+        
+        if ( reverse )
+        {
+            return !result;
+        }
+        else
+        {
+            return result;
+        }
+    }
+
+    private boolean determineNameMatch( String name )
+    {
+        String test = name;
+        boolean reverse = false;
+        
+        if ( test.startsWith( "!" ) )
+        {
+            reverse = true;
+            test = test.substring( 1 );
+        }
+        
+        boolean result = Os.isName( test );
+        
+        if ( reverse )
+        {
+            return !result;
+        }
+        else
+        {
+            return result;
+        }
+    }
+
+    private boolean determineFamilyMatch( String family )
+    {
+        String test = family;
+        boolean reverse = false;
+        
+        if ( test.startsWith( "!" ) )
+        {
+            reverse = true;
+            test = test.substring( 1 );
+        }
+        
+        boolean result = Os.isFamily( test );
+        
+        if ( reverse )
+        {
+            return !result;
+        }
+        else
+        {
+            return result;
+        }
+    }
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-settings/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/pom.xml?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/pom.xml (original)
+++ maven/components/trunk/maven-settings/pom.xml Mon Oct  3 18:07:36 2005
@@ -14,6 +14,9 @@
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <version>1.0-alpha-3</version>
+        <configuration>
+          <packageWithVersion>false</packageWithVersion>
+        </configuration>
         <executions>
           <execution>
             <goals>

Modified: maven/components/trunk/maven-settings/settings.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/settings.mdo?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/settings.mdo (original)
+++ maven/components/trunk/maven-settings/settings.mdo Mon Oct  3 18:07:36 2005
@@ -94,7 +94,7 @@
           <description>
             <![CDATA[Whether Maven should use the plugin-registry.xml file to manage plugin versions.]]></description>
           <type>boolean</type>
-          <defaultValue>true</defaultValue>
+          <defaultValue>false</defaultValue>
         </field>
         <!-- [JC] Not ready to use yet, so I'm making if unavailable for now. -->
         <!-- field>
@@ -593,6 +593,16 @@
           ]]></description>
         </field>
         <field>
+          <name>os</name>
+          <version>1.0.0</version>
+          <description><![CDATA[
+            Specifies that this profile will be activated when matching OS attributes are detected.
+          ]]></description>
+          <association>
+            <type>ActivationOS</type>
+          </association>
+        </field>
+        <field>
           <name>property</name>
           <version>1.0.0</version>
           <description><![CDATA[
@@ -602,6 +612,16 @@
             <type>ActivationProperty</type>
           </association>
         </field>
+        <field>
+          <name>file</name>
+          <version>1.0.0</version>
+          <description><![CDATA[
+             Specifies that this profile will be activated based on existence of a file.
+             ]]></description>
+          <association>
+            <type>ActivationFile</type>
+          </association>
+        </field>
       </fields>
     </class>
 
@@ -760,6 +780,63 @@
           <version>1.0.0</version>
           <type>String</type>
           <description>The value of the property to be used to activate a profile</description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>ActivationOS</name>
+      <version>1.0.0</version>
+      <description><![CDATA[
+        This is an activator which will detect an operating system's attributes in order to activate
+        its profile.
+      ]]></description>
+      <fields>
+        <field>
+          <name>name</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The name of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>family</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The general family of the OS to be used to activate a profile (e.g. 'windows')</description>
+        </field>
+        <field>
+          <name>arch</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The architecture of the OS to be used to activate a profile</description>
+        </field>
+        <field>
+          <name>version</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The version of the OS to be used to activate a profile</description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>ActivationFile</name>
+      <version>1.0.0</version>
+      <description><![CDATA[
+        This is the file specification used to activate a profile. The missing value will be a the location
+        of a file that needs to exist, and if it doesn't the profile must run.  On the other hand exists will test 
+        for the existence of the file and if it is there will run the profile.
+      ]]></description>
+      <fields>
+        <field>
+          <name>missing</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The name of the file that should be missing to activate a profile</description>
+        </field>
+        <field>
+          <name>exists</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The name of the file that should exist to activate a profile</description>
         </field>
       </fields>
     </class>

Modified: maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java (original)
+++ maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java Mon Oct  3 18:07:36 2005
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.model.ActivationFile;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.ArrayList;
@@ -161,6 +162,30 @@
                 prop.setValue( settingsProp.getValue() );
 
                 activation.setProperty( prop );
+            }
+            
+            ActivationOS settingsOs = settingsActivation.getOs();
+            
+            if ( settingsOs != null )
+            {
+                org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS();
+
+                os.setArch( settingsOs.getArch() );
+                os.setFamily( settingsOs.getFamily() );
+                os.setName( settingsOs.getName() );
+                os.setVersion( settingsOs.getVersion() );
+            }
+            
+            org.apache.maven.settings.ActivationFile settingsFile = settingsActivation.getFile();
+
+            if ( settingsFile != null )
+            {
+                ActivationFile file = new ActivationFile();
+
+                file.setExists( settingsFile.getExists() );
+                file.setMissing( settingsFile.getMissing() );
+
+                activation.setFile( file );
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r293479 - in /maven/components/trunk: maven-model/ maven-plugin-registry/ maven-profile/ maven-profile/src/main/java/org/apache/maven/profiles/ maven-project/src/main/java/org/apache/maven/profiles/activation/ maven-settings/ maven-settings...

Posted by Brett Porter <br...@apache.org>.
What this was was the removal of another deprecation. The modello plugin
hasn't been built in some time.

- Brett

Brett Porter wrote:

>Woah, this sounds like a regression!
>
>Can we work it through please?
>
>
>- Brett
>
>jdcasey@apache.org wrote:
>
>  
>
>>o Added packageWithVersion configuration to the modello plugin definition in maven-settings (this is apparently required now)
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r293479 - in /maven/components/trunk: maven-model/ maven-plugin-registry/ maven-profile/ maven-profile/src/main/java/org/apache/maven/profiles/ maven-project/src/main/java/org/apache/maven/profiles/activation/ maven-settings/ maven-settings...

Posted by Brett Porter <br...@apache.org>.
Woah, this sounds like a regression!

Can we work it through please?


- Brett

jdcasey@apache.org wrote:

>o Added packageWithVersion configuration to the modello plugin definition in maven-settings (this is apparently required now)
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org