Java Code Examples for org.gradle.api.internal.IConventionAware
The following examples show how to use
org.gradle.api.internal.IConventionAware. These examples are extracted from open source projects.
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 Project: pushfish-android Source File: OsgiPluginConvention.java License: BSD 2-Clause "Simplified" License | 6 votes |
private OsgiManifest createDefaultOsgiManifest(final ProjectInternal project) { OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver()); ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping(); final OsgiHelper osgiHelper = new OsgiHelper(); mapping.map("version", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getVersion(project.getVersion().toString()); } }); mapping.map("name", new Callable<Object>() { public Object call() throws Exception { return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName(); } }); mapping.map("symbolicName", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getBundleSymbolicName(project); } }); return osgiManifest; }
Example 2
Source Project: pushfish-android Source File: OsgiPluginConvention.java License: BSD 2-Clause "Simplified" License | 6 votes |
private OsgiManifest createDefaultOsgiManifest(final ProjectInternal project) { OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver()); ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping(); final OsgiHelper osgiHelper = new OsgiHelper(); mapping.map("version", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getVersion(project.getVersion().toString()); } }); mapping.map("name", new Callable<Object>() { public Object call() throws Exception { return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName(); } }); mapping.map("symbolicName", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getBundleSymbolicName(project); } }); return osgiManifest; }
Example 3
Source Project: Pushjet-Android Source File: OsgiPluginConvention.java License: BSD 2-Clause "Simplified" License | 6 votes |
private OsgiManifest createDefaultOsgiManifest(final ProjectInternal project) { OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver()); ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping(); final OsgiHelper osgiHelper = new OsgiHelper(); mapping.map("version", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getVersion(project.getVersion().toString()); } }); mapping.map("name", new Callable<Object>() { public Object call() throws Exception { return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName(); } }); mapping.map("symbolicName", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getBundleSymbolicName(project); } }); return osgiManifest; }
Example 4
Source Project: Pushjet-Android Source File: OsgiPluginConvention.java License: BSD 2-Clause "Simplified" License | 6 votes |
private OsgiManifest createDefaultOsgiManifest(final ProjectInternal project) { OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver()); ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping(); final OsgiHelper osgiHelper = new OsgiHelper(); mapping.map("version", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getVersion(project.getVersion().toString()); } }); mapping.map("name", new Callable<Object>() { public Object call() throws Exception { return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName(); } }); mapping.map("symbolicName", new Callable<Object>() { public Object call() throws Exception { return osgiHelper.getBundleSymbolicName(project); } }); return osgiManifest; }
Example 5
Source Project: JGiven Source File: JGivenPlugin.java License: Apache License 2.0 | 6 votes |
private void applyTo( Test test ){ final String testName = test.getName(); final JGivenTaskExtension extension = test.getExtensions().create( "jgiven", JGivenTaskExtension.class ); final Project project = test.getProject(); ( (IConventionAware) extension ).getConventionMapping().map( "resultsDir", (Callable<File>) () -> project.file( project.getBuildDir() + "/jgiven-results/" + testName ) ); File resultsDir = extension.getResultsDir(); if( resultsDir != null ) { test.getOutputs().dir( resultsDir ).withPropertyName( "jgiven.resultsDir" ); } // Java lambda classes are created at runtime with a non-deterministic classname. // Therefore, the class name does not identify the implementation of the lambda and changes between different Gradle runs. // https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:how_does_it_work test.prependParallelSafeAction( new Action<Task>() { @Override public void execute( Task task ){ ((Test) task).systemProperty( Config.JGIVEN_REPORT_DIR, extension.getResultsDir().getAbsolutePath() ); } } ); }
Example 6
Source Project: javaide Source File: JavaBasePlugin.java License: GNU General Public License v3.0 | 5 votes |
private BridgedBinaries configureSourceSetDefaults(final JavaPluginConvention pluginConvention) { final Project project = pluginConvention.getProject(); final List<ClassDirectoryBinarySpecInternal> binaries = Lists.newArrayList(); pluginConvention.getSourceSets().all(new Action<SourceSet>() { public void execute(final SourceSet sourceSet) { ConventionMapping outputConventionMapping = ((IConventionAware) sourceSet.getOutput()).getConventionMapping(); ConfigurationContainer configurations = project.getConfigurations(); defineConfigurationsForSourceSet(sourceSet, configurations); definePathsForSourceSet(sourceSet, outputConventionMapping, project); createProcessResourcesTaskForBinary(sourceSet, sourceSet.getResources(), project); createCompileJavaTaskForBinary(sourceSet, sourceSet.getJava(), project); createBinaryLifecycleTask(sourceSet, project); DefaultComponentSpecIdentifier binaryId = new DefaultComponentSpecIdentifier(project.getPath(), sourceSet.getName()); ClassDirectoryBinarySpecInternal binary = instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, binaryId, sourceSet, javaToolChain, DefaultJavaPlatform.current(), instantiator, taskFactory); Classpath compileClasspath = new SourceSetCompileClasspath(sourceSet); DefaultJavaSourceSet javaSourceSet = instantiator.newInstance(DefaultJavaSourceSet.class, binaryId.child("java"), sourceSet.getJava(), compileClasspath); JvmResourceSet resourceSet = instantiator.newInstance(DefaultJvmResourceSet.class, binaryId.child("resources"), sourceSet.getResources()); binary.addSourceSet(javaSourceSet); binary.addSourceSet(resourceSet); attachTasksToBinary(binary, sourceSet, project); binaries.add(binary); } }); return new BridgedBinaries(binaries); }
Example 7
Source Project: putnami-gradle-plugin Source File: GwtDevTask.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void configureCodeServer(final Project project, final PutnamiExtension extention) { final DevOption options = extention.getDev(); options.init(project); ConventionMapping convention = ((IConventionAware) this).getConventionMapping(); convention.map("modules", new Callable<List<String>>() { @Override public List<String> call() { return extention.getModule(); } }); }
Example 8
Source Project: putnami-gradle-plugin Source File: GwtSetUpTask.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void configure(final PutnamiExtension extension) { ConventionMapping mapping = ((IConventionAware) this).getConventionMapping(); mapping.map("modules", new Callable<List<String>>() { @Override public List<String> call() { return extension.getModule(); } }); }
Example 9
Source Project: putnami-gradle-plugin Source File: GwtCompileTask.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void configure(final Project project, final PutnamiExtension extention) { final CompilerOption options = extention.getCompile(); options.init(project); options.setLocalWorkers(evalWorkers(options)); final ConfigurableFileCollection sources = project.files(); addSourceSet(sources, project, SourceSet.MAIN_SOURCE_SET_NAME); final Configuration compileClasspath = project.getConfigurations().getByName( JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); compileClasspath.getDependencies().withType(ProjectDependency.class, new Action<ProjectDependency>() { @Override public void execute(ProjectDependency dep) { addSourceSet(sources, dep.getDependencyProject(), SourceSet.MAIN_SOURCE_SET_NAME); } }); ConventionMapping mapping = ((IConventionAware) this).getConventionMapping(); mapping.map("modules", new Callable<List<String>>() { @Override public List<String> call() { return extention.getModule(); } }); mapping.map("war", new Callable<File>() { @Override public File call() { return options.getWar(); } }); mapping.map("src", new Callable<FileCollection>() { @Override public FileCollection call() { return sources; } }); }
Example 10
Source Project: putnami-gradle-plugin Source File: GwtCheckTask.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void configure(final Project project, final PutnamiExtension extention) { final CompilerOption options = extention.getCompile(); options.init(getProject()); JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class); SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); final FileCollection sources = getProject() .files(project.files(mainSourceSet.getOutput().getResourcesDir())) .plus(project.files(mainSourceSet.getOutput().getClassesDirs())) .plus(getProject().files(mainSourceSet.getAllSource().getSrcDirs())); ConventionMapping mapping = ((IConventionAware) this).getConventionMapping(); mapping.map("modules", new Callable<List<String>>() { @Override public List<String> call() { return extention.getModule(); } }); mapping.map("war", new Callable<File>() { @Override public File call() { return new File(getProject().getBuildDir(), "out"); } }); mapping.map("src", new Callable<FileCollection>() { @Override public FileCollection call() { return sources; } }); }
Example 11
Source Project: gradle-cpd-plugin Source File: CpdPlugin.java License: Apache License 2.0 | 5 votes |
/** Set up task defaults for every created {@link Cpd} task. */ private void setupTaskDefaults(Project project, CpdExtension extension) { project.getTasks().withType(Cpd.class).configureEach(task -> { ConventionMapping taskMapping = task.getConventionMapping(); taskMapping.map("encoding", extension::getEncoding); taskMapping.map("ignoreAnnotations", extension::isIgnoreAnnotations); taskMapping.map("ignoreIdentifiers", extension::isIgnoreIdentifiers); taskMapping.map("ignoreFailures", extension::isIgnoreFailures); taskMapping.map("ignoreLiterals", extension::isIgnoreLiterals); taskMapping.map("language", extension::getLanguage); taskMapping.map("minimumTokenCount", extension::getMinimumTokenCount); taskMapping.map("pmdClasspath", () -> project.getConfigurations().findByName("cpd")); taskMapping.map("skipDuplicateFiles", extension::isSkipDuplicateFiles); taskMapping.map("skipLexicalErrors", extension::isSkipLexicalErrors); taskMapping.map("skipBlocks", extension::isSkipBlocks); taskMapping.map("skipBlocksPattern", extension::getSkipBlocksPattern); ConventionMapping extensionMapping = ((IConventionAware) extension).getConventionMapping(); extensionMapping.map("reportsDir", () -> project.getExtensions().getByType(ReportingExtension.class).file("cpd")); task.getReports().all(report -> { ConventionMapping reportMapping = ((IConventionAware) report).getConventionMapping(); reportMapping.map("enabled", () -> "xml".equals(report.getName())); reportMapping.map("destination", () -> new File(extension.getReportsDir(), task.getName() + "." + report.getName())); }); }); }
Example 12
Source Project: JGiven Source File: JGivenPlugin.java License: Apache License 2.0 | 5 votes |
private void configureDefaultReportTask( final Test test, JGivenReportTask reportTask, final ReportingExtension reportingExtension ){ ConventionMapping mapping = ( (IConventionAware) reportTask ).getConventionMapping(); mapping.map( "results", (Callable<File>) () -> test.getExtensions().getByType( JGivenTaskExtension.class ).getResultsDir() ); mapping.getConventionValue( reportTask.getReports(), "reports", false ) .all( (Action<Report>) report -> { ConventionMapping reportMapping = ( (IConventionAware) report ).getConventionMapping(); reportMapping.map( "destination", (Callable<File>) () -> reportingExtension.file( "jgiven" + "/" + test.getName() + "/" + report.getName() ) ); } ); }
Example 13
Source Project: JGiven Source File: JGivenPlugin.java License: Apache License 2.0 | 4 votes |
private void configureJGivenReportDefaults( Project project ){ project.getTasks().withType( JGivenReportTask.class, reportTask -> reportTask.getReports().all( (Action<Report>) report -> { ConventionMapping mapping = ( (IConventionAware) report ).getConventionMapping(); mapping.map( "enabled", (Callable<Boolean>) () -> report.getName().equals( JGivenHtmlReportImpl.NAME ) ); } ) ); }
Example 14
Source Project: pushfish-android Source File: ConventionValue.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns some object. * * @param convention The convention object belonging to the task's project * @param conventionAwareObject The convention aware object */ Object getValue(Convention convention, IConventionAware conventionAwareObject);
Example 15
Source Project: pushfish-android Source File: ConventionValue.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns some object. * * @param convention The convention object belonging to the task's project * @param conventionAwareObject The convention aware object */ Object getValue(Convention convention, IConventionAware conventionAwareObject);
Example 16
Source Project: Pushjet-Android Source File: ConventionValue.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns some object. * * @param convention The convention object belonging to the task's project * @param conventionAwareObject The convention aware object */ Object getValue(Convention convention, IConventionAware conventionAwareObject);
Example 17
Source Project: Pushjet-Android Source File: ConventionValue.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns some object. * * @param convention The convention object belonging to the task's project * @param conventionAwareObject The convention aware object */ Object getValue(Convention convention, IConventionAware conventionAwareObject);