Java 类org.gradle.api.plugins.BasePlugin 实例源码

项目:Reer    文件:EarPlugin.java   
public void apply(final Project project) {
    project.getPluginManager().apply(BasePlugin.class);

    final EarPluginConvention earPluginConvention = instantiator.newInstance(EarPluginConvention.class, fileResolver, instantiator);
    project.getConvention().getPlugins().put("ear", earPluginConvention);
    earPluginConvention.setLibDirName("lib");
    earPluginConvention.setAppDirName("src/main/application");

    wireEarTaskConventions(project, earPluginConvention);
    configureConfigurations(project);

    PluginContainer plugins = project.getPlugins();

    setupEarTask(project, earPluginConvention);

    configureWithJavaPluginApplied(project, earPluginConvention, plugins);
    configureWithNoJavaPluginApplied(project, earPluginConvention);
}
项目:jsass-gradle-plugin    文件:JSassWarPlugin.java   
@Override
public void apply(Project project) {

    jSassBasePlugin = project.getPlugins().apply(JSassBasePlugin.class);
    project.getPlugins().apply(WarPlugin.class);

    SassCompile compileWebappSass = project.getTasks().create("compileWebappSass", SassCompile.class);
    compileWebappSass.setGroup(BasePlugin.BUILD_GROUP);
    compileWebappSass.setDescription("Compile sass and scss files for the webapp");

    WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class);
    compileWebappSass.setSourceDir(warPluginConvention.getWebAppDir());

    project.afterEvaluate(p -> {
        War war = (War) p.getTasks().getByName(WarPlugin.WAR_TASK_NAME);
        if (jSassBasePlugin.getExtension().isInplace()) {
            compileWebappSass.setDestinationDir(warPluginConvention.getWebAppDir());
        } else {
            compileWebappSass.setDestinationDir(new File(p.getBuildDir(), "generated/webappCss"));
            war.from(compileWebappSass.getDestinationDir());
        }
        war.dependsOn(compileWebappSass);
    });
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RepackagePluginFeatures.java   
private void addRepackageTask(Project project) {
    RepackageTask task = project.getTasks().create(REPACKAGE_TASK_NAME,
            RepackageTask.class);
    task.setDescription("Repackage existing JAR and WAR "
            + "archives so that they can be executed from the command "
            + "line using 'java -jar'");
    task.setGroup(BasePlugin.BUILD_GROUP);
    Configuration runtimeConfiguration = project.getConfigurations()
            .getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME);
    TaskDependency runtimeProjectDependencyJarTasks = runtimeConfiguration
            .getTaskDependencyFromProjectDependency(true, JavaPlugin.JAR_TASK_NAME);
    task.dependsOn(
            project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION)
                    .getAllArtifacts().getBuildDependencies(),
            runtimeProjectDependencyJarTasks);
    registerOutput(project, task);
    ensureTaskRunsOnAssembly(project, task);
    ensureMainClassHasBeenFound(project, task);
}
项目:spring-boot-concourse    文件:RepackagePluginFeatures.java   
private void addRepackageTask(Project project) {
    RepackageTask task = project.getTasks().create(REPACKAGE_TASK_NAME,
            RepackageTask.class);
    task.setDescription("Repackage existing JAR and WAR "
            + "archives so that they can be executed from the command "
            + "line using 'java -jar'");
    task.setGroup(BasePlugin.BUILD_GROUP);
    Configuration runtimeConfiguration = project.getConfigurations()
            .getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME);
    TaskDependency runtimeProjectDependencyJarTasks = runtimeConfiguration
            .getTaskDependencyFromProjectDependency(true, JavaPlugin.JAR_TASK_NAME);
    task.dependsOn(
            project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION)
                    .getAllArtifacts().getBuildDependencies(),
            runtimeProjectDependencyJarTasks);
    registerOutput(project, task);
    ensureTaskRunsOnAssembly(project, task);
    ensureMainClassHasBeenFound(project, task);
}
项目:intellij-ce-playground    文件:ProductFlavorData.java   
ProductFlavorData(
        @NonNull T productFlavor,
        @NonNull DefaultAndroidSourceSet sourceSet,
        @Nullable DefaultAndroidSourceSet androidTestSourceSet,
        @Nullable DefaultAndroidSourceSet unitTestSourceSet,
        @NonNull Project project) {
    super(sourceSet, androidTestSourceSet, unitTestSourceSet, project);

    this.productFlavor = productFlavor;

    if (!BuilderConstants.MAIN.equals(sourceSet.getName())) {
        String sourceSetName = StringHelper.capitalize(sourceSet.getName());
        assembleTask = project.getTasks().create("assemble" + sourceSetName);
        assembleTask.setDescription("Assembles all " + sourceSetName + " builds.");
        assembleTask.setGroup(BasePlugin.BUILD_GROUP);
    } else {
        assembleTask = null;
    }
}
项目:contestparser    文件:RepackagePluginFeatures.java   
private void addRepackageTask(Project project) {
    RepackageTask task = project.getTasks().create(REPACKAGE_TASK_NAME,
            RepackageTask.class);
    task.setDescription("Repackage existing JAR and WAR "
            + "archives so that they can be executed from the command "
            + "line using 'java -jar'");
    task.setGroup(BasePlugin.BUILD_GROUP);
    Configuration runtimeConfiguration = project.getConfigurations()
            .getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME);
    TaskDependency runtimeProjectDependencyJarTasks = runtimeConfiguration
            .getTaskDependencyFromProjectDependency(true, JavaPlugin.JAR_TASK_NAME);
    task.dependsOn(
            project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION)
                    .getAllArtifacts().getBuildDependencies(),
            runtimeProjectDependencyJarTasks);
    registerOutput(project, task);
    ensureTaskRunsOnAssembly(project, task);
    ensureMainClassHasBeenFound(project, task);
}
项目:Pushjet-Android    文件:EarPlugin.java   
public void apply(final Project project) {
    project.getPlugins().apply(BasePlugin.class);

    final EarPluginConvention earPluginConvention = instantiator.newInstance(EarPluginConvention.class, fileResolver, instantiator);
    project.getConvention().getPlugins().put("ear", earPluginConvention);
    earPluginConvention.setLibDirName("lib");
    earPluginConvention.setAppDirName("src/main/application");

    wireEarTaskConventions(project, earPluginConvention);
    configureConfigurations(project);

    PluginContainer plugins = project.getPlugins();

    setupEarTask(project, earPluginConvention);

    configureWithJavaPluginApplied(project, earPluginConvention, plugins);
    configureWithNoJavaPluginApplied(project, earPluginConvention);
}
项目:Pushjet-Android    文件:EarPlugin.java   
public void apply(final Project project) {
    project.getPlugins().apply(BasePlugin.class);

    final EarPluginConvention earPluginConvention = instantiator.newInstance(EarPluginConvention.class, fileResolver);
    project.getConvention().getPlugins().put("ear", earPluginConvention);
    earPluginConvention.setLibDirName("lib");
    earPluginConvention.setAppDirName("src/main/application");

    wireEarTaskConventions(project, earPluginConvention);
    configureConfigurations(project);

    PluginContainer plugins = project.getPlugins();

    setupEarTask(project, earPluginConvention);

    configureWithJavaPluginApplied(project, earPluginConvention, plugins);
    configureWithNoJavaPluginApplied(project, earPluginConvention);
}
项目:nw-gradle    文件:NWEarPlugin.java   
@Override
public void apply(final Project project) {
  project.getPlugins().apply(BasePlugin.class);

  final NWEarPluginConvention earPluginConvention = instantiator.newInstance(NWEarPluginConvention.class, fileResolver, instantiator);
  project.getConvention().getPlugins().put(NWEAR_TASK_NAME, earPluginConvention);
  earPluginConvention.setAppDirName("EarContent"); //default

  this.earTask = setupEarTask(project, earPluginConvention);
  wireEarTaskConventions(project, earPluginConvention);
  configureAppDirSources(project, earPluginConvention);
  configureDeploymentDescriptor(project, earPluginConvention);
  configureManifest(project, earPluginConvention, earTask);
  configureSapManifest(project, earPluginConvention);

}
项目:checkstyle-addons    文件:TaskCreator.java   
private void setupCompileTaskForSourceSet(@Nonnull final DependencyConfig pDepConfig,
    @Nonnull final String pSourceSetName, @Nonnull final TaskNames pCompileTaskName,
    @Nonnull final TaskNames pClassesTaskName)
{
    final TaskContainer tasks = project.getTasks();
    final boolean isTest = SourceSet.TEST_SOURCE_SET_NAME.equals(pSourceSetName);

    final SourceSet sourceSet = buildUtil.getSourceSet(pSourceSetName);
    final CompileTask compileTask = tasks.create(pCompileTaskName.getName(pDepConfig), CompileTask.class);
    compileTask.configureFor(pDepConfig, sourceSet, isTest);

    final Task classesTask = tasks.create(pClassesTaskName.getName(pDepConfig));
    classesTask.setDescription(
        buildUtil.getLongName() + ": Assembles '" + pSourceSetName + "' classes for dependency configuration '"
            + pDepConfig.getName() + "'");
    classesTask.setGroup(BasePlugin.BUILD_GROUP);
    classesTask.dependsOn(compileTask, tasks.getByName(sourceSet.getProcessResourcesTaskName()));
}
项目:checkstyle-addons    文件:TaskCreator.java   
/**
 * Assign some standard tasks and tasks created by third-party plugins to their task groups according to the
 * order of things for Checkstyle Addons.
 */
