Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: consolidate configuration in google-cloud-pom-parent and google-cloud-jar-parent #8521

Merged
merged 54 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0690a6e
chore: add script to remove shared deps from modules
meltsufin Oct 5, 2022
cb51f57
chore: remove shared-dependencies and junit dependencyManagement from…
meltsufin Oct 5, 2022
b514547
chore: add non release-please versions check
meltsufin Oct 5, 2022
70c1dad
chore: restrict reonvate to only root pom.xml
meltsufin Oct 5, 2022
92db694
chore: .gitignore tweak
meltsufin Oct 5, 2022
1370a60
Merge branch 'main' into update-versions
meltsufin Oct 5, 2022
a8141b6
chore: update set_parent_pom.sh to remove parent from boms
meltsufin Oct 5, 2022
fdff9be
chore: remove parent from boms
meltsufin Oct 5, 2022
5025e98
Revert "chore: remove parent from boms"
meltsufin Oct 6, 2022
91bd647
chore: split parent into aggregator and parent
meltsufin Oct 6, 2022
85a605b
chore: apply set_parent_pom.sh
meltsufin Oct 7, 2022
a680cc4
Merge branch 'main' into update-versions
meltsufin Oct 7, 2022
d3dd698
chore: apply set_parent_pom.sh
meltsufin Oct 7, 2022
336114e
chore: fix CoverageAggregator
meltsufin Oct 7, 2022
d55b6fe
chore: organzie into pom-parent and jar-parent
meltsufin Oct 7, 2022
e37350c
chore: fix parent pom sync
meltsufin Oct 8, 2022
d589559
chore: fix bom generation script
meltsufin Oct 8, 2022
d7a077b
chore: coverage pom template fix
meltsufin Oct 8, 2022
ed0566a
chore: fix parent version
meltsufin Oct 8, 2022
01e7b94
chore: more config consolidation to parent
meltsufin Oct 8, 2022
fd77b45
chore: improve set_parent_pom.sh
meltsufin Oct 8, 2022
951885a
chore: update renovate.json
meltsufin Oct 8, 2022
71803c6
chore: make junit a dependency in jar parent
meltsufin Oct 9, 2022
9a4f814
chore: cleanup samples poms
meltsufin Oct 9, 2022
a72cb67
chore: regen release please config
meltsufin Oct 9, 2022
32891d5
chore: fix typos
meltsufin Oct 9, 2022
fc409fb
chore: consolidate truth and joda-time
meltsufin Oct 9, 2022
1069752
chore: remove nexus-staging-maven-plugin
meltsufin Oct 9, 2022
fa02b32
chore: remove easymock
meltsufin Oct 9, 2022
5265eca
chore: do not exclude objenesis
meltsufin Oct 9, 2022
2d11c29
Merge branch 'main' into update-versions
meltsufin Oct 10, 2022
600b2ef
chore: update apikes and publicca
meltsufin Oct 10, 2022
0f84333
chore: consolidate only dependency management to parent
meltsufin Oct 10, 2022
896ffbc
chore: simply manage junit version in parent
meltsufin Oct 10, 2022
0fec51b
chore: restore deps accidentally being removed
meltsufin Oct 10, 2022
05d038c
Merge branch 'main' into update-versions
meltsufin Oct 10, 2022
7b7c248
chore: sync with main
meltsufin Oct 10, 2022
d1930cb
chore: chore more cleanup of versions
meltsufin Oct 10, 2022
5c7d4e2
chore: move pubsub bom import to parent
meltsufin Oct 11, 2022
f25a2dd
chore: a few more
meltsufin Oct 11, 2022
f79a194
chore: translate dep fix
meltsufin Oct 11, 2022
e3989af
chore: cleanup grafeas deps
meltsufin Oct 11, 2022
0f67046
chore: add version annotations where needed
meltsufin Oct 11, 2022
821edcf
chore: remove Java 11 setting
meltsufin Oct 11, 2022
6e2e0e0
Merge branch 'main' into update-versions
meltsufin Oct 11, 2022
0845f6b
chore: set suztomo as the developer for maven central
meltsufin Oct 11, 2022
d5be52e
chore: update bom template
meltsufin Oct 11, 2022
b2a8e75
chore: apply version updates
meltsufin Oct 11, 2022
85e46db
Merge branch 'main' into update-versions
meltsufin Oct 11, 2022
68fa32b
chore: remove unnecessary build section in parent pom
meltsufin Oct 11, 2022
512f907
chore: add Repository Structure documentation
meltsufin Oct 11, 2022
6f94bfa
chore: rename google-cloud-gapic-bom to gapic-libraries-bom
meltsufin Oct 11, 2022
0e14e1c
Merge branch 'main' into update-versions
meltsufin Oct 12, 2022
d54f737
chore: fix generate_release_please_config.sh
meltsufin Oct 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .github/workflows/generated_files_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
bash generation/apply_current_versions.sh
- name: Fail if there's any difference
run: git --no-pager diff --exit-code

