diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index bf65051..21cca4a 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -1,14 +1,16 @@ name: bld-ci -on: [push, pull_request, workflow_dispatch] +on: [ push, pull_request, workflow_dispatch ] jobs: build-bld-project: - runs-on: ubuntu-latest - strategy: matrix: - java-version: [17, 21, 22] + java-version: [ 17, 21, 24 ] + kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + + runs-on: ${{ matrix.os }} steps: - name: Checkout source repository @@ -22,8 +24,28 @@ jobs: distribution: "zulu" java-version: ${{ matrix.java-version }} + - name: Download dependencies [examples] + working-directory: examples + run: ./bld download + + - name: Compile run [examples] + working-directory: examples + run: ./bld compile run + + - name: Update version properties and run [examples] + working-directory: examples + run: | + ./bld update-major run + ./bld update-minor run + ./bld update-patch run + ./bld update-release run + + - name: Delete version properties and run [examples] + working-directory: examples + run: ./bld delete-version run + - name: Download dependencies run: ./bld download - name: Run tests - run: ./bld compile test + run: ./bld compile test \ No newline at end of file diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index bf43624..508f6a5 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@v1 + uses: actions/upload-pages-artifact@v3 with: # Upload generated Javadocs repository path: "build/javadoc/" - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 + uses: actions/deploy-pages@v4 diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index ade80da..4446c15 100644 --- a/.idea/copyright/Apache_License.xml +++ b/.idea/copyright/Apache_License.xml @@ -1,6 +1,6 @@ - - + \ No newline at end of file diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100644 index 0000000..81220b4 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index 4dd96bf..153a060 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml index 9bd86aa..99cc0c0 100644 --- a/.idea/libraries/compile.xml +++ b/.idea/libraries/compile.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml index 81feb0b..56ddbf1 100644 --- a/.idea/libraries/runtime.xml +++ b/.idea/libraries/runtime.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml index 13b6513..f72f7a3 100644 --- a/.idea/libraries/test.xml +++ b/.idea/libraries/test.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 5b2667b..ba429d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-2.0.1.jar", + "${HOME}/.bld/dist/bld-2.2.1.jar", "lib/**/*.jar" ] } diff --git a/README.md b/README.md index d599633..b7ae443 100755 --- a/README.md +++ b/README.md @@ -2,14 +2,22 @@ [![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) -[![bld](https://img.shields.io/badge/2.0.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) +[![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-property-file/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-property-file) [![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-property-file/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-property-file) [![GitHub CI](https://github.com/rife2/bld-property-file/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-property-file/actions/workflows/bld.yml) -To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions). +To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file: -To create or modifying [property files](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) with [bld](https://rife2.com/bld), add the follwing to your build file: +```properties +bld.extension-property-file=com.uwyn.rife2:bld-property-file +``` + +For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation. + +## Create or Modify Property Files + +To create or modify [property files](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) with [bld](https://rife2.com/bld), add the follwing to your build file: ```java @BuildCommand diff --git a/config/pmd.xml b/config/pmd.xml index 3d3203c..2641880 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -7,9 +7,9 @@ - - + + diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml index c56c376..b1bce61 100644 --- a/examples/.idea/libraries/bld.xml +++ b/examples/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/examples/.idea/libraries/compile.xml b/examples/.idea/libraries/compile.xml index 9bd86aa..99cc0c0 100644 --- a/examples/.idea/libraries/compile.xml +++ b/examples/.idea/libraries/compile.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/examples/.idea/libraries/runtime.xml b/examples/.idea/libraries/runtime.xml index 81feb0b..56ddbf1 100644 --- a/examples/.idea/libraries/runtime.xml +++ b/examples/.idea/libraries/runtime.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/examples/.idea/libraries/test.xml b/examples/.idea/libraries/test.xml index 13b6513..f72f7a3 100644 --- a/examples/.idea/libraries/test.xml +++ b/examples/.idea/libraries/test.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json index 5b2667b..ba429d0 100644 --- a/examples/.vscode/settings.json +++ b/examples/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-2.0.1.jar", + "${HOME}/.bld/dist/bld-2.2.1.jar", "lib/**/*.jar" ] } diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar index 9633e67..2e6f0b2 100644 Binary files a/examples/lib/bld/bld-wrapper.jar and b/examples/lib/bld/bld-wrapper.jar differ diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index 1b2f976..804e68c 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ #Sun Apr 02 10:32:44 PDT 2023 bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension=com.uwyn.rife2:bld-property-file:0.9.6 +bld.extension=com.uwyn.rife2:bld-property-file:0.9.9 bld.repositories=MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES -bld.version=2.0.1 +bld.version=2.2.1 diff --git a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java index 7cc4319..8f9a29c 100644 --- a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java +++ b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java @@ -42,8 +42,8 @@ public class PropertyFileExampleBuild extends Project { repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(test) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1))); } public static void main(String[] args) { diff --git a/examples/version.properties b/examples/version.properties index 8a1539b..2d06736 100644 --- a/examples/version.properties +++ b/examples/version.properties @@ -1,7 +1,7 @@ # -#Sun Jul 28 22:07:37 PDT 2024 -build.date=2024-07-28 -release=beta.20240728220737 -version.major=1 +#Mon Jan 13 22:23:02 PST 2025 +build.date=2025-01-13 +release=beta.20250113222132 +version.major=3 version.minor=1 version.patch=20 diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index d055d00..b067ce9 100644 Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index e783f23..42fad1d 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.4 +bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.2 bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES -bld.version=2.0.1 +bld.version=2.2.1 diff --git a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java index a0b3afb..fbfd1e7 100644 --- a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java +++ b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. @@ -34,7 +34,7 @@ public class PropertyFileBuild extends Project { public PropertyFileBuild() { pkg = "rife.bld.extension"; name = "bld-property-file"; - version = version(0, 9, 6); + version = version(0, 9, 9); javaRelease = 17; downloadSources = true; @@ -42,11 +42,11 @@ public class PropertyFileBuild extends Project { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); scope(compile) - .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))); + .include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1))); scope(test) - .include(dependency("org.jsoup", "jsoup", version(1, 18, 1))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) + .include(dependency("org.jsoup", "jsoup", version(1, 19, 1))) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1))) .include(dependency("org.assertj:assertj-joda-time:2.2.0")); javadocOperation() @@ -58,6 +58,7 @@ public class PropertyFileBuild extends Project { publishOperation() .repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2")) + .repository(repository("github")) .info() .groupId("com.uwyn.rife2") .artifactId("bld-property-file") diff --git a/src/main/java/rife/bld/extension/propertyfile/Calc.java b/src/main/java/rife/bld/extension/propertyfile/Calc.java index 3f17e67..4c3f8bf 100644 --- a/src/main/java/rife/bld/extension/propertyfile/Calc.java +++ b/src/main/java/rife/bld/extension/propertyfile/Calc.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. diff --git a/src/main/java/rife/bld/extension/propertyfile/Entry.java b/src/main/java/rife/bld/extension/propertyfile/Entry.java index 9e8009a..3cdf925 100644 --- a/src/main/java/rife/bld/extension/propertyfile/Entry.java +++ b/src/main/java/rife/bld/extension/propertyfile/Entry.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryBase.java b/src/main/java/rife/bld/extension/propertyfile/EntryBase.java index ca193b1..ff9f05e 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryBase.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryDate.java b/src/main/java/rife/bld/extension/propertyfile/EntryDate.java index 0a93745..8990119 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryDate.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryDate.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. @@ -48,6 +48,16 @@ public class EntryDate extends EntryBase { return this; } + /** + * Sets the {@link java.time.format.DateTimeFormatter DateTimeFormatter} pattern. + * + * @param pattern the pattern + */ + public EntryDate pattern(String pattern) { + super.pattern(pattern); + return this; + } + /** * Sets the new {@link java.util.Properties property} value to an {@link Instant} * @@ -145,16 +155,6 @@ public class EntryDate extends EntryBase { return this; } - /** - * Sets the {@link java.time.format.DateTimeFormatter DateTimeFormatter} pattern. - * - * @param pattern the pattern - */ - public EntryDate pattern(String pattern) { - super.pattern(pattern); - return this; - } - /** * The units available for {@link EntryDate} calculations. * diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryInt.java b/src/main/java/rife/bld/extension/propertyfile/EntryInt.java index 896bbf1..b2e0e91 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryInt.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryInt.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. @@ -32,6 +32,16 @@ public class EntryInt extends EntryBase { super(key); } + /** + * Sets the {@link java.text.DecimalFormat DecimalFormat} pattern. + * + * @param pattern the pattern + */ + public EntryInt pattern(String pattern) { + super.pattern(pattern); + return this; + } + /** * Sets the new {@link java.util.Properties property} value to an integer. * @@ -42,14 +52,4 @@ public class EntryInt extends EntryBase { newValue(i); return this; } - - /** - * Sets the {@link java.text.DecimalFormat DecimalFormat} pattern. - * - * @param pattern the pattern - */ - public EntryInt pattern(String pattern) { - super.pattern(pattern); - return this; - } } diff --git a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java index c86204e..f51b288 100644 --- a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java +++ b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-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. @@ -21,6 +21,7 @@ import rife.bld.operations.AbstractOperation; import rife.bld.operations.exceptions.ExitStatusException; import java.io.File; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -34,7 +35,7 @@ import java.util.logging.Logger; * @since 1.0 */ public class PropertyFileOperation extends AbstractOperation { - private final static Logger LOGGER = Logger.getLogger(PropertyFileOperation.class.getName()); + private static final Logger LOGGER = Logger.getLogger(PropertyFileOperation.class.getName()); private final List> entries_ = new ArrayList<>(); private String comment_ = ""; private boolean failOnWarning_; @@ -152,8 +153,26 @@ public class PropertyFileOperation extends AbstractOperation v - 2); PropertyFileUtils.processDate(p, entryDate.now()); - assertThat(p.getProperty(entryDate.key())).as("processDate(now-2)").isEqualTo(String.valueOf(dayOfYear - 2)); + assertThat(p.getProperty(entryDate.key())).as("processDate(now-2)").isEqualTo(String.valueOf( + LocalDateTime.now().minusDays(2).getDayOfYear())); entryDate.calc(SUB); PropertyFileUtils.processDate(p, entryDate.set(new Date())); - assertThat(p.getProperty(entryDate.key())).as("processDate(date-1)").isEqualTo(String.valueOf(dayOfYear - 1)); + assertThat(p.getProperty(entryDate.key())).as("processDate(date-1)").isEqualTo(String.valueOf( + LocalDateTime.now().minusDays(1).getDayOfYear())); entryDate.calc(v -> v - 2); PropertyFileUtils.processDate(p, entryDate.set(Calendar.getInstance())); - assertThat(p.getProperty(entryDate.key())).as("processDate(cal-2)").isEqualTo(String.valueOf(dayOfYear - 2)); + assertThat(p.getProperty(entryDate.key())).as("processDate(cal-2)").isEqualTo(String.valueOf( + LocalDateTime.now().minusDays(2).getDayOfYear())); entryDate.calc(v -> v - 3); PropertyFileUtils.processDate(p, entryDate.set(LocalDate.now())); - assertThat(p.getProperty(entryDate.key())).as("processDate(LocalDate-3)").isEqualTo(String.valueOf(dayOfYear - 3)); + assertThat(p.getProperty(entryDate.key())).as("processDate(LocalDate-3)").isEqualTo(String.valueOf( + LocalDateTime.now().minusDays(3).getDayOfYear())); } @Test @@ -170,22 +174,26 @@ class PropertyFileUtilsTest { var entryDate = newEntryDate(); entryDate.calc(ADD); PropertyFileUtils.processDate(p, entryDate.now()); - assertThat(p.getProperty(entryDate.key())).as("processDate(now+1)").isEqualTo(String.valueOf(dayOfYear + 1)); + assertThat(p.getProperty(entryDate.key())).as("processDate(now+1)").isEqualTo(String.valueOf( + LocalDateTime.now().plusDays(1).getDayOfYear())); PropertyFileUtils.processDate(p, entryDate.now().calc(v -> v + 3)); - assertThat(p.getProperty(entryDate.key())).as("processDate(now+3)").isEqualTo(String.valueOf(dayOfYear + 3)); + assertThat(p.getProperty(entryDate.key())).as("processDate(now+3)").isEqualTo(String.valueOf( + LocalDateTime.now().plusDays(3).getDayOfYear())); entryDate.calc(ADD); PropertyFileUtils.processDate(p, entryDate.set(ZonedDateTime.now())); assertThat(p.getProperty(entryDate.key())).as("processDate(ZonedDateTime+1)") - .isEqualTo(String.valueOf(dayOfYear + 1)); + .isEqualTo(String.valueOf(LocalDateTime.now().plusDays(1).getDayOfYear())); PropertyFileUtils.processDate(p, entryDate.set(Instant.now()).calc(v -> v + 2)); - assertThat(p.getProperty(entryDate.key())).as("processDate(Instant+2)").isEqualTo(String.valueOf(dayOfYear + 2)); + assertThat(p.getProperty(entryDate.key())).as("processDate(Instant+2)").isEqualTo(String.valueOf( + LocalDateTime.now().plusDays(2).getDayOfYear())); entryDate.calc(v -> v + 3); PropertyFileUtils.processDate(p, entryDate.set(LocalDateTime.now())); - assertThat(p.getProperty(entryDate.key())).as("processDate(LocalDteTime+2)").isEqualTo(String.valueOf(dayOfYear + 3)); + assertThat(p.getProperty(entryDate.key())).as("processDate(LocalDteTime+2)") + .isEqualTo(String.valueOf(LocalDateTime.now().plusDays(3).getDayOfYear())); } @Test