diff --git a/src/main/java/rife/bld/BuildCommand.java b/src/main/java/rife/bld/BuildCommand.java index 63db244..615ad86 100644 --- a/src/main/java/rife/bld/BuildCommand.java +++ b/src/main/java/rife/bld/BuildCommand.java @@ -25,6 +25,15 @@ */ String value() default ""; + /** + * When provided, specifies an alias for the build command that can be + * different from the method name. + * + * @return a string representing an alias for the build command + * @since 1.9 + */ + String alias() default ""; + /** * When provided, specifies a short description about the command. * diff --git a/src/main/java/rife/bld/BuildExecutor.java b/src/main/java/rife/bld/BuildExecutor.java index 028b578..41eb88e 100644 --- a/src/main/java/rife/bld/BuildExecutor.java +++ b/src/main/java/rife/bld/BuildExecutor.java @@ -42,6 +42,7 @@ public class BuildExecutor { private final HierarchicalProperties properties_; private List arguments_ = Collections.emptyList(); private Map buildCommands_ = null; + private Map buildAliases_ = null; private final AtomicReference currentCommandName_ = new AtomicReference<>(); private final AtomicReference currentCommandDefinition_ = new AtomicReference<>(); private int exitStatus_ = 0; @@ -294,6 +295,7 @@ public List arguments() { public Map buildCommands() { if (buildCommands_ == null) { var build_commands = new TreeMap(); + var build_aliases = new HashMap(); Class klass = getClass(); @@ -311,6 +313,11 @@ public Map buildCommands() { name = annotation_name; } + var annotation_alias = annotation.alias(); + if (annotation_alias != null && !annotation_alias.isEmpty()) { + build_aliases.put(annotation_alias, name); + } + if (!build_commands.containsKey(name)) { var build_help = annotation.help(); CommandHelp command_help = null; @@ -343,11 +350,27 @@ public Map buildCommands() { } buildCommands_ = build_commands; + buildAliases_ = build_aliases; } return buildCommands_; } + /** + * Retrieves the command aliases that can be executed by this {@code BuildExecutor}. + * + * @return a map containing the alias and the associated name of the build command + * @see BuildCommand + * @since 1.9 + */ + public Map buildAliases() { + if (buildAliases_ == null) { + buildCommands(); + } + + return buildAliases_; + } + private static class AnnotatedCommandHelp implements CommandHelp { private final String summary_; private final String description_; @@ -383,6 +406,15 @@ public boolean executeCommand(String command) var matched_command = command; var definition = buildCommands().get(command); + // try to find an alias + if (definition == null) { + var aliased_command = buildAliases().get(command); + if (aliased_command != null) { + matched_command = aliased_command; + definition = buildCommands().get(aliased_command); + } + } + // try to find a match for the provided command amongst // the ones that are known if (definition == null) { diff --git a/src/main/java/rife/bld/Cli.java b/src/main/java/rife/bld/Cli.java index c16c9f0..2ab14b1 100644 --- a/src/main/java/rife/bld/Cli.java +++ b/src/main/java/rife/bld/Cli.java @@ -17,7 +17,7 @@ public class Cli extends BuildExecutor { private final CreateOperation createOperation_ = new CreateOperation(); private final CreateBaseOperation createBaseOperation_ = new CreateBaseOperation(); - private final CreateBlankOperation createBlankOperation_ = new CreateBlankOperation(); + private final CreateAppOperation createAppOperation_ = new CreateAppOperation(); private final CreateLibOperation createLibOperation_ = new CreateLibOperation(); private final CreateRife2Operation createRife2Operation_ = new CreateRife2Operation(); private final UpgradeOperation upgradeOperation_ = new UpgradeOperation(); @@ -36,15 +36,15 @@ public void create() } /** - * The standard {@code create-blank} command. + * The standard {@code create-app} command. * * @throws Exception when an error occurred during the creation process - * @since 1.5 + * @since 1.9 */ - @BuildCommand(value = "create-blank", help = CreateBlankHelp.class) - public void createBlank() + @BuildCommand(value = "create-app", alias = "create-blank", help = CreateAppHelp.class) + public void createApp() throws Exception { - createBlankOperation_.executeOnce(() -> createBlankOperation_.fromArguments(arguments())); + createAppOperation_.executeOnce(() -> createAppOperation_.fromArguments(arguments())); } /** diff --git a/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java b/src/main/java/rife/bld/blueprints/AppProjectBlueprint.java similarity index 81% rename from src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java rename to src/main/java/rife/bld/blueprints/AppProjectBlueprint.java index 8325b68..1c1cddc 100644 --- a/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java +++ b/src/main/java/rife/bld/blueprints/AppProjectBlueprint.java @@ -16,17 +16,17 @@ import static rife.bld.dependencies.Scope.test; /** - * Provides the dependency information required to create a new blank project. + * Provides the dependency information required to create a new app project. * * @author Geert Bevin (gbevin[remove] at uwyn dot com) - * @since 1.5 + * @since 1.9 */ -public class BlankProjectBlueprint extends Project { - public BlankProjectBlueprint(File work, String packageName, String projectName) { +public class AppProjectBlueprint extends Project { + public AppProjectBlueprint(File work, String packageName, String projectName) { this(work, packageName, projectName, new VersionNumber(0,0,1)); } - public BlankProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) { + public AppProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) { workDirectory = work; pkg = packageName; diff --git a/src/main/java/rife/bld/help/CreateBlankHelp.java b/src/main/java/rife/bld/help/CreateAppHelp.java similarity index 71% rename from src/main/java/rife/bld/help/CreateBlankHelp.java rename to src/main/java/rife/bld/help/CreateAppHelp.java index 3afa215..6ea3a7b 100644 --- a/src/main/java/rife/bld/help/CreateBlankHelp.java +++ b/src/main/java/rife/bld/help/CreateAppHelp.java @@ -8,19 +8,19 @@ import rife.tools.StringUtils; /** - * Provides help for the create-blank command. + * Provides help for the create-app command. * * @author Geert Bevin (gbevin[remove] at uwyn dot com) - * @since 1.5 + * @since 1.9 */ -public class CreateBlankHelp implements CommandHelp { +public class CreateAppHelp implements CommandHelp { public String getSummary() { - return "Creates a new blank Java project with standard commands"; + return "Creates a new Java application project"; } public String getDescription(String topic) { return StringUtils.replace(""" - Creates a new blank Java project with standard commands. + Creates a new Java application project. Usage : ${topic} package The package of the project to create diff --git a/src/main/java/rife/bld/help/CreateBaseHelp.java b/src/main/java/rife/bld/help/CreateBaseHelp.java index 78a40f5..d538c46 100644 --- a/src/main/java/rife/bld/help/CreateBaseHelp.java +++ b/src/main/java/rife/bld/help/CreateBaseHelp.java @@ -8,19 +8,19 @@ import rife.tools.StringUtils; /** - * Provides help for the create-blank command. + * Provides help for the create-base command. * * @author Geert Bevin (gbevin[remove] at uwyn dot com) * @since 1.5.20 */ public class CreateBaseHelp implements CommandHelp { public String getSummary() { - return "Creates a new baseline Java project with minimal commands"; + return "Creates a new Java baseline project"; } public String getDescription(String topic) { return StringUtils.replace(""" - Creates a new baseline Java project with minimal commands. + Creates a new Java baseline project. Usage : ${topic} package The package of the project to create diff --git a/src/main/java/rife/bld/help/CreateHelp.java b/src/main/java/rife/bld/help/CreateHelp.java index 939f30a..ec2313b 100644 --- a/src/main/java/rife/bld/help/CreateHelp.java +++ b/src/main/java/rife/bld/help/CreateHelp.java @@ -15,15 +15,15 @@ */ public class CreateHelp implements CommandHelp { public String getSummary() { - return "Creates a new project"; + return "Creates a new project from multiple choice"; } public String getDescription(String topic) { return StringUtils.replace(""" - Creates a new project. + Creates a new project from multiple choice. Usage : ${topic} - type The type of project to create (base, blank, lib, rife2) + type The type of project to create (app, base, lib, rife2) package The package of the project to create name The name of the project to create""", "${topic}", topic); } diff --git a/src/main/java/rife/bld/help/CreateLibHelp.java b/src/main/java/rife/bld/help/CreateLibHelp.java index 9163df3..e72b2b2 100644 --- a/src/main/java/rife/bld/help/CreateLibHelp.java +++ b/src/main/java/rife/bld/help/CreateLibHelp.java @@ -15,12 +15,12 @@ */ public class CreateLibHelp implements CommandHelp { public String getSummary() { - return "Creates a new Java library with minimal commands"; + return "Creates a new Java library project"; } public String getDescription(String topic) { return StringUtils.replace(""" - Creates a new library Java project with minimal commands. + Creates a new Java library project. Usage : ${topic} package The package of the project to create diff --git a/src/main/java/rife/bld/help/CreateRife2Help.java b/src/main/java/rife/bld/help/CreateRife2Help.java index 7c29014..2ca8a9c 100644 --- a/src/main/java/rife/bld/help/CreateRife2Help.java +++ b/src/main/java/rife/bld/help/CreateRife2Help.java @@ -15,12 +15,12 @@ */ public class CreateRife2Help implements CommandHelp { public String getSummary() { - return "Creates a new RIFE2 project"; + return "Creates a new RIFE2 web application project"; } public String getDescription(String topic) { return StringUtils.replace(""" - Creates a new RIFE2 project. + Creates a new RIFE2 web application project. Usage : ${topic} package The package of the project to create diff --git a/src/main/java/rife/bld/operations/CreateAppOperation.java b/src/main/java/rife/bld/operations/CreateAppOperation.java new file mode 100644 index 0000000..996fe36 --- /dev/null +++ b/src/main/java/rife/bld/operations/CreateAppOperation.java @@ -0,0 +1,26 @@ +/* + * Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) + * Licensed under the Apache License, Version 2.0 (the "License") + */ +package rife.bld.operations; + +import rife.bld.Project; +import rife.bld.blueprints.AppProjectBlueprint; + +import java.io.File; + +/** + * Creates a new app project structure. + * + * @author Geert Bevin (gbevin[remove] at uwyn dot com) + * @since 1.8 + */ +public class CreateAppOperation extends AbstractCreateOperation { + public CreateAppOperation() { + super("bld.app."); + } + + protected Project createProjectBlueprint() { + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName()); + } +} diff --git a/src/main/java/rife/bld/operations/CreateBlankOperation.java b/src/main/java/rife/bld/operations/CreateBlankOperation.java deleted file mode 100644 index a52a1db..0000000 --- a/src/main/java/rife/bld/operations/CreateBlankOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) - * Licensed under the Apache License, Version 2.0 (the "License") - */ -package rife.bld.operations; - -import rife.bld.Project; -import rife.bld.blueprints.BlankProjectBlueprint; - -import java.io.File; - -/** - * Creates a new blank project structure. - * - * @author Geert Bevin (gbevin[remove] at uwyn dot com) - * @since 1.5 - */ -public class CreateBlankOperation extends AbstractCreateOperation { - public CreateBlankOperation() { - super("bld.blank."); - } - - protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName()); - } -} diff --git a/src/main/java/rife/bld/operations/CreateOperation.java b/src/main/java/rife/bld/operations/CreateOperation.java index ebd577d..fbec33e 100644 --- a/src/main/java/rife/bld/operations/CreateOperation.java +++ b/src/main/java/rife/bld/operations/CreateOperation.java @@ -18,7 +18,7 @@ public class CreateOperation { private static final String BASE = "base"; - private static final String BLANK = "blank"; + private static final String APP = "app"; private static final String LIB = "lib"; private static final String RIFE2 = "rife2"; @@ -48,14 +48,14 @@ public class CreateOperation { if (type == null || type.isEmpty()) { System.out.println("Please enter a number for the project type:"); - System.out.printf(" 1: %s%n", BASE); - System.out.printf(" 2: %s%n", BLANK); - System.out.printf(" 3: %s%n", LIB); - System.out.printf(" 4: %s%n", RIFE2); + System.out.printf(" 1: %s (Java baseline project)%n", BASE); + System.out.printf(" 2: %s (Java application project)%n", APP); + System.out.printf(" 3: %s (Java library project)%n", LIB); + System.out.printf(" 4: %s (RIFE2 web application)%n", RIFE2); var number = System.console().readLine(); switch (Integer.parseInt(number)) { case 1 -> type = BASE; - case 2 -> type = BLANK; + case 2 -> type = APP; case 3 -> type = LIB; case 4 -> type = RIFE2; } @@ -69,7 +69,7 @@ public class CreateOperation { AbstractCreateOperation create_operation = null; switch (type) { case BASE -> create_operation = new CreateBaseOperation(); - case BLANK -> create_operation = new CreateBlankOperation(); + case APP -> create_operation = new CreateAppOperation(); case LIB -> create_operation = new CreateLibOperation(); case RIFE2 -> create_operation = new CreateRife2Operation(); } diff --git a/src/main/resources/BLD_VERSION b/src/main/resources/BLD_VERSION index d2a02c7..06898e3 100644 --- a/src/main/resources/BLD_VERSION +++ b/src/main/resources/BLD_VERSION @@ -1 +1 @@ -1.8.1-SNAPSHOT \ No newline at end of file +1.9.0-SNAPSHOT \ No newline at end of file diff --git a/src/main/resources/templates/bld/blank/idea/app_iml.xml b/src/main/resources/templates/bld/app/idea/app_iml.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/app_iml.xml rename to src/main/resources/templates/bld/app/idea/app_iml.xml diff --git a/src/main/resources/templates/bld/blank/idea/bld_iml.xml b/src/main/resources/templates/bld/app/idea/bld_iml.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/bld_iml.xml rename to src/main/resources/templates/bld/app/idea/bld_iml.xml diff --git a/src/main/resources/templates/bld/blank/idea/libraries/bld.xml b/src/main/resources/templates/bld/app/idea/libraries/bld.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/libraries/bld.xml rename to src/main/resources/templates/bld/app/idea/libraries/bld.xml diff --git a/src/main/resources/templates/bld/blank/idea/libraries/compile.xml b/src/main/resources/templates/bld/app/idea/libraries/compile.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/libraries/compile.xml rename to src/main/resources/templates/bld/app/idea/libraries/compile.xml diff --git a/src/main/resources/templates/bld/blank/idea/libraries/runtime.xml b/src/main/resources/templates/bld/app/idea/libraries/runtime.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/libraries/runtime.xml rename to src/main/resources/templates/bld/app/idea/libraries/runtime.xml diff --git a/src/main/resources/templates/bld/blank/idea/libraries/test.xml b/src/main/resources/templates/bld/app/idea/libraries/test.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/libraries/test.xml rename to src/main/resources/templates/bld/app/idea/libraries/test.xml diff --git a/src/main/resources/templates/bld/blank/idea/misc.xml b/src/main/resources/templates/bld/app/idea/misc.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/misc.xml rename to src/main/resources/templates/bld/app/idea/misc.xml diff --git a/src/main/resources/templates/bld/blank/idea/modules.xml b/src/main/resources/templates/bld/app/idea/modules.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/modules.xml rename to src/main/resources/templates/bld/app/idea/modules.xml diff --git a/src/main/resources/templates/bld/blank/idea/runConfigurations/Run_Main.xml b/src/main/resources/templates/bld/app/idea/runConfigurations/Run_Main.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/runConfigurations/Run_Main.xml rename to src/main/resources/templates/bld/app/idea/runConfigurations/Run_Main.xml diff --git a/src/main/resources/templates/bld/blank/idea/runConfigurations/Run_Tests.xml b/src/main/resources/templates/bld/app/idea/runConfigurations/Run_Tests.xml similarity index 100% rename from src/main/resources/templates/bld/blank/idea/runConfigurations/Run_Tests.xml rename to src/main/resources/templates/bld/app/idea/runConfigurations/Run_Tests.xml diff --git a/src/main/resources/templates/bld/blank/project_build.txt b/src/main/resources/templates/bld/app/project_build.txt similarity index 100% rename from src/main/resources/templates/bld/blank/project_build.txt rename to src/main/resources/templates/bld/app/project_build.txt diff --git a/src/main/resources/templates/bld/blank/project_gitignore.txt b/src/main/resources/templates/bld/app/project_gitignore.txt similarity index 100% rename from src/main/resources/templates/bld/blank/project_gitignore.txt rename to src/main/resources/templates/bld/app/project_gitignore.txt diff --git a/src/main/resources/templates/bld/blank/project_main.txt b/src/main/resources/templates/bld/app/project_main.txt similarity index 100% rename from src/main/resources/templates/bld/blank/project_main.txt rename to src/main/resources/templates/bld/app/project_main.txt diff --git a/src/main/resources/templates/bld/blank/project_test.txt b/src/main/resources/templates/bld/app/project_test.txt similarity index 100% rename from src/main/resources/templates/bld/blank/project_test.txt rename to src/main/resources/templates/bld/app/project_test.txt diff --git a/src/main/resources/templates/bld/blank/vscode/launch.json b/src/main/resources/templates/bld/app/vscode/launch.json similarity index 100% rename from src/main/resources/templates/bld/blank/vscode/launch.json rename to src/main/resources/templates/bld/app/vscode/launch.json diff --git a/src/main/resources/templates/bld/blank/vscode/settings.json b/src/main/resources/templates/bld/app/vscode/settings.json similarity index 100% rename from src/main/resources/templates/bld/blank/vscode/settings.json rename to src/main/resources/templates/bld/app/vscode/settings.json diff --git a/src/test/java/rife/bld/TestProject.java b/src/test/java/rife/bld/TestProject.java index eaea1a8..cce0c6c 100644 --- a/src/test/java/rife/bld/TestProject.java +++ b/src/test/java/rife/bld/TestProject.java @@ -157,6 +157,61 @@ void testCustomCommand() } } + static class CustomProjectRenamedCommand extends Project { + StringBuilder result_; + + CustomProjectRenamedCommand(File tmp, StringBuilder result) { + result_ = result; + workDirectory = tmp; + pkg = "test.pkg"; + name = "my_project"; + version = new VersionNumber(0, 0, 1); + } + + @BuildCommand(value = "renamed", alias = "alias") + public void newcommand() { + assertEquals("renamed", getCurrentCommandName()); + assertNotNull(getCurrentCommandDefinition()); + result_.append("renamed"); + } + } + + @Test + void testRenamedCustomCommand() + throws Exception { + var tmp = Files.createTempDirectory("test").toFile(); + try { + var result = new StringBuilder(); + var project = new CustomProjectRenamedCommand(tmp, result); + + assertNull(project.getCurrentCommandName()); + assertNull(project.getCurrentCommandDefinition()); + + project.execute(new String[]{"renamed"}); + + assertNull(project.getCurrentCommandName()); + assertNull(project.getCurrentCommandDefinition()); + + assertEquals("renamed", result.toString()); + + // test alias + result = new StringBuilder(); + project = new CustomProjectRenamedCommand(tmp, result); + + assertNull(project.getCurrentCommandName()); + assertNull(project.getCurrentCommandDefinition()); + + project.execute(new String[]{"alias"}); + + assertNull(project.getCurrentCommandName()); + assertNull(project.getCurrentCommandDefinition()); + + assertEquals("renamed", result.toString()); + } finally { + FileUtils.deleteDirectory(tmp); + } + } + static class CustomProjectInlineHelp extends Project { CustomProjectInlineHelp(File tmp) { workDirectory = tmp; diff --git a/src/test/java/rife/bld/operations/TestCompileOperation.java b/src/test/java/rife/bld/operations/TestCompileOperation.java index fc6b478..de7cedf 100644 --- a/src/test/java/rife/bld/operations/TestCompileOperation.java +++ b/src/test/java/rife/bld/operations/TestCompileOperation.java @@ -11,7 +11,6 @@ import javax.tools.DiagnosticCollector; import javax.tools.JavaFileObject; import java.io.File; -import java.net.URL; import java.nio.file.Files; import java.util.List; @@ -214,7 +213,7 @@ void testFromProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("tst") .projectName("app") diff --git a/src/test/java/rife/bld/operations/TestCreateBlankOperation.java b/src/test/java/rife/bld/operations/TestCreateAppOperation.java similarity index 98% rename from src/test/java/rife/bld/operations/TestCreateBlankOperation.java rename to src/test/java/rife/bld/operations/TestCreateAppOperation.java index 5c858e1..a05e4b6 100644 --- a/src/test/java/rife/bld/operations/TestCreateBlankOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateAppOperation.java @@ -19,10 +19,10 @@ import static org.junit.jupiter.api.Assertions.*; -public class TestCreateBlankOperation { +public class TestCreateAppOperation { @Test void testInstantiation() { - var operation = new CreateBlankOperation(); + var operation = new CreateAppOperation(); assertNotNull(operation.workDirectory()); assertTrue(operation.workDirectory().exists()); assertTrue(operation.workDirectory().isDirectory()); @@ -41,7 +41,7 @@ void testPopulation() var package_name = "packageName"; var project_name = "projectName"; - var operation = new CreateBlankOperation(); + var operation = new CreateAppOperation(); operation .workDirectory(work_directory) .downloadDependencies(download_dependencies) @@ -62,7 +62,7 @@ void testExecute() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("com.example") .projectName("myapp") @@ -236,7 +236,7 @@ void testExecuteNoDownload() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("org.stuff") .projectName("yourthing"); @@ -312,7 +312,7 @@ void testExecuteLocalDependencies() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("com.example") .projectName("myapp") @@ -436,7 +436,7 @@ void testExecuteLocalDependenciesFolders() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("com.example") .projectName("myapp") diff --git a/src/test/java/rife/bld/operations/TestJUnitOperation.java b/src/test/java/rife/bld/operations/TestJUnitOperation.java index 4b6436c..b9aac21 100644 --- a/src/test/java/rife/bld/operations/TestJUnitOperation.java +++ b/src/test/java/rife/bld/operations/TestJUnitOperation.java @@ -16,7 +16,6 @@ import java.util.function.Function; import static org.junit.jupiter.api.Assertions.*; -import static rife.bld.dependencies.Scope.test; public class TestJUnitOperation { @Test @@ -176,7 +175,7 @@ void testFromProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("com.example") .projectName("myapp") @@ -219,7 +218,7 @@ void testFromOldProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() { + var create_operation = new CreateAppOperation() { @Override protected Project createProjectBlueprint() { var project = super.createProjectBlueprint(); diff --git a/src/test/java/rife/bld/operations/TestJarOperation.java b/src/test/java/rife/bld/operations/TestJarOperation.java index 8f70192..4257b6e 100644 --- a/src/test/java/rife/bld/operations/TestJarOperation.java +++ b/src/test/java/rife/bld/operations/TestJarOperation.java @@ -182,7 +182,7 @@ void testFromProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("tst") .projectName("app") diff --git a/src/test/java/rife/bld/operations/TestJavadocOperation.java b/src/test/java/rife/bld/operations/TestJavadocOperation.java index 672bcef..9c94c22 100644 --- a/src/test/java/rife/bld/operations/TestJavadocOperation.java +++ b/src/test/java/rife/bld/operations/TestJavadocOperation.java @@ -263,7 +263,7 @@ void testFromProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("tst") .projectName("app") diff --git a/src/test/java/rife/bld/operations/TestPublishOperation.java b/src/test/java/rife/bld/operations/TestPublishOperation.java index 86bab35..d4f9d63 100644 --- a/src/test/java/rife/bld/operations/TestPublishOperation.java +++ b/src/test/java/rife/bld/operations/TestPublishOperation.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; import rife.bld.Project; -import rife.bld.blueprints.BlankProjectBlueprint; +import rife.bld.blueprints.AppProjectBlueprint; import rife.bld.dependencies.*; import rife.bld.publish.PublishArtifact; import rife.tools.FileUtils; @@ -136,7 +136,7 @@ void testPublishRelease() assertThrows(FileUtilsErrorException.class, () -> FileUtils.readString(new URL("http://localhost:8081/api/maven/details/releases/test/pkg/myapp/0.0.1"))); // create a first publication - var create_operation1 = new CreateBlankOperation() + var create_operation1 = new CreateAppOperation() .workDirectory(tmp1) .packageName("test.pkg") .projectName("myapp") @@ -193,9 +193,9 @@ void testPublishRelease() assertEquals("myapp-0.0.1.pom", version_files_json1.getJSONObject(9).get("name")); // created an updated publication - var create_operation2 = new CreateBlankOperation() { + var create_operation2 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 0, 0)); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 0, 0)); } } .workDirectory(tmp2) @@ -286,7 +286,7 @@ void testPublishReleaseLocal() var tmp_local = Files.createTempDirectory("test").toFile(); try { // create a first publication - var create_operation1 = new CreateBlankOperation() + var create_operation1 = new CreateAppOperation() .workDirectory(tmp1) .packageName("test.pkg") .projectName("myapp") @@ -326,9 +326,9 @@ void testPublishReleaseLocal() assertTrue(maven_metadata1.getVersions().contains(create_operation1.project().version())); // created an updated publication - var create_operation2 = new CreateBlankOperation() { + var create_operation2 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 0, 0)); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 0, 0)); } } .workDirectory(tmp2) @@ -403,9 +403,9 @@ void testPublishSnapshot() assertThrows(FileUtilsErrorException.class, () -> FileUtils.readString(new URL("http://localhost:8081/api/maven/details/releases/test/pkg/myapp/1.2.3-SNAPSHOT"))); // create a first publication - var create_operation1 = new CreateBlankOperation() { + var create_operation1 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); } } .workDirectory(tmp1) @@ -480,9 +480,9 @@ protected Project createProjectBlueprint() { assertTrue(maven_snapshot_metadata1.getVersions().contains(create_operation1.project().version())); // created an updated publication - var create_operation2 = new CreateBlankOperation() { + var create_operation2 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); } } .workDirectory(tmp2) @@ -573,9 +573,9 @@ void testPublishSnapshotLocal() var tmp_local = Files.createTempDirectory("test").toFile(); try { // create a first publication - var create_operation1 = new CreateBlankOperation() { + var create_operation1 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); } } .workDirectory(tmp1) @@ -629,9 +629,9 @@ protected Project createProjectBlueprint() { assertTrue(maven_snapshot_metadata1.getVersions().contains(create_operation1.project().version())); // created an updated publication - var create_operation2 = new CreateBlankOperation() { + var create_operation2 = new CreateAppOperation() { protected Project createProjectBlueprint() { - return new BlankProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); + return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), new VersionNumber(1, 2, 3, "SNAPSHOT")); } } .workDirectory(tmp2) diff --git a/src/test/java/rife/bld/operations/TestRunOperation.java b/src/test/java/rife/bld/operations/TestRunOperation.java index f213ff5..6073ee6 100644 --- a/src/test/java/rife/bld/operations/TestRunOperation.java +++ b/src/test/java/rife/bld/operations/TestRunOperation.java @@ -160,7 +160,7 @@ void testFromProject() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("com.example") .projectName("myapp") diff --git a/src/test/java/rife/bld/operations/TestUberJarOperation.java b/src/test/java/rife/bld/operations/TestUberJarOperation.java index ab35e69..41429a2 100644 --- a/src/test/java/rife/bld/operations/TestUberJarOperation.java +++ b/src/test/java/rife/bld/operations/TestUberJarOperation.java @@ -90,11 +90,11 @@ void testPopulation() { } @Test - void testFromProjectBlank() + void testFromProjectApp() throws Exception { var tmp = Files.createTempDirectory("test").toFile(); try { - var create_operation = new CreateBlankOperation() + var create_operation = new CreateAppOperation() .workDirectory(tmp) .packageName("tst") .projectName("app")