View Javadoc

1   package org.apache.continuum.buildagent.build.execution.shell;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.continuum.buildagent.build.execution.AbstractBuildExecutor;
23  import org.apache.continuum.buildagent.build.execution.ContinuumAgentBuildCancelledException;
24  import org.apache.continuum.buildagent.build.execution.ContinuumAgentBuildExecutionResult;
25  import org.apache.continuum.buildagent.build.execution.ContinuumAgentBuildExecutor;
26  import org.apache.continuum.buildagent.build.execution.ContinuumAgentBuildExecutorException;
27  import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
28  import org.apache.maven.continuum.model.project.BuildDefinition;
29  import org.apache.maven.continuum.model.project.Project;
30  
31  import java.io.File;
32  import java.util.Map;
33  
34  public class ShellBuildExecutor
35      extends AbstractBuildExecutor
36      implements ContinuumAgentBuildExecutor
37  {
38      public static final String CONFIGURATION_EXECUTABLE = "executable";
39  
40      public static final String ID = ContinuumBuildExecutorConstants.SHELL_BUILD_EXECUTOR;
41  
42      public ShellBuildExecutor()
43      {
44          super( ID, false );
45      }
46  
47      public ContinuumAgentBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput,
48                                                       Map<String, String> environments, String localRepository )
49          throws ContinuumAgentBuildExecutorException, ContinuumAgentBuildCancelledException
50      {
51          String executable = getBuildFileForProject( buildDefinition );
52  
53          return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput, environments );
54      }
55  
56      public void updateProjectFromWorkingDirectory( File workingDirectory, Project project,
57                                                     BuildDefinition buildDefinition )
58          throws ContinuumAgentBuildExecutorException
59      {
60          // nothing to do here   
61      }
62  }