Author: brett Date: Fri Sep 2 23:59:07 2005 New Revision: 267429 URL: http://svn.apache.org/viewcvs?rev=267429&view=rev Log: PR: MNG-821 Submitted by: Jesse McConnell Reviewed by: Brett Porter Add file existence based profile activation
Modified: maven/components/trunk/maven-model/maven.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-project/src/main/resources/META-INF/plexus/components.xml Modified: maven/components/trunk/maven-model/maven.mdo URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=267429&r1=267428&r2=267429&view=diff ============================================================================== --- maven/components/trunk/maven-model/maven.mdo (original) +++ maven/components/trunk/maven-model/maven.mdo Fri Sep 2 23:59:07 2005 @@ -2602,7 +2602,7 @@ </codeSegment> </codeSegments> </class> - <class> + <class> <name>Activation</name> <version>4.0.0</version> <description><![CDATA[ @@ -2628,6 +2628,16 @@ <type>ActivationProperty</type> </association> </field> + <field> + <name>file</name> + <version>4.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> <class> @@ -2651,6 +2661,29 @@ <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>ActivationFile</name> + <version>4.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>4.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>4.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-profile/profiles.mdo URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/profiles.mdo?rev=267429&r1=267428&r2=267429&view=diff ============================================================================== --- maven/components/trunk/maven-profile/profiles.mdo (original) +++ maven/components/trunk/maven-profile/profiles.mdo Fri Sep 2 23:59:07 2005 @@ -130,6 +130,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> @@ -169,8 +179,7 @@ <field> <name>layout</name> <version>1.0.0</version> - <description>The type of layout this repository uses for locating and storing artifacts - can be "legacy" or - "default".</description> + <description>The type of layout this repository uses for locating and storing artifacts - can be "legacy" or "default".</description> <type>String</type> <defaultValue>default</defaultValue> </field> @@ -196,7 +205,6 @@ </codeSegment> </codeSegments> </class> - <class> <name>Repository</name> <superClass>RepositoryBase</superClass> @@ -284,7 +292,6 @@ </field> </fields> </class> - <class> <name>ActivationProperty</name> <version>1.0.0</version> @@ -309,5 +316,28 @@ </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> </classes> -</model> \ No newline at end of file +</model> 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=267429&r1=267428&r2=267429&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 Fri Sep 2 23:59:07 2005 @@ -18,6 +18,7 @@ import org.apache.maven.model.Activation; import org.apache.maven.model.ActivationProperty; +import org.apache.maven.model.ActivationFile; import org.apache.maven.model.Profile; import org.apache.maven.model.Repository; @@ -45,7 +46,7 @@ Activation activation = new Activation(); activation.setJdk( profileActivation.getJdk() ); - + org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty(); if ( profileProp != null ) @@ -57,7 +58,19 @@ activation.setProperty( prop ); } + + org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile(); + + if ( profileFile != null ) + { + ActivationFile file = new ActivationFile(); + file.setExists( profileFile.getExists() ); + file.setMissing( profileFile.getMissing() ); + + activation.setFile( file ); + } + profile.setActivation( activation ); } else Modified: maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml?rev=267429&r1=267428&r2=267429&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml (original) +++ maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml Fri Sep 2 23:59:07 2005 @@ -115,6 +115,16 @@ <role-hint>system-property</role-hint> <implementation>org.apache.maven.profiles.activation.SystemPropertyProfileActivator</implementation> </component> + <!-- + | + | + | + --> + <component> + <role>org.apache.maven.profiles.activation.ProfileActivator</role> + <role-hint>file</role-hint> + <implementation>org.apache.maven.profiles.activation.FileProfileActivator</implementation> + </component> <!-- | | --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]