001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 SonarSource SA
004 * mailto:info AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.batch.bootstrap;
021
022import org.sonar.api.ExtensionPoint;
023import org.sonar.api.batch.InstantiationStrategy;
024import org.sonar.api.batch.ScannerSide;
025
026/**
027 * This extension point allows to change project structure at runtime. It is executed once during task startup.
028 * Some use-cases :
029 * <ul>
030 *   <li>Add sub-projects. For example the C# plugin gets the hierarchy
031 *   of sub-projects from the Visual Studio metadata file. The single root pom.xml does not contain any declarations of
032 *   modules</li>
033 *   <li>Change project metadata like description or source directories.</li>
034 * </ul>
035 *
036 * @deprecated since 6.5. It won't be possible to manipulate the project's structure.
037 * @since 2.9
038 */
039@ScannerSide
040@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
041@ExtensionPoint
042@Deprecated
043public abstract class ProjectBuilder {
044
045  /**
046   * Plugins can use the implementation {@link org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext}
047   * for their unit tests.
048   */
049  @Deprecated
050  public interface Context {
051    ProjectReactor projectReactor();
052  }
053
054  /**
055   * @since 3.7
056   */
057  protected ProjectBuilder() {
058  }
059
060  /**
061   * Override this method to change project reactor structure.
062   * @since 3.7
063   */
064  public void build(Context context) {
065    // Call deprecated method for backward compatibility
066    build(context.projectReactor());
067  }
068
069  /**
070   * @deprecated since 3.7 override {@link #build(Context)} instead
071   */
072  @Deprecated
073  protected void build(ProjectReactor reactor) {
074  }
075}