mirror of https://github.com/apache/maven.git
[MNG-4287] Make ToolchainManagerPrivate session-aware
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@802024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b3a4fcc490
commit
ce63149fa7
|
@ -41,10 +41,10 @@ public class DefaultToolchainManagerPrivate
|
|||
@Requirement
|
||||
private ToolchainsBuilder toolchainsBuilder;
|
||||
|
||||
public ToolchainPrivate[] getToolchainsForType( String type )
|
||||
public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
|
||||
throws MisconfiguredToolchainException
|
||||
{
|
||||
PersistedToolchains pers = toolchainsBuilder.build();
|
||||
PersistedToolchains pers = toolchainsBuilder.build( context.getRequest().getUserToolchainsFile() );
|
||||
|
||||
List<ToolchainPrivate> toRet = new ArrayList<ToolchainPrivate>();
|
||||
|
||||
|
|
|
@ -41,12 +41,7 @@ public class DefaultToolchainsBuilder
|
|||
@Requirement
|
||||
private Logger logger;
|
||||
|
||||
/**
|
||||
* The path to the user's toolchains file or <code>null</code> if not configured.
|
||||
*/
|
||||
private File userToolchainsFile;
|
||||
|
||||
public PersistedToolchains build()
|
||||
public PersistedToolchains build( File userToolchainsFile )
|
||||
throws MisconfiguredToolchainException
|
||||
{
|
||||
PersistedToolchains toolchains = null;
|
||||
|
@ -77,9 +72,4 @@ public class DefaultToolchainsBuilder
|
|||
return toolchains;
|
||||
}
|
||||
|
||||
public void setUserToolchainsFile( File userToolchainsFile )
|
||||
{
|
||||
this.userToolchainsFile = userToolchainsFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,16 +29,16 @@ import org.apache.maven.execution.MavenSession;
|
|||
*/
|
||||
public interface ToolchainManagerPrivate
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves the toolchains of given type from the user settings.
|
||||
*/
|
||||
ToolchainPrivate[] getToolchainsForType( String type )
|
||||
ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
|
||||
throws MisconfiguredToolchainException;
|
||||
|
||||
/**
|
||||
* Stores the toolchain into build context.
|
||||
*/
|
||||
void storeToolchainToBuildContext( ToolchainPrivate toolchain,
|
||||
MavenSession context );
|
||||
|
||||
void storeToolchainToBuildContext( ToolchainPrivate toolchain, MavenSession context );
|
||||
|
||||
}
|
||||
|
|
|
@ -35,18 +35,12 @@ public interface ToolchainsBuilder
|
|||
/**
|
||||
* Builds the toolchains model from the configured toolchain files.
|
||||
*
|
||||
* @return The toolchains model or <code>null</code> if no toolchain file was configured or the configured files do
|
||||
* @param userToolchainsFile The path to the toolchains file, may be <code>null</code> to disable parsing.
|
||||
* @return The toolchains model or <code>null</code> if no toolchain file was configured or the configured file does
|
||||
* not exist.
|
||||
* @throws MisconfiguredToolchainException If the toolchain files exist but cannot be parsed.
|
||||
* @throws MisconfiguredToolchainException If the toolchain file exists but cannot be parsed.
|
||||
*/
|
||||
PersistedToolchains build()
|
||||
PersistedToolchains build( File userToolchainsFile )
|
||||
throws MisconfiguredToolchainException;
|
||||
|
||||
/**
|
||||
* Sets the path to the file from which to read the available toolchains.
|
||||
*
|
||||
* @param userToolchainsFile The path to the toolchains file, may be <code>null</code> to disable parsing.
|
||||
*/
|
||||
void setUserToolchainsFile( File userToolchainsFile );
|
||||
|
||||
}
|
||||
|
|
|
@ -318,12 +318,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
}
|
||||
}
|
||||
|
||||
private void toolchains( MavenExecutionRequest request )
|
||||
{
|
||||
// FIXME individual requests must not change global state
|
||||
toolchainsBuilder.setUserToolchainsFile( request.getUserToolchainsFile() );
|
||||
}
|
||||
|
||||
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
|
||||
throws MavenEmbedderException
|
||||
{
|
||||
|
@ -333,8 +327,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
|
||||
localRepository( request );
|
||||
|
||||
toolchains( request );
|
||||
|
||||
processSettings( request );
|
||||
|
||||
return request;
|
||||
|
|
Loading…
Reference in New Issue