-
Notifications
You must be signed in to change notification settings - Fork 72
feat: move Java Owlbot into this repository for postprocessing #2282
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
Merged
Merged
Changes from all commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
1394f1c
use local synthtool and owlbot
diegomarquezp bf80792
remove unused files
diegomarquezp ce3e9a2
remove more unused files
diegomarquezp 76d4892
remove cache files in owlbot
diegomarquezp bd00a72
use java 11 for it
diegomarquezp 988132e
remove kokoro files
diegomarquezp 5b1b70e
use glob in owlbot entrypoint
diegomarquezp 5340c39
remove unused files
diegomarquezp c62a373
do not do post-process IT on mac
diegomarquezp 3f28553
concise entrypoint logic
diegomarquezp 46a0c89
cleanup i
diegomarquezp ddf202e
cleanup ii
diegomarquezp 7cfbd6f
cleanup iii
diegomarquezp a2b843d
cleanup iv
diegomarquezp 35b7916
remove templates
diegomarquezp 81d4d60
remove protos folder
diegomarquezp 1e9a788
remove synthtool
diegomarquezp d99e0ae
connect image to owlbot entrypoint
diegomarquezp b1baed7
simplify synthtool docker run command
diegomarquezp 860c45b
install synthtool locally
diegomarquezp 6755cd1
install synthtool only once
diegomarquezp 6ecef4e
Merge remote-tracking branch 'origin/main' into local-owlbot-java-owl…
diegomarquezp 558118d
use virtualenvs to run python scripts
diegomarquezp f8183f8
install pyenv in action
diegomarquezp bdb6cd0
remove jar from history
diegomarquezp e42fc0f
download google-java-format
diegomarquezp 4c489e6
fix pyenv init
diegomarquezp d125c9d
attempt to fix pyenv installation in gh action
diegomarquezp 40c5d24
fix manual pyenv installation
diegomarquezp 60075b3
install pyenv in profile
diegomarquezp e956f4f
install pyenv in bashrc as well
diegomarquezp 0d1c466
use bash shell explicitly in gh action
diegomarquezp 0e6d547
install pyenv in same step as IT
diegomarquezp 7604f3c
do not restart shell
diegomarquezp 5cce976
set pyenv path manually
diegomarquezp 30392b8
install pyenv in its own step
diegomarquezp 29291a7
propagate environment variables to other steps
diegomarquezp ecd3b13
fix global env var setup
diegomarquezp 87ac0ab
remove wrong env settings
diegomarquezp 91d5be6
explain usage of pyenv in README
diegomarquezp 9d4a54c
simplify pyenv setup
diegomarquezp f923b65
add comment to owlbot entrypoint
diegomarquezp 6bda94a
rename destination_path to preprocessed_libraries_path
diegomarquezp e27a402
infer scripts_root in postprocess_library.sh
diegomarquezp 182c111
use temporary folder for preprocess step
diegomarquezp d0db9a0
use owlbot files from workspace
diegomarquezp 4516ba4
get rid of output_folder argument
diegomarquezp d59e65c
use common temp dir to clone synthtool into
diegomarquezp d0915f3
lock synthtool to a specific commitish
diegomarquezp e7ea3b1
fix file transfer
diegomarquezp 8ab96e1
fix owl-bot-staging unpacking
diegomarquezp b140e08
remove unnecessary workspace variable
diegomarquezp 60736ae
rename workspace to postprocessing_target
diegomarquezp 39c3156
remove owlbot sha logic
diegomarquezp ba561c2
remove repository_root variable
diegomarquezp 86e6a3f
cleanup
diegomarquezp c98ba18
correct pyenv comment
diegomarquezp b453c47
clean temp sources folder on each run
diegomarquezp 65f0090
safety checks for get_proto_path_from_preprocessed_sources
diegomarquezp 143534a
fix integration test
diegomarquezp 57e81fa
Merge remote-tracking branch 'origin/main' into move-java-owlbot
diegomarquezp 91fd696
disable compute and asset/v1p2beta1 temporarily
diegomarquezp 33e268a
fix unit tests
diegomarquezp ae3e577
correct comment
diegomarquezp b37cc0d
do not install docker for macos
diegomarquezp 1d25e77
fix owlbot files check
diegomarquezp f0ec962
fix license headers
diegomarquezp a179552
remove unnecessary owlbot_sha
diegomarquezp 3c20c45
add explanation on why are there no macos + postprocess ITs
diegomarquezp a38efb0
use `fmt:format` instead of google formatter
diegomarquezp 1d97cdf
clean templates
diegomarquezp 747560f
remove more unnecessary elements
diegomarquezp f2c937d
add README entry explaining owlbot maintenance
diegomarquezp 5bc7c7f
remove unnecessary java format version
diegomarquezp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.11.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 59fe44fde9866a26e7ee4e4450fd79f67f8cf599 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| #!/bin/bash | ||
| # Copyright 2023 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 | ||
| # | ||
| # 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. | ||
|
|
||
| # This is the entrypoint script for java owlbot. This is not intended to be | ||
| # called directly but rather be called from postproces_library.sh | ||
| # For reference, the positional arguments are | ||
| # 1: scripts_root: location of postprocess_library.sh | ||
| # 2: versions_file: points to a versions.txt containing versions to be applied | ||
| # both to README and pom.xml files | ||
|
|
||
| # The scripts assumes the CWD is the folder where postprocessing is going to be | ||
| # applied | ||
|
|
||
| set -ex | ||
| scripts_root=$1 | ||
| versions_file=$2 | ||
|
|
||
| # Runs template and etc in current working directory | ||
| function processModule() { | ||
| # templates as well as retrieving files from owl-bot-staging | ||
| echo "Generating templates and retrieving files from owl-bot-staging directory..." | ||
| if [ -f "owlbot.py" ] | ||
| then | ||
| # defaults to run owlbot.py | ||
| python3 owlbot.py | ||
| fi | ||
| echo "...done" | ||
|
|
||
| # write or restore pom.xml files | ||
| echo "Generating missing pom.xml..." | ||
| python3 "${scripts_root}/owlbot/src/fix-poms.py" "${versions_file}" "true" | ||
| echo "...done" | ||
|
|
||
| # write or restore clirr-ignored-differences.xml | ||
| echo "Generating clirr-ignored-differences.xml..." | ||
| ${scripts_root}/owlbot/bin/write_clirr_ignore.sh "${scripts_root}" | ||
| echo "...done" | ||
|
|
||
| # fix license headers | ||
| echo "Fixing missing license headers..." | ||
| python3 "${scripts_root}/owlbot/src/fix-license-headers.py" | ||
| echo "...done" | ||
|
|
||
| # TODO: re-enable this once we resolve thrashing | ||
| # restore license headers years | ||
| # echo "Restoring copyright years..." | ||
| # /owlbot/bin/restore_license_headers.sh | ||
| # echo "...done" | ||
|
|
||
| # ensure formatting on all .java files in the repository | ||
| echo "Reformatting source..." | ||
| mvn fmt:format | ||
| echo "...done" | ||
| } | ||
|
|
||
| if [ "$(ls */.OwlBot.yaml|wc -l)" -gt 1 ];then | ||
| # Monorepo (googleapis/google-cloud-java) has multiple OwlBot.yaml config | ||
| # files in the modules. | ||
| echo "Processing monorepo" | ||
| if [ -d owl-bot-staging ]; then | ||
| # The content of owl-bot-staging is controlled by Owlbot.yaml files in | ||
| # each module in the monorepo | ||
| echo "Extracting contents from owl-bot-staging" | ||
| for module in owl-bot-staging/* ; do | ||
| if [ ! -d "$module" ]; then | ||
| continue | ||
| fi | ||
| # This relocation allows us continue to use owlbot.py without modification | ||
| # after monorepo migration. | ||
| mv "owl-bot-staging/$module" "$module/owl-bot-staging" | ||
| pushd "$module" | ||
| processModule | ||
| popd | ||
| done | ||
| rm -r owl-bot-staging | ||
| else | ||
| echo "In monorepo but no owl-bot-staging." \ | ||
| "Formatting changes in the last commit" | ||
| # Find the files that were touched by the last commit. | ||
| last_commit=$(git log -1 --format=%H) | ||
| # [A]dded, [C]reated, [M]odified, and [R]enamed | ||
| changed_files=$(git show --name-only --no-renames --diff-filter=ACMR \ | ||
| "${last_commit}") | ||
| changed_modules=$(echo "$changed_files" |grep -E '.java$' |cut -d '/' -f 1 \ | ||
| |sort -u) | ||
| for module in ${changed_modules}; do | ||
| if [ ! -f "$module/.OwlBot.yaml" ]; then | ||
| # Changes irrelevant to Owlbot-generated module (such as .github) do not | ||
| # need formatting | ||
| continue | ||
| fi | ||
| pushd "$module" | ||
| processModule | ||
| popd | ||
| done | ||
| fi | ||
| else | ||
| # Split repository | ||
| echo "Processing a split repo" | ||
| processModule | ||
| fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.