protected void configurePluginsSDK(
      Project project,
      final WorkspaceExtension workspaceExtension,
      Copy initBundleTask,
      AbstractArchiveTask[] distBundleTasks) {

    final Project pluginsSDKProject =
        GradleUtil.getProject(project, workspaceExtension.getPluginsSDKDir());

    if (pluginsSDKProject == null) {
      return;
    }

    AntBuilder antBuilder = pluginsSDKProject.getAnt();

    antBuilder.importBuild("build.xml");

    final Task warTask = GradleUtil.getTask(pluginsSDKProject, WarPlugin.WAR_TASK_NAME);

    File homeDir = workspaceExtension.getHomeDir();

    if (!homeDir.exists()) {
      warTask.dependsOn(initBundleTask);
    }

    Task updateSDKPropertiesTask =
        addTaskUpdateSDKProperties(pluginsSDKProject, workspaceExtension);

    Task buildTask = pluginsSDKProject.task(LifecycleBasePlugin.BUILD_TASK_NAME);

    buildTask.dependsOn(updateSDKPropertiesTask, warTask);

    for (AbstractArchiveTask abstractArchiveTask : distBundleTasks) {
      abstractArchiveTask.into(
          "deploy",
          new Closure<Void>(null) {

            @SuppressWarnings("unused")
            public void doCall(CopySpec copySpec) {
              ConfigurableFileTree configurableFileTree = pluginsSDKProject.fileTree("dist");

              configurableFileTree.builtBy(warTask);
              configurableFileTree.include("*.war");

              copySpec.from(configurableFileTree);
            }
          });
    }
  }
示例#2
0
  private static void _invokeAntMethodUnzip(AntBuilder antBuilder, File file, File destinationDir) {

    Map<String, Object> args = new HashMap<>();

    args.put("dest", destinationDir);
    args.put("src", file);

    antBuilder.invokeMethod("unzip", args);
  }
  private void _configureAnt(Project project) {
    AntBuilder antBuilder = project.getAnt();

    antBuilder.importBuild("build.xml");
  }