org.gradle.api.plugins.BasePlugin Java Examples
The following examples show how to use
org.gradle.api.plugins.BasePlugin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SourcesJarPlugin.java From gradle-plugins with MIT License | 7 votes |
@Override public void apply(Project project) { project.getLogger().warn("io.freefair.sources-jar is deprecated. Use java.withSourcesJar() instead"); project.getPluginManager().withPlugin("java", appliedPlugin -> { sourcesJar = project.getTasks().register("sourcesJar", Jar.class, sourcesJar -> { sourcesJar.setDescription("Assembles a jar archive containing the sources."); sourcesJar.getArchiveClassifier().set("sources"); sourcesJar.setGroup(BasePlugin.BUILD_GROUP); sourcesJar.dependsOn(project.getTasks().named(JavaPlugin.CLASSES_TASK_NAME)); JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class); DefaultSourceSet mainSourceSet = (DefaultSourceSet) javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); sourcesJar.from(mainSourceSet.getAllSource()); }); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, sourcesJar); }); }
Example #2
Source File: CodelabsPlugin.java From curiostack with MIT License | 6 votes |
@Override public void apply(Project project) { project.getRootProject().getPlugins().apply(CodelabsSetupPlugin.class); project.getPlugins().apply(BasePlugin.class); var setupClaat = DownloadToolUtil.getSetupTask(project, "claat"); var exportDocs = project .getTasks() .register( "exportDocs", ExportDocsTask.class, t -> { t.dependsOn(setupClaat); var mdFileTree = project.fileTree("src"); mdFileTree.exclude("build").include("**/*.md"); t.getMdFiles().set(mdFileTree); t.getOutputDir().set(project.file("build/site")); }); project.getTasks().named("assemble").configure(t -> t.dependsOn(exportDocs)); }
Example #3
Source File: AppEngineAppYamlPlugin.java From app-gradle-plugin with Apache License 2.0 | 6 votes |
private void createStageTask() { StageAppYamlTask stageTask = project .getTasks() .create( STAGE_TASK_NAME, StageAppYamlTask.class, stageTask1 -> { stageTask1.setGroup(APP_ENGINE_APP_YAML_TASK_GROUP); stageTask1.setDescription( "Stage an App Engine app.yaml based project for deployment"); stageTask1.dependsOn(BasePlugin.ASSEMBLE_TASK_NAME); project.afterEvaluate(project -> stageTask1.setStagingConfig(stageExtension)); }); project .getTasks() .getByName(AppEngineCorePluginConfiguration.DEPLOY_TASK_NAME) .dependsOn(stageTask); project .getTasks() .getByName(AppEngineCorePluginConfiguration.DEPLOY_ALL_TASK_NAME) .dependsOn(stageTask); }
Example #4
Source File: AppEngineStandardPlugin.java From app-gradle-plugin with Apache License 2.0 | 6 votes |
private void createExplodedWarTask() { project .getTasks() .create( EXPLODE_WAR_TASK_NAME, ExplodeWarTask.class, explodeWar -> { explodeWar.setExplodedAppDirectory(explodedWarDir); explodeWar.dependsOn(WarPlugin.WAR_TASK_NAME); explodeWar.setGroup(APP_ENGINE_STANDARD_TASK_GROUP); explodeWar.setDescription("Explode a war into a directory"); project.afterEvaluate( project -> explodeWar.setWarFile( ((War) project.getTasks().getByPath(WarPlugin.WAR_TASK_NAME)) .getArchivePath())); }); project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(EXPLODE_WAR_TASK_NAME); }
Example #5
Source File: RunExtension.java From app-gradle-plugin with Apache License 2.0 | 6 votes |
/** * Returns the appengine service directory for this project and modifies the task dependencies of * run/start to ensure {@code serviceProject} is built first. */ public File projectAsService(Project serviceProject) { if (!serviceProject.equals(project)) { project.evaluationDependsOn(serviceProject.getPath()); } project .getTasks() .findByName(AppEngineStandardPlugin.RUN_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); project .getTasks() .findByName(AppEngineStandardPlugin.START_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); return serviceProject .getTasks() .findByName(AppEngineStandardPlugin.EXPLODE_WAR_TASK_NAME) .getOutputs() .getFiles() .getSingleFile(); }
Example #6
Source File: JSassWarPlugin.java From gradle-plugins with MIT License | 6 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JSassWebjarsPlugin.class); project.getPlugins().apply(WarPlugin.class); TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register("compileWebappSass", SassCompile.class, compileWebappSass -> { compileWebappSass.setGroup(BasePlugin.BUILD_GROUP); compileWebappSass.setDescription("Compile sass and scss files for the webapp"); WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class); compileWebappSass.source(warPluginConvention.getWebAppDir()); compileWebappSass.getDestinationDir().set(new File(project.getBuildDir(), "jsass/webapp")); }); project.getTasks().named(WarPlugin.WAR_TASK_NAME, War.class) .configure(war -> war.from(sassCompileTaskProvider)); }
Example #7
Source File: JSassJavaPlugin.java From gradle-plugins with MIT License | 6 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JSassWebjarsPlugin.class); project.getPlugins().apply(JavaPlugin.class); File baseDestinationDir = new File(project.getBuildDir(), "jsass"); project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> { String taskName = sourceSet.getCompileTaskName("Sass"); TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register(taskName, SassCompile.class, sassCompile -> { sassCompile.setSource(sourceSet.getResources()); sassCompile.getDestinationDir().set(new File(baseDestinationDir, sourceSet.getName())); sassCompile.setGroup(BasePlugin.BUILD_GROUP); sassCompile.setDescription("Compile sass and scss files for the " + sourceSet.getName() + " source set"); }); project.getTasks().named(sourceSet.getProcessResourcesTaskName(), ProcessResources.class) .configure(processResources -> processResources.from(sassCompileTaskProvider)); }); }
Example #8
Source File: SourcesJarPlugin.java From gradle-plugins with MIT License | 6 votes |
@Override public void apply(Project project) { project.getLogger().warn("io.freefair.sources-jar is deprecated. Use java.withSourcesJar() instead"); project.getPluginManager().withPlugin("java", appliedPlugin -> { sourcesJar = project.getTasks().register("sourcesJar", Jar.class, sourcesJar -> { sourcesJar.setDescription("Assembles a jar archive containing the sources."); sourcesJar.getArchiveClassifier().set("sources"); sourcesJar.setGroup(BasePlugin.BUILD_GROUP); sourcesJar.dependsOn(project.getTasks().named(JavaPlugin.CLASSES_TASK_NAME)); JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class); DefaultSourceSet mainSourceSet = (DefaultSourceSet) javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); sourcesJar.from(mainSourceSet.getAllSource()); }); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, sourcesJar); }); }
Example #9
Source File: JSassJavaPlugin.java From gradle-plugins with MIT License | 6 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JSassWebjarsPlugin.class); project.getPlugins().apply(JavaPlugin.class); File baseDestinationDir = new File(project.getBuildDir(), "jsass"); project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> { String taskName = sourceSet.getCompileTaskName("Sass"); TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register(taskName, SassCompile.class, sassCompile -> { sassCompile.setSource(sourceSet.getResources()); sassCompile.getDestinationDir().set(new File(baseDestinationDir, sourceSet.getName())); sassCompile.setGroup(BasePlugin.BUILD_GROUP); sassCompile.setDescription("Compile sass and scss files for the " + sourceSet.getName() + " source set"); }); project.getTasks().named(sourceSet.getProcessResourcesTaskName(), ProcessResources.class) .configure(processResources -> processResources.from(sassCompileTaskProvider)); }); }
Example #10
Source File: CurioGenericCiPlugin.java From curiostack with MIT License | 6 votes |
private static void doAddToBranchBuild(Project project, Object task) { project .getRootProject() .getPlugins() .withType( CurioGenericCiPlugin.class, unused -> { var state = getCiState(project); if (!state.isReleaseBuild() && !state.isMasterBuild()) { project .getPlugins() .withType( BasePlugin.class, unused2 -> project.getTasks().named("build").configure(t -> t.dependsOn(task))); } }); }
Example #11
Source File: CurioGenericCiPlugin.java From curiostack with MIT License | 6 votes |
private static void doAddToReleaseBuild(Project project, Object task) { project .getRootProject() .getPlugins() .withType( CurioGenericCiPlugin.class, unused -> { if (getCiState(project).isReleaseBuild()) { project .getPlugins() .withType( BasePlugin.class, unused2 -> project.getTasks().named("build").configure(t -> t.dependsOn(task))); } }); }
Example #12
Source File: CurioGenericCiPlugin.java From curiostack with MIT License | 6 votes |
private static void doAddToMasterBuild(Project project, Object task) { project .getRootProject() .getPlugins() .withType( CurioGenericCiPlugin.class, unused -> { if (getCiState(project).isMasterBuild()) { project .getPlugins() .withType( BasePlugin.class, unused2 -> project.getTasks().named("build").configure(t -> t.dependsOn(task))); } }); }
Example #13
Source File: JSassWarPlugin.java From gradle-plugins with MIT License | 6 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JSassWebjarsPlugin.class); project.getPlugins().apply(WarPlugin.class); TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register("compileWebappSass", SassCompile.class, compileWebappSass -> { compileWebappSass.setGroup(BasePlugin.BUILD_GROUP); compileWebappSass.setDescription("Compile sass and scss files for the webapp"); WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class); compileWebappSass.source(warPluginConvention.getWebAppDir()); compileWebappSass.getDestinationDir().set(new File(project.getBuildDir(), "jsass/webapp")); }); project.getTasks().named(WarPlugin.WAR_TASK_NAME, War.class) .configure(war -> war.from(sassCompileTaskProvider)); }
Example #14
Source File: GeneratePlugin.java From jpa2ddl with Apache License 2.0 | 6 votes |
@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.getFiles(); } else { paths = new HashSet<>(); } generateTask.setOutputClassesDirs(paths); }); }
Example #15
Source File: EarPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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); }
Example #16
Source File: ProductFlavorData.java From javaide with GNU General Public License v3.0 | 6 votes |
ProductFlavorData( @NonNull T productFlavor, @NonNull DefaultAndroidSourceSet sourceSet, @NonNull Project project) { super(sourceSet, 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; } }
Example #17
Source File: EarPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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); }
Example #18
Source File: EarPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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); }
Example #19
Source File: EarPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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); }
Example #20
Source File: CpdPluginTest.java From gradle-cpd-plugin with Apache License 2.0 | 5 votes |
static Stream<Class<? extends Plugin>> CpdPlugin_shouldAddCpdCheckTaskAsDependencyOfCheckLifecycleTaskIfPluginIsApplied() { return Stream.of( LifecycleBasePlugin.class, BasePlugin.class, LanguageBasePlugin.class, JavaBasePlugin.class, JavaPlugin.class, GroovyPlugin.class, CppPlugin.class ); }
Example #21
Source File: EarPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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); } }); } }); }
Example #22
Source File: UploadRule.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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; }
Example #23
Source File: JavadocJarPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { project.getLogger().warn("io.freefair.javadoc-jar is deprecated. Use java.withJavadocJar() instead"); javadocJar = project.getTasks().register("javadocJar", Jar.class, javadocJar -> { javadocJar.from(project.getTasks().named(JavaPlugin.JAVADOC_TASK_NAME)); javadocJar.getArchiveClassifier().set("javadoc"); javadocJar.setDescription("Assembles a jar archive containing the javadocs."); javadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, javadocJar); }); project.getPlugins().withType(AggregateJavadocPlugin.class, aggregateJavadocPlugin -> { aggregateJavadocJar = project.getTasks().register("aggregateJavadocJar", Jar.class, aggregateJavadocJar -> { aggregateJavadocJar.from(aggregateJavadocPlugin.getAggregateJavadoc()); aggregateJavadocJar.getArchiveClassifier().set("javadoc"); aggregateJavadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getPlugins().apply(BasePlugin.class); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, aggregateJavadocJar); project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { aggregateJavadocJar.configure(aggregateJavadocJar -> { aggregateJavadocJar.getArchiveClassifier().convention("aggregateJavadoc"); aggregateJavadocJar.getDestinationDirectory().set(new File( project.getConvention().getPlugin(JavaPluginConvention.class).getDocsDir(), "aggregateJavadoc" )); }); }); }); }
Example #24
Source File: NativeBinariesModelPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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() )); }
Example #25
Source File: EarPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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); } }); } }); }
Example #26
Source File: UploadRule.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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; }
Example #27
Source File: RunExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 5 votes |
private Set<String> getAssembleDependencies(Project project, String taskName) { Task task = project.getTasks().findByPath(taskName); return task.getDependsOn() .stream() .filter(t -> t instanceof Task) .map(t -> (Task) t) .filter(t -> t.getName().equals(BasePlugin.ASSEMBLE_TASK_NAME)) .map(Task::getPath) .collect(Collectors.toSet()); }
Example #28
Source File: JavadocJarPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { project.getLogger().warn("io.freefair.javadoc-jar is deprecated. Use java.withJavadocJar() instead"); javadocJar = project.getTasks().register("javadocJar", Jar.class, javadocJar -> { javadocJar.from(project.getTasks().named(JavaPlugin.JAVADOC_TASK_NAME)); javadocJar.getArchiveClassifier().set("javadoc"); javadocJar.setDescription("Assembles a jar archive containing the javadocs."); javadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, javadocJar); }); project.getPlugins().withType(AggregateJavadocPlugin.class, aggregateJavadocPlugin -> { aggregateJavadocJar = project.getTasks().register("aggregateJavadocJar", Jar.class, aggregateJavadocJar -> { aggregateJavadocJar.from(aggregateJavadocPlugin.getAggregateJavadoc()); aggregateJavadocJar.getArchiveClassifier().set("javadoc"); aggregateJavadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getPlugins().apply(BasePlugin.class); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, aggregateJavadocJar); project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { aggregateJavadocJar.configure(aggregateJavadocJar -> { aggregateJavadocJar.getArchiveClassifier().convention("aggregateJavadoc"); aggregateJavadocJar.getDestinationDirectory().set(new File( project.getConvention().getPlugin(JavaPluginConvention.class).getDocsDir(), "aggregateJavadoc" )); }); }); }); }
Example #29
Source File: NodePlugin.java From curiostack with MIT License | 5 votes |
@Override public void apply(Project project) { project.getRootProject().getPlugins().apply(NodeSetupPlugin.class); project.getPlugins().apply(BasePlugin.class); project .getTasks() .withType(Delete.class) .named("clean") .configure(t -> t.delete("node_modules")); project .getTasks() .addRule( "Pattern: \"yarn_<command>\": Executes an Yarn command.", taskName -> { if (taskName.startsWith("yarn_")) { project .getTasks() .create( taskName, NodeTask.class, t -> { List<String> tokens = YARN_TASK_SPLITTER.splitToList(taskName); t.args(tokens.subList(1, tokens.size())); }); } }); }
Example #30
Source File: CurioDatabasePlugin.java From curiostack with MIT License | 5 votes |
@Override public void apply(Project project) { DatabaseExtension.create(project); project.getPlugins().apply(BasePlugin.class); project.getPlugins().apply(DockerRemoteApiPlugin.class); project.getPlugins().apply(FlywayPlugin.class); project.afterEvaluate(CurioDatabasePlugin::addTasks); }