org.gradle.api.plugins.ApplicationPlugin Java Examples

The following examples show how to use org.gradle.api.plugins.ApplicationPlugin. 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: MergeClassesTask.java    From gradle-modules-plugin with MIT License 6 votes vote down vote up
public void configureMergeClassesAfterEvaluate() {
    if (!mergeClassesHelper().isMergeRequired()) {
        return;
    }

    var mergeClasses = mergeClassesHelper().createMergeClassesTask();

    mergeClassesHelper().allCompileTaskStream().forEach(task -> {
        mergeClasses.from(task.getDestinationDir());
        mergeClasses.dependsOn(task);
    });
    mergeClasses.into(helper().getMergedDir());

    Stream.of(ApplicationPlugin.TASK_RUN_NAME, JavaPlugin.TEST_TASK_NAME)
            .map(helper()::findTask)
            .flatMap(Optional::stream)
            .forEach(task -> task.dependsOn(mergeClasses));
}
 
Example #2
Source File: JigsawPlugin.java    From gradle-java-modules with Apache License 2.0 6 votes vote down vote up
private void configureRunTask(final Project project) {
    final JavaExec run = (JavaExec) project.getTasks().findByName(ApplicationPlugin.TASK_RUN_NAME);
    final JavaModule module = (JavaModule) project.getExtensions().getByName(EXTENSION_NAME);
    run.getInputs().property("moduleName", module.geName());
    run.doFirst(new Action<Task>() {
        @Override
        public void execute(Task task) {
            List<String> args = new ArrayList<>();
            args.add("--module-path");
            args.add(run.getClasspath().getAsPath());
            args.add("--module");
            args.add(module.geName() + "/" + run.getMain());
            run.setJvmArgs(args);
            run.setClasspath(project.files());
        }
    });
}
 
Example #3
Source File: RunTask.java    From gradle-modules-plugin with MIT License 5 votes vote down vote up
private void doConfigureRun() {
    if(helper().shouldFixEffectiveArguments()) {
        project.getTasks().replace(ApplicationPlugin.TASK_RUN_NAME, ModularJavaExec.class);
    }
    var mutator = new RunTaskMutator(getRunTask(), project);
    mutator.configureRun();
    project.afterEvaluate(p -> configureStartScripts());
}
 
Example #4
Source File: ModularJavaExec.java    From gradle-modules-plugin with MIT License 5 votes vote down vote up
private static void configureAfterEvaluate(Project project) {
    project.getTasks().withType(ModularJavaExec.class).forEach(execTask -> {
        if(!execTask.getName().equals(ApplicationPlugin.TASK_RUN_NAME)) {
            configure(execTask, project);
        }
    });
}
 
Example #5
Source File: ExecTask.java    From javafx-gradle-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Inject
public ExecTask(Project project) {
    this.project = project;
    project.getPluginManager().withPlugin(ApplicationPlugin.APPLICATION_PLUGIN_NAME, e -> {
        execTask = (JavaExec) project.getTasks().findByName(ApplicationPlugin.TASK_RUN_NAME);
        if (execTask != null) {
            execTask.dependsOn(this);
        } else {
            throw new GradleException("Run task not found.");
        }
    });
}
 
Example #6
Source File: BootPlugin.java    From purplejs with Apache License 2.0 5 votes vote down vote up
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 );
}
 
Example #7
Source File: RunTask.java    From gradle-modules-plugin with MIT License 4 votes vote down vote up
public void configureRun() {
    project.getPluginManager().withPlugin(ApplicationPlugin.APPLICATION_PLUGIN_NAME, plugin -> doConfigureRun());
}
 
Example #8
Source File: RunTask.java    From gradle-modules-plugin with MIT License 4 votes vote down vote up
private void configureStartScripts() {
    var mutator = new StartScriptsMutator(getRunTask(), project);
    mutator.updateStartScriptsTask(ApplicationPlugin.TASK_START_SCRIPTS_NAME);
    mutator.movePatchedLibs();
}
 
Example #9
Source File: RunTask.java    From gradle-modules-plugin with MIT License 4 votes vote down vote up
private JavaExec getRunTask() {
    return helper().task(ApplicationPlugin.TASK_RUN_NAME, JavaExec.class);
}
 
Example #10
Source File: BootPlugin.java    From purplejs with Apache License 2.0 4 votes vote down vote up
private void addPlugins()
{
    this.project.getPlugins().apply( JavaPlugin.class );
    this.project.getPlugins().apply( ApplicationPlugin.class );
}