public void adjustTaskGroupAssignments()
{
    final TaskContainer tasks = project.getTasks();
    tasks.getByName(BasePlugin.ASSEMBLE_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME);
    tasks.getByName(JavaPlugin.JAR_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME);

    final SourceSet sqSourceSet = buildUtil.getSourceSet(BuildUtil.SONARQUBE_SOURCE_SET_NAME);
    tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP);
    tasks.getByName(sqSourceSet.getCompileJavaTaskName()).setGroup(BasePlugin.BUILD_GROUP);
    tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP);

    for (final FindBugs fbTask : tasks.withType(FindBugs.class)) {
        fbTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
    }
    for (final Checkstyle csTask : tasks.withType(Checkstyle.class)) {
        csTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
    }
    for (final Copy task : tasks.withType(Copy.class)) {
        if (task.getName().startsWith("process") && task.getName().endsWith("Resources")) {
            task.setGroup(LifecycleBasePlugin.BUILD_GROUP);
        }
    }
}
项目:Reer    文件:EarPlugin.java   
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
项目:Reer    文件:JavaScriptBasePlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(BasePlugin.class);
    project.getExtensions().create(JavaScriptExtension.NAME, JavaScriptExtension.class);
    ((ExtensionAware) project.getRepositories()).getExtensions().create(
        JavaScriptRepositoriesExtension.NAME,
        JavaScriptRepositoriesExtension.class,
        project.getRepositories());
}
项目:Reer    文件:DistributionPlugin.java   
@Override
public void apply(final ProjectInternal project) {
    project.getPluginManager().apply(BasePlugin.class);
    DefaultDistributionContainer distributions = project.getExtensions().create("distributions", DefaultDistributionContainer.class, Distribution.class, instantiator, fileOperations);

    // TODO - refactor this action out so it can be unit tested
    distributions.all(new Action<Distribution>() {
        @Override
        public void execute(final Distribution dist) {
            ((IConventionAware) dist).getConventionMapping().map("baseName", new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    return dist.getName().equals(MAIN_DISTRIBUTION_NAME) ? project.getName() : String.format("%s-%s", project.getName(), dist.getName());
                }
            });

            dist.getContents().from("src/" + dist.getName() + "/dist");
            String zipTaskName = MAIN_DISTRIBUTION_NAME.equals(dist.getName()) ? TASK_DIST_ZIP_NAME : dist.getName() + "DistZip";
            Task zipTask = configureArchiveTask(project, zipTaskName, dist, Zip.class);
            String tarTaskName = MAIN_DISTRIBUTION_NAME.equals(dist.getName()) ? TASK_DIST_TAR_NAME : dist.getName() + "DistTar";
            Task tarTask = configureArchiveTask(project, tarTaskName, dist, Tar.class);
            addAssembleTask(project, dist, zipTask, tarTask);
            addInstallTask(project, dist);
        }
    });
    distributions.create(MAIN_DISTRIBUTION_NAME);
}
项目:Reer    文件:UploadRule.java   
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
    Upload upload = project.getTasks().create(name, Upload.class);
    upload.setDescription("Uploads all artifacts belonging to " + configuration);
    upload.setGroup(BasePlugin.UPLOAD_GROUP);
    upload.setConfiguration(configuration);
    upload.setUploadDescriptor(true);
    upload.getConventionMapping().map("descriptorDestination", new Callable<File>() {
        public File call() throws Exception {
            return new File(project.getBuildDir(), "ivy.xml");
        }
    });
    return upload;
}
项目:jsass-gradle-plugin    文件:JSassJavaPlugin.java   
@Override
public void apply(Project project) {
    jSassBasePlugin = project.getPlugins().apply(JSassBasePlugin.class);

    project.getPlugins().apply(JavaPlugin.class);

    project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> {
        String taskName = sourceSet.getTaskName("compile", "Sass");

        Set<File> srcDirs = sourceSet.getResources().getSrcDirs();

        int i = 1;
        for (File srcDir : srcDirs) {
            SassCompile sassCompile = project.getTasks().create(i == 1 ? taskName : taskName + i, SassCompile.class);
            i++;

            sassCompile.setGroup(BasePlugin.BUILD_GROUP);
            sassCompile.setDescription("Compile sass and scss files for the " + sourceSet.getName() + " source set");

            sassCompile.setSourceDir(srcDir);

            Copy processResources = (Copy) project.getTasks().getByName(sourceSet.getProcessResourcesTaskName());

            sassCompile.getConventionMapping().map("destinationDir", () -> {
                        if (jSassBasePlugin.getExtension().isInplace()) {
                            return srcDir;
                        } else {
                            return processResources.getDestinationDir();
                        }
                    });

            processResources.dependsOn(sassCompile);
        }
    });
}
项目:jpa2ddl    文件:GeneratePlugin.java   
@Override
public void apply(Project project) {
    GeneratePluginExtension generatePluginExtension = project.getExtensions().create(EXTENSION_NAME,
            GeneratePluginExtension.class, project);

    GenerateTask generateTask = project.getTasks().create(TASK_NAME, GenerateTask.class);
    generateTask.setGroup(BasePlugin.BUILD_GROUP);
    generateTask.setDescription("Generates DDL scripts based on JPA model.");
    generateTask.setExtension(generatePluginExtension);
    generateTask.dependsOn(JavaBasePlugin.BUILD_TASK_NAME);


    project.afterEvaluate(evaluatedProject -> {
        fillDefaults(evaluatedProject, generatePluginExtension);
        SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
        Set<File> paths;
        if (sourceSets != null) {
            UnionFileCollection mainClasspath = (UnionFileCollection) sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
            paths = mainClasspath.getSources()
                    .stream()
                    .filter(fileCollection -> fileCollection instanceof DefaultSourceSetOutput)
                    .map(DefaultSourceSetOutput.class::cast)
                    .flatMap(fileCollection -> fileCollection.getClassesDirs().getFiles().stream())
                    .collect(Collectors.toSet());
        } else {
            paths = new HashSet<>();
        }
        generateTask.setOutputClassesDirs(paths);
    });
}
项目:curiostack    文件:CurioDatabasePlugin.java   
@Override
public void apply(Project project) {
  project
      .getExtensions()
      .create(ImmutableDatabaseExtension.NAME, DatabaseExtension.class, project);

  project.getPlugins().apply(BasePlugin.class);
  project.getPlugins().apply(DockerRemoteApiPlugin.class);
  project.getPlugins().apply(FlywayPlugin.class);

  project.afterEvaluate(CurioDatabasePlugin::addTasks);
}
项目:gradle-plugins    文件:AbstractMavenJarPlugin.java   
@Override
public void apply(Project project) {
    this.project = project;
    jarTask = project.getTasks().create(getTaskName(), Jar.class);
    jarTask.setClassifier(getClassifier());
    jarTask.setGroup(BasePlugin.BUILD_GROUP);

    project.getPluginManager().apply(BasePlugin.class);
    project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, getJarTask());
}
项目:gradle-plugins    文件:ExplodedArchivesPlugin.java   
@Override
public void apply(final Project project) {

    explodedArchives = project.getExtensions().create("explodedArchives", ExplodedArchivesExtension.class);

    explodeAll = project.getTasks().create("explode");
    explodeAll.setGroup(BasePlugin.BUILD_GROUP);

    project.getTasks().withType(AbstractArchiveTask.class, archiveTask -> {
        Sync explodeArchive = project.getTasks().create("explode" + capitalize((CharSequence) archiveTask.getName()), Sync.class);

        explodeAll.dependsOn(explodeArchive);
        explodeArchive.dependsOn(archiveTask);

        explodeArchive.getConventionMapping()
                .map("group", (Callable<String>) archiveTask::getGroup);

        explodeArchive.getConventionMapping()
                .map("destinationDir", (Callable<File>) () -> {
                    File explodedDir = new File(archiveTask.getDestinationDir(), "exploded");
                    if (explodedArchives.isIncludeExtension()) {
                        return new File(explodedDir, archiveTask.getArchiveName());
                    } else {
                        return new File(explodedDir, minus((CharSequence) archiveTask.getArchiveName(), "." + archiveTask.getExtension()));
                    }
                });

        explodeArchive.from((Callable<FileTree>) () -> project.zipTree(archiveTask.getArchivePath()));
    });
}
项目:intellij-ce-playground    文件:BuildTypeData.java   
BuildTypeData(
        @NonNull  CoreBuildType buildType,
        @NonNull  Project project,
        @NonNull  DefaultAndroidSourceSet sourceSet,
        @Nullable DefaultAndroidSourceSet unitTestSourceSet) {
    super(sourceSet, null, unitTestSourceSet, project);

    this.buildType = buildType;

    String sourceSetName = StringHelper.capitalize(buildType.getName());

    assembleTask = project.getTasks().create("assemble" + sourceSetName);
    assembleTask.setDescription("Assembles all " + sourceSetName + " builds.");
    assembleTask.setGroup(BasePlugin.BUILD_GROUP);
}
项目:gradle-plugins    文件:AbstractMavenJarPlugin.java   
@Override
public void apply(Project project) {
    this.project = project;
    jarTask = project.getTasks().create(getTaskName(), Jar.class);
    jarTask.setClassifier(getClassifier());
    jarTask.setGroup(BasePlugin.BUILD_GROUP);

    project.getPluginManager().apply(BasePlugin.class);
    project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, getJarTask());
}
项目:gradle-plugins    文件:ExplodedArchivesPlugin.java   
@Override
public void apply(final Project project) {

    explodedArchives = project.getExtensions().create("explodedArchives", ExplodedArchivesExtension.class);

    explodeAll = project.getTasks().create("explode");
    explodeAll.setGroup(BasePlugin.BUILD_GROUP);

    project.getTasks().withType(AbstractArchiveTask.class, archiveTask -> {
        Sync explodeArchive = project.getTasks().create("explode" + capitalize((CharSequence) archiveTask.getName()), Sync.class);

        explodeAll.dependsOn(explodeArchive);
        explodeArchive.dependsOn(archiveTask);

        explodeArchive.getConventionMapping()
                .map("group", (Callable<String>) archiveTask::getGroup);

        explodeArchive.getConventionMapping()
                .map("destinationDir", (Callable<File>) () -> {
                    File explodedDir = new File(archiveTask.getDestinationDir(), "exploded");
                    if (explodedArchives.isIncludeExtension()) {
                        return new File(explodedDir, archiveTask.getArchiveName());
                    } else {
                        return new File(explodedDir, minus((CharSequence) archiveTask.getArchiveName(), "." + archiveTask.getExtension()));
                    }
                });

        explodeArchive.from((Callable<FileTree>) () -> project.zipTree(archiveTask.getArchivePath()));
    });
}
项目:Pushjet-Android    文件:EarPlugin.java   
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
项目:Pushjet-Android    文件:UploadRule.java   
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
    Upload upload = project.getTasks().create(name, Upload.class);
    upload.setDescription(String.format("Uploads all artifacts belonging to %s", configuration));
    upload.setGroup(BasePlugin.UPLOAD_GROUP);
    upload.setConfiguration(configuration);
    upload.setUploadDescriptor(true);
    upload.getConventionMapping().map("descriptorDestination", new Callable<File>() {
        public File call() throws Exception {
            return new File(project.getBuildDir(), "ivy.xml");
        }
    });
    return upload;
}
项目:Pushjet-Android    文件:NativeBinariesModelPlugin.java   
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(BasePlugin.class);
    project.getPlugins().apply(LanguageBasePlugin.class);

    modelRules.register("toolChains", ToolChainRegistryInternal.class, factory(DefaultToolChainRegistry.class));
    modelRules.register("platforms", PlatformContainer.class, factory(DefaultPlatformContainer.class));
    modelRules.register("buildTypes", BuildTypeContainer.class, factory(DefaultBuildTypeContainer.class));
    modelRules.register("flavors", FlavorContainer.class, factory(DefaultFlavorContainer.class));

    project.getModelRegistry().create("repositories", Arrays.asList("flavors", "platforms", "buildTypes"), new RepositoriesFactory(instantiator, fileResolver));

    modelRules.rule(new CreateDefaultPlatform());
    modelRules.rule(new CreateDefaultBuildTypes());
    modelRules.rule(new CreateDefaultFlavors());
    modelRules.rule(new AddDefaultToolChainsIfRequired());
    modelRules.rule(new CreateNativeBinaries(instantiator, project, resolver));
    modelRules.rule(new CloseBinariesForTasks());

    project.getExtensions().create(
            "executables",
            DefaultExecutableContainer.class,
            instantiator,
            project
    );
    project.getExtensions().create(
            "libraries",
            DefaultLibraryContainer.class,
            instantiator,
            project
    );

    // TODO:DAZ Lazy configuration actions: need a better way to accomplish these.
    configurationActions.add(Actions.composite(
            new ConfigureGeneratedSourceSets(),
            new ApplySourceSetConventions()
    ));
}
项目:Pushjet-Android    文件:EarPlugin.java   
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
项目:Pushjet-Android    文件:UploadRule.java   
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
    Upload upload = project.getTasks().create(name, Upload.class);
    upload.setDescription(String.format("Uploads all artifacts belonging to %s", configuration));
    upload.setGroup(BasePlugin.UPLOAD_GROUP);
    upload.setConfiguration(configuration);
    upload.setUploadDescriptor(true);
    upload.getConventionMapping().map("descriptorDestination", new Callable<File>() {
        public File call() throws Exception {
            return new File(project.getBuildDir(), "ivy.xml");
        }
    });
    return upload;
}
项目:spotless    文件:SpotlessPlugin.java   
@Override
public void apply(Project project) {
    // make sure there's a `clean` task
    project.getPlugins().apply(BasePlugin.class);

    // setup the extension
    spotlessExtension = project.getExtensions().create(EXTENSION, SpotlessExtension.class, project);

    // after the project has been evaluated, configure the check and format tasks per source set
    project.afterEvaluate(this::createTasks);
}
项目:checkstyle-addons    文件:CompileTask.java   
public CompileTask()
{
    super();
    final Project project = getProject();
    buildUtil = new BuildUtil(project);
    setGroup(BasePlugin.BUILD_GROUP);
}
项目:baratine    文件:GradleBaratine.java   
private void bootJarTask(Project project)
{
  project.getConvention().getPlugins().put("baratine", new BaratineConvention(project));

  GradlePackageTask task;

  task = project.getTasks().create("jarBoot", 
                                   GradlePackageTask.class);

  task.setDescription("Assembles an executable boot jar containing the application and any dependencies");
  task.setGroup("build");

  project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(task);

  Task jarTask = project.getTasks().getByName("jar");

  task.dependsOn(jarTask);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RepackagePluginFeatures.java   
private void ensureTaskRunsOnAssembly(Project project, Task task) {
    project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(task);
}
项目:spring-boot-concourse    文件:RepackagePluginFeatures.java   
private void ensureTaskRunsOnAssembly(Project project, Task task) {
    project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(task);
}
项目:intellij-ce-playground    文件:TaskManager.java   
/**
 * Create tasks before the evaluation (on plugin apply). This is useful for tasks that
 * could be referenced by custom build logic.
 */
public void createTasksBeforeEvaluate(@NonNull TaskFactory tasks) {
    tasks.create(UNINSTALL_ALL, new Action<Task>() {
        @Override
        public void execute(Task uninstallAllTask) {
            uninstallAllTask.setDescription("Uninstall all applications.");
            uninstallAllTask.setGroup(INSTALL_GROUP);
        }
    });

    tasks.create(DEVICE_CHECK, new Action<Task>() {
        @Override
        public void execute(Task deviceCheckTask) {
            deviceCheckTask.setDescription(
                    "Runs all device checks using Device Providers and Test Servers.");
            deviceCheckTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
        }
    });

    tasks.create(CONNECTED_CHECK, new Action<Task>() {
        @Override
        public void execute(Task connectedCheckTask) {
            connectedCheckTask.setDescription(
                    "Runs all device checks on currently connected devices.");
            connectedCheckTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
        }
    });

    tasks.create(MAIN_PREBUILD);

    tasks.create(SOURCE_SETS, SourceSetsTask.class, new Action<SourceSetsTask>() {
        @Override
        public void execute(SourceSetsTask sourceSetsTask) {
            sourceSetsTask.setConfig(extension);
            sourceSetsTask.setDescription(
                    "Prints out all the source sets defined in this project.");
            sourceSetsTask.setGroup(ANDROID_GROUP);
        }
    });

    tasks.create(ASSEMBLE_ANDROID_TEST, new Action<Task>() {
        @Override
        public void execute(Task assembleAndroidTestTask) {
            assembleAndroidTestTask.setGroup(BasePlugin.BUILD_GROUP);
            assembleAndroidTestTask.setDescription("Assembles all the Test applications.");
        }
    });

    tasks.create(LINT, Lint.class, new Action<Lint>() {
        @Override
        public void execute(Lint lintTask) {
            lintTask.setDescription("Runs lint on all variants.");
            lintTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
            lintTask.setLintOptions(getExtension().getLintOptions());
            lintTask.setSdkHome(sdkHandler.getSdkFolder());
            lintTask.setToolingRegistry(toolingRegistry);
        }
    });
    tasks.named(JavaBasePlugin.CHECK_TASK_NAME, new Action<Task>() {
        @Override
        public void execute(Task it) {
            it.dependsOn(LINT);
        }
    });
    createLintCompileTask(tasks);
}
项目:contestparser    文件:RepackagePluginFeatures.java   
private void ensureTaskRunsOnAssembly(Project project, Task task) {
    project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(task);
}
项目:spotless    文件:SpotlessPlugin.java   
@SuppressWarnings("rawtypes")
void createTasks(Project project) {
    Task rootCheckTask = project.task(EXTENSION + CHECK);
    rootCheckTask.setGroup(TASK_GROUP);
    rootCheckTask.setDescription(CHECK_DESCRIPTION);
    Task rootApplyTask = project.task(EXTENSION + APPLY);
    rootApplyTask.setGroup(TASK_GROUP);
    rootApplyTask.setDescription(APPLY_DESCRIPTION);

    spotlessExtension.formats.forEach((key, value) -> {
        // create the task that does the work
        String taskName = EXTENSION + capitalize(key);
        SpotlessTask spotlessTask = project.getTasks().create(taskName, SpotlessTask.class);
        value.setupTask(spotlessTask);

        // create the check and apply control tasks
        Task checkTask = project.getTasks().create(taskName + CHECK);
        Task applyTask = project.getTasks().create(taskName + APPLY);
        // the root tasks depend on them
        rootCheckTask.dependsOn(checkTask);
        rootApplyTask.dependsOn(applyTask);
        // and they depend on the work task
        checkTask.dependsOn(spotlessTask);
        applyTask.dependsOn(spotlessTask);

        // when the task graph is ready, we'll configure the spotlessTask appropriately
        project.getGradle().getTaskGraph().whenReady(new Closure(null) {
            private static final long serialVersionUID = 1L;

            // called by gradle
            @SuppressFBWarnings("UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS")
            public Object doCall(TaskExecutionGraph graph) {
                if (graph.hasTask(checkTask)) {
                    spotlessTask.setCheck();
                }
                if (graph.hasTask(applyTask)) {
                    spotlessTask.setApply();
                }
                return Closure.DONE;
            }
        });
    });

    // Add our check task as a dependency on the global check task
    // getTasks() returns a "live" collection, so this works even if the
    // task doesn't exist at the time this call is made
    if (spotlessExtension.enforceCheck) {
        project.getTasks()
                .matching(task -> task.getName().equals(JavaBasePlugin.CHECK_TASK_NAME))
                .all(task -> task.dependsOn(rootCheckTask));
    }

    // clear spotless' cache when the user does a clean, but only after any spotless tasks
    Task clean = project.getTasks().getByName(BasePlugin.CLEAN_TASK_NAME);
    clean.doLast(unused -> SpotlessCache.clear());
    project.getTasks()
            .withType(SpotlessTask.class)
            .all(task -> task.mustRunAfter(clean));
}
项目:Reer    文件:SigningPlugin.java   
/**
 * <p>Adds the ability to digitally sign files and artifacts.</p>
 *
 * <p>Adds the extension {@link SigningExtension} with the name “signing”.</p>
 * <p>Also adds conventions to all {@link Sign sign tasks} to use the signing extension setting defaults.</p>
 *
 * @see SigningExtension
 */
public void apply(Project project) {
    project.getPluginManager().apply(BasePlugin.class);
    project.getExtensions().create("signing", SigningExtension.class, project);
}