Compare commits

..

5 commits

Author SHA1 Message Date
b8a02dce9e
Changed to ConcurrentSkipListMap to preserve order
Some checks failed
bld-ci / build-bld-project (17, 1.9.24) (push) Has been cancelled
bld-ci / build-bld-project (17, 2.0.21) (push) Has been cancelled
bld-ci / build-bld-project (21, 1.9.24) (push) Has been cancelled
bld-ci / build-bld-project (21, 2.0.21) (push) Has been cancelled
bld-ci / build-bld-project (23, 1.9.24) (push) Has been cancelled
bld-ci / build-bld-project (23, 2.0.21) (push) Has been cancelled
javadocs-pages / deploy (push) Has been cancelled
2024-10-27 16:54:11 -07:00
aa8d50d4cb
Minor cleanups 2024-10-27 16:23:21 -07:00
ca811b1469
Updated dependencies
Bumped JUnit version to 5.11.3
Bumped PMD extension version to 1.1.7
Bumped JDK to version 23 (GitHub CI Workflow)
Bumped Kotlin to version 2.0.21
Bumped Kotlin extension to version 1.0.2
2024-10-27 16:22:57 -07:00
d797c515bb
Added soft assertions 2024-10-27 16:19:33 -07:00
0983f323a2
Added GitHub repository 2024-10-27 16:18:18 -07:00
10 changed files with 87 additions and 74 deletions

View file

@ -1,6 +1,6 @@
name: bld-ci name: bld-ci
on: [ push, pull_request, workflow_dispatch ] on: [push, pull_request, workflow_dispatch]
jobs: jobs:
build-bld-project: build-bld-project:
@ -8,8 +8,8 @@ jobs:
strategy: strategy:
matrix: matrix:
java-version: [ 17, 21, 22 ] java-version: [17, 21, 23]
kotlin-version: [ 1.19.24, 2.0.0 ] kotlin-version: [1.9.24, 2.0.21]
steps: steps:
- name: Checkout source repository - name: Checkout source repository

View file

@ -7,9 +7,9 @@
<!-- BEST PRACTICES --> <!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml"> <rule ref="category/java/bestpractices.xml">
<exclude name="AvoidPrintStackTrace"/> <exclude name="AvoidPrintStackTrace"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="GuardLogStatement"/> <exclude name="GuardLogStatement"/>
<exclude name="UnitTestContainsTooManyAsserts"/>
<exclude name="UnitTestShouldUseTestAnnotation"/>
</rule> </rule>
<rule ref="category/java/bestpractices.xml/MissingOverride"> <rule ref="category/java/bestpractices.xml/MissingOverride">

View file

@ -2,7 +2,7 @@ bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.downloadLocation=
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.1 bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.1
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.1 bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.2
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.1.0 bld.version=2.1.0

View file

@ -34,13 +34,13 @@ public class ExampleBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES); repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
final var kotlin = version(2, 0, 20); final var kotlin = version(2, 0, 21);
scope(compile) scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)); .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin));
scope(test) scope(test)
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin)) .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0))); .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 3)));
// Include the Kotlin source directory when creating or publishing sources Java Archives // Include the Kotlin source directory when creating or publishing sources Java Archives
jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin")); jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin"));

View file

@ -2,7 +2,7 @@ bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.downloadLocation=
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.3 bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.3
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.5 bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.7
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.1.0 bld.version=2.1.0

View file

