diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/FrontendGradlePlugin.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/FrontendGradlePlugin.java index 84fa7048..7fd268dc 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/FrontendGradlePlugin.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/FrontendGradlePlugin.java @@ -305,7 +305,7 @@ protected void configureTasks(final Project project, final String beanRegistryId */ protected void configureInstallNodeTask(final InstallNodeTask task, final String beanRegistryId, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Downloads and installs a Node.js distribution."); @@ -319,7 +319,7 @@ protected void configureInstallNodeTask(final InstallNodeTask task, final String .set(extension .getNodeInstallDirectory() .map(Directory::getAsFile) - .orElse(taskContext.getDefaultNodeInstallDirectoryPath().toFile())); + .orElse(taskContext.defaultNodeInstallDirectoryPath().toFile())); task.getHttpProxyHost().set(extension.getHttpProxyHost()); task.getHttpProxyPort().set(extension.getHttpProxyPort()); task.getHttpProxyUsername().set(extension.getHttpProxyUsername()); @@ -333,7 +333,7 @@ protected void configureInstallNodeTask(final InstallNodeTask task, final String .fileProvider(extension .getNodeInstallDirectory() .map(directory -> directory.getAsFile().toPath()) - .orElse(taskContext.getDefaultNodeInstallDirectoryPath()) + .orElse(taskContext.defaultNodeInstallDirectoryPath()) .map(nodeInstallDirectoryPath -> getBeanOrFail(beanRegistryId, ResolveGlobalNodeExecutablePath.class) .execute(ResolveGlobalExecutablePathCommand .builder() @@ -354,7 +354,7 @@ protected void configureInstallNodeTask(final InstallNodeTask task, final String */ protected void configureResolvePackageManagerTask(final ResolvePackageManagerTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Resolves the package manager."); @@ -383,7 +383,7 @@ protected void configureResolvePackageManagerTask(final ResolvePackageManagerTas */ protected void configureInstallPackageManagerTask(final InstallPackageManagerTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Installs the package manager."); @@ -431,7 +431,7 @@ protected void configureInstallPackageManagerTask(final InstallPackageManagerTas */ protected void configureInstallFrontendTask(final InstallFrontendTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Installs frontend dependencies."); @@ -458,7 +458,7 @@ protected void configureInstallFrontendTask(final InstallFrontendTask task, fina */ protected void configureCleanTask(final CleanTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Cleans frontend resources outside the build directory by running a specific script."); @@ -480,7 +480,7 @@ protected void configureCleanTask(final CleanTask task, final String beanRegistr */ protected void configureCheckTask(final CheckTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Checks frontend by running a specific script."); @@ -502,7 +502,7 @@ protected void configureCheckTask(final CheckTask task, final String beanRegistr */ protected void configureAssembleTask(final AssembleTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Assembles frontend artifacts by running a specific script."); @@ -524,7 +524,7 @@ protected void configureAssembleTask(final AssembleTask task, final String beanR */ protected void configurePublishTask(final PublishTask task, final String beanRegistryId, final TaskContainer taskContainer, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); task.setGroup(TASK_GROUP); task.setDescription("Publishes frontend artifacts by running a specific script."); @@ -546,7 +546,7 @@ private Provider getExecutableType(final TaskContainer taskConta return getBeanOrFail(beanRegistryId, ParsePackageManagerSpecification.class) .execute(getBeanOrFail(beanRegistryId, FileManager.class).readString(f.toPath(), StandardCharsets.UTF_8)) - .getType() + .type() .getExecutableType(); } catch (final IOException | MalformedPackageManagerSpecification | UnsupportedPackageManagerException e) { @@ -586,7 +586,7 @@ private void configureDependency(final TaskCont } private Provider resolveNodeInstallDirectory(final String beanRegistryId, final TaskContext taskContext) { - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); final ResolveNodeInstallDirectoryPath resolveNodeInstallDirectoryPath; try { resolveNodeInstallDirectoryPath = Beans.getBean(beanRegistryId, ResolveNodeInstallDirectoryPath.class); @@ -600,8 +600,8 @@ private Provider resolveNodeInstallDirectory(final String beanRegistryId, .builder() .nodeInstallDirectoryFromUser(extension.getNodeInstallDirectory().getAsFile().map(File::toPath)) .nodeDistributionProvided(extension.getNodeDistributionProvided()) - .nodeInstallDirectoryFromEnvironment(taskContext.getNodeInstallDirectoryFromEnvironment()) - .defaultPath(taskContext.getDefaultNodeInstallDirectoryPath()) + .nodeInstallDirectoryFromEnvironment(taskContext.nodeInstallDirectoryFromEnvironment()) + .defaultPath(taskContext.defaultNodeInstallDirectoryPath()) .build()) .map(Path::toFile); } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/GetExecutablePath.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/GetExecutablePath.java index fded82bf..cd598098 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/GetExecutablePath.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/GetExecutablePath.java @@ -35,20 +35,12 @@ public Path execute(final GetExecutablePathCommand command) { .platform(command.getPlatform()) .nodeInstallDirectoryPath(command.getNodeInstallDirectoryPath()) .build(); - final ExecutableType executableType = command.getExecutableType(); - switch (executableType) { - case COREPACK: - return getCorepackExecutablePath.execute(resolveGlobalExecutablePathCommand); - case NODE: - return getNodeExecutablePath.execute(resolveGlobalExecutablePathCommand); - case NPM: - return getNpmExecutablePath.execute(resolveGlobalExecutablePathCommand); - case PNPM: - return getPnpmExecutablePath.execute(resolveGlobalExecutablePathCommand); - case YARN: - return getYarnExecutablePath.execute(resolveGlobalExecutablePathCommand); - default: - throw new IllegalArgumentException("Unsupported type of executable: " + executableType); - } + return switch (command.getExecutableType()) { + case COREPACK -> getCorepackExecutablePath.execute(resolveGlobalExecutablePathCommand); + case NODE -> getNodeExecutablePath.execute(resolveGlobalExecutablePathCommand); + case NPM -> getNpmExecutablePath.execute(resolveGlobalExecutablePathCommand); + case PNPM -> getPnpmExecutablePath.execute(resolveGlobalExecutablePathCommand); + case YARN -> getYarnExecutablePath.execute(resolveGlobalExecutablePathCommand); + }; } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/PackageManager.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/PackageManager.java index 1fd8c466..3a72b65a 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/PackageManager.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/PackageManager.java @@ -1,7 +1,6 @@ package org.siouan.frontendgradleplugin.domain; import lombok.Builder; -import lombok.Getter; /** * Model class providing the content of the @@ -11,10 +10,4 @@ * @since 7.0.0 */ @Builder -@Getter -public class PackageManager { - - private final PackageManagerType type; - - private final String version; -} +public record PackageManager(PackageManagerType type, String version) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerFromPackageJsonFile.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerFromPackageJsonFile.java index 2fa7a060..2395f658 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerFromPackageJsonFile.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerFromPackageJsonFile.java @@ -46,8 +46,7 @@ public PackageManager execute(final Path packageJsonFilePath) throw new InvalidJsonFileException(packageJsonFilePath); } final PackageManager packageManager = parsePackageManagerSpecification.execute(packageManagerSpecification); - logger.info("Package manager: {} v{}", packageManager.getType().getPackageManagerName(), - packageManager.getVersion()); + logger.info("Package manager: {} v{}", packageManager.type().getPackageManagerName(), packageManager.version()); return packageManager; } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolveExecutionSettings.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolveExecutionSettings.java index 83115b2f..2ce49db3 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolveExecutionSettings.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolveExecutionSettings.java @@ -64,9 +64,12 @@ public ExecutionSettings execute(final ResolveExecutionSettingsCommand command) .nodeInstallDirectoryPath(command.getNodeInstallDirectoryPath()) .platform(command.getPlatform()) .build()); - final Path executablePath = getExecutablePath.execute( - new GetExecutablePathCommand(command.getExecutableType(), command.getNodeInstallDirectoryPath(), - command.getPlatform())); + final Path executablePath = getExecutablePath.execute(GetExecutablePathCommand + .builder() + .executableType(command.getExecutableType()) + .nodeInstallDirectoryPath(command.getNodeInstallDirectoryPath()) + .platform(command.getPlatform()) + .build()); final Path executable; final List args = new ArrayList<>(); diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManager.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManager.java index be183e2c..b2704351 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManager.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManager.java @@ -33,16 +33,16 @@ public void execute(final ResolvePackageManagerCommand command) throws InvalidJsonFileException, UnsupportedPackageManagerException, IOException, MalformedPackageManagerSpecification { final PackageManager packageManager = parsePackageManagerFromPackageJsonFile.execute( - command.getPackageJsonFilePath()); - fileManager.writeString(command.getPackageManagerSpecificationFilePath(), - packageManager.getType().getPackageManagerName() + '@' + packageManager.getVersion(), - StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); - fileManager.writeString(command.getPackageManagerExecutablePathFilePath(), getExecutablePath + command.packageJsonFilePath()); + fileManager.writeString(command.packageManagerSpecificationFilePath(), + packageManager.type().getPackageManagerName() + '@' + packageManager.version(), StandardCharsets.UTF_8, + StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); + fileManager.writeString(command.packageManagerExecutablePathFilePath(), getExecutablePath .execute(GetExecutablePathCommand .builder() - .executableType(packageManager.getType().getExecutableType()) - .nodeInstallDirectoryPath(command.getNodeInstallDirectoryPath()) - .platform(command.getPlatform()) + .executableType(packageManager.type().getExecutableType()) + .nodeInstallDirectoryPath(command.nodeInstallDirectoryPath()) + .platform(command.platform()) .build()) .toString(), StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerCommand.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerCommand.java index 97aea85b..3a8a4fdf 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerCommand.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerCommand.java @@ -3,39 +3,17 @@ import java.nio.file.Path; import lombok.Builder; -import lombok.Getter; /** * Parameters to resolve the package manager in a project. * + * @param packageJsonFilePath Path to the metadata file (i.e. {@code package.json} file). + * @param nodeInstallDirectoryPath Path to a Node.js install directory. + * @param platform Underlying platform. + * @param packageManagerSpecificationFilePath Path to the file providing the name of the package manager. + * @param packageManagerExecutablePathFilePath Path to the file providing the path to the package manager executable. * @since 7.0.0 */ @Builder -@Getter -public class ResolvePackageManagerCommand { - - /** - * Path to the metadata file (i.e. {@code package.json} file). - */ - private final Path packageJsonFilePath; - - /** - * Path to a Node.js install directory. - */ - private final Path nodeInstallDirectoryPath; - - /** - * Underlying platform. - */ - private final Platform platform; - - /** - * Path to the file providing the name of the package manager. - */ - private final Path packageManagerSpecificationFilePath; - - /** - * Path to the file providing the path to the package manager executable. - */ - private final Path packageManagerExecutablePathFilePath; -} +public record ResolvePackageManagerCommand(Path packageJsonFilePath, Path nodeInstallDirectoryPath, Platform platform, + Path packageManagerSpecificationFilePath, Path packageManagerExecutablePathFilePath) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java index 532d61ed..1311209e 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java @@ -50,23 +50,22 @@ public void execute(final InstallNodeDistributionCommand command) throws IOException, InvalidNodeDistributionException, NodeDistributionShasumNotFoundException, UnsupportedPlatformException, InvalidDistributionUrlException, ResourceDownloadException, ArchiverException, UnsupportedDistributionArchiveException { - logger.info("Removing install directory '{}'", command.getInstallDirectoryPath()); - fileManager.deleteFileTree(command.getInstallDirectoryPath(), true); + logger.info("Removing install directory '{}'", command.installDirectoryPath()); + fileManager.deleteFileTree(command.installDirectoryPath(), true); - final GetDistributionCommand getDistributionCommand = new GetDistributionCommand(command.getPlatform(), - command.getVersion(), command.getDistributionUrlRoot(), command.getDistributionUrlPathPattern(), - command.getDistributionServerCredentials(), command.getProxySettings(), - command.getTemporaryDirectoryPath()); + final GetDistributionCommand getDistributionCommand = new GetDistributionCommand(command.platform(), + command.version(), command.distributionUrlRoot(), command.distributionUrlPathPattern(), + command.distributionServerCredentials(), command.proxySettings(), command.temporaryDirectoryPath()); final Path distributionFilePath = getDistribution.execute(getDistributionCommand); // Deploys the distribution - deployDistribution.execute(new DeployDistributionCommand(command.getPlatform(), - command.getTemporaryDirectoryPath().resolve(EXTRACT_DIRECTORY_NAME), command.getInstallDirectoryPath(), + deployDistribution.execute(new DeployDistributionCommand(command.platform(), + command.temporaryDirectoryPath().resolve(EXTRACT_DIRECTORY_NAME), command.installDirectoryPath(), distributionFilePath)); logger.info("Removing distribution file '{}'", distributionFilePath); fileManager.delete(distributionFilePath); - logger.info("Distribution installed in '{}'", command.getInstallDirectoryPath()); + logger.info("Distribution installed in '{}'", command.installDirectoryPath()); } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionCommand.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionCommand.java index d972ecff..8cab6144 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionCommand.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionCommand.java @@ -3,55 +3,22 @@ import java.nio.file.Path; import lombok.Builder; -import lombok.Getter; import org.siouan.frontendgradleplugin.domain.Platform; /** * Settings to install a distribution. * + * @param platform Underlying platform. + * @param version Version of the distribution. + * @param distributionUrlRoot URL root part to build the exact URL to download the distribution. + * @param distributionUrlPathPattern Trailing path pattern to build the exact URL to download the distribution. + * @param distributionServerCredentials Credentials to authenticate on the distribution server before download. + * @param proxySettings Proxy settings used for downloads. + * @param temporaryDirectoryPath Path to a temporary directory. + * @param installDirectoryPath Path to a directory where the distribution shall be installed. * @since 1.1.2 */ @Builder -@Getter -public class InstallNodeDistributionCommand { - - /** - * Underlying platform. - */ - private final Platform platform; - - /** - * Version of the distribution. - */ - private final String version; - - /** - * URL root part to build the exact URL to download the distribution. - */ - private final String distributionUrlRoot; - - /** - * Trailing path pattern to build the exact URL to download the distribution. - */ - private final String distributionUrlPathPattern; - - /** - * Credentials to authenticate on the distribution server before download. - */ - private final Credentials distributionServerCredentials; - - /** - * Proxy settings used for downloads. - */ - private final ProxySettings proxySettings; - - /** - * Path to a temporary directory. - */ - private final Path temporaryDirectoryPath; - - /** - * Path to a directory where the distribution shall be installed. - */ - private final Path installDirectoryPath; -} +public record InstallNodeDistributionCommand(Platform platform, String version, String distributionUrlRoot, + String distributionUrlPathPattern, Credentials distributionServerCredentials, ProxySettings proxySettings, + Path temporaryDirectoryPath, Path installDirectoryPath) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrl.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrl.java index 9a6ab37d..ee2733e2 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrl.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrl.java @@ -26,7 +26,7 @@ public class ResolveProxySettingsByUrl { private final SelectProxySettings selectProxySettings; public ProxySettings execute(final ResolveProxySettingsByUrlCommand command) { - final URL resourceUrl = command.getResourceUrl(); + final URL resourceUrl = command.resourceUrl(); final String resourceProtocol = resourceUrl.getProtocol(); if (resourceProtocol.equals(HTTP_PROTOCOL) || resourceProtocol.equals(HTTPS_PROTOCOL)) { if (isNonProxyHost.execute(IsNonProxyHostCommand @@ -41,16 +41,16 @@ public ProxySettings execute(final ResolveProxySettingsByUrlCommand command) { selectProxySettingsCommandBuilder .systemProxyHost(systemSettingsProvider.getHttpsProxyHost()) .systemProxyPort(systemSettingsProvider.getHttpsProxyPort()) - .proxyHost(command.getHttpsProxyHost()) - .proxyPort(command.getHttpsProxyPort()) - .proxyCredentials(command.getHttpsProxyCredentials()); + .proxyHost(command.httpsProxyHost()) + .proxyPort(command.httpsProxyPort()) + .proxyCredentials(command.httpsProxyCredentials()); } else { selectProxySettingsCommandBuilder .systemProxyHost(systemSettingsProvider.getHttpProxyHost()) .systemProxyPort(systemSettingsProvider.getHttpProxyPort()) - .proxyHost(command.getHttpProxyHost()) - .proxyPort(command.getHttpProxyPort()) - .proxyCredentials(command.getHttpProxyCredentials()); + .proxyHost(command.httpProxyHost()) + .proxyPort(command.httpProxyPort()) + .proxyCredentials(command.httpProxyCredentials()); } return selectProxySettings.execute(selectProxySettingsCommandBuilder.build()); } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlCommand.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlCommand.java index ef99a433..b43ef3b0 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlCommand.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlCommand.java @@ -3,7 +3,6 @@ import java.net.URL; import lombok.Builder; -import lombok.Getter; /** * Parameters to resolve proxy settings. @@ -11,20 +10,6 @@ * @since 7.0.0 */ @Builder -@Getter -public class ResolveProxySettingsByUrlCommand { - - private final String httpProxyHost; - - private final int httpProxyPort; - - private final Credentials httpProxyCredentials; - - private final String httpsProxyHost; - - private final int httpsProxyPort; - - private final Credentials httpsProxyCredentials; - - private final URL resourceUrl; -} +public record ResolveProxySettingsByUrlCommand(String httpProxyHost, int httpProxyPort, + Credentials httpProxyCredentials, String httpsProxyHost, int httpsProxyPort, Credentials httpsProxyCredentials, + URL resourceUrl) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiver.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiver.java index ed373c87..e34ca298 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiver.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiver.java @@ -86,13 +86,13 @@ protected Optional getNextEntry(final TarArchiverContext context) thro @Override protected String getSymbolicLinkTarget(final TarArchiverContext context, final TarEntry entry) { - return entry.getLowLevelEntry().getLinkName(); + return entry.lowLevelEntry().getLinkName(); } @Override protected void writeRegularFile(final TarArchiverContext context, final TarEntry entry, final Path filePath) throws IOException { - final long entrySize = entry.getLowLevelEntry().getSize(); + final long entrySize = entry.lowLevelEntry().getSize(); int bytesRead; int bytesToRead = (int) entrySize; try (final OutputStream outputStream = fileManager.newOutputStream(filePath)) { diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverContext.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverContext.java index f76b773b..629fa017 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverContext.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverContext.java @@ -15,7 +15,7 @@ */ @Builder @Getter -class TarArchiverContext implements ArchiverContext { +public class TarArchiverContext implements ArchiverContext { /** * Explode settings. diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntry.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntry.java index 70282b7d..12b86ed9 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntry.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntry.java @@ -1,7 +1,6 @@ package org.siouan.frontendgradleplugin.infrastructure.archiver; import lombok.Builder; -import lombok.Getter; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.siouan.frontendgradleplugin.domain.installer.archiver.ArchiveEntry; @@ -10,16 +9,11 @@ * implementation of TAR entries. It allows to hide implementation details, and conforms to a uniform interface for this * plugin's archivers. * + * @param lowLevelEntry Low-level entry mapped to this entry. * @since 1.1.3 */ @Builder -@Getter -class TarEntry implements ArchiveEntry { - - /** - * Low-level entry mapped to this entry. - */ - private final TarArchiveEntry lowLevelEntry; +record TarEntry(TarArchiveEntry lowLevelEntry) implements ArchiveEntry { @Override public String getName() { diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java index 9ecdff38..849ad712 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java @@ -1,7 +1,6 @@ package org.siouan.frontendgradleplugin.infrastructure.archiver; import lombok.Builder; -import lombok.Getter; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.siouan.frontendgradleplugin.domain.installer.archiver.ArchiveEntry; @@ -10,23 +9,18 @@ * implementation of ZIP entries. It allows to hide implementation details, and conforms to a uniform interface for this * plugin's archivers. * + * @param lowLevelEntry Low-level entry. * @since 1.1.3 */ @Builder -@Getter -public class ZipEntry implements ArchiveEntry { - - /** - * Low-level entry. - */ - private final ZipArchiveEntry lowLevelEntry; +public record ZipEntry(ZipArchiveEntry lowLevelEntry) implements ArchiveEntry { /** * Gets the low-level entry this entry is mapped to. * * @return Entry. */ - ZipArchiveEntry getLowLevelEntry() { + public ZipArchiveEntry getLowLevelEntry() { return lowLevelEntry; } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AbstractRunCommandTaskType.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AbstractRunCommandTaskType.java index 23b09a45..7d2956b3 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AbstractRunCommandTaskType.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AbstractRunCommandTaskType.java @@ -27,15 +27,15 @@ public abstract class AbstractRunCommandTaskType extends AbstractRunCommandTask } catch (final BeanRegistryException e) { throw new GradleException(e.getClass().getName() + ": " + e.getMessage(), e); } - final FrontendExtension extension = taskContext.getExtension(); + final FrontendExtension extension = taskContext.extension(); this.packageJsonDirectory.set(extension.getPackageJsonDirectory().getAsFile()); this.nodeInstallDirectory.set(resolveNodeInstallDirectoryPath .execute(ResolveNodeInstallDirectoryPathCommand .builder() .nodeInstallDirectoryFromUser(extension.getNodeInstallDirectory().getAsFile().map(File::toPath)) .nodeDistributionProvided(extension.getNodeDistributionProvided()) - .nodeInstallDirectoryFromEnvironment(taskContext.getNodeInstallDirectoryFromEnvironment()) - .defaultPath(taskContext.getDefaultNodeInstallDirectoryPath()) + .nodeInstallDirectoryFromEnvironment(taskContext.nodeInstallDirectoryFromEnvironment()) + .defaultPath(taskContext.defaultNodeInstallDirectoryPath()) .build()) .map(Path::toFile)); } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapter.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapter.java index 2b496fcb..9b3dc4b8 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapter.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapter.java @@ -28,16 +28,16 @@ public class GradleScriptRunnerAdapter { public void execute(final ScriptProperties scriptProperties) { final ExecutionSettings executionSettings = resolveExecutionSettings.execute(ResolveExecutionSettingsCommand .builder() - .packageJsonDirectoryPath(scriptProperties.getPackageJsonDirectoryPath()) - .executableType(scriptProperties.getExecutableType()) - .nodeInstallDirectoryPath(scriptProperties.getNodeInstallDirectoryPath()) - .platform(scriptProperties.getPlatform()) - .script(scriptProperties.getScript()) + .packageJsonDirectoryPath(scriptProperties.packageJsonDirectoryPath()) + .executableType(scriptProperties.executableType()) + .nodeInstallDirectoryPath(scriptProperties.nodeInstallDirectoryPath()) + .platform(scriptProperties.platform()) + .script(scriptProperties.script()) .build()); logger.debug("Execution settings: {}", executionSettings); scriptProperties - .getExecOperations() + .execOperations() .exec(ExecSpecAction .builder() .executionSettings(executionSettings) diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleSettings.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleSettings.java index d396dea0..1dcfad63 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleSettings.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleSettings.java @@ -7,22 +7,4 @@ * * @since 5.2.0 */ -public class GradleSettings { - - private final LogLevel projectLogLevel; - - private final LogLevel commandLineLogLevel; - - public GradleSettings(final LogLevel projectLogLevel, final LogLevel commandLineLogLevel) { - this.projectLogLevel = projectLogLevel; - this.commandLineLogLevel = commandLineLogLevel; - } - - public LogLevel getProjectLogLevel() { - return projectLogLevel; - } - - public LogLevel getCommandLineLogLevel() { - return commandLineLogLevel; - } -} +public record GradleSettings(LogLevel projectLogLevel, LogLevel commandLineLogLevel) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPath.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPath.java index 5fb93423..dcadaef6 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPath.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPath.java @@ -24,10 +24,10 @@ public class ResolveNodeInstallDirectoryPath { */ public Provider execute(final ResolveNodeInstallDirectoryPathCommand command) { final Provider nodeInstallDirectoryPath = command - .getNodeDistributionProvided() + .nodeDistributionProvided() .flatMap(nodeDistributionProvided -> Boolean.TRUE.equals(nodeDistributionProvided) ? command - .getNodeInstallDirectoryFromUser() - .orElse(command.getNodeInstallDirectoryFromEnvironment()) : command.getNodeInstallDirectoryFromUser()); - return nodeInstallDirectoryPath.orElse(command.getDefaultPath()); + .nodeInstallDirectoryFromUser() + .orElse(command.nodeInstallDirectoryFromEnvironment()) : command.nodeInstallDirectoryFromUser()); + return nodeInstallDirectoryPath.orElse(command.defaultPath()); } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPathCommand.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPathCommand.java index 04344069..807e0ede 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPathCommand.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolveNodeInstallDirectoryPathCommand.java @@ -3,30 +3,15 @@ import java.nio.file.Path; import lombok.Builder; -import lombok.Getter; import org.gradle.api.provider.Provider; -@Getter +/** + * @param nodeInstallDirectoryFromUser A user-defined provider of the path to the install directory + * @param nodeDistributionProvided Whether the Node.js distribution is already installed in the system and shall not be + * downloaded. + * @param nodeInstallDirectoryFromEnvironment A provider of the path to the install directory given by the environment. + * @param defaultPath A default path to an install directory. + */ @Builder -public class ResolveNodeInstallDirectoryPathCommand { - - /** - * A user-defined provider of the path to the install directory. - */ - private final Provider nodeInstallDirectoryFromUser; - - /** - * Whether the Node.js distribution is already installed in the system and shall not be downloaded. - */ - private final Provider nodeDistributionProvided; - - /** - * A provider of the path to the install directory given by the environment. - */ - private final Provider nodeInstallDirectoryFromEnvironment; - - /** - * A default path to an install directory. - */ - private final Path defaultPath; -} +public record ResolveNodeInstallDirectoryPathCommand(Provider nodeInstallDirectoryFromUser, + Provider nodeDistributionProvided, Provider nodeInstallDirectoryFromEnvironment, Path defaultPath) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ScriptProperties.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ScriptProperties.java index adee57b4..935c7f64 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ScriptProperties.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ScriptProperties.java @@ -3,7 +3,6 @@ import java.nio.file.Path; import lombok.Builder; -import lombok.Getter; import org.gradle.process.ExecOperations; import org.siouan.frontendgradleplugin.domain.ExecutableType; import org.siouan.frontendgradleplugin.domain.Platform; @@ -11,39 +10,14 @@ /** * Properties to run a script. * + * @param execOperations Gradle exec operations. + * @param packageJsonDirectoryPath Path to the directory containing the {@code package.json} file. + * @param executableType Executable use to run the script. + * @param nodeInstallDirectoryPath Directory where the Node distribution is installed. + * @param script The script run by the job with npm or Yarn. + * @param platform Underlying platform. * @since 2.0.0 */ @Builder -@Getter -public class ScriptProperties { - - /** - * Gradle exec operations. - */ - private final ExecOperations execOperations; - - /** - * Path to the directory containing the {@code package.json} file. - */ - private final Path packageJsonDirectoryPath; - - /** - * Executable use to run the script. - */ - private final ExecutableType executableType; - - /** - * Directory where the Node distribution is installed. - */ - private final Path nodeInstallDirectoryPath; - - /** - * The script run by the job with npm or Yarn. - */ - private final String script; - - /** - * Underlying platform. - */ - private final Platform platform; -} +public record ScriptProperties(ExecOperations execOperations, Path packageJsonDirectoryPath, + ExecutableType executableType, Path nodeInstallDirectoryPath, String script, Platform platform) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskContext.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskContext.java index 300289bf..5cbcf0be 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskContext.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskContext.java @@ -3,16 +3,8 @@ import java.nio.file.Path; import lombok.Builder; -import lombok.Getter; import org.gradle.api.provider.Provider; @Builder -@Getter -public class TaskContext { - - private final Path defaultNodeInstallDirectoryPath; - - private final Provider nodeInstallDirectoryFromEnvironment; - - private final FrontendExtension extension; -} +public record TaskContext(Path defaultNodeInstallDirectoryPath, Provider nodeInstallDirectoryFromEnvironment, + FrontendExtension extension) {} diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurer.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurer.java index 4b03da9e..4f3f7fce 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurer.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurer.java @@ -48,11 +48,11 @@ private LogLevel resolveLogLevel(final Task task) { return loggingLevel; } - loggingLevel = gradleSettings.getProjectLogLevel(); + loggingLevel = gradleSettings.projectLogLevel(); if (loggingLevel != null) { return loggingLevel; } - return gradleSettings.getCommandLineLogLevel(); + return gradleSettings.commandLineLogLevel(); } } diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/GetExecutablePathTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/GetExecutablePathTest.java index 6aebffbf..57b09b74 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/GetExecutablePathTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/GetExecutablePathTest.java @@ -3,8 +3,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import static org.siouan.frontendgradleplugin.test.PathFixture.ANY_PATH; import static org.siouan.frontendgradleplugin.domain.PlatformFixture.aPlatform; +import static org.siouan.frontendgradleplugin.test.PathFixture.ANY_PATH; import java.nio.file.Path; import java.nio.file.Paths; @@ -48,9 +48,12 @@ void should_resolve_node_executable_path() { .platform(platform) .build())).thenReturn(executablePath); - assertThat(usecase.execute( - new GetExecutablePathCommand(ExecutableType.NODE, NODE_INSTALL_DIRECTORY_PATH, platform))).isEqualTo( - executablePath); + assertThat(usecase.execute(GetExecutablePathCommand + .builder() + .executableType(ExecutableType.NODE) + .nodeInstallDirectoryPath(NODE_INSTALL_DIRECTORY_PATH) + .platform(platform) + .build())).isEqualTo(executablePath); verifyNoMoreInteractions(getCorepackExecutablePath, getNodeExecutablePath, getNpmExecutablePath, getPnpmExecutablePath, getYarnExecutablePath); @@ -66,9 +69,12 @@ void should_resolve_corepack_executable_path() { .platform(platform) .build())).thenReturn(executablePath); - assertThat(usecase.execute( - new GetExecutablePathCommand(ExecutableType.COREPACK, NODE_INSTALL_DIRECTORY_PATH, platform))).isEqualTo( - executablePath); + assertThat(usecase.execute(GetExecutablePathCommand + .builder() + .executableType(ExecutableType.COREPACK) + .nodeInstallDirectoryPath(NODE_INSTALL_DIRECTORY_PATH) + .platform(platform) + .build())).isEqualTo(executablePath); verifyNoMoreInteractions(getCorepackExecutablePath, getNodeExecutablePath, getNpmExecutablePath, getPnpmExecutablePath, getYarnExecutablePath); @@ -84,9 +90,12 @@ void should_resolve_npm_executable_path() { .platform(platform) .build())).thenReturn(executablePath); - assertThat(usecase.execute( - new GetExecutablePathCommand(ExecutableType.NPM, NODE_INSTALL_DIRECTORY_PATH, platform))).isEqualTo( - executablePath); + assertThat(usecase.execute(GetExecutablePathCommand + .builder() + .executableType(ExecutableType.NPM) + .nodeInstallDirectoryPath(NODE_INSTALL_DIRECTORY_PATH) + .platform(platform) + .build())).isEqualTo(executablePath); verifyNoMoreInteractions(getCorepackExecutablePath, getNodeExecutablePath, getNpmExecutablePath, getPnpmExecutablePath, getYarnExecutablePath); @@ -102,9 +111,12 @@ void should_resolve_pnpm_executable_path() { .platform(platform) .build())).thenReturn(executablePath); - assertThat(usecase.execute( - new GetExecutablePathCommand(ExecutableType.PNPM, NODE_INSTALL_DIRECTORY_PATH, platform))).isEqualTo( - executablePath); + assertThat(usecase.execute(GetExecutablePathCommand + .builder() + .executableType(ExecutableType.PNPM) + .nodeInstallDirectoryPath(NODE_INSTALL_DIRECTORY_PATH) + .platform(platform) + .build())).isEqualTo(executablePath); verifyNoMoreInteractions(getCorepackExecutablePath, getNodeExecutablePath, getNpmExecutablePath, getPnpmExecutablePath, getYarnExecutablePath); @@ -120,9 +132,12 @@ void should_resolve_yarn_executable_path() { .platform(platform) .build())).thenReturn(executablePath); - assertThat(usecase.execute( - new GetExecutablePathCommand(ExecutableType.YARN, NODE_INSTALL_DIRECTORY_PATH, platform))).isEqualTo( - executablePath); + assertThat(usecase.execute(GetExecutablePathCommand + .builder() + .executableType(ExecutableType.YARN) + .nodeInstallDirectoryPath(NODE_INSTALL_DIRECTORY_PATH) + .platform(platform) + .build())).isEqualTo(executablePath); verifyNoMoreInteractions(getCorepackExecutablePath, getNodeExecutablePath, getNpmExecutablePath, getPnpmExecutablePath, getYarnExecutablePath); diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerSpecificationTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerSpecificationTest.java index fab47f80..cd0ace0d 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerSpecificationTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ParsePackageManagerSpecificationTest.java @@ -30,8 +30,8 @@ void should_return_package_manager_specification_with_no_other_specification_pre throws MalformedPackageManagerSpecification, UnsupportedPackageManagerException { assertThat(usecase.execute("npm@9.6.7")).satisfies(packageManager -> { - assertThat(packageManager.getType()).isEqualTo(PackageManagerType.NPM); - assertThat(packageManager.getVersion()).isEqualTo("9.6.7"); + assertThat(packageManager.type()).isEqualTo(PackageManagerType.NPM); + assertThat(packageManager.version()).isEqualTo("9.6.7"); }); } } diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntryTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntryTest.java index 7fca2abb..c13648ea 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntryTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarEntryTest.java @@ -39,7 +39,7 @@ void should_map_entry_to_directory_archive_entry() { final TarEntry entry = new TarEntry(lowLevelEntry); - assertThat(entry.getLowLevelEntry()).isEqualTo(lowLevelEntry); + assertThat(entry.lowLevelEntry()).isEqualTo(lowLevelEntry); assertThat(entry.getName()).isEqualTo(name); assertThat(entry.isDirectory()).isEqualTo(isDirectory); assertThat(entry.isSymbolicLink()).isEqualTo(isSymbolicLink); @@ -62,7 +62,7 @@ void should_map_entry_to_symbolic_link_archive_entry() { final TarEntry entry = new TarEntry(lowLevelEntry); - assertThat(entry.getLowLevelEntry()).isEqualTo(lowLevelEntry); + assertThat(entry.lowLevelEntry()).isEqualTo(lowLevelEntry); assertThat(entry.getName()).isEqualTo(name); assertThat(entry.isDirectory()).isEqualTo(isDirectory); assertThat(entry.isSymbolicLink()).isEqualTo(isSymbolicLink); @@ -85,7 +85,7 @@ void should_map_entry_to_file_archive_entry() { final TarEntry entry = new TarEntry(lowLevelEntry); - assertThat(entry.getLowLevelEntry()).isEqualTo(lowLevelEntry); + assertThat(entry.lowLevelEntry()).isEqualTo(lowLevelEntry); assertThat(entry.getName()).isEqualTo(name); assertThat(entry.isDirectory()).isEqualTo(isDirectory); assertThat(entry.isSymbolicLink()).isEqualTo(isSymbolicLink); diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapterTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapterTest.java index 2ba3f7d9..7825cc37 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapterTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/GradleScriptRunnerAdapterTest.java @@ -6,8 +6,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import static org.siouan.frontendgradleplugin.test.PathFixture.ANY_PATH; import static org.siouan.frontendgradleplugin.domain.PlatformFixture.LOCAL_PLATFORM; +import static org.siouan.frontendgradleplugin.test.PathFixture.ANY_PATH; import java.nio.file.Path; import java.util.List; @@ -63,11 +63,11 @@ void should_run_script_when_settings_are_resolved() { .build(); when(resolveExecutionSettings.execute(ResolveExecutionSettingsCommand .builder() - .packageJsonDirectoryPath(scriptProperties.getPackageJsonDirectoryPath()) - .executableType(scriptProperties.getExecutableType()) - .nodeInstallDirectoryPath(scriptProperties.getNodeInstallDirectoryPath()) - .platform(scriptProperties.getPlatform()) - .script(scriptProperties.getScript()) + .packageJsonDirectoryPath(scriptProperties.packageJsonDirectoryPath()) + .executableType(scriptProperties.executableType()) + .nodeInstallDirectoryPath(scriptProperties.nodeInstallDirectoryPath()) + .platform(scriptProperties.platform()) + .script(scriptProperties.script()) .build())).thenReturn(executionSettings); final ExecResult execResult = mock(ExecResult.class); when(execOperations.exec(any(ExecSpecAction.class))).thenReturn(execResult); diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurerTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurerTest.java index cee640b7..7746f920 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurerTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/gradle/TaskLoggerConfigurerTest.java @@ -68,7 +68,7 @@ void should_init_logger_before_task_execution_with_project_level() { when(task.getName()).thenReturn(TASK_NAME); when(task.getLogger()).thenReturn(gradleLogger); when(task.getLogging()).thenReturn(taskLoggingManager); - when(gradleSettings.getProjectLogLevel()).thenReturn(LOGGING_LEVEL); + when(gradleSettings.projectLogLevel()).thenReturn(LOGGING_LEVEL); when(extension.getVerboseModeEnabled()).thenReturn(verboseModeEnabled); when(verboseModeEnabled.get()).thenReturn(true); @@ -84,8 +84,8 @@ void should_init_logger_before_task_execution_with_gradle_start_level() { when(task.getName()).thenReturn(TASK_NAME); when(task.getLogger()).thenReturn(gradleLogger); when(task.getLogging()).thenReturn(taskLoggingManager); - when(gradleSettings.getProjectLogLevel()).thenReturn(null); - when(gradleSettings.getCommandLineLogLevel()).thenReturn(LOGGING_LEVEL); + when(gradleSettings.projectLogLevel()).thenReturn(null); + when(gradleSettings.commandLineLogLevel()).thenReturn(LOGGING_LEVEL); when(extension.getVerboseModeEnabled()).thenReturn(verboseModeEnabled); when(verboseModeEnabled.get()).thenReturn(true);