Skip to content

Commit

Permalink
Minor fixes to the publishing and catalog plugins (#189)
Browse files Browse the repository at this point in the history
* Publish all modules in the root build directory

Previously, the task which allowed creating a local Maven repository
in the build directory used each subproject directory. Now it will
use the root project build directory, making it easier to publish
all at once in a single test repository.

* Fix missing dependencyUpdates task

Some CI jobs are calling `dependencyUpdates` which should be a
no-op with the new version catalog update mechanism.
  • Loading branch information
melix authored Sep 7, 2021
1 parent 44e91fe commit bc158e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MicronautPublishingPlugin implements Plugin<Project> {
repositories {
maven {
name = "Build"
url = "${layout.buildDirectory.dir("repo").get().asFile.toURI()}"
url = "${rootProject.layout.buildDirectory.dir("repo").get().asFile.toURI()}"
}
}
publications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.Copy;
import org.gradle.api.tasks.TaskContainer;
import org.gradle.api.tasks.TaskProvider;

import java.util.Arrays;
Expand All @@ -17,17 +18,19 @@ public void apply(Project project) {
if (project != project.getRootProject()) {
throw new IllegalStateException("The " + MicronautVersionCatalogUpdatePlugin.class.getName() + " plugin must be applied on the root project only");
}
TaskProvider<VersionCatalogUpdate> updater = project.getTasks().register("updateVersionCatalogs", VersionCatalogUpdate.class, task -> {
TaskContainer tasks = project.getTasks();
TaskProvider<VersionCatalogUpdate> updater = tasks.register("updateVersionCatalogs", VersionCatalogUpdate.class, task -> {
task.getCatalogsDirectory().convention(project.getLayout().getProjectDirectory().dir("gradle"));
task.getOutputDirectory().convention(project.getLayout().getProjectDirectory().dir("gradle/updates"));
task.getRejectedQualifiers().convention(Arrays.asList("alpha", "beta", "rc", "cr", "m", "preview", "b", "ea"));
task.getIgnoredModules().convention(Collections.emptySet());
task.getAllowMajorUpdates().convention(false);
});
project.getTasks().register("useLatestVersions", Copy.class, task -> {
tasks.register("useLatestVersions", Copy.class, task -> {
VersionCatalogUpdate dependent = updater.get();
task.from(dependent.getOutputDirectory());
task.into(dependent.getCatalogsDirectory());
});
tasks.register("dependencyUpdates", task -> task.setDescription("Compatibility task with the old update mechanism"));
}
}

0 comments on commit bc158e8

Please sign in to comment.