@ -39,6 +39,7 @@ public class DokkaOperationBuild extends Project {
downloadSources = true; downloadSources = true;
autoDownloadPurge = true; autoDownloadPurge = true;
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
var dokka = version(1, 9, 20); var dokka = version(1, 9, 20);
@ -51,8 +52,8 @@ public class DokkaOperationBuild extends Project {
.include(dependency("org.jetbrains.dokka", "jekyll-plugin", dokka)) .include(dependency("org.jetbrains.dokka", "jekyll-plugin", dokka))
.include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0))); .include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0)));
scope(test) scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 3)))
.include(dependency("org.assertj", "assertj-core", version(3, 26, 3))); .include(dependency("org.assertj", "assertj-core", version(3, 26, 3)));
javadocOperation() javadocOperation()
@ -63,28 +64,26 @@ public class DokkaOperationBuild extends Project {
publishOperation() publishOperation()
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2")) .repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
.repository(repository("github"))
.info() .info()
.groupId("com.uwyn.rife2") .groupId("com.uwyn.rife2")
.artifactId(name) .artifactId(name)
.description("bld Dokka Extension") .description("bld Dokka Extension")
.url("https://github.com/rife2/bld-dokka") .url("https://github.com/rife2/bld-dokka")
.developer( .developer(new PublishDeveloper()
new PublishDeveloper() .id("ethauvin")
.id("ethauvin") .name("Erik C. Thauvin")
.name("Erik C. Thauvin") .email("erik@thauvin.net")
.email("erik@thauvin.net") .url("https://erik.thauvin.net/")
.url("https://erik.thauvin.net/")
) )
.license( .license(new PublishLicense()
new PublishLicense() .name("The Apache License, Version 2.0")
.name("The Apache License, Version 2.0") .url("https://www.apache.org/licenses/LICENSE-2.0.txt")
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
) )
.scm( .scm(new PublishScm()
new PublishScm() .connection("scm:git:https://github.com/rife2/bld-dokka.git")
.connection("scm:git:https://github.com/rife2/bld-dokka.git") .developerConnection("scm:git:git@github.com:rife2/bld-dokka.git")
.developerConnection("scm:git:git@github.com:rife2/bld-dokka.git") .url("https://github.com/rife2/bld-dokka")
.url("https://github.com/rife2/bld-dokka")
) )
.signKey(property("sign.key")) .signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase")); .signPassphrase(property("sign.passphrase"));

View file

@ -45,13 +45,13 @@ import java.util.stream.Collectors;
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes") @SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> { public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
public static final String SEMICOLON = ";"; public static final String SEMICOLON = ";";
private final static String GFM_PLUGIN_REGEXP = private static final String GFM_PLUGIN_REGEXP =
"^.*(dokka-base|analysis-kotlin-descriptors|gfm-plugin|freemarker).*\\.jar$"; "^.*(dokka-base|analysis-kotlin-descriptors|gfm-plugin|freemarker).*\\.jar$";
private final static String HTML_PLUGIN_REGEXP = private static final String HTML_PLUGIN_REGEXP =
"^.*(dokka-base|analysis-kotlin-descriptors|kotlinx-html-jvm|freemarker).*\\.jar$"; "^.*(dokka-base|analysis-kotlin-descriptors|kotlinx-html-jvm|freemarker).*\\.jar$";
private final static String JAVADOC_PLUGIN_REGEXP = private static final String JAVADOC_PLUGIN_REGEXP =
"^.*(dokka-base|analysis-kotlin-descriptors|javadoc-plugin|kotlin-as-java-plugin|korte-jvm).*\\.jar$"; "^.*(dokka-base|analysis-kotlin-descriptors|javadoc-plugin|kotlin-as-java-plugin|korte-jvm).*\\.jar$";
private final static String JEKYLL_PLUGIN_REGEXP = private static final String JEKYLL_PLUGIN_REGEXP =
"^.*(dokka-base|analysis-kotlin-descriptors|jekyll-plugin|gfm-plugin|freemarker).*\\.jar$"; "^.*(dokka-base|analysis-kotlin-descriptors|jekyll-plugin|gfm-plugin|freemarker).*\\.jar$";
private final Logger LOGGER = Logger.getLogger(DokkaOperation.class.getName()); private final Logger LOGGER = Logger.getLogger(DokkaOperation.class.getName());
private final Map<String, String> globalLinks_ = new ConcurrentHashMap<>(); private final Map<String, String> globalLinks_ = new ConcurrentHashMap<>();

View file

@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -33,15 +33,16 @@ import java.util.stream.Collectors;
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("PMD.UseConcurrentHashMap")
public class SourceSet { public class SourceSet {
private final Collection<File> classpath_ = new ArrayList<>(); private final Collection<File> classpath_ = new ArrayList<>();
private final Map<String, String> dependentSourceSets_ = new ConcurrentHashMap<>(); private final Map<String, String> dependentSourceSets_ = new ConcurrentSkipListMap<>();
private final Collection<DocumentedVisibility> documentedVisibilities_ = new ArrayList<>(); private final Collection<DocumentedVisibility> documentedVisibilities_ = new ArrayList<>();
private final Map<String, String> externalDocumentationLinks_ = new ConcurrentHashMap<>(); private final Map<String, String> externalDocumentationLinks_ = new ConcurrentSkipListMap<>();
private final Collection<File> includes_ = new ArrayList<>(); private final Collection<File> includes_ = new ArrayList<>();
private final Collection<String> perPackageOptions_ = new ArrayList<>(); private final Collection<String> perPackageOptions_ = new ArrayList<>();
private final Collection<File> samples_ = new ArrayList<>(); private final Collection<File> samples_ = new ArrayList<>();
private final Map<String, String> srcLinks_ = new ConcurrentHashMap<>(); private final Map<String, String> srcLinks_ = new ConcurrentSkipListMap<>();
private final Collection<File> src_ = new ArrayList<>(); private final Collection<File> src_ = new ArrayList<>();
private final Collection<File> suppressedFiles_ = new ArrayList<>(); private final Collection<File> suppressedFiles_ = new ArrayList<>();
private AnalysisPlatform analysisPlatform_; private AnalysisPlatform analysisPlatform_;

View file

@ -16,6 +16,7 @@
package rife.bld.extension; package rife.bld.extension;
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import rife.bld.blueprints.BaseProjectBlueprint; import rife.bld.blueprints.BaseProjectBlueprint;
@ -107,23 +108,27 @@ class DokkaOperationTest {
))) )))
.suppressInheritedMembers(true); .suppressInheritedMembers(true);
assertThat(op.globalLinks()).as("globalLinks").hasSize(2); try (var softly = new AutoCloseableSoftAssertions()) {
assertThat(op.globalPackageOptions()).as("globalPackageOptions").hasSize(4); softly.assertThat(op.globalLinks()).as("globalLinks").hasSize(2);
assertThat(op.globalSrcLink()).as("globalSrcLink").hasSize(4); softly.assertThat(op.globalPackageOptions()).as("globalPackageOptions").hasSize(4);
assertThat(op.includes()).as("includes").hasSize(4); softly.assertThat(op.globalSrcLink()).as("globalSrcLink").hasSize(4);
assertThat(op.pluginConfigurations()).as("pluginConfigurations").hasSize(3); softly.assertThat(op.includes()).as("includes").hasSize(4);
assertThat(op.pluginsClasspath()).as("pluginsClasspath").hasSize(9); softly.assertThat(op.pluginConfigurations()).as("pluginConfigurations").hasSize(3);
softly.assertThat(op.pluginsClasspath()).as("pluginsClasspath").hasSize(9);
}
var params = op.executeConstructProcessCommandList(); var params = op.executeConstructProcessCommandList();
for (var p : args) { try (var softly = new AutoCloseableSoftAssertions()) {
var found = false; for (var p : args) {
for (var a : params) { var found = false;
if (a.startsWith(p)) { for (var a : params) {
found = true; if (a.startsWith(p)) {
break; found = true;
break;
}
} }
softly.assertThat(found).as(p + " not found.").isTrue();
} }
assertThat(found).as(p + " not found.").isTrue();
} }
var path = EXAMPLES.getAbsolutePath(); var path = EXAMPLES.getAbsolutePath();
@ -157,14 +162,17 @@ class DokkaOperationTest {
assertThat(params).hasSize(matches.size()); assertThat(params).hasSize(matches.size());
IntStream.range(0, params.size()).forEach(i -> { try (var softly = new AutoCloseableSoftAssertions()) {
if (params.get(i).contains(".jar;")) { IntStream.range(0, params.size()).forEach(i -> {
var jars = params.get(i).split(";"); if (params.get(i).contains(".jar;")) {
Arrays.stream(jars).forEach(jar -> assertThat(matches.get(i)).as(matches.get(i)).contains(jar)); var jars = params.get(i).split(";");
} else { Arrays.stream(jars).forEach(jar ->
assertThat(params.get(i)).as(params.get(i)).isEqualTo(matches.get(i)); softly.assertThat(matches.get(i)).as(matches.get(i)).contains(jar));
} } else {
}); softly.assertThat(params.get(i)).as(params.get(i)).isEqualTo(matches.get(i));
}
});
}
} }
@Test @Test

