o decoupled Settings from the profile manager

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@573436 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-09-07 03:47:53 +00:00
parent a698b7ef49
commit c8ab5fb076
3 changed files with 3 additions and 58 deletions

View File

@ -128,7 +128,7 @@ private ProfileManager buildProfileManager( Model model, File projectDir, List e
List explicitlyInactiveIds ) List explicitlyInactiveIds )
throws ProjectBuildingException throws ProjectBuildingException
{ {
ProfileManager profileManager = new DefaultProfileManager( container, new Properties() ); ProfileManager profileManager = new DefaultProfileManager( container );
profileManager.explicitlyActivate( explicitlyActiveIds ); profileManager.explicitlyActivate( explicitlyActiveIds );
profileManager.explicitlyDeactivate( explicitlyInactiveIds ); profileManager.explicitlyDeactivate( explicitlyInactiveIds );

View File

@ -23,8 +23,6 @@
import org.apache.maven.model.Profile; import org.apache.maven.model.Profile;
import org.apache.maven.profiles.activation.ProfileActivationException; import org.apache.maven.profiles.activation.ProfileActivationException;
import org.apache.maven.profiles.activation.ProfileActivator; import org.apache.maven.profiles.activation.ProfileActivator;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsUtils;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@ -55,33 +53,9 @@ public class DefaultProfileManager
* are passed to maven, possibly containing profile activator properties * are passed to maven, possibly containing profile activator properties
* *
*/ */
public DefaultProfileManager( PlexusContainer container, Properties props ) public DefaultProfileManager( PlexusContainer container )
{
this( container, null, props );
}
/**
* @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work correctly
* in embedded envirnments.
*/
public DefaultProfileManager( PlexusContainer container, Settings settings )
{ {
this.container = container; this.container = container;
loadSettingsProfiles( settings );
}
/**
* the properties passed to the profile manager are the props that
* are passed to maven, possibly containing profile activator properties
*
*/
public DefaultProfileManager( PlexusContainer container, Settings settings, Properties props )
{
this.container = container;
loadSettingsProfiles( settings );
} }
public Map getProfilesById() public Map getProfilesById()
@ -308,30 +282,4 @@ public List getIdsActivatedByDefault()
{ {
return defaultIds; return defaultIds;
} }
public void loadSettingsProfiles( Settings settings )
{
if ( settings == null )
{
return;
}
List settingsProfiles = settings.getProfiles();
if ( settingsProfiles != null && !settingsProfiles.isEmpty() )
{
List settingsActiveProfileIds = settings.getActiveProfiles();
explicitlyActivate( settingsActiveProfileIds );
for ( Iterator it = settings.getProfiles().iterator(); it.hasNext(); )
{
org.apache.maven.settings.Profile rawProfile = (org.apache.maven.settings.Profile) it.next();
Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );
addProfile( profile );
}
}
}
} }

View File

@ -51,8 +51,5 @@ List getActiveProfiles()
List getExplicitlyDeactivatedIds(); List getExplicitlyDeactivatedIds();
List getIdsActivatedByDefault(); List getIdsActivatedByDefault();
void loadSettingsProfiles( Settings settings );
} }