owlbot-py:
name: applying templated owlbot.py config doesn't create a diff
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,3 +120,14 @@ jobs:
exit 1
fi


consolidate-config:
name: parent handles config for child modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Apply consolidate_config.sh
run: |
bash generation/consolidate_config.sh
- name: Fail if there's any difference
run: git --no-pager diff --exit-code
27 changes: 27 additions & 0 deletions .github/workflows/versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2022 Google LLC
#
# 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.
# Github action job to test core java library features on
# downstream client libraries before they are released.
on:
push:
branches:
- main
pull_request:
name: unmanaged versions check
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./generation/check_non_release_please_versions.sh
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ api_key
generation/new_client/workspace

# Monorepo repository generation
monorepo/
monorepo

1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"google-cloud-gapic-bom": "0.0.0",
"google-cloud-jar-parent": "0.0.0",
"java-accessapproval": "2.4.9",
"java-accesscontextmanager": "1.4.5",
"java-aiplatform": "3.4.0",
Expand Down
4 changes: 2 additions & 2 deletions CoverageAggregator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>google-cloud-java-parent</artifactId>
<artifactId>google-cloud-pom-parent</artifactId>
<groupId>com.google.cloud</groupId>
<version>1.0.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-java:current} -->
<version>1.0.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-pom-parent:current} -->
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
118 changes: 5 additions & 113 deletions generation/bom.pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,124 +13,16 @@
detail of the Libraries BOM.
</description>

<developers>
<developer>
<id>chingor</id>
<name>Jeff Ching</name>
<email>chingor@google.com</email>
<organization>Google</organization>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<organization>
<name>Google LLC</name>
</organization>
<scm>
<connection>scm:git:git@github.com:googleapis/google-cloud-java.git</connection>
<developerConnection>scm:git:git@github.com:googleapis/google-cloud-java.git</developerConnection>
<url>https://github.com/googleapis/google-cloud-java</url>
<tag>HEAD</tag>
</scm>
<issueManagement>
<url>https://github.com/googleapis/google-cloud-java/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<licenses>
<license>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<parent>
<artifactId>google-cloud-pom-parent</artifactId>
<groupId>com.google.cloud</groupId>
<version>1.0.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-pom-parent:current} -->
</parent>

<dependencyManagement>
<dependencies>
BOM_ARTIFACT_LIST
</dependencies>
</dependencyManagement>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://google.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://google.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<skipDeploy>true</skipDeploy>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
6 changes: 6 additions & 0 deletions generation/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ echo "Working directory: $(pwd)"

cp ../../../license-checks.xml .
cp ../../../java.header .
cp -R ../../../google-cloud-jar-parent google-cloud-jar-parent

git add --all
git commit -m 'chore: add template files'
Expand All @@ -80,6 +81,11 @@ bash ../../set_parent_pom.sh
git add --all
git commit -am 'chore: point modules to the aggregator pom as parent'

../../consolidate_config.sh

git add --all
git commit -am 'chore: consolidate config to parent'

../../generate_gapic_bom.sh

# add the gapic bom module to root pom.xml by regenerating aggregator pom
Expand Down
22 changes: 22 additions & 0 deletions generation/check_non_release_please_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

violations=0
for pomFile in $(find . -mindepth 2 -name pom.xml | sort ); do
if [[ "${pomFile}" =~ .*google-cloud-jar-parent.* ]] || [[ "${pomFile}" =~ .*CoverageAggregator.* ]]; then
continue
fi

if grep -n '<version>.*</version>' "$pomFile" | grep -v 'x-version-update'; then
echo "Found version declaration(s) without x-version-update in: $pomFile"
violations=$((violations + 1))
echo "---------------------------------------------------------"
fi
done

echo "FOUND $violations VIOLATIONS!"

if [[ $violations -gt 0 ]]; then
exit 1
fi
94 changes: 94 additions & 0 deletions generation/consolidate_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

# For each {module}/pom.xml
# Removes dependencyManagement and pluginManagement that should be handled in the parent
# Also removes other configuration that is handled in google-cloud-pom-parent and google-cloud-jar-parent

set -e

function runRegexOnPoms {
perl_command=$1
search=$2
for pomFile in $(find . -mindepth 2 -maxdepth 3 -name pom.xml | sort ); do
if [[ $pomFile =~ .*google-cloud-jar-parent.* ]]; then
continue
fi

if grep -q "${search}" "$pomFile" && [[ $(wc -c < "$pomFile") != $(perl -0pe "$perl_command" "$pomFile" | wc -c) ]]; then
# execute the replacement in pom.xml
echo "Applying $perl_command for $pomFile"
perl -i -0pe "$perl_command" "$pomFile"
fi

done
}