View file

@ -16,6 +16,7 @@
package rife.bld.extension.dokka; package rife.bld.extension.dokka;
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
@ -170,7 +171,7 @@ class SourceSetTest {
var matches = List.of( var matches = List.of(
"-classpath", localPath(PATH_1, PATH_2), "-classpath", localPath(PATH_1, PATH_2),
"-dependentSourceSets", "set1/set2;set3/set4", "-dependentSourceSets", "set1/set2;set3/set4",
"-externalDocumentationLinks", "link3^link4^^link1^link2", "-externalDocumentationLinks", "link1^link2^^link3^link4",
"-perPackageOptions", OPTION_1 + ';' + OPTION_2, "-perPackageOptions", OPTION_1 + ';' + OPTION_2,
"-samples", localPath(SAMPLES_1, SAMPLES_2, SAMPLES_3), "-samples", localPath(SAMPLES_1, SAMPLES_2, SAMPLES_3),
"-suppressedFiles", localPath(SUP_1, SUP_2, SUP_3) "-suppressedFiles", localPath(SUP_1, SUP_2, SUP_3)
@ -225,28 +226,32 @@ class SourceSetTest {
.srcLink(Path.of(PATH_3), "remote3", "#suffix3") .srcLink(Path.of(PATH_3), "remote3", "#suffix3")
.suppressedFiles(SUP_1, SUP_2); .suppressedFiles(SUP_1, SUP_2);
assertThat(sourceSet.classpath()).as("classpath").hasSize(2); try (var softly = new AutoCloseableSoftAssertions()) {
assertThat(sourceSet.dependentSourceSets()).as("dependentSourceSets").hasSize(2); softly.assertThat(sourceSet.classpath()).as("classpath").hasSize(2);
assertThat(sourceSet.documentedVisibilities()).as("documentedVisibilities").hasSize(2); softly.assertThat(sourceSet.dependentSourceSets()).as("dependentSourceSets").hasSize(2);
assertThat(sourceSet.externalDocumentationLinks()).as("externalDocumentationLinks").hasSize(2); softly.assertThat(sourceSet.documentedVisibilities()).as("documentedVisibilities").hasSize(2);
assertThat(sourceSet.includes()).as("includes").hasSize(4); softly.assertThat(sourceSet.externalDocumentationLinks()).as("externalDocumentationLinks").hasSize(2);
assertThat(sourceSet.perPackageOptions()).as("perPackageOptions").hasSize(2); softly.assertThat(sourceSet.includes()).as("includes").hasSize(4);
assertThat(sourceSet.samples()).as("samples").hasSize(2); softly.assertThat(sourceSet.perPackageOptions()).as("perPackageOptions").hasSize(2);
assertThat(sourceSet.src()).as("src").hasSize(4); softly.assertThat(sourceSet.samples()).as("samples").hasSize(2);
assertThat(sourceSet.srcLinks()).as("srcLinks").hasSize(3); softly.assertThat(sourceSet.src()).as("src").hasSize(4);
assertThat(sourceSet.suppressedFiles()).as("suppressedFiles").hasSize(2); softly.assertThat(sourceSet.srcLinks()).as("srcLinks").hasSize(3);
softly.assertThat(sourceSet.suppressedFiles()).as("suppressedFiles").hasSize(2);
}
var params = sourceSet.args(); var params = sourceSet.args();
for (var p : args) { try (var softly = new AutoCloseableSoftAssertions()) {
var found = false; for (var p : args) {
for (var a : params) { var found = false;
if (a.startsWith(p)) { for (var a : params) {
found = true; if (a.startsWith(p)) {
break; found = true;
break;
}
} }
softly.assertThat(found).as(p + " not found.").isTrue();
} }
assertThat(found).as(p + " not found.").isTrue();
} }
var matches = List.of( var matches = List.of(