mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-27 00:38:12 -07:00
Test fixes for changed dependency versions.
Tweaked vscode project structures. Changed lib project to use JUnit and extend Project instead of BaseProject
This commit is contained in:
parent
183097c4f9
commit
30101af0ab
18 changed files with 240 additions and 424 deletions
|
@ -13,6 +13,7 @@ import java.util.List;
|
|||
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
|
||||
/**
|
||||
* Provides the dependency information required to create a new lib project.
|
||||
|
@ -35,5 +36,8 @@ public class LibProjectBlueprint extends Project {
|
|||
|
||||
downloadSources = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
|
||||
scope(test)
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,2)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,2)));
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ public class Rife2ProjectBlueprint extends WebProject {
|
|||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "rife2", version(1,7,3)));
|
||||
scope(test)
|
||||
.include(dependency("org.jsoup", "jsoup", version(1,17,3)))
|
||||
.include(dependency("org.jsoup", "jsoup", version(1,17,2)))
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,2)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,2)));
|
||||
scope(standalone)
|
||||
|
|
|
@ -206,8 +206,12 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
|
|||
// project build
|
||||
var build_template = TemplateFactory.TXT.get(templateBase_ + "project_build");
|
||||
build_template.setValue("projectBuild", projectBuildName_);
|
||||
build_template.setValue("package", project_.pkg());
|
||||
build_template.setValue("project", projectClassName_);
|
||||
if (build_template.hasValueId("package")) {
|
||||
build_template.setValue("package", project_.pkg());
|
||||
}
|
||||
if (build_template.hasValueId("project")) {
|
||||
build_template.setValue("project", projectClassName_);
|
||||
}
|
||||
if (build_template.hasValueId("projectMain")) {
|
||||
build_template.setValue("projectMain", projectMainName_);
|
||||
}
|
||||
|
@ -326,17 +330,6 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
|
|||
*/
|
||||
protected void executePopulateVscodeProject()
|
||||
throws FileUtilsErrorException {
|
||||
var launch_template = TemplateFactory.JSON.get(templateBase_ + "vscode.launch");
|
||||
launch_template.setValue("package", project_.pkg());
|
||||
if (launch_template.hasValueId("projectMain")) {
|
||||
launch_template.setValue("projectMain", projectMainName_);
|
||||
}
|
||||
if (launch_template.hasValueId("projectTest")) {
|
||||
launch_template.setValue("projectTest", projectTestName_);
|
||||
}
|
||||
var launch_file = new File(vscodeDirectory_, "launch.json");
|
||||
FileUtils.writeString(launch_template.getContent(), launch_file);
|
||||
|
||||
var settings_template = TemplateFactory.JSON.get(templateBase_ + "vscode.settings");
|
||||
if (settings_template.hasValueId("version")) {
|
||||
settings_template.setValue("version", BldVersion.getVersion());
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Main",
|
||||
"request": "launch",
|
||||
"mainClass": "{{v package/}}.{{v projectMain/}}"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "org.junit.platform.console.ConsoleLauncher",
|
||||
"args": [
|
||||
"--details=verbose",
|
||||
"--scan-classpath",
|
||||
"--disable-banner",
|
||||
"--disable-ansi-colors",
|
||||
"--exclude-engine=junit-platform-suite",
|
||||
"--exclude-engine=junit-vintage"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}/.bld/dist/bld-{{v version/}}.jar",
|
||||
"lib/bld/*.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/provided/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Main",
|
||||
"request": "launch",
|
||||
"mainClass": "{{v package/}}.{{v projectMain/}}"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "{{v package/}}.{{v projectTest/}}"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}/.bld/dist/bld-{{v version/}}.jar",
|
||||
"lib/bld/*.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/provided/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="{{v package/}}.{{v projectTest/}}" />
|
||||
<configuration default="false" name="Run Tests" type="JUnit" factoryName="JUnit">
|
||||
<module name="app" />
|
||||
<option name="PACKAGE_NAME" value="moog" />
|
||||
<option name="MAIN_CLASS_NAME" value="{{v package/}}" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="directory" />
|
||||
<dir value="$PROJECT_DIR$/src/test/java" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
package {{v package/}};
|
||||
|
||||
import rife.bld.BaseProject;
|
||||
import rife.bld.Project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class {{v projectBuild/}} extends BaseProject {
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
import static rife.bld.dependencies.Scope.*;
|
||||
|
||||
public class {{v projectBuild/}} extends Project {
|
||||
public {{v projectBuild/}}() {
|
||||
pkg = "{{v package/}}";
|
||||
name = "{{v project/}}";
|
||||
version = version(0,1,0);
|
||||
|
||||
testOperation().mainClass("{{v package/}}.{{v projectTest/}}");
|
||||
}
|
||||
downloadSources = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
{{v scopes}}{{/v}}{{b scope}} scope({{v name/}}){{v dependencies}}{{/v}};
|
||||
{{b dependency}}
|
||||
.include(dependency("{{v groupId/}}", "{{v artifactId/}}", version({{v version/}}))){{/b}}{{/b}} }
|
||||
|
||||
public static void main(String[] args) {
|
||||
new {{v projectBuild/}}().start(args);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package {{v package/}};
|
||||
|
||||
public class {{v projectTest/}} {
|
||||
void verifyHello() {
|
||||
if (!"Hello World!".equals(new {{v projectMain/}}().getMessage())) {
|
||||
throw new AssertionError();
|
||||
} else {
|
||||
System.out.println("Succeeded");
|
||||
}
|
||||
}
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new {{v projectTest/}}().verifyHello();
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class {{v projectTest/}} {
|
||||
@Test
|
||||
void verifyHello() {
|
||||
assertEquals("Hello World!", new {{v projectMain/}}().getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "{{v package/}}.{{v projectTest/}}"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}/.bld/dist/bld-{{v version/}}.jar",
|
||||
"lib/bld/*.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/provided/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Main",
|
||||
"request": "launch",
|
||||
"mainClass": "{{v package/}}.{{v projectMain/}}"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "org.junit.platform.console.ConsoleLauncher",
|
||||
"args": [
|
||||
"--details=verbose",
|
||||
"--scan-classpath",
|
||||
"--disable-banner",
|
||||
"--disable-ansi-colors",
|
||||
"--exclude-engine=junit-platform-suite",
|
||||
"--exclude-engine=junit-vintage"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}/.bld/dist/bld-{{v version/}}.jar",
|
||||
"lib/bld/*.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/provided/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue