From c2b24e7f6b586c4a95fa2f8297b2c380673ab499 Mon Sep 17 00:00:00 2001 From: Dariusz Kuc <9501705+dariuszkuc@users.noreply.github.com> Date: Wed, 19 Apr 2023 17:45:27 -0500 Subject: [PATCH] cleanup build (#46) --- .gitattributes | 9 + .github/workflows/continuous-integration.yaml | 10 +- .gitignore | 6 +- README.md | 4 +- docker-compose.yaml | 2 +- .../gradle.properties => gradle.properties | 5 + .../wrapper/gradle-wrapper.jar | Bin .../wrapper/gradle-wrapper.properties | 0 products-subgraph/gradlew => gradlew | 0 reviews-subgraph/gradlew.bat => gradlew.bat | 184 ++++++------- products-subgraph/gradlew.bat | 92 ------- products-subgraph/settings.gradle.kts | 1 - reviews-subgraph/gradle.properties | 2 - .../gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 - reviews-subgraph/gradlew | 244 ------------------ reviews-subgraph/settings.gradle.kts | 1 - router.yaml | 5 +- settings.gradle.kts | 4 + supergraph.yaml | 2 +- 20 files changed, 123 insertions(+), 454 deletions(-) create mode 100644 .gitattributes rename products-subgraph/gradle.properties => gradle.properties (53%) rename {products-subgraph/gradle => gradle}/wrapper/gradle-wrapper.jar (100%) rename {products-subgraph/gradle => gradle}/wrapper/gradle-wrapper.properties (100%) rename products-subgraph/gradlew => gradlew (100%) rename reviews-subgraph/gradlew.bat => gradlew.bat (96%) delete mode 100644 products-subgraph/gradlew.bat delete mode 100644 products-subgraph/settings.gradle.kts delete mode 100644 reviews-subgraph/gradle.properties delete mode 100644 reviews-subgraph/gradle/wrapper/gradle-wrapper.jar delete mode 100644 reviews-subgraph/gradle/wrapper/gradle-wrapper.properties delete mode 100755 reviews-subgraph/gradlew delete mode 100644 reviews-subgraph/settings.gradle.kts create mode 100644 settings.gradle.kts diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..097f9f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 860e28d..95fe374 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -12,9 +12,6 @@ jobs: build-products: timeout-minutes: 5 runs-on: ubuntu-latest - defaults: - run: - working-directory: ./products-subgraph steps: - uses: actions/checkout@v3 @@ -28,7 +25,7 @@ jobs: - name: Set up Gradle cache uses: gradle/gradle-build-action@v2 - name: Build products subgraph with Gradle - run: ./gradlew clean build bootJar + run: ./gradlew :products-subgraph:clean :products-subgraph:build :products-subgraph:bootJar - name: Upload JAR uses: actions/upload-artifact@v3 with: @@ -40,9 +37,6 @@ jobs: build-reviews: timeout-minutes: 5 runs-on: ubuntu-latest - defaults: - run: - working-directory: ./reviews-subgraph steps: - uses: actions/checkout@v3 @@ -56,7 +50,7 @@ jobs: - name: Set up Gradle cache uses: gradle/gradle-build-action@v2 - name: Build reviews subgraph with Gradle - run: ./gradlew clean build bootJar + run: ./gradlew :reviews-subgraph:clean :reviews-subgraph:build :reviews-subgraph:bootJar - name: Upload JAR uses: actions/upload-artifact@v3 with: diff --git a/.gitignore b/.gitignore index 532929a..8afbd92 100644 --- a/.gitignore +++ b/.gitignore @@ -10,10 +10,10 @@ build/ out/ -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - # ignore files used for composition *.jar supergraph.graphql response.json + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/README.md b/README.md index 2639379..bd3b33f 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ See individual projects READMEs for detailed instructions on how to run them. Running the demo ---- -1. Start `products-subgraph` by running the Spring Boot app from the IDE or by running `./gradlew bootRun` from `products-subgraph` project -2. Start `reviews-subgraph` by running the Spring Boot app from the IDE or `./gradlew bootRun` from `reviews-subgraph` project +1. Start `products-subgraph` by running the `ProductsApplication` Spring Boot app from the IDE or by running `./gradlew :products-subgraph:bootRun` from the root project directory +2. Start `reviews-subgraph` by running the `ReviewsApplication` Spring Boot app from the IDE or `./gradlew :reviews-subgraph:bootRun` from the root project directory 3. Start Federated Router 1. Install [rover CLI](https://www.apollographql.com/docs/rover/getting-started) 2. Start router and compose products schema using [rover dev command](https://www.apollographql.com/docs/rover/commands/dev) diff --git a/docker-compose.yaml b/docker-compose.yaml index fe6f35e..6f6d49e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,6 @@ services: router: - image: ghcr.io/apollographql/router:v1.4.0 + image: ghcr.io/apollographql/router:v1.15.1 volumes: - ./router.yaml:/dist/config/router.yaml - ./supergraph.graphql:/dist/config/supergraph.graphql diff --git a/products-subgraph/gradle.properties b/gradle.properties similarity index 53% rename from products-subgraph/gradle.properties rename to gradle.properties index 74a4fd5..a269c8f 100644 --- a/products-subgraph/gradle.properties +++ b/gradle.properties @@ -1,2 +1,7 @@ +org.gradle.caching=true +org.gradle.parallel=true + federation-jvm.version = 2.1.0 graphql-java.version = 19.2 + + diff --git a/products-subgraph/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from products-subgraph/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/products-subgraph/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from products-subgraph/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties diff --git a/products-subgraph/gradlew b/gradlew similarity index 100% rename from products-subgraph/gradlew rename to gradlew diff --git a/reviews-subgraph/gradlew.bat b/gradlew.bat similarity index 96% rename from reviews-subgraph/gradlew.bat rename to gradlew.bat index 6689b85..93e3f59 100644 --- a/reviews-subgraph/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/products-subgraph/gradlew.bat b/products-subgraph/gradlew.bat deleted file mode 100644 index 6689b85..0000000 --- a/products-subgraph/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/products-subgraph/settings.gradle.kts b/products-subgraph/settings.gradle.kts deleted file mode 100644 index 6a2656b..0000000 --- a/products-subgraph/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "products-subgraph" diff --git a/reviews-subgraph/gradle.properties b/reviews-subgraph/gradle.properties deleted file mode 100644 index 74a4fd5..0000000 --- a/reviews-subgraph/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -federation-jvm.version = 2.1.0 -graphql-java.version = 19.2 diff --git a/reviews-subgraph/gradle/wrapper/gradle-wrapper.jar b/reviews-subgraph/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 61574 zcmb6AV{~QRwml9f72CFLyJFk6ZKq;e729@pY}>YNR8p1vbMJH7ubt