public ContinuumAgentBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput, Map<String, String> environments, String localRepository ) throws ContinuumAgentBuildExecutorException, ContinuumAgentBuildCancelledException { String executable = getBuildFileForProject( buildDefinition ); return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput, environments ); }
private List<BuildDefinition> getBuildDefinitions( BuildDefinitionTemplate template, boolean loadRecursiveProjects ) throws ContinuumProjectBuilderException, BuildDefinitionServiceException { List<BuildDefinition> buildDefinitions = new ArrayList<BuildDefinition>(); for ( Iterator<BuildDefinition> iterator = template.getBuildDefinitions().iterator(); iterator.hasNext(); ) { BuildDefinition buildDefinition = iterator.next(); // due to CONTINUUM-1207 CONTINUUM-1436 user can do what they want with arguments // we must remove if exists --non-recursive or -N if ( !loadRecursiveProjects ) { if ( StringUtils.isEmpty( buildDefinition.getArguments() ) ) { // strange for a mvn build getLogger().info( "build definition has empty args" ); } else { String arguments = buildDefinition.getArguments().replace( "--non-recursive", "" ); arguments = arguments.replace( "-N", "" ); buildDefinition.setArguments( arguments ); } } buildDefinition.setTemplate( false ); buildDefinitions.add( buildDefinition ); } return buildDefinitions; }
public synchronized ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput ) throws ContinuumBuildExecutorException { // TODO: this should be validated earlier? String executable = getBuildFileForProject( project, buildDefinition ); return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput, getEnvironments( buildDefinition ) ); }
arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput, List<Project> projectsWithCommonScmRoot, String projectScmRootUrl ) throws ContinuumBuildExecutorException { // TODO: this should be validated earlier? String executable = getBuildFileForProject( project, buildDefinition ); return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput, getEnvironments( buildDefinition ), null, null ); }
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput ) throws ContinuumBuildExecutorException { String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN2_TYPE ) .getExecutable(); StringBuffer arguments = new StringBuffer(); String buildFile = getBuildFileForProject( project, buildDefinition ); if ( !StringUtils.isEmpty( buildFile ) && !"pom.xml".equals( buildFile ) ) { arguments.append( "-f " ).append( buildFile ).append( " " ); } arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " ); Properties props = getContinuumSystemProperties( project ); for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); ) { String name = (String) itr.nextElement(); String value = props.getProperty( name ); arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " ); } arguments.append( StringUtils.clean( buildDefinition.getGoals() ) ); Map<String, String> environments = getEnvironments( buildDefinition ); String m2Home = environments.get( getInstallationService().getEnvVar( InstallationService.MAVEN2_TYPE ) ); if ( StringUtils.isNotEmpty( m2Home ) ) { executable = m2Home + File.separator + "bin" + File.separator + executable; setResolveExecutable( false ); } return executeShellCommand( project, executable, arguments.toString(), buildOutput, environments ); }
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput ) throws ContinuumBuildExecutorException { String executable = getInstallationService().getExecutorConfigurator( InstallationService.ANT_TYPE ) .getExecutable(); StringBuffer arguments = new StringBuffer(); String buildFile = getBuildFileForProject( project, buildDefinition ); if ( !StringUtils.isEmpty( buildFile ) ) { arguments.append( "-f " ).append( buildFile ).append( " " ); } arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " ); Properties props = getContinuumSystemProperties( project ); for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); ) { String name = (String) itr.nextElement(); String value = props.getProperty( name ); arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " ); } arguments.append( StringUtils.clean( buildDefinition.getGoals() ) ); Map<String, String> environments = getEnvironments( buildDefinition ); String antHome = environments.get( getInstallationService().getEnvVar( InstallationService.ANT_TYPE ) ); if ( StringUtils.isNotEmpty( antHome ) ) { executable = antHome + File.separator + "bin" + File.separator + executable; setResolveExecutable( false ); } return executeShellCommand( project, executable, arguments.toString(), buildOutput, environments ); }
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput, List<Project> projectsWithCommonScmRoot, String projectScmRootUrl ) throws ContinuumBuildExecutorException { String executable = getInstallationService().getExecutorConfigurator( InstallationService.ANT_TYPE ).getExecutable(); StringBuffer arguments = new StringBuffer(); String buildFile = getBuildFileForProject( project, buildDefinition ); if ( !StringUtils.isEmpty( buildFile ) ) { arguments.append( "-f " ).append( buildFile ).append( " " ); } arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " ); Properties props = getContinuumSystemProperties( project ); for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); ) { String name = (String) itr.nextElement(); String value = props.getProperty( name ); arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " ); } arguments.append( StringUtils.clean( buildDefinition.getGoals() ) ); Map<String, String> environments = getEnvironments( buildDefinition ); String antHome = environments.get( getInstallationService().getEnvVar( InstallationService.ANT_TYPE ) ); if ( StringUtils.isNotEmpty( antHome ) ) { executable = antHome + File.separator + "bin" + File.separator + executable; setResolveExecutable( false ); } return executeShellCommand( project, executable, arguments.toString(), buildOutput, environments, null, null ); }
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput ) throws ContinuumBuildExecutorException { String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE ) .getExecutable(); StringBuffer arguments = new StringBuffer(); String buildFile = getBuildFileForProject( project, buildDefinition ); if ( !StringUtils.isEmpty( buildFile ) && !"project.xml".equals( buildFile ) ) { arguments.append( "-p " ).append( buildFile ).append( " " ); } arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " ); Properties props = getContinuumSystemProperties( project ); for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); ) { String name = (String) itr.nextElement(); String value = props.getProperty( name ); arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " ); } arguments.append( StringUtils.clean( buildDefinition.getGoals() ) ); Map<String, String> environments = getEnvironments( buildDefinition ); String m1Home = environments.get( getInstallationService().getEnvVar( InstallationService.MAVEN1_TYPE ) ); if ( StringUtils.isNotEmpty( m1Home ) ) { executable = m1Home + File.separator + "bin" + File.separator + executable; setResolveExecutable( false ); } return executeShellCommand( project, executable, arguments.toString(), buildOutput, environments ); }
arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
if ( StringUtils.isEmpty( buildDefinition.getArguments() ) ) String arguments = buildDefinition.getArguments().replace( "--non-recursive", "" ); arguments = arguments.replace( "-N", "" ); arguments = arguments.trim();
arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
storedDefinition.setArguments( buildDefinition.getArguments() ); storedDefinition.setBuildFile( buildDefinition.getBuildFile() ); storedDefinition.setBuildFresh( buildDefinition.isBuildFresh() );
/** * @see org.apache.maven.continuum.builddefinition.BuildDefinitionService#cloneBuildDefinition(org.apache.maven.continuum.model.project.BuildDefinition) */ public BuildDefinition cloneBuildDefinition( BuildDefinition buildDefinition ) { BuildDefinition cloned = new BuildDefinition(); cloned.setAlwaysBuild( buildDefinition.isAlwaysBuild() ); cloned.setArguments( buildDefinition.getArguments() ); cloned.setBuildFile( buildDefinition.getBuildFile() ); cloned.setBuildFresh( buildDefinition.isBuildFresh() ); cloned.setDefaultForProject( buildDefinition.isDefaultForProject() ); cloned.setDescription( buildDefinition.getDescription() ); cloned.setGoals( buildDefinition.getGoals() ); cloned.setProfile( buildDefinition.getProfile() ); cloned.setSchedule( buildDefinition.getSchedule() ); cloned.setType( buildDefinition.getType() ); cloned.setTemplate( buildDefinition.isTemplate() ); return cloned; }
/** * @see org.apache.maven.continuum.builddefinition.BuildDefinitionService#cloneBuildDefinition(org.apache.maven.continuum.model.project.BuildDefinition) */ public BuildDefinition cloneBuildDefinition( BuildDefinition buildDefinition ) { BuildDefinition cloned = new BuildDefinition(); cloned.setAlwaysBuild( buildDefinition.isAlwaysBuild() ); cloned.setArguments( buildDefinition.getArguments() ); cloned.setBuildFile( buildDefinition.getBuildFile() ); cloned.setBuildFresh( buildDefinition.isBuildFresh() ); cloned.setDefaultForProject( buildDefinition.isDefaultForProject() ); cloned.setDescription( buildDefinition.getDescription() ); cloned.setGoals( buildDefinition.getGoals() ); cloned.setProfile( buildDefinition.getProfile() ); cloned.setSchedule( buildDefinition.getSchedule() ); cloned.setType( buildDefinition.getType() ); cloned.setTemplate( buildDefinition.isTemplate() ); cloned.setUpdatePolicy( buildDefinition.getUpdatePolicy() ); return cloned; }
public void updateBuildDefinition( BuildDefinition buildDefinition ) throws BuildDefinitionServiceException { try { BuildDefinition storedBuildDefinition = store.getBuildDefinition( buildDefinition.getId() ); storedBuildDefinition.setBuildFresh( buildDefinition.isBuildFresh() ); storedBuildDefinition.setAlwaysBuild( buildDefinition.isAlwaysBuild() ); storedBuildDefinition.setArguments( buildDefinition.getArguments() ); storedBuildDefinition.setBuildFile( buildDefinition.getBuildFile() ); storedBuildDefinition.setDefaultForProject( buildDefinition.isDefaultForProject() ); storedBuildDefinition.setDescription( buildDefinition.getDescription() ); storedBuildDefinition.setGoals( buildDefinition.getGoals() ); storedBuildDefinition.setProfile( buildDefinition.getProfile() ); storedBuildDefinition.setSchedule( buildDefinition.getSchedule() ); storedBuildDefinition.setType( buildDefinition.getType() ); store.storeBuildDefinition( storedBuildDefinition ); } catch ( ContinuumStoreException e ) { throw new BuildDefinitionServiceException( e.getMessage(), e ); } }
public void updateBuildDefinition( BuildDefinition buildDefinition ) throws BuildDefinitionServiceException { try { BuildDefinition storedBuildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinition.getId() ); storedBuildDefinition.setBuildFresh( buildDefinition.isBuildFresh() ); storedBuildDefinition.setAlwaysBuild( buildDefinition.isAlwaysBuild() ); storedBuildDefinition.setArguments( buildDefinition.getArguments() ); storedBuildDefinition.setBuildFile( buildDefinition.getBuildFile() ); storedBuildDefinition.setDefaultForProject( buildDefinition.isDefaultForProject() ); storedBuildDefinition.setDescription( buildDefinition.getDescription() ); storedBuildDefinition.setGoals( buildDefinition.getGoals() ); storedBuildDefinition.setProfile( buildDefinition.getProfile() ); storedBuildDefinition.setSchedule( buildDefinition.getSchedule() ); storedBuildDefinition.setType( buildDefinition.getType() ); storedBuildDefinition.setUpdatePolicy( buildDefinition.getUpdatePolicy() ); buildDefinitionDao.storeBuildDefinition( storedBuildDefinition ); } catch ( ContinuumStoreException e ) { throw new BuildDefinitionServiceException( e.getMessage(), e ); } }
storedDefinition.setArguments( buildDefinition.getArguments() ); storedDefinition.setBuildFile( buildDefinition.getBuildFile() ); storedDefinition.setBuildFresh( buildDefinition.isBuildFresh() );