private static ConventionMapping conventionMapping(Object conventionAware) { // TODO: try other alternatives to convention mapping // Convention mapping is an internal API. // Other options here: // http://forums.gradle.org/gradle/topics/how_can_i_do_convention_mappings_from_java_without_depending_on_an_internal_api return ((IConventionAware) conventionAware).getConventionMapping(); }
private static ConventionMapping conventionMapping(Object conventionAware) { // TODO: try other alternatives to convention mapping // Convention mapping is an internal API. // Other options here: // http://forums.gradle.org/gradle/topics/how_can_i_do_convention_mappings_from_java_without_depending_on_an_internal_api return ((IConventionAware) conventionAware).getConventionMapping(); } }
protected static ConventionMapping conventionMappingOf(Object object) { return ((IConventionAware) object).getConventionMapping(); }
protected void configure(final GwtCompileOptions options) { ((IConventionAware)this).getConventionMapping().map("localWorkers", new Callable<Integer>() { @Override public Integer call() throws Exception { return options.getLocalWorkers(); } }); }
public ConventionMapping getConventionMapping() { if (conventionMapping == null) { this.conventionMapping = toType(object, IConventionAware.class).getConventionMapping(); } return conventionMapping; }
@Override public void execute( final Report report ) { ConventionMapping reportMapping = ( (IConventionAware) report ).getConventionMapping(); reportMapping.map( "destination", new Callable<File>() { @Override public File call() { return reportingExtension.file( "jgiven" + "/" + test.getName() + "/" + report.getName() ); } } ); } } );
public void configure(final GwtExtension extension) { ConventionMapping mapping = ((IConventionAware) this).getConventionMapping(); mapping.map("modules", new Callable<List<String>>() { @Override public List<String> call() { return extension.getModule(); } }); }
/** * Propagate 'defaultResourcesDirectory' */ private void configureDefaultResourcesDirectory(final Project project, final IConventionAware conventionAwareRebelTask) { conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_RESOURCES_DIRECTORY, new Callable<File>() { public File call() { try { return getMainOutput(project).getResourcesDir(); } catch (Exception e) { return null; } } }); }
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(); } }); }
/** * Propagate 'defaultResourcesDirectory' */ private void configureDefaultResourcesDirectory(final Project project, final IConventionAware conventionAwareRebelTask) { conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_RESOURCES_DIRECTORY, new Callable<File>() { public File call() { try { return getMainOutput(project).getResourcesDir(); } catch (Exception e) { return null; } } }); }
/** * Propagate 'defaultClassesDirectory' */ private void configureDefaultClassesDirectory(final Project project, final IConventionAware conventionAwareRebelTask) { conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_CLASSES_DIRECTORIES, new Callable<List<File>>() { public List<File> call() { try { return getClassesDirs(getMainOutput(project)); } catch (Exception e) { return null; } } }); }
/** * Propagate 'defaultClassesDirectory' */ private void configureDefaultClassesDirectory(final Project project, final IConventionAware conventionAwareRebelTask) { conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_CLASSES_DIRECTORIES, new Callable<List<File>>() { public List<File> call() { try { return getClassesDirs(getMainOutput(project)); } catch (Exception e) { return null; } } }); }
/** * Handle the 'rebelXmlDirectory' configuration option */ private void configureRebelXmlDirectory(final Project project, final IConventionAware conventionAwareRebelTask, final RebelDslMain rebelExtension) { conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_REBEL_XML_DIRECTORY, new Callable<Object>() { public Object call() throws Exception { if (project.hasProperty("rebel.rebelXmlDirectory")) { return new File(project.property("rebel.rebelXmlDirectory").toString()); } else if (rebelExtension.getRebelXmlDirectory() != null) { return new File(rebelExtension.getRebelXmlDirectory()); } else { return getMainOutput(project).getResourcesDir(); } } }); }
public void execute(Plugin p) { generateRebelTask.setPackaging(RebelGenerateTask.PACKAGING_TYPE_WAR); // Propagate 'defaultWebappDirectory' conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_WEBAPP_DIRECTORY, new Callable<Object>() { public Object call() throws Exception { try { WarPluginConvention warConvention = project.getConvention().getPlugin(WarPluginConvention.class); return warConvention.getWebAppDir(); } catch (Exception e) { return null; } } }); } });
public void execute(Plugin p) { generateRebelTask.setPackaging(RebelGenerateTask.PACKAGING_TYPE_WAR); // Propagate 'defaultWebappDirectory' conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_WEBAPP_DIRECTORY, new Callable<Object>() { public Object call() throws Exception { try { WarPluginConvention warConvention = project.getConvention().getPlugin(WarPluginConvention.class); return warConvention.getWebAppDir(); } catch (Exception e) { return null; } } }); } });
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(); } }); }
public void configureCodeServer(final Project project, final GwtExtension 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(); } }); }
@Override public void execute(final GwtSuperDev task) { task.configure(extension.getSuperDev()); ConventionMapping conventionMapping = ((IConventionAware)task).getConventionMapping(); conventionMapping.map("workDir", new Callable<File>() { @Override public File call() throws Exception { return extension.getWorkDir(); }}); } });
private void configureGdtExtension(final GwtPluginExtension extension, final GdtOptions gdtExtension) { final WarPluginConvention warPluginConvention = (WarPluginConvention) project.getConvention().getPlugins().get("war"); ConventionMapping conventionMapping = ((IConventionAware)gdtExtension).getConventionMapping(); conventionMapping.map("warSrcDir", new Callable<File>() { @Override public File call() throws Exception { return warPluginConvention.getWebAppDir(); } }); conventionMapping.map("lastWarOutDir", new Callable<File>() { @Override public File call() throws Exception { return extension.getDevWar(); } }); gdtExtension.setWarSrcDirIsOutput(false); }
private GwtPluginExtension configureGwtExtension(final File buildDir) { final GwtPluginExtension extension = project.getExtensions().create(EXTENSION_NAME, GwtPluginExtension.class); extension.setDevWar(project.file(DEV_WAR)); extension.setExtraDir(new File(buildDir, EXTRA_DIR)); extension.setWorkDir(new File(buildDir, WORK_DIR)); extension.setGenDir(new File(buildDir, GEN_DIR)); extension.setCacheDir(new File(buildDir, CACHE_DIR)); extension.getDev().setLogDir(new File(buildDir, LOG_DIR)); extension.getCompiler().setLocalWorkers(Runtime.getRuntime().availableProcessors()); extension.setLogLevel(getLogLevel()); extension.getSuperDev().setUseClasspathForSrc(true); ConventionMapping conventionMapping = ((IConventionAware)extension).getConventionMapping(); conventionMapping.map("src", new Callable<FileCollection>(){ @Override public FileCollection call() throws Exception { final SourceSet mainSourceSet = getMainSourceSet(); return project.files(mainSourceSet.getAllJava().getSrcDirs()).plus(project.files(mainSourceSet.getOutput().getResourcesDir())); }}); return extension; }