function removeArtifact {
type=$1
name=$2
parent=$3
perl_command="s/(<${parent}>.*?)\s*<${type}>\s*?<groupId>[a-z\-\.]*<\/groupId>\s*?<artifactId>${name//-/\-}<\/artifactId>.*?<\/${type}>(.*?<\/${parent}>)/\$1\$2/s"
runRegexOnPoms "$perl_command" "$name"
}

function removeArtifactVersion {
type=$1
name=$2
perl_command="s/(\s*<${type}>\s*?<groupId>[a-z\-\.]*<\/groupId>\s*?<artifactId>${name//-/\-}<\/artifactId>\s*?(<scope>.*?<\/scope>)?)\s*?<version>[^\\n]*?<\/version>(.*?<\/${type}>)/\$1\$3/s"
runRegexOnPoms "$perl_command" "$name"
}

function annotateArtifactVersion {
type=$1
name=$2
perl_command="s/(\s*<${type}>\s*?<groupId>[a-z\-\.]*<\/groupId>\s*?<artifactId>${name//-/\-}<\/artifactId>\s*?(<scope>.*?<\/scope>)?\s*?)(<version>[^\\n]*?<\/version>)([^:\\n]*\\n.*?<\/${type}>)/\$1\$3<!-- {x-version-update:${name//-/\-}:current} -->\$4/s"
runRegexOnPoms "$perl_command" "$name"
}

function removeManagedDependency {
dependency=$1
removeArtifact 'dependency' "${dependency}" "dependencyManagement"
}

function removeElement {
element=$1
perl_command="s/\s*<${element}>.*?<\/${element}>//s"
runRegexOnPoms "$perl_command" "<${element}>"
}

removeManagedDependency 'google-cloud-shared-dependencies'
removeManagedDependency 'junit'
removeManagedDependency 'joda-time'
removeManagedDependency 'truth'
removeManagedDependency 'easymock'
removeManagedDependency 'perfmark-api'
removeManagedDependency 'google-cloud-pubsub'
removeManagedDependency 'proto-google-cloud-pubsub-v1'
removeManagedDependency 'google-cloud-pubsub-bom'
removeManagedDependency 'google-api-services-translate'
removeElement 'reporting'
removeElement 'developers'
removeElement 'organization'
removeElement 'scm'
removeElement 'issueManagement'
removeElement 'licenses'
removeElement 'junit.version'
removeArtifact 'plugin' 'nexus-staging-maven-plugin' 'plugins'
removeArtifact 'dependency' 'checkstyle' 'plugins'
removeArtifactVersion 'dependency' 'junit'
removeArtifactVersion 'dependency' 'easymock'
removeArtifactVersion 'dependency' 'truth'
removeArtifactVersion 'dependency' 'grpc-google-common-protos'
removeArtifactVersion 'dependency' 'google-api-services-dns'
removeArtifactVersion 'dependency' 'google-api-services-translate'
removeArtifactVersion 'dependency' 'google-api-services-cloudresourcemanager'
removeArtifactVersion 'dependency' 'google-api-services-storage'
removeArtifactVersion 'dependency' 'google-cloud-storage'
removeArtifactVersion 'plugin' 'maven-checkstyle-plugin'
removeArtifactVersion 'dependency' 'mockito-all'
removeArtifactVersion 'dependency' 'objenesis'
annotateArtifactVersion 'dependency' 'grafeas'
annotateArtifactVersion 'dependency' 'proto-google-cloud-orgpolicy-v1'
annotateArtifactVersion 'dependency' 'proto-google-identity-accesscontextmanager-v1'
annotateArtifactVersion 'dependency' 'proto-google-cloud-os-config-v1'
annotateArtifactVersion 'dependency' 'google-cloud-resourcemanager'
4 changes: 2 additions & 2 deletions generation/coverage.pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>google-cloud-java-parent</artifactId>
<artifactId>google-cloud-pom-parent</artifactId>
<groupId>com.google.cloud</groupId>
<version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-java:current} -->
<version>1.0.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-pom-parent:current} -->
</parent>
<modelVersion>4.0.0</modelVersion>

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 @@ -45,7 +45,7 @@ for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml |sort --dictionary-
if ls ${module}/*-bom 1> /dev/null 2>&1; then
continue
fi
if [[ "${module}" = *google-cloud-gapic-bom ]] || [[ "${module}" = *CoverageAggregator ]]; then
if ! test -f "${module}/.repo-metadata.json"; then
continue
fi

Expand Down
Loading