report used packages agent-side
[teamcity/dotNetPackagesSupport.git] / nuget-agent / src / jetbrains / buildServer / nuget / agent / install / impl / PackagesInstallerBuilder.java
similarity index 78%
rename from nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesInstallerBuilder.java
rename to nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/PackagesInstallerBuilder.java
index 856da9050dbfc34dffc90864ab3ea85a6fec02e4..230851c2a44b8df1e41084f647caac5e6865e4e8 100644 (file)
  * limitations under the License.\r
  */\r
 \r
-package jetbrains.buildServer.nuget.agent.install;\r
+package jetbrains.buildServer.nuget.agent.install.impl;\r
 \r
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
+import jetbrains.buildServer.nuget.agent.install.LocateNuGetConfigBuildProcess;\r
+import jetbrains.buildServer.nuget.agent.install.NuGetActionFactory;\r
 import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;\r
-import jetbrains.buildServer.nuget.agent.util.BuildProcessContinuation;\r
 import jetbrains.buildServer.nuget.common.PackagesUpdateMode;\r
 import org.jetbrains.annotations.NotNull;\r
 import org.jetbrains.annotations.Nullable;\r
@@ -35,24 +36,18 @@ import static jetbrains.buildServer.nuget.common.PackagesUpdateMode.FOR_EACH_PAC
  */\r
 public class PackagesInstallerBuilder implements LocateNuGetConfigBuildProcess.Callback {\r
   private final NuGetActionFactory myActionFactory;\r
-  private final BuildProcessContinuation myInstall;\r
-  private final BuildProcessContinuation myUpdate;\r
-  private final BuildProcessContinuation myPostUpdate;\r
+  private final InstallStages myStages;\r
   private final BuildRunnerContext myContext;\r
 \r
   private final PackagesUpdateParameters myUpdateParameters;\r
   private final PackagesInstallParameters myInstallParameters;\r
 \r
   public PackagesInstallerBuilder(@NotNull final NuGetActionFactory actionFactory,\r
-                                  @NotNull final BuildProcessContinuation install,\r
-                                  @NotNull final BuildProcessContinuation update,\r
-                                  @NotNull final BuildProcessContinuation postUpdate,\r
+                                  @NotNull final InstallStages stages,\r
                                   @NotNull final BuildRunnerContext context,\r
                                   @NotNull final PackagesInstallParameters installParameters,\r
                                   @Nullable final PackagesUpdateParameters updateParameters) {\r
-    myInstall = install;\r
-    myUpdate = update;\r
-    myPostUpdate = postUpdate;\r
+    myStages = stages;\r
     myContext = context;\r
     myUpdateParameters = updateParameters;\r
     myInstallParameters = installParameters;\r
@@ -63,7 +58,7 @@ public class PackagesInstallerBuilder implements LocateNuGetConfigBuildProcess.C
     if (myUpdateParameters == null) return;\r
     if (myUpdateParameters.getUpdateMode() != PackagesUpdateMode.FOR_SLN) return;\r
 \r
-    myUpdate.pushBuildProcess(\r
+    myStages.getUpdateStage().pushBuildProcess(\r
             myActionFactory.createUpdate(\r
                     myContext,\r
                     myUpdateParameters,\r
@@ -74,14 +69,20 @@ public class PackagesInstallerBuilder implements LocateNuGetConfigBuildProcess.C
   }\r
 \r
   public final void onPackagesConfigFound(@NotNull final File config, @NotNull final File targetFolder) throws RunBuildException {\r
-    myInstall.pushBuildProcess(myActionFactory.createInstall(myContext,\r
+    myStages.getInstallStage().pushBuildProcess(myActionFactory.createInstall(\r
+            myContext,\r
             myInstallParameters,\r
             config,\r
             targetFolder));\r
 \r
+    myStages.getReportStage().pushBuildProcess(myActionFactory.createUsageReport(\r
+            myContext,\r
+            myInstallParameters.getNuGetParameters(),\r
+            config, targetFolder));\r
+\r
     if (myUpdateParameters == null) return;\r
     if (myUpdateParameters.getUpdateMode() == FOR_EACH_PACKAGES_CONFIG) {\r
-      myUpdate.pushBuildProcess(\r
+      myStages.getUpdateStage().pushBuildProcess(\r
               myActionFactory.createUpdate(\r
                       myContext,\r
                       myUpdateParameters,\r
@@ -91,7 +92,7 @@ public class PackagesInstallerBuilder implements LocateNuGetConfigBuildProcess.C
       );\r
     }\r
 \r
-    myPostUpdate.pushBuildProcess(\r
+    myStages.getPostUpdateStart().pushBuildProcess(\r
             myActionFactory.createInstall(\r
                     myContext,\r
                     myInstallParameters,\r
@@ -99,6 +100,8 @@ public class PackagesInstallerBuilder implements LocateNuGetConfigBuildProcess.C
                     targetFolder\r
             )\r
     );\r
+\r
+\r
   }\r
 \r
 }\r