From 711de26d208edcc05038763f079259fde043d7c6 Mon Sep 17 00:00:00 2001 From: Jose Chavez Date: Fri, 15 Mar 2024 14:04:03 -0700 Subject: [PATCH 1/5] First attempt, fails with error --- build.gradle | 3 +++ gradle/spotless.gradle | 7 +++++++ .../rangerforce/spockexample/LoadContextSpec.groovy | 13 ++++++------- .../web/StarFleetShipResourceSpec.groovy | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index e1505a8..1da8d8d 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,9 @@ dependencies { // Spock Framework testImplementation "org.spockframework:spock-core:${spockVersion}" testImplementation "org.spockframework:spock-spring:${spockVersion}" + + // Spotless workaround for Groovy + compileOnly 'org.eclipse.platform:org.eclipse.swt:3.124.100' } test { diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index a3dcba9..c0cd75f 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -20,4 +20,11 @@ spotless { licenseHeader '/* (C) $YEAR */' // or licenseHeaderFile } + + groovy { + target '**/*.groovy' // Specify the files to format (all .groovy files in the project) + greclipse("4.6.3") // Use Google Java Format for Groovy code formatting + trimTrailingWhitespace() // Trim trailing whitespace + indentWithSpaces(4) // Use 4 spaces for indentation + } } diff --git a/src/test/groovy/com/rangerforce/spockexample/LoadContextSpec.groovy b/src/test/groovy/com/rangerforce/spockexample/LoadContextSpec.groovy index 2c35e48..457f7ac 100644 --- a/src/test/groovy/com/rangerforce/spockexample/LoadContextSpec.groovy +++ b/src/test/groovy/com/rangerforce/spockexample/LoadContextSpec.groovy @@ -8,12 +8,11 @@ import spock.lang.Specification @SpringBootTest class LoadContextSpec extends Specification { - @Autowired (required = false) - private HelloController helloController - - def "when context is loaded then all expected beans are created"() { - expect: "the HelloController is created" - helloController - } + @Autowired (required = false) + private HelloController helloController + def "when context is loaded then all expected beans are created"() { + expect: "the HelloController is created" + helloController + } } diff --git a/src/test/groovy/com/rangerforce/spockexample/web/StarFleetShipResourceSpec.groovy b/src/test/groovy/com/rangerforce/spockexample/web/StarFleetShipResourceSpec.groovy index aefd5d2..95ea461 100644 --- a/src/test/groovy/com/rangerforce/spockexample/web/StarFleetShipResourceSpec.groovy +++ b/src/test/groovy/com/rangerforce/spockexample/web/StarFleetShipResourceSpec.groovy @@ -23,9 +23,9 @@ class StarFleetShipResourceSpec extends Specification { @SpringBean private StarshipsRepository starshipsRepository = Stub() { findAll() >> [ - "USS Enterprise (NCC-1701)", - "USS Voyager (NCC-74656)", - "USS Defiant (NX-74205)" + "USS Enterprise (NCC-1701)", + "USS Voyager (NCC-74656)", + "USS Defiant (NX-74205)" ] } From 5c52411a8e2b8383afd2b55158604aff24e2af06 Mon Sep 17 00:00:00 2001 From: Jose Chavez Date: Fri, 15 Mar 2024 14:06:04 -0700 Subject: [PATCH 2/5] Adding PR template --- .github/pull_request_template.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..8169b05 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +# What's in this PR? + +## Describe your changes + +A brief description of the changes you made in this pull request. + +**Example:** + +* Fixed a bug that caused... +* Implemented a new feature that allows... +* Improved the performance of... + +## Related issue(s) + +* If this pull request addresses an existing issue, link it here. +* You can use the issue number (e.g., #123) to automatically link to the issue. + +## Checklist before requesting a review + +* [ ] I have added unit tests for my changes (if applicable). +* [ ] I have made sure my code adheres to the project's coding style guidelines. +* [ ] I have documented any changes made to the API. From 0126378d6ac1aafa09bd952164a6a6a754a79ff9 Mon Sep 17 00:00:00 2001 From: Jose Chavez Date: Tue, 19 Mar 2024 10:25:25 -0700 Subject: [PATCH 3/5] Still failing --- gradle/spotless.gradle | 2 +- .../domain/repository/StarshipsRepositorySpec.groovy | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index c0cd75f..65d7b85 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -23,7 +23,7 @@ spotless { groovy { target '**/*.groovy' // Specify the files to format (all .groovy files in the project) - greclipse("4.6.3") // Use Google Java Format for Groovy code formatting + greclipse() // Use Google Java Format for Groovy code formatting trimTrailingWhitespace() // Trim trailing whitespace indentWithSpaces(4) // Use 4 spaces for indentation } diff --git a/src/test/groovy/com/rangerforce/spockexample/domain/repository/StarshipsRepositorySpec.groovy b/src/test/groovy/com/rangerforce/spockexample/domain/repository/StarshipsRepositorySpec.groovy index f8e8c54..b0155eb 100644 --- a/src/test/groovy/com/rangerforce/spockexample/domain/repository/StarshipsRepositorySpec.groovy +++ b/src/test/groovy/com/rangerforce/spockexample/domain/repository/StarshipsRepositorySpec.groovy @@ -1,6 +1,5 @@ package com.rangerforce.spockexample.domain.repository - import spock.lang.Shared import spock.lang.Specification From 30fada47cc9f2a823bad573a1b628f922f4fbc42 Mon Sep 17 00:00:00 2001 From: Jose Chavez Date: Tue, 4 Jun 2024 08:23:45 -0700 Subject: [PATCH 4/5] Attempted to set specific greclipse version, still failing --- gradle/spotless.gradle | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index 65d7b85..efe071c 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -23,7 +23,14 @@ spotless { groovy { target '**/*.groovy' // Specify the files to format (all .groovy files in the project) - greclipse() // Use Google Java Format for Groovy code formatting + greclipse("4.9") // Use Google Java Format for Groovy code formatting + trimTrailingWhitespace() // Trim trailing whitespace + indentWithSpaces(4) // Use 4 spaces for indentation + } + + groovyGradle { + target '**/*.gradle' // Specify the files to format (all .groovy files in the project) + greclipse("4.9") // Use Google Java Format for Groovy code formatting trimTrailingWhitespace() // Trim trailing whitespace indentWithSpaces(4) // Use 4 spaces for indentation } From 7aa3790e370df3874ae7469b1b55b0c058d7470b Mon Sep 17 00:00:00 2001 From: Jose Chavez Date: Tue, 4 Jun 2024 10:00:37 -0700 Subject: [PATCH 5/5] Attempting to bypass version var --- build.gradle | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/build.gradle b/build.gradle index b51daf3..a90e8d6 100644 --- a/build.gradle +++ b/build.gradle @@ -6,11 +6,16 @@ plugins { id "com.diffplug.spotless" version "6.25.0" } +dependencyManagement { + applyMavenExclusions = false +} + apply from: 'gradle/spotless.gradle' group = 'com.rangerforce' version = '1.0.0' def spockVersion = '2.4-M4-groovy-4.0' // Doesn't follow SimVer so using a variable +def swt_version = '3.124.100' java { sourceCompatibility = '17' @@ -61,3 +66,25 @@ test { info.exceptionFormat = lifecycle.exceptionFormat } } + +// Setting value of osgi_platform based on OS value +def os = System.getProperty("os.name").toLowerCase() +if (os.contains("win")) { + ext.osgi_platform = "win32.win32.x86_64" +} else if (os.contains("mac")) { + ext.osgi_platform = "cocoa.macosx.x86_64" +} else if (os.contains("nix") || os.contains("nux") || os.contains("aix")) { + ext.osgi_platform = "linux" +} else { + ext.osgi_platform = "unknown" +} + +configurations.all { + resolutionStrategy { + dependencySubstitution { + // The maven property ${osgi.platform} is not handled by Gradle + // so we replace the dependency, using the osgi platform from the project settings + substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.${ext.osgi_platform}:${swt_version}") + } + } +}