From 36d2ad0b2e9b4185991a53d447c7a3d0d1508cd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 02:01:47 +0000 Subject: [PATCH 1/6] Bump github/codeql-action from 2.22.5 to 2.22.8 (#168) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.22.5 to 2.22.8. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/74483a38d39275f33fcff5f35b679b5ca4a26a99...407ffafae6a767df3e0230c3df91b6443ae8df75) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 4 ++-- .github/workflows/scorecards.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b22bc33..6b16a75 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Initialize CodeQL - uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 + uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 with: languages: ${{ matrix.language }} @@ -47,4 +47,4 @@ jobs: run: ./gradlew test - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 + uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 394d801..0a5d183 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 + uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 with: sarif_file: results.sarif From 8a79fcf7bb62587b7c95834097c9038e82018266 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 05:07:32 +0000 Subject: [PATCH 2/6] Bump gradle/gradle-build-action from 2.9.0 to 2.10.0 (#169) Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.9.0 to 2.10.0. - [Release notes](https://github.com/gradle/gradle-build-action/releases) - [Commits](https://github.com/gradle/gradle-build-action/compare/842c587ad8aa4c68eeba24c396e15af4c2e9f30a...87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6) --- updated-dependencies: - dependency-name: gradle/gradle-build-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/dependencies.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/version.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a2aaf3..9d0ce50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: java-version: '17' distribution: 'adopt' - name: Setup Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 with: gradle-home-cache-cleanup: true - name: Build diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6b16a75..53e9202 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -39,7 +39,7 @@ jobs: distribution: 'adopt' - name: Setup Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 8475dac..2788efa 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -25,7 +25,7 @@ jobs: java-version: '17' distribution: 'adopt' - name: Setup Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 with: dependency-graph: generate-and-submit gradle-home-cache-cleanup: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6a03ae..3ad94fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: distribution: 'adopt' - name: Setup Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 with: gradle-home-cache-cleanup: true - name: Ensure build is green diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index f942226..659d737 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -33,7 +33,7 @@ jobs: distribution: 'adopt' - name: Setup Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 with: gradle-home-cache-cleanup: true - name: Increment version From dc6c9c1c248e3b7dec75bb94ba08aea7c4894170 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 05:12:56 +0000 Subject: [PATCH 3/6] Bump actions/setup-java from 3.13.0 to 4.0.0 (#170) Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3.13.0 to 4.0.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/0ab4596768b603586c0de567f2430c30f5b0d2b0...387ac29b308b003ca37ba93a6cab5eb57c8f5f93) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/dependencies.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/version.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d0ce50..20be1e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: if: (!startsWith(github.ref, 'refs/tags/')) run: git fetch --tag --unshallow - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: '17' distribution: 'adopt' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 53e9202..2d3e185 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,7 +33,7 @@ jobs: languages: ${{ matrix.language }} - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: '17' distribution: 'adopt' diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 2788efa..1955bfe 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0 - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: '17' distribution: 'adopt' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ad94fe..3ba76d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Fetch version history run: git fetch --tags --unshallow - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: '17' distribution: 'adopt' diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 659d737..e854584 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -27,7 +27,7 @@ jobs: - name: Fetch version history run: git fetch --tags --unshallow - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: '17' distribution: 'adopt' From 8981f292c0688a645c987bef5647aed669641823 Mon Sep 17 00:00:00 2001 From: Big Andy <8012398+big-andy-coates@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:37:32 +0000 Subject: [PATCH 4/6] Drop `ResourceHandler`. `ResourceHandler` has moved to `creek-service` repo. This decouples things. The initializer that a reduced-scope call back for resource creation. BREAKING CHANGE: This is a braking change. Downstream projects won't build clean until they too are updated to work with this change. --- .../platform/metadata/ResourceHandler.java | 41 ----------------- .../resource/ResourceInitializer.java | 43 ++++++++--------- .../resource/ResourceInitializerTest.java | 46 ++++++++----------- 3 files changed, 41 insertions(+), 89 deletions(-) delete mode 100644 metadata/src/main/java/org/creekservice/api/platform/metadata/ResourceHandler.java diff --git a/metadata/src/main/java/org/creekservice/api/platform/metadata/ResourceHandler.java b/metadata/src/main/java/org/creekservice/api/platform/metadata/ResourceHandler.java deleted file mode 100644 index ffc888c..0000000 --- a/metadata/src/main/java/org/creekservice/api/platform/metadata/ResourceHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2022-2023 Creek Contributors (https://github.com/creek-service) - * - * 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 - * - * http://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 org.creekservice.api.platform.metadata; - -import java.util.Collection; - -/** - * A Callback that Creek extensions implement to handler the resource types they support. - * - * @param the specific resource type the handler handles. - */ -public interface ResourceHandler { - - /** - * Ensure the supplied {@code resources} exists. - * - *

Instructs an extension to ensure the resources described by the supplied descriptor exist - * and are initialized. - * - *

Implementations should consider outputting a warning or failing if the resource already - * exists, but does not match the expected configuration. - * - * @param resources the resource instances to ensure exists and are initialized. Resources - * passed will be {@link ResourceDescriptor#isCreatable creatable}. - */ - void ensure(Collection resources); -} diff --git a/resource/src/main/java/org/creekservice/api/platform/resource/ResourceInitializer.java b/resource/src/main/java/org/creekservice/api/platform/resource/ResourceInitializer.java index 4e7f45c..7c7ea5a 100644 --- a/resource/src/main/java/org/creekservice/api/platform/resource/ResourceInitializer.java +++ b/resource/src/main/java/org/creekservice/api/platform/resource/ResourceInitializer.java @@ -36,8 +36,8 @@ import org.creekservice.api.observability.logging.structured.StructuredLogger; import org.creekservice.api.observability.logging.structured.StructuredLoggerFactory; import org.creekservice.api.platform.metadata.ComponentDescriptor; +import org.creekservice.api.platform.metadata.OwnedResource; import org.creekservice.api.platform.metadata.ResourceDescriptor; -import org.creekservice.api.platform.metadata.ResourceHandler; import org.creekservice.internal.platform.resource.ComponentValidator; /** @@ -58,38 +58,42 @@ public final class ResourceInitializer { private static final StructuredLogger LOGGER = StructuredLoggerFactory.internalLogger(ResourceInitializer.class); - private final ResourceHandlers handlers; + private final ResourceCreator resourceCreator; private final ComponentValidator componentValidator; - /** Type for retrieving resource handlers */ + /** Type for ensuring external resources exist */ @FunctionalInterface - public interface ResourceHandlers { + public interface ResourceCreator { /** - * Get the handler for a specific type + * Get the handler for a specific type. * - * @param type the type - * @param the type - * @return the handler + *

All {@code creatableResources} will be of the same type. + * + * @param creatableResources the resource instances to ensure exists and are initialized. + * Resources passed will be {@link ResourceDescriptor#isCreatable creatable}. + * @param the creatable resource descriptor type * @throws RuntimeException on unknown resource type */ - ResourceHandler get(Class type); + void ensure( + Collection creatableResources); } /** * Create an initializer instance. * - * @param handlers accessor to resource handlers, as exposed by Creek extensions. + * @param resourceCreator callback used to ensure external resources exist, as exposed by Creek + * extensions. * @return an initializer instance. */ - public static ResourceInitializer resourceInitializer(final ResourceHandlers handlers) { - return new ResourceInitializer(handlers, new ComponentValidator()); + public static ResourceInitializer resourceInitializer(final ResourceCreator resourceCreator) { + return new ResourceInitializer(resourceCreator, new ComponentValidator()); } @VisibleForTesting ResourceInitializer( - final ResourceHandlers handlers, final ComponentValidator componentValidator) { - this.handlers = requireNonNull(handlers, "handlers"); + final ResourceCreator resourceCreator, final ComponentValidator componentValidator) { + this.resourceCreator = requireNonNull(resourceCreator, "resourceCreator"); this.componentValidator = requireNonNull(componentValidator, "componentValidator"); } @@ -173,12 +177,14 @@ public void test( ensureResources(stream); } + @SuppressWarnings({"unchecked", "rawtypes"}) private void ensureResources(final Stream> resGroups) { resGroups .peek(this::validateResourceGroup) .map(this::creatableDescriptor) - .collect(groupingBy(this::resourceHandler)) - .forEach(ResourceHandler::ensure); + .collect(groupingBy(Object::getClass)) + .values() + .forEach(creatableResources -> resourceCreator.ensure((List) creatableResources)); } private ResourceDescriptor creatableDescriptor(final List resGroup) { @@ -237,11 +243,6 @@ private void validateResourceGroup(final List } } - @SuppressWarnings("unchecked") - private ResourceHandler resourceHandler(final T resource) { - return handlers.get((Class) resource.getClass()); - } - private static String formatResource(final List descriptors) { return descriptors.stream() .map(ResourceInitializer::formatResource) diff --git a/resource/src/test/java/org/creekservice/api/platform/resource/ResourceInitializerTest.java b/resource/src/test/java/org/creekservice/api/platform/resource/ResourceInitializerTest.java index a90c005..d67532d 100644 --- a/resource/src/test/java/org/creekservice/api/platform/resource/ResourceInitializerTest.java +++ b/resource/src/test/java/org/creekservice/api/platform/resource/ResourceInitializerTest.java @@ -36,7 +36,6 @@ import org.creekservice.api.platform.metadata.ComponentDescriptor; import org.creekservice.api.platform.metadata.OwnedResource; import org.creekservice.api.platform.metadata.ResourceDescriptor; -import org.creekservice.api.platform.metadata.ResourceHandler; import org.creekservice.api.platform.metadata.SharedResource; import org.creekservice.api.platform.metadata.UnownedResource; import org.creekservice.internal.platform.resource.ComponentValidator; @@ -58,9 +57,7 @@ class ResourceInitializerTest { @Mock private ComponentValidator validator; @Mock private ComponentDescriptor component0; @Mock private ComponentDescriptor component1; - @Mock private ResourceInitializer.ResourceHandlers handlers; - @Mock private ResourceHandler handlerA; - @Mock private ResourceHandler handlerB; + @Mock private ResourceInitializer.ResourceCreator resourceCreator; @Mock(extraInterfaces = SharedResource.class) private ResourceA sharedResource1; @@ -77,9 +74,7 @@ class ResourceInitializerTest { @BeforeEach void setUp() { - initializer = new ResourceInitializer(handlers, validator); - - when(handlers.get(any())).thenReturn(handlerA); + initializer = new ResourceInitializer(resourceCreator, validator); when(sharedResource1.id()).thenReturn(A1_ID); when(ownedResource1.id()).thenReturn(A1_ID); @@ -239,7 +234,7 @@ void shouldNotInitializeAnyResourceOnInitIfNoSharedResources() { initializer.init(List.of(component0, component1)); // Then: - verify(handlers, never()).get(any()); + verify(resourceCreator, never()).ensure(any()); } @Test @@ -254,7 +249,7 @@ void shouldNotInitializeAnyResourcesOnServiceIfNoOwnedResources() { initializer.service(List.of(component0, component1)); // Then: - verify(handlerA, never()).ensure(any()); + verify(resourceCreator, never()).ensure(any()); } @Test @@ -271,7 +266,7 @@ void shouldNotInitializeAnyResourcesOnTestIfNoUnownedResources() { initializer.test(List.of(component0), List.of(component1)); // Then: - verify(handlerA, never()).ensure(any()); + verify(resourceCreator, never()).ensure(any()); } @Test @@ -285,7 +280,7 @@ void shouldNotInitializeAnyResourcesOnTestIfNoUnownedResources() { initializer.test(List.of(component0, component1), List.of()); // Then: - verify(handlerA, never()).ensure(any()); + verify(resourceCreator, never()).ensure(any()); } @Test @@ -301,7 +296,7 @@ void shouldNotInitializeUnmanagedGroups() { initializer.init(List.of(component0, component1)); // Then: - verify(handlers, never()).get(any()); + verify(resourceCreator, never()).ensure(any()); } @Test @@ -325,6 +320,7 @@ void shouldThrowOnUncreatableResource() { assertThat(e.getMessage(), containsString("unownedResource1")); } + @SuppressWarnings({"unchecked", "rawtypes"}) @Test void shouldEnsureSharedResource() { // Given: @@ -336,9 +332,10 @@ void shouldEnsureSharedResource() { initializer.init(List.of(component0, component1)); // Then: - verify(handlerA).ensure(List.of(sharedResource1, sharedResource2)); + verify(resourceCreator).ensure((List) List.of(sharedResource1, sharedResource2)); } + @SuppressWarnings({"unchecked", "rawtypes"}) @Test void shouldEnsureOwnedResource() { // Given: @@ -350,9 +347,10 @@ void shouldEnsureOwnedResource() { initializer.service(List.of(component0, component1)); // Then: - verify(handlerA).ensure(List.of(ownedResource1, ownedResource2)); + verify(resourceCreator).ensure((List) List.of(ownedResource1, ownedResource2)); } + @SuppressWarnings({"unchecked", "rawtypes"}) @Test void shouldEnsureUnownedResource() { // Given: @@ -365,14 +363,14 @@ void shouldEnsureUnownedResource() { initializer.test(List.of(component0), List.of(component1)); // Then: - verify(handlerA).ensure(List.of(ownedResource2)); + verify(resourceCreator).ensure((List) List.of(ownedResource2)); } @Test void shouldThrowIfEnsureThrows() { // Given: final RuntimeException expected = new RuntimeException("boom"); - doThrow(expected).when(handlerA).ensure(any()); + doThrow(expected).when(resourceCreator).ensure(any()); when(component0.resources()).thenReturn(Stream.of(ownedResource1)); // When: @@ -384,16 +382,10 @@ void shouldThrowIfEnsureThrows() { assertThat(e, is(sameInstance(expected))); } + @SuppressWarnings({"unchecked", "rawtypes"}) @Test void shouldEnsureGroupingByHandler() { // Given - when(handlers.get(any())) - .thenAnswer( - inv -> - ResourceA.class.isAssignableFrom(inv.getArgument(0)) - ? handlerA - : handlerB); - final ResourceB ownedResourceB = resourceB(OwnedResource.class); when(component0.resources()).thenReturn(Stream.of(ownedResource1, ownedResourceB)); @@ -401,15 +393,15 @@ void shouldEnsureGroupingByHandler() { initializer.service(List.of(component0)); // Then: - verify(handlerA).ensure(List.of(ownedResource1)); - verify(handlerB).ensure(List.of(ownedResourceB)); + verify(resourceCreator).ensure((List) List.of(ownedResource1)); + verify(resourceCreator).ensure((List) List.of(ownedResourceB)); } @Test void shouldThrowOnUnknownResourceType() { // Given: final NullPointerException expected = new NullPointerException("unknown"); - when(handlers.get(any())).thenThrow(expected); + doThrow(expected).when(resourceCreator).ensure(any()); when(component0.resources()).thenReturn(Stream.of(sharedResource1)); // When: @@ -424,7 +416,7 @@ void shouldThrowOnUnknownResourceType() { @Test void shouldThrowOnInvalidComponentUsingActualValidator() { // Given: - initializer = ResourceInitializer.resourceInitializer(handlers); + initializer = ResourceInitializer.resourceInitializer(resourceCreator); // Then: assertThrows(RuntimeException.class, () -> initializer.init(List.of(component0))); From 5fd12c4ec34dc52bac8aab966dad4cc250014218 Mon Sep 17 00:00:00 2001 From: Andy Coates <8012398+big-andy-coates@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:40:46 +0000 Subject: [PATCH 5/6] Latest conv (#177) --- .github/workflows/build.yml | 22 +++++++++++++++++-- .../kotlin/creek-common-convention.gradle.kts | 10 +++++++-- ...ek-plugin-publishing-convention.gradle.kts | 4 ++-- .../creek-publishing-convention.gradle.kts | 4 ++-- config/spotbugs/suppressions.xml | 6 +++++ 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20be1e4..b32af29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ permissions: contents: read jobs: - build: + build_linux: permissions: packages: write runs-on: ubuntu-latest @@ -67,9 +67,27 @@ jobs: run: | ./gradlew -Dgradle.publish.key="$GRADLE_PUBLISH_KEY" -Dgradle.publish.secret="$GRADLE_PUBLISH_SECRET" publishPlugins + # Until Creek fully supports Windows, minimal check: + build_windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0 + - name: Set up JDK + uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + with: + java-version: '17' + distribution: 'adopt' + - name: Setup Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 + with: + gradle-home-cache-cleanup: true + - name: Build + run: ./gradlew.bat build -PexcludeContainerised + create-gh-release: if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-alpha') - needs: build + needs: [build_linux, build_windows] runs-on: ubuntu-latest permissions: contents: write diff --git a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts index 1806f0b..7d3527e 100644 --- a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts @@ -19,7 +19,8 @@ * *

Apply to all java modules, usually excluding the root project in multi-module sets. * - *

Version: 1.9 + *

Versions: + * - 1.10: Add ability to exclude containerised tests * - 1.9: Add `allDeps` task. * - 1.8: Tweak test config to reduce build speed. * - 1.7: Switch to setting Java version via toolchain @@ -70,7 +71,12 @@ tasks.withType { } tasks.test { - useJUnitPlatform() + useJUnitPlatform() { + if (project.hasProperty("excludeContainerised")) { + excludeTags("ContainerisedTest") + } + } + setForkEvery(5) maxParallelForks = Runtime.getRuntime().availableProcessors() testLogging { diff --git a/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts index 8196620..b3d048f 100644 --- a/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts @@ -95,9 +95,9 @@ publishing { name.set("${project.group}:${artifactId}") if (prependRootName) { - description.set("${rootProject.name.capitalize()} ${project.name} library".replace("-", " ")) + description.set("${rootProject.name} ${project.name} library".replace("-", " ")) } else { - description.set("${project.name.capitalize()} library".replace("-", " ")) + description.set("${project.name} library".replace("-", " ")) } url.set("https://www.creekservice.org") diff --git a/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts index f7c5fb4..ebb7f27 100644 --- a/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts @@ -78,9 +78,9 @@ publishing { name.set("${project.group}:${artifactId}") if (prependRootName) { - description.set("${rootProject.name.capitalize()} ${project.name} library".replace("-", " ")) + description.set("${rootProject.name} ${project.name} library".replace("-", " ")) } else { - description.set("${project.name.capitalize()} library".replace("-", " ")) + description.set("${project.name} library".replace("-", " ")) } url.set("https://www.creekservice.org") diff --git a/config/spotbugs/suppressions.xml b/config/spotbugs/suppressions.xml index 116ee98..c51071a 100644 --- a/config/spotbugs/suppressions.xml +++ b/config/spotbugs/suppressions.xml @@ -8,4 +8,10 @@ + + + + + + \ No newline at end of file From 703ca814acd18ff4e0f39395cea199d5a5187c39 Mon Sep 17 00:00:00 2001 From: Andy Coates <8012398+big-andy-coates@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:47:34 +0000 Subject: [PATCH 6/6] Drop `ResourceHandler`. (#178) `ResourceHandler` has moved to `creek-service` repo. This decouples things. The initializer that a reduced-scope call back for resource creation. BREAKING CHANGE: This is a braking change. Downstream projects won't build clean until they too are updated to work with this change.