diff --git a/scripts/check_local_version_update.sh b/scripts/check_local_version_update.sh new file mode 100644 index 0000000000..f5e1cabec7 --- /dev/null +++ b/scripts/check_local_version_update.sh @@ -0,0 +1,116 @@ +############################################################### +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### + +#!/bin/bash + +# Initialize a global arrays to store data +projects_to_update=() +already_checked_projects=() +version_update_needed=() + +# get the directory.build files to check the updated versions +IFS=$'\n' read -d '' -ra updatedVersions < <(git diff HEAD --name-only | grep 'Directory.Build.props') + +check_version_update(){ + local directory="$1" + local updated_name="$2" + local props_file="src/framework/"$(basename "$directory")"/Directory.Build.props" + # Check if the Directory.Builds.props file exists + if [[ " ${updatedVersions[@]} " =~ " $props_file " ]]; then + already_checked_projects+=($directory) + # Update the depending solutions + update_csproj_files_recursive "$updated_name" + else + version_update_needed+=($directory) + already_checked_projects+=($directory) + update_csproj_files_recursive "$updated_name" + fi +} + +# Function to search and check the version update recursively +update_csproj_files_recursive() { + local updated_name="$1" + + for dir in ./src/Framework/*/; do + if [ -d "$dir" ]; then + csproj_files=("$dir"*.csproj) + for project_file in "${csproj_files[@]}"; do + if grep -q "$updated_name" "$project_file"; then + project=$(basename "$dir") + if [[ ! " ${already_checked_projects[*]} " == *"$project"* ]]; then + check_version_update "$dir" "$project" + if [[ ! " ${already_checked_projects[*]} " == *"$project"* ]]; then + already_checked_projects+=("$project") + fi + fi + fi + done + fi + done + + # Recursively update projects that depend on the updated projects + for project_name in "${projects_to_update[@]}"; do + # Only update projects if they haven't been updated before + if [[ ! " ${already_checked_projects[*]} " == *"$project_name"* ]]; then + update_csproj_files_recursive "$project_name" + fi + done +} + +# iterate over directories in the Framework directory and check if the version was updated +iterate_directories() { + local updated_name="$1" + + for dir in ./src/framework/*/; do + if [ -d "$dir" ]; then + if [[ $dir == "./src/framework/$updated_name/" ]]; then + check_version_update "$dir" "$updated_name" + if [[ ! " ${projects_to_update[*]} " == *"$updated_name"* ]]; then + projects_to_update+=("$updated_name") + fi + if [[ ! " ${already_checked_projects[*]} " == *"$updated_name"* ]]; then + already_checked_projects+=("$updated_name") + fi + fi + fi + done + + # Update all projects that depend on the updated projects recursively + for project_name in "${projects_to_update[@]}"; do + # Only update projects if they haven't been updated before + if [[ ! " ${already_checked_projects[*]} " == *"$project_name"* ]]; then + update_csproj_files_recursive "$project_name" + fi + done +} + +# find out which directories were changed with the last push +IFS=$'\n' read -d '' -ra changedPackages < <(git diff HEAD --name-only | xargs dirname | sort | uniq | grep '^src/framework/.*') + +if [ ! -z "${changedPackages[*]}" ]; then + for dir in "${changedPackages[@]}"; do + package="$(basename "$dir")" + iterate_directories "$package" + done +fi + +# return all packages that still need a version update +for dir in "${version_update_needed[@]}"; do + echo "$dir" +done \ No newline at end of file diff --git a/scripts/check_push_version_update.sh b/scripts/check_push_version_update.sh index 28b26340c9..a543140caf 100755 --- a/scripts/check_push_version_update.sh +++ b/scripts/check_push_version_update.sh @@ -1,14 +1,23 @@ -#!/bin/bash - -# Check if the correct number of arguments are provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi +############################################################### +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### -# Assign the arguments to variables -baseBranch="$1" -currentBranch="$2" +#!/bin/bash # Initialize a global arrays to store data projects_to_update=() diff --git a/scripts/pack_and_push_packages.sh b/scripts/pack_and_push_packages.sh index c86c9c1336..eed6930a41 100755 --- a/scripts/pack_and_push_packages.sh +++ b/scripts/pack_and_push_packages.sh @@ -1,3 +1,22 @@ +############################################################### +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### + #!/bin/bash # Check if the correct number of arguments are provided @@ -36,10 +55,17 @@ done case "$nugetSource" in local) - dotnet nuget push "$folderPath/*" --source "local" + for packageFile in "$folderPath"/*.nupkg; do + dotnet nuget push "$packageFile" --source "local" + done ;; nuget) - dotnet nuget push "$folderPath/*" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json + for packageFile in "$folderPath"/*.nupkg; do + dotnet nuget push "$packageFile" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json + done + for packageFile in "$folderPath"/*.snupkg; do + dotnet nuget push "$packageFile" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json + done ;; *) echo "Invalid nuget source argument. Valid options: local, nuget" diff --git a/scripts/push.sh b/scripts/push.sh deleted file mode 100644 index 79546edf1e..0000000000 --- a/scripts/push.sh +++ /dev/null @@ -1,34 +0,0 @@ -############################################################### -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################### - -success=1 -attempts=0 -until [ $success == 0 ] || [ $attempts == 10 ] -do - (( attempts++ )) - git pull --rebase - git push - success=$? -done -if [ $success != 0 ] -then - echo "Gave up after $attempts attempts" -else - echo "Push was successful" -fi diff --git a/src/framework/Framework.Async/Framework.Async.csproj b/src/framework/Framework.Async/Framework.Async.csproj index bcae1607e5..b59104f0d7 100644 --- a/src/framework/Framework.Async/Framework.Async.csproj +++ b/src/framework/Framework.Async/Framework.Async.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Async Org.Eclipse.TractusX.Portal.Backend.Framework.Async TractusX diff --git a/src/framework/Framework.Authorization/Framework.Authorization.csproj b/src/framework/Framework.Authorization/Framework.Authorization.csproj index 3220d836e7..4d07f883e6 100644 --- a/src/framework/Framework.Authorization/Framework.Authorization.csproj +++ b/src/framework/Framework.Authorization/Framework.Authorization.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Authorization Org.Eclipse.TractusX.Portal.Backend.Framework.Authorization TractusX diff --git a/src/framework/Framework.Cors/Framework.Cors.csproj b/src/framework/Framework.Cors/Framework.Cors.csproj index b21d7d0c35..8a47bed9ef 100644 --- a/src/framework/Framework.Cors/Framework.Cors.csproj +++ b/src/framework/Framework.Cors/Framework.Cors.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Cors Org.Eclipse.TractusX.Portal.Backend.Framework.Cors TractusX diff --git a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj index 9cbb21a6d8..ac36fada2d 100644 --- a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj +++ b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj @@ -28,7 +28,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess TractusX diff --git a/src/framework/Framework.DateTimeProvider/Framework.DateTimeProvider.csproj b/src/framework/Framework.DateTimeProvider/Framework.DateTimeProvider.csproj index 50146b39a1..819bc6043c 100644 --- a/src/framework/Framework.DateTimeProvider/Framework.DateTimeProvider.csproj +++ b/src/framework/Framework.DateTimeProvider/Framework.DateTimeProvider.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider TractusX diff --git a/src/framework/Framework.DependencyInjection/Framework.DependencyInjection.csproj b/src/framework/Framework.DependencyInjection/Framework.DependencyInjection.csproj index 68dd6c0099..0ceff04c12 100644 --- a/src/framework/Framework.DependencyInjection/Framework.DependencyInjection.csproj +++ b/src/framework/Framework.DependencyInjection/Framework.DependencyInjection.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.DependencyInjection Org.Eclipse.TractusX.Portal.Backend.Framework.DependencyInjection TractusX diff --git a/src/framework/Framework.ErrorHandling.Library/Framework.ErrorHandling.Library.csproj b/src/framework/Framework.ErrorHandling.Library/Framework.ErrorHandling.Library.csproj index 503d459004..8c05d5b860 100644 --- a/src/framework/Framework.ErrorHandling.Library/Framework.ErrorHandling.Library.csproj +++ b/src/framework/Framework.ErrorHandling.Library/Framework.ErrorHandling.Library.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library TractusX diff --git a/src/framework/Framework.ErrorHandling.Web/Framework.ErrorHandling.Web.csproj b/src/framework/Framework.ErrorHandling.Web/Framework.ErrorHandling.Web.csproj index 9d9792a184..32b8e4a5a0 100644 --- a/src/framework/Framework.ErrorHandling.Web/Framework.ErrorHandling.Web.csproj +++ b/src/framework/Framework.ErrorHandling.Web/Framework.ErrorHandling.Web.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web TractusX diff --git a/src/framework/Framework.HttpClientExtensions/Framework.HttpClientExtensions.csproj b/src/framework/Framework.HttpClientExtensions/Framework.HttpClientExtensions.csproj index 3109a62cbb..6831eb0813 100644 --- a/src/framework/Framework.HttpClientExtensions/Framework.HttpClientExtensions.csproj +++ b/src/framework/Framework.HttpClientExtensions/Framework.HttpClientExtensions.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions TractusX diff --git a/src/framework/Framework.IO/Framework.IO.csproj b/src/framework/Framework.IO/Framework.IO.csproj index 2223a5b992..f50b03f229 100644 --- a/src/framework/Framework.IO/Framework.IO.csproj +++ b/src/framework/Framework.IO/Framework.IO.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.IO Org.Eclipse.TractusX.Portal.Backend.Framework.IO TractusX diff --git a/src/framework/Framework.Linq/Framework.Linq.csproj b/src/framework/Framework.Linq/Framework.Linq.csproj index a796e194fb..447bb05288 100644 --- a/src/framework/Framework.Linq/Framework.Linq.csproj +++ b/src/framework/Framework.Linq/Framework.Linq.csproj @@ -28,7 +28,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Linq Org.Eclipse.TractusX.Portal.Backend.Framework.Linq TractusX diff --git a/src/framework/Framework.Logging/Framework.Logging.csproj b/src/framework/Framework.Logging/Framework.Logging.csproj index 45f630bbbe..bfff35167b 100644 --- a/src/framework/Framework.Logging/Framework.Logging.csproj +++ b/src/framework/Framework.Logging/Framework.Logging.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Logging Org.Eclipse.TractusX.Portal.Backend.Framework.Logging TractusX diff --git a/src/framework/Framework.Models/Framework.Models.csproj b/src/framework/Framework.Models/Framework.Models.csproj index bc8b43a4db..6bc2edc7c5 100644 --- a/src/framework/Framework.Models/Framework.Models.csproj +++ b/src/framework/Framework.Models/Framework.Models.csproj @@ -30,7 +30,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Models Org.Eclipse.TractusX.Portal.Backend.Framework.Models TractusX diff --git a/src/framework/Framework.Seeding/Framework.Seeding.csproj b/src/framework/Framework.Seeding/Framework.Seeding.csproj index 3a768bb535..bb8f24fdc5 100644 --- a/src/framework/Framework.Seeding/Framework.Seeding.csproj +++ b/src/framework/Framework.Seeding/Framework.Seeding.csproj @@ -33,7 +33,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding TractusX diff --git a/src/framework/Framework.Swagger/Framework.Swagger.csproj b/src/framework/Framework.Swagger/Framework.Swagger.csproj index c3d2163639..62a6e5e1ea 100644 --- a/src/framework/Framework.Swagger/Framework.Swagger.csproj +++ b/src/framework/Framework.Swagger/Framework.Swagger.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Swagger Org.Eclipse.TractusX.Portal.Backend.Framework.Swagger TractusX diff --git a/src/framework/Framework.Token/Framework.Token.csproj b/src/framework/Framework.Token/Framework.Token.csproj index 6f51b4a286..f08effbc6e 100644 --- a/src/framework/Framework.Token/Framework.Token.csproj +++ b/src/framework/Framework.Token/Framework.Token.csproj @@ -29,7 +29,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Token Org.Eclipse.TractusX.Portal.Backend.Framework.Token TractusX diff --git a/src/framework/Framework.Web/Framework.Web.csproj b/src/framework/Framework.Web/Framework.Web.csproj index 11f1b087fc..a7cabd4265 100644 --- a/src/framework/Framework.Web/Framework.Web.csproj +++ b/src/framework/Framework.Web/Framework.Web.csproj @@ -28,7 +28,6 @@ - true Org.Eclipse.TractusX.Portal.Backend.Framework.Web Org.Eclipse.TractusX.Portal.Backend.Framework.Web TractusX