org.gradle.api.plugins.ApplicationPluginConvention Java Examples
The following examples show how to use
org.gradle.api.plugins.ApplicationPluginConvention.
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: ModularCreateStartScripts.java From gradle-modules-plugin with MIT License | 6 votes |
private static void configure(ModularCreateStartScripts startScriptsTask, Project project) { var appConvention = project.getConvention().findPlugin(ApplicationPluginConvention.class); if (appConvention != null) { var distDir = project.file(project.getBuildDir() + "/install/" + appConvention.getApplicationName()); startScriptsTask.setOutputDir(new File(distDir, appConvention.getExecutableDir())); } ModularJavaExec runTask = startScriptsTask.getRunTask(); if (runTask == null) throw new GradleException("runTask not set for task " + startScriptsTask.getName()); var runJvmArgs = runTask.getOwnJvmArgs(); if (!runJvmArgs.isEmpty()) { var defaultJvmOpts = new ArrayList<>(runJvmArgs); startScriptsTask.getDefaultJvmOpts().forEach(defaultJvmOpts::add); startScriptsTask.setDefaultJvmOpts(defaultJvmOpts); } var mutator = new StartScriptsMutator(runTask, project); mutator.updateStartScriptsTask(startScriptsTask); mutator.movePatchedLibs(); }
Example #2
Source File: PackageTask.java From thorntail with Apache License 2.0 | 6 votes |
@Input @Optional private String getMainClassName() { Project project = getProject(); ThorntailExtension thorntailExtension = getThorntailExtension(); String mainClassName = thorntailExtension.getMainClassName(); if (mainClassName == null && project.getConvention().getPlugins().containsKey("application")) { ApplicationPluginConvention app = (ApplicationPluginConvention) project.getConvention().getPlugins().get("application"); mainClassName = app.getMainClassName(); } if (mainClassName != null && !mainClassName.equals("")) { getLogger().warn( "\n------\n" + "Custom main() usage is deprecated and is no longer supported.\n" + "Please refer to https://docs.thorntail.io for YAML configuration that replaces it." + "\n------" ); } return mainClassName; }
Example #3
Source File: NativeImageTask.java From curiostack with MIT License | 5 votes |
@TaskAction public void exec() { var appPluginConvention = getProject().getConvention().getPlugin(ApplicationPluginConvention.class); String classpathArg = Streams.concat(classpath.getFiles().stream(), Stream.of(jarFile.getAsFile().get())) .map(File::getAbsolutePath) .collect(Collectors.joining(":")); getProject() .exec( exec -> { exec.executable( DownloadedToolManager.get(getProject()) .getBinDir("graalvm") .resolve("native-image")); var args = new ImmutableList.Builder<String>(); args.add( "-cp", classpathArg, "-H:Path=" + outputDir.getAsFile().get().getAbsolutePath(), "-H:name=" + outputName.get()) .addAll(options.get()) .add(appPluginConvention.getMainClassName()); exec.args(args); }); }
Example #4
Source File: BootPlugin.java From purplejs with Apache License 2.0 | 5 votes |
private void configureAppPlugin() { final ApplicationPluginConvention convention = this.project.getConvention().findPlugin( ApplicationPluginConvention.class ); convention.setMainClassName( "io.purplejs.boot.MainApp" ); final JavaExec runTask = (JavaExec) this.project.getTasks().getByName( ApplicationPlugin.TASK_RUN_NAME ); runTask.systemProperty( "io.purplejs.runMode", "dev" ); final String devDirs = new File( this.project.getProjectDir(), "src/main/resources" ).getAbsolutePath(); runTask.systemProperty( "io.purplejs.devSourceDirs", devDirs ); }