diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 508f6a5..bf43624 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -47,11 +47,11 @@ jobs: uses: actions/configure-pages@v3 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v1 with: # Upload generated Javadocs repository path: "build/javadoc/" - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v1 diff --git a/src/main/java/rife/bld/extension/AbstractJReleaserDistributionModelOperation.java b/src/main/java/rife/bld/extension/AbstractJReleaserDistributionModelOperation.java deleted file mode 100644 index ba2649c..0000000 --- a/src/main/java/rife/bld/extension/AbstractJReleaserDistributionModelOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Base class for JReleaser operations that rely on distributions. - */ -public class AbstractJReleaserDistributionModelOperation> extends AbstractJReleaserPlatformAwareModelOperation { - public AbstractJReleaserDistributionModelOperation(String command) { - super(command); - } - - /** - * Includes the given distribution. - * - * @param distribution the distribution name - * @return this operation instance - */ - public S distribution(String distribution) { - setOption("--distribution", distribution); - return self(); - } - - /** - * Excludes the given distribution. - * - * @param distribution the distribution name - * @return this operation instance - */ - public S excludeDistribution(String distribution) { - setOption("--exclude-distribution", distribution); - return self(); - } -} diff --git a/src/main/java/rife/bld/extension/AbstractJReleaserModelOperation.java b/src/main/java/rife/bld/extension/AbstractJReleaserModelOperation.java deleted file mode 100644 index b7c6cb8..0000000 --- a/src/main/java/rife/bld/extension/AbstractJReleaserModelOperation.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -import java.io.File; -import java.nio.file.Path; - -/** - * Base class for JReleaser operations that resolve a model. - */ -public class AbstractJReleaserModelOperation> extends AbstractJReleaserOperation { - public AbstractJReleaserModelOperation(String command) { - super(command); - } - - /** - * Input configFile. - * - * @param configFile the input configFile - * @return this operation instance - */ - public S configFile(String configFile) { - setOption("--config-file", configFile); - return self(); - } - - /** - * Input configFile. - * - * @param configFile the input configFile - * @return this operation instance - */ - public S configFile(File configFile) { - return configFile(configFile.getAbsolutePath()); - } - - /** - * Input configFile. - * - * @param configFile the input configFile - * @return this operation instance - */ - public S configFile(Path configFile) { - return configFile(configFile.toFile()); - } - - /** - * Searches for a .git directory at the project's root directory. - * - * @return this operation instance - */ - public S gitRootSearch() { - setOption("--git-root-search"); - return self(); - } - - /** - * Sets strict mode. - * - * @return this operation instance - */ - public S strict() { - setOption("--strict"); - return self(); - } - - /** - * Sets a project property. - * - * @param key the property key - * @param value the property value - * @return this operation instance - */ - public S projectProperty(String key, String value) { - setOption("-P", key + '=' + value); - return self(); - } -} diff --git a/src/main/java/rife/bld/extension/AbstractJReleaserOperation.java b/src/main/java/rife/bld/extension/AbstractJReleaserOperation.java deleted file mode 100644 index a20c972..0000000 --- a/src/main/java/rife/bld/extension/AbstractJReleaserOperation.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -import rife.bld.BaseProject; -import rife.bld.operations.AbstractProcessOperation; -import rife.bld.operations.exceptions.ExitStatusException; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - - -/** - * Base class for all JReleaser operations. - */ -public abstract class AbstractJReleaserOperation> extends AbstractProcessOperation { - private static final Logger LOGGER = Logger.getLogger(AbstractJReleaserOperation.class.getName()); - protected static final String EMPTY = ""; - - private final Map options_ = new ConcurrentHashMap<>(); - private final String command_; - - private BaseProject project_; - - protected AbstractJReleaserOperation(String command) { - command_ = command; - } - - protected final S self() { - return (S) this; - } - - protected String getCommand() { - return command_; - } - - protected BaseProject getProject() { - return project_; - } - - protected void setOption(String key) { - setOption(key, EMPTY); - } - - protected void setOption(String key, String value) { - options_.put(key, value); - } - - /** - * Sets the base directory. - * - * @param directory the base directory - * @return this operation instance - */ - public S basedir(String directory) { - setOption("--basedir", directory); - return self(); - } - - /** - * Sets the base directory. - * - * @param directory the base directory - * @return this operation instance - */ - public S basedir(File directory) { - return basedir(directory.getAbsolutePath()); - } - - /** - * Sets the base directory. - * - * @param directory the base directory - * @return this operation instance - */ - public S basedir(Path directory) { - return basedir(directory.toFile()); - } - - /** - * Set log level to debug. - * - * @return this operation instance - */ - public S debug() { - setOption("--debug"); - return self(); - } - - @Override - public void execute() throws IOException, InterruptedException, ExitStatusException { - if (project_ == null) { - if (LOGGER.isLoggable(Level.SEVERE) && !silent()) { - LOGGER.severe("A project must be specified."); - } - throw new ExitStatusException(ExitStatusException.EXIT_FAILURE); - } else { - super.execute(); - } - } - - /** - * Part of the {@link #execute} operation, constructs the command list - * to use for building the process. - */ - @Override - protected List executeConstructProcessCommandList() { - List args = new ArrayList<>(); - - if (project_ != null) { - args.add(javaTool()); - args.add("-cp"); - args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"), - new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(), - project_.buildTestDirectory())); - args.add("org.jreleaser.cli.Main"); - args.add(getCommand()); - - options_.forEach((k, v) -> { - if (!v.isEmpty()) { - args.add(k + '=' + v); - } else { - args.add(k); - } - }); - } - - return args; - } - - /** - * Configures the operation from a {@link BaseProject}. - * - * @param project the project to configure the operation from - */ - @Override - public S fromProject(BaseProject project) { - project_ = project; - return self(); - } - - /** - * Show the help message. - * - * @return this operation instance - */ - public S help() { - setOption("--help"); - return self(); - } - - /** - * Set log level to info. - * - * @return this operation instance - */ - public S info() { - setOption("--info"); - return self(); - } - - /** - * Output directory. - * - * @param directory the output directory - * @return this operation instance - */ - public S outputDirectory(String directory) { - setOption("--output-directory", directory); - return self(); - } - - /** - * Output directory. - * - * @param directory the output directory - * @return this operation instance - */ - public S outputDirectory(File directory) { - return outputDirectory(directory.getAbsolutePath()); - } - - /** - * Output directory. - * - * @param directory the output directory - * @return this operation instance - */ - public S outputDirectory(Path directory) { - return outputDirectory(directory.toFile()); - } - - /** - * Sets a System property. - * - * @param key the property key - * @param value the property value - * @return this operation instance - */ - public S systemProperty(String key, String value) { - setOption("-D", key + '=' + value); - return self(); - } - - /** - * Print version information. - * - * @return this operation instance - */ - public S version() { - setOption("--version"); - return self(); - } - - /** - * Set log level to warn. - * - * @return this operation instance - */ - public S warn() { - setOption("--warn"); - return self(); - } -} diff --git a/src/main/java/rife/bld/extension/AbstractJReleaserPackagerModelOperation.java b/src/main/java/rife/bld/extension/AbstractJReleaserPackagerModelOperation.java deleted file mode 100644 index dad9776..0000000 --- a/src/main/java/rife/bld/extension/AbstractJReleaserPackagerModelOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Base class for JReleaser operations that rely on packagers. - */ -public class AbstractJReleaserPackagerModelOperation> extends AbstractJReleaserDistributionModelOperation { - public AbstractJReleaserPackagerModelOperation(String command) { - super(command); - } - - /** - * Includes the given packager. - * - * @param packager the packager name - * @return this operation instance - */ - public S packager(String packager) { - setOption("--packager", packager); - return self(); - } - - /** - * Excludes the given packager. - * - * @param packager the packager name - * @return this operation instance - */ - public S excludePackager(String packager) { - setOption("--exclude-packager", packager); - return self(); - } -} diff --git a/src/main/java/rife/bld/extension/AbstractJReleaserPlatformAwareModelOperation.java b/src/main/java/rife/bld/extension/AbstractJReleaserPlatformAwareModelOperation.java deleted file mode 100644 index 300b389..0000000 --- a/src/main/java/rife/bld/extension/AbstractJReleaserPlatformAwareModelOperation.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Base class for JReleaser operations that are platform aware. - */ -public class AbstractJReleaserPlatformAwareModelOperation> extends AbstractJReleaserModelOperation { - public AbstractJReleaserPlatformAwareModelOperation(String command) { - super(command); - } - - /** - * Enables dry-run mode. - * - * @return this operation instance - */ - public S dryRun() { - setOption("--dry-run"); - return self(); - } - - /** - * Limits artifact selection to the current platform. - * - * @return this operation instance - */ - public S selectCurrentPlatform() { - setOption("--select-current-platform"); - return self(); - } - - /** - * Limits artifact selection to the given platform. - * - * @param platform the platform value - * @return this operation instance - */ - public S selectPlatform(String platform) { - setOption("--select-platform", platform); - return self(); - } - - /** - * Excludes artifact selection from the given platform. - * - * @param platform the platform value - * @return this operation instance - */ - public S rejectPlatform(String platform) { - setOption("--reject-platform", platform); - return self(); - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserAnnounceOperation.java b/src/main/java/rife/bld/extension/JReleaserAnnounceOperation.java deleted file mode 100644 index 371ea7a..0000000 --- a/src/main/java/rife/bld/extension/JReleaserAnnounceOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Announce a release. - */ -public class JReleaserAnnounceOperation extends AbstractJReleaserModelOperation { - public JReleaserAnnounceOperation() { - super("announce"); - } - - /** - * Includes the given announcer. - * - * @param announcer the announcer name - * @return this operation instance - */ - public JReleaserAnnounceOperation announcer(String announcer) { - setOption("--announcer", announcer); - return this; - } - - /** - * Excludes the given announcer. - * - * @param announcer the announcer name - * @return this operation instance - */ - public JReleaserAnnounceOperation excludeAnnouncer(String announcer) { - setOption("--exclude-announcer", announcer); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserAssembleOperation.java b/src/main/java/rife/bld/extension/JReleaserAssembleOperation.java deleted file mode 100644 index 3c92070..0000000 --- a/src/main/java/rife/bld/extension/JReleaserAssembleOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Assemble distributions. - */ -public class JReleaserAssembleOperation extends AbstractJReleaserDistributionModelOperation { - public JReleaserAssembleOperation() { - super("assemble"); - } - - /** - * Includes the given assembler. - * - * @param assembler the assembler name - * @return this operation instance - */ - public JReleaserAssembleOperation assembler(String assembler) { - setOption("--assembler", assembler); - return this; - } - - /** - * Excludes the given assembler. - * - * @param assembler the assembler name - * @return this operation instance - */ - public JReleaserAssembleOperation excludeAssembler(String assembler) { - setOption("--exclude-assembler", assembler); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserCatalogOperation.java b/src/main/java/rife/bld/extension/JReleaserCatalogOperation.java deleted file mode 100644 index c13eef3..0000000 --- a/src/main/java/rife/bld/extension/JReleaserCatalogOperation.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Catalog release assets. - */ -public class JReleaserCatalogOperation extends AbstractJReleaserDistributionModelOperation { - public JReleaserCatalogOperation() { - super("catalog"); - } - - /** - * Includes the given cataloger. - * - * @param cataloger the cataloger name - * @return this operation instance - */ - public JReleaserCatalogOperation cataloger(String cataloger) { - setOption("--cataloger", cataloger); - return this; - } - - /** - * Excludes the given cataloger. - * - * @param cataloger the cataloger name - * @return this operation instance - */ - public JReleaserCatalogOperation excludeCataloger(String cataloger) { - setOption("--exclude-cataloger", cataloger); - return this; - } - - /** - * Includes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserCatalogOperation deployerByType(String deployer) { - setOption("--deployer", deployer); - return this; - } - - /** - * Excludes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserCatalogOperation excludeDeployerByType(String deployer) { - setOption("--exclude-deployer", deployer); - return this; - } - - /** - * Includes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserCatalogOperation deployerByName(String name) { - setOption("--deployer-name", name); - return this; - } - - /** - * Excludes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserCatalogOperation excludeDeployerByName(String name) { - setOption("--exclude-deployer-name", name); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserChangelogOperation.java b/src/main/java/rife/bld/extension/JReleaserChangelogOperation.java deleted file mode 100644 index 53bc915..0000000 --- a/src/main/java/rife/bld/extension/JReleaserChangelogOperation.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Generates a changelog. - */ -public class JReleaserChangelogOperation extends AbstractJReleaserModelOperation { - public JReleaserChangelogOperation() { - super("changelog"); - } - - /** - * Enables dry-run mode. - * - * @return this operation instance - */ - public JReleaserChangelogOperation dryRun() { - setOption("--dry-run"); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserChecksumOperation.java b/src/main/java/rife/bld/extension/JReleaserChecksumOperation.java deleted file mode 100644 index 988374d..0000000 --- a/src/main/java/rife/bld/extension/JReleaserChecksumOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Calculate checksum files. - */ -public class JReleaserChecksumOperation extends AbstractJReleaserDistributionModelOperation { - public JReleaserChecksumOperation() { - super("checksum"); - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserConfigOperation.java b/src/main/java/rife/bld/extension/JReleaserConfigOperation.java deleted file mode 100644 index 23378f6..0000000 --- a/src/main/java/rife/bld/extension/JReleaserConfigOperation.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Create a JReleaser config file. - */ -public class JReleaserConfigOperation extends AbstractJReleaserPlatformAwareModelOperation { - public JReleaserConfigOperation() { - super("config"); - } - - /** - * Display full configuration. - * - * @return this operation instance - */ - public JReleaserConfigOperation full() { - setOption("--full"); - return this; - } - - /** - * Display announce configuration. - * - * @return this operation instance - */ - public JReleaserConfigOperation announce() { - setOption("--announce"); - return this; - } - - /** - * Display assembly configuration. - * - * @return this operation instance - */ - public JReleaserConfigOperation assembly() { - setOption("--assembly"); - return this; - } - - /** - * Display changelog configuration. - * - * @return this operation instance - */ - public JReleaserConfigOperation changelog() { - setOption("--changelog"); - return this; - } - - /** - * Display download configuration. - * - * @return this operation instance - */ - public JReleaserConfigOperation download() { - setOption("--download"); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserDeployOperation.java b/src/main/java/rife/bld/extension/JReleaserDeployOperation.java deleted file mode 100644 index ef52496..0000000 --- a/src/main/java/rife/bld/extension/JReleaserDeployOperation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Deploy assets. - */ -public class JReleaserDeployOperation extends AbstractJReleaserModelOperation { - public JReleaserDeployOperation() { - super("deploy"); - } - - /** - * Includes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserDeployOperation deployerByType(String deployer) { - setOption("--deployer", deployer); - return this; - } - - /** - * Excludes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserDeployOperation excludeDeployerByType(String deployer) { - setOption("--exclude-deployer", deployer); - return this; - } - - /** - * Includes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserDeployOperation deployerByName(String name) { - setOption("--deployer-name", name); - return this; - } - - /** - * Excludes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserDeployOperation excludeDeployerByName(String name) { - setOption("--exclude-deployer-name", name); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserDownloadOperation.java b/src/main/java/rife/bld/extension/JReleaserDownloadOperation.java deleted file mode 100644 index a2239d9..0000000 --- a/src/main/java/rife/bld/extension/JReleaserDownloadOperation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Download assets. - */ -public class JReleaserDownloadOperation extends AbstractJReleaserModelOperation { - public JReleaserDownloadOperation() { - super("download"); - } - - /** - * Includes the given downloader by type. - * - * @param downloader the downloader type - * @return this operation instance - */ - public JReleaserDownloadOperation downloaderByType(String downloader) { - setOption("--downloader", downloader); - return this; - } - - /** - * Excludes the given downloader by type. - * - * @param downloader the downloader type - * @return this operation instance - */ - public JReleaserDownloadOperation excludeDownloaderByType(String downloader) { - setOption("--exclude-downloader", downloader); - return this; - } - - /** - * Includes the given downloader by name. - * - * @param name the downloader name - * @return this operation instance - */ - public JReleaserDownloadOperation downloaderByName(String name) { - setOption("--downloader-name", name); - return this; - } - - /** - * Excludes the given downloader by name. - * - * @param name the downloader name - * @return this operation instance - */ - public JReleaserDownloadOperation excludeDownloaderByName(String name) { - setOption("--exclude-downloader-name", name); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserEnvOperation.java b/src/main/java/rife/bld/extension/JReleaserEnvOperation.java deleted file mode 100644 index b86abbe..0000000 --- a/src/main/java/rife/bld/extension/JReleaserEnvOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Displays environment settings. - */ -public class JReleaserEnvOperation extends AbstractJReleaserOperation { - public JReleaserEnvOperation() { - super("env"); - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserFullReleaseOperation.java b/src/main/java/rife/bld/extension/JReleaserFullReleaseOperation.java deleted file mode 100644 index 21aafd4..0000000 --- a/src/main/java/rife/bld/extension/JReleaserFullReleaseOperation.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2025 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package rife.bld.extension; - -/** - * Perform a full release. - */ -public class JReleaserFullReleaseOperation extends AbstractJReleaserDistributionModelOperation { - public JReleaserFullReleaseOperation() { - super("full-release"); - } - - /** - * Includes the given uploader by type. - * - * @param uploader the uploader type - * @return this operation instance - */ - public JReleaserFullReleaseOperation uploaderByType(String uploader) { - setOption("--uploader", uploader); - return this; - } - - /** - * Excludes the given uploader by type. - * - * @param uploader the uploader type - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeUploaderByType(String uploader) { - setOption("--exclude-uploader", uploader); - return this; - } - - /** - * Includes the given uploader by name. - * - * @param name the uploader name - * @return this operation instance - */ - public JReleaserFullReleaseOperation uploaderByName(String name) { - setOption("--uploader-name", name); - return this; - } - - /** - * Excludes the given uploader by name. - * - * @param name the uploader name - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeUploaderByName(String name) { - setOption("--exclude-uploader-name", name); - return this; - } - - /** - * Includes the given cataloger. - * - * @param cataloger the cataloger name - * @return this operation instance - */ - public JReleaserFullReleaseOperation cataloger(String cataloger) { - setOption("--cataloger", cataloger); - return this; - } - - /** - * Excludes the given cataloger. - * - * @param cataloger the cataloger name - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeCataloger(String cataloger) { - setOption("--exclude-cataloger", cataloger); - return this; - } - - /** - * Includes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserFullReleaseOperation deployerByType(String deployer) { - setOption("--deployer", deployer); - return this; - } - - /** - * Excludes the given deployer by type. - * - * @param deployer the deployer type - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeDeployerByType(String deployer) { - setOption("--exclude-deployer", deployer); - return this; - } - - /** - * Includes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserFullReleaseOperation deployerByName(String name) { - setOption("--deployer-name", name); - return this; - } - - /** - * Excludes the given deployer by name. - * - * @param name the deployer name - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeDeployerByName(String name) { - setOption("--exclude-deployer-name", name); - return this; - } - - /** - * Includes the given announcer. - * - * @param announcer the announcer name - * @return this operation instance - */ - public JReleaserFullReleaseOperation announcer(String announcer) { - setOption("--announcer", announcer); - return this; - } - - /** - * Excludes the given announcer. - * - * @param announcer the announcer name - * @return this operation instance - */ - public JReleaserFullReleaseOperation excludeAnnouncer(String announcer) { - setOption("--exclude-announcer", announcer); - return this; - } -} diff --git a/src/main/java/rife/bld/extension/JReleaserInitOperation.java b/src/main/java/rife/bld/extension/JReleaserInitOperation.java index e0d77a3..5387162 100644 --- a/src/main/java/rife/bld/extension/JReleaserInitOperation.java +++ b/src/main/java/rife/bld/extension/JReleaserInitOperation.java @@ -16,12 +16,121 @@ package rife.bld.extension; +import rife.bld.BaseProject; +import rife.bld.operations.AbstractProcessOperation; +import rife.bld.operations.exceptions.ExitStatusException; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; + + /** * Create a JReleaser config file. */ -public class JReleaserInitOperation extends AbstractJReleaserOperation { - public JReleaserInitOperation() { - super("init"); +public class JReleaserInitOperation extends AbstractProcessOperation { + private static final String EMPTY = ""; + private static final Logger LOGGER = Logger.getLogger(JReleaserInitOperation.class.getName()); + private final Map options_ = new ConcurrentHashMap<>(); + private BaseProject project_; + + /** + * Sets the base directory. + * + * @param directory the base directory + * @return this operation instance + */ + public JReleaserInitOperation basedir(String directory) { + options_.put("--basedir", directory); + return this; + } + + /** + * Sets the base directory. + * + * @param directory the base directory + * @return this operation instance + */ + public JReleaserInitOperation basedir(File directory) { + return basedir(directory.getAbsolutePath()); + } + + /** + * Sets the base directory. + * + * @param directory the base directory + * @return this operation instance + */ + public JReleaserInitOperation basedir(Path directory) { + return basedir(directory.toFile()); + } + + /** + * Set log level to debug. + * + * @return this operation instance + */ + public JReleaserInitOperation debug() { + options_.put("--debug", EMPTY); + return this; + } + + @Override + public void execute() throws IOException, InterruptedException, ExitStatusException { + if (project_ == null) { + if (LOGGER.isLoggable(Level.SEVERE) && !silent()) { + LOGGER.severe("A project must be specified."); + } + throw new ExitStatusException(ExitStatusException.EXIT_FAILURE); + } else { + super.execute(); + } + } + + /** + * Part of the {@link #execute} operation, constructs the command list + * to use for building the process. + */ + @Override + protected List executeConstructProcessCommandList() { + List args = new ArrayList<>(); + + if (project_ != null) { + args.add(javaTool()); + args.add("-cp"); + args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"), + new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(), + project_.buildTestDirectory())); + args.add("org.jreleaser.cli.Main"); + args.add("init"); + + options_.forEach((k, v) -> { + if (!v.isEmpty()) { + args.add(k + '=' + v); + } else { + args.add(k); + } + }); + } + + return args; + } + + /** + * Configures the operation from a {@link BaseProject}. + * + * @param project the project to configure the operation from + */ + @Override + public JReleaserInitOperation fromProject(BaseProject project) { + project_ = project; + return this; } /** @@ -31,17 +140,100 @@ public class JReleaserInitOperation extends AbstractJReleaserOperation