Skip to content

Commit

Permalink
chore: merge java-core, java-shared-dependencies, and java-iam into g…
Browse files Browse the repository at this point in the history
…oogle-cloud-java (#9051)

chore: merge java-core, java-shared-dependencies, and java-iam into google-cloud-java
  • Loading branch information
suztomo committed Feb 1, 2023
2 parents 7611a91 + 16ccbb6 commit 1750ab3
Show file tree
Hide file tree
Showing 158 changed files with 25,580 additions and 22 deletions.
7 changes: 7 additions & 0 deletions gapic-libraries-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-iam-policy-bom</artifactId>
<version>1.7.1-SNAPSHOT</version><!-- {x-version-update:google-iam-policy:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-ids-bom</artifactId>
Expand Down
5 changes: 4 additions & 1 deletion generation/check_non_release_please_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set -e

violations=0
for pomFile in $(find . -mindepth 2 -name pom.xml | sort ); do
if [[ "${pomFile}" =~ .*google-cloud-jar-parent.* ]] || [[ "${pomFile}" =~ .*google-cloud-pom-parent.* ]] ||[[ "${pomFile}" =~ .*CoverageAggregator.* ]]; then
if [[ "${pomFile}" =~ .*google-cloud-jar-parent.* ]] || \
[[ "${pomFile}" =~ .*google-cloud-pom-parent.* ]] || \
[[ "${pomFile}" =~ .*CoverageAggregator.* ]] || \
[[ "${pomFile}" =~ .*java-shared-dependencies*. ]]; then
continue
fi
if [[ "${pomFile}" =~ .*owl-bot-postprocessor.* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion generation/generate_gapic_bom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
bom_lines=""
# For modules that produce BOMs
for bom_directory in $(find . -maxdepth 3 -name 'google-*-bom' | sort --dictionary-order); do
if [[ "${bom_directory}" = *gapic-libraries-bom ]]; then
if [[ "${bom_directory}" = *gapic-libraries-bom ]] || [[ "${bom_directory}" = *google-cloud-core* ]]; then
continue
fi
repo_metadata="${bom_directory}/../.repo-metadata.json"
Expand Down
52 changes: 34 additions & 18 deletions generation/merge_repository.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/bin/bash

# Merging repository to google-cloud-java using git-filter-repo.
# https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories
#
# Usage:
# cd google-cloud-java
# # edit the repository to merge.
# vim generation/repo.txt
# # use your account
# export USERNAME=XXX
# # Run the script
# ./generation/merge_repository.sh
# # Create a pull request. Ensure you MERGE the pull request. Not 'squash'.
# cd generation/monorepo/google-cloud-java-merged
# git checkout -b merge_repositories
# gh pr create --title 'chore: merge new repository into google-cloud-java' --body ''

set -xe

Expand Down Expand Up @@ -33,23 +47,25 @@ do
git filter-repo --to-subdirectory-filter ${service}

# setup owlbot files correctly to match monorepo configuration
cp ${service}/.github/.OwlBot.yaml ${service}/.OwlBot.yaml
rm ${service}/.github/.OwlBot.lock.yaml
rm ${service}/.github/.OwlBot.yaml
sed -i.bak '/docker/d' ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak
sed -i.bak '/image/d' ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak

# In monorepo, the staging directory structure tells the destination module to
# which the OwlBot Java postprocessor copies the files.
sed -i.bak "s|owl-bot-staging|owl-bot-staging/${service}|" ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak

text=$(grep '^.*api_shortname.*' ${service}/.repo-metadata.json)
text=$(echo "$text" | sed 's/\"//g; s/\,//g; s/^[[:space:]]*//' )
text=${text/api_shortname/api-name}
echo -e "\n"$text>> ${service}/.OwlBot.yaml
git add .
git config --add secrets.allowed "dest.*src"
git commit -am "chore: setup owlbot configuration"
if [ -r "${service}/.github/.OwlBot.yaml" ]; then
cp ${service}/.github/.OwlBot.yaml ${service}/.OwlBot.yaml
rm ${service}/.github/.OwlBot.lock.yaml
rm ${service}/.github/.OwlBot.yaml
sed -i.bak '/docker/d' ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak
sed -i.bak '/image/d' ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak

# In monorepo, the staging directory structure tells the destination module to
# which the OwlBot Java postprocessor copies the files.
sed -i.bak "s|owl-bot-staging|owl-bot-staging/${service}|" ${service}/.OwlBot.yaml && rm ${service}/.OwlBot.yaml.bak

text=$(grep '^.*api_shortname.*' ${service}/.repo-metadata.json)
text=$(echo "$text" | sed 's/\"//g; s/\,//g; s/^[[:space:]]*//' )
text=${text/api_shortname/api-name}
echo -e "\n"$text>> ${service}/.OwlBot.yaml
git add .
git config --add secrets.allowed "dest.*src"
git commit -am "chore: setup owlbot configuration"
fi

cd "../${merged_repository}"
git remote add ${service} ../${service}
Expand Down Expand Up @@ -158,4 +174,4 @@ git commit -m 'split repo - diff versions.txt' --allow-empty

git add --all || true
git commit -am 'split repo - diff everything else' --allow-empty
cd ../..
cd ../..
5 changes: 4 additions & 1 deletion generation/set_parent_pom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ function replaceParent {
# Then, apply the values as the parent pom of each module
for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml | sort --dictionary-order | xargs dirname); do
# example value of module is "./java-accessapproval"
if [[ "${module}" = *gapic-libraries-bom ]] || [[ "${module}" = *google-cloud-jar-parent ]] || [[ "${module}" = *google-cloud-pom-parent ]]; then
if [[ "${module}" = *gapic-libraries-bom ]] || \
[[ "${module}" = *google-cloud-jar-parent ]] || \
[[ "${module}" = *google-cloud-pom-parent ]] || \
[[ "${module}" = *java-shared-dependencies ]]; then
continue
fi
echo "Processing module $module"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-jar-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-dependencies</artifactId>
<version>3.1.2</version>
<version>3.1.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-shared-dependencies:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down

0 comments on commit 1750ab3

Please sign in to comment.