@SuppressWarnings("NullableProblems") @Override public void execute(Project project) { Objects.requireNonNull(project.getExtensions().findByType(DependencyManagementExtension.class)) .imports((importsHandler) -> importsHandler .mavenBom(SofaBootPlugin.BOM_COORDINATES)); } }
@Override public void apply(Project project) { WMRouterExtension extension = project.getExtensions() .create(Const.NAME, WMRouterExtension.class); WMRouterLogger.info("register transform"); project.getExtensions().findByType(BaseExtension.class) .registerTransform(new WMRouterTransform()); project.afterEvaluate(p -> WMRouterLogger.setConfig(extension)); } }
public static <T> T maybeCreate(PythonExtension extension, String name, Class<T> type, Object... args) { ExtensionContainer extensionContainer = ((ExtensionAware) extension).getExtensions(); T maybeExtension = extensionContainer.findByType(type); if (maybeExtension == null) { maybeExtension = extensionContainer.create(name, type, args); } return maybeExtension; }
public static <T> T maybeCreate(PythonExtension extension, String name, Class<T> type, Object... args) { ExtensionContainer extensionContainer = ((ExtensionAware) extension).getExtensions(); T maybeExtension = extensionContainer.findByType(type); if (maybeExtension == null) { maybeExtension = extensionContainer.create(name, type, args); } return maybeExtension; }
private void addDefaultReports( final Project project ) { final ReportingExtension reportingExtension = project.getExtensions().findByType( ReportingExtension.class ); project.getTasks().withType( Test.class, new Action<Test>() { @Override public void execute( final Test test ) { final JGivenReportTask reportTask = project.getTasks() .create( "jgiven" + WordUtil.capitalize( test.getName() ) + "Report", JGivenReportTask.class ); configureDefaultReportTask( test, reportTask, reportingExtension ); } } ); }
public static <T> T findPythonComponentExtension(PythonExtension extension, Class<T> type) { ExtensionContainer extensionContainer = ((ExtensionAware) extension).getExtensions(); return extensionContainer.findByType(type); }
/** * Sets up the environments. * * @throws EnvironmentConfigException If an error during environment setup occurs. */ void setupEnvironments() throws EnvironmentConfigException { // Retrieve the deployer configuration DeployerExtension deployerExtension = getProject().getExtensions().findByType(DeployerExtension.class); // Build environments environments = EnvironmentFactory.create(deployerExtension); } }
LightningTask() { extension = getProject().getExtensions().findByType(LightningExtension.class); if (extension == null) { extension = new LightningExtension(); } }
LightningTask() { extension = getProject().getExtensions().findByType(LightningExtension.class); if (extension == null) { extension = new LightningExtension(); } }
@TaskAction public void greet() { DemoPluginExtension extension = getProject().getExtensions().findByType(DemoPluginExtension.class); if (extension == null) { extension = new DemoPluginExtension(); } String message = extension.getMessage(); // HelloWorld helloWorld = new HelloWorld(message); // System.out.println(helloWorld.greet()); System.out.println("sup!!!!!!!!!!!!!!!!!!!!!!!!"); } }
@TaskAction public void generate() throws Exception { Project project = getProject(); ExtensionContainer extensions = project.getExtensions(); Extension ext = extensions.findByType(Extension.class); SDKBuilder builder = new SDKBuilder(); builder.build( ext.platforms, ext.url, ext.contexts, ext.packageName, ext.filter, ext.portalVersion, ext.destination); }
@TaskAction public void createForgeChangelog() throws IOException { ForgeChangelogPluginExtension extension = getProject().getExtensions().findByType(ForgeChangelogPluginExtension.class); if (extension == null) extension = new ForgeChangelogPluginExtension(); if (!extension.getDestination().exists()) extension.getDestination().createNewFile(); GsonBuilder builder = new GsonBuilder(); if (extension.isPrettyPrinting()) builder.setPrettyPrinting(); builder.registerTypeHierarchyAdapter(ForgeChangelogPluginExtension.class, new ForgeChangelogPluginExtensionSerializer(getProject())); Gson gson = builder.create(); Files.write(extension.getDestination().toPath(), gson.toJson(extension).getBytes(Charset.forName("UTF-8"))); System.out.println("Generated changelog at " + extension.getDestination().getAbsolutePath()); }
public LiteModJson getJson() throws IOException { if (this.json == null) { Project project = this.getProject(); String version = project.getExtensions().findByType(LiteloaderExtension.class).getVersion(); String revision = this.getBuildNumber(); this.json = new LiteModJson(project, version, revision); } return this.json; }
private DatabaseProfile findSelectedProfileInParents(Project project) { if ( project == null ) { return null; } final DatabaseProfile profileToUseFromParent = findSelectedProfileInParents( project.getParent() ); final DatabaseProfilesExtension parentExtension = project.getExtensions().findByType( DatabaseProfilesExtension.class ); if ( parentExtension == null ) { return null; } parentExtension.resolve(); return parentExtension.getSelectedProfile(); }
public void discover(Project project) { PluginBundleExtension extension = project.getExtensions().findByType(PluginBundleExtension.class); Set<File> pluginPropertyFiles = PluginUtil.discoverGradlePluginPropertyFiles(project); LOG.lifecycle(" Adding {} discovered Gradle plugins to 'pluginBundle'", pluginPropertyFiles.size()); for (File pluginPropertyFile : pluginPropertyFiles) { PluginConfig config = new PluginConfig(generatePluginName(pluginPropertyFile.getName())); config.setId(pluginPropertyFile.getName().substring(0, pluginPropertyFile.getName().lastIndexOf(DOT_PROPERTIES))); config.setDisplayName(PluginUtil.getImplementationClass(pluginPropertyFile)); LOG.info("Discovered plugin " + config); extension.getPlugins().add(config); } }
@TaskAction public final void doAction() { JBBPExtension ext = getProject().getExtensions().findByType(JBBPExtension.class); if (ext == null) { ext = new JBBPExtension(getProject()); } ext.prepare(getProject()); doTaskAction(ext); }
@Test void apply() { this.project.getPlugins().apply(BomPlugin.class); assertThat(this.project.getPlugins()).anyMatch(DependencyManagementPlugin.class::isInstance); DependencyManagementExtension dependencyManagement = this.project.getExtensions().findByType(DependencyManagementExtension.class); assertThat(dependencyManagement).isNotNull(); } }
@Before public void setupProject() { this.testProject = ProjectBuilder.builder().build(); assertNotNull(this.testProject); this.testProject.apply(ImmutableMap.of("plugin", ForgePlugin.class)); this.ext = this.testProject.getExtensions().findByType(ForgeExtension.class); // unlike getByType(), does not throw exception assertNotNull(this.ext); this.ext.setSuppressVersionTest(true); }
@Before public void setupProject() { this.testProject = ProjectBuilder.builder().build(); assertNotNull(this.testProject); this.testProject.apply(ImmutableMap.of("plugin", LiteloaderPlugin.class)); this.ext = this.testProject.getExtensions().findByType(LiteloaderExtension.class); // unlike getByType(), does not throw exception assertNotNull(this.ext); this.ext.setSuppressVersionTest(true); }
@Before public void setupProject() { this.testProject = ProjectBuilder.builder().build(); assertNotNull(this.testProject); this.testProject.apply(ImmutableMap.of("plugin", ClientTweaker.class)); this.ext = this.testProject.getExtensions().findByType(TweakerExtension.class); // unlike getByType(), does not throw exception assertNotNull(this.ext); this.ext.setSuppressVersionTest(true); this.ext.setTweakClass("some.thing.other"); // to ignore any issues regarding this. } private static final String VERSION_17 = "1.7.10";