diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000..ec24ba682 --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,3 @@ +docker: + digest: sha256:db1616f2f70823d8381d859835229e04371d14f59ac78063c5af73c55c3fffbb + image: gcr.io/repo-automation-bots/owlbot-java:latest diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 000000000..8c5f03b4d --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,16 @@ +# Copyright 2021 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. + +docker: + image: "gcr.io/repo-automation-bots/owlbot-java:latest" diff --git a/.github/.release-please.yml b/.github/.release-please.yml new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/.github/.release-please.yml @@ -0,0 +1 @@ + diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..30fdb7b9c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. + +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +* @googleapis/yoshi-java + +# The java-samples-reviewers team is the default owner for samples changes +samples/**/*.java @googleapis/java-samples-reviewers diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..7c86b0e47 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ +Thanks for stopping by to let us know something could be better! + +Please be sure to include as much information as possible: + +#### Environment details + +- OS: +- Java version: +- google-api-java-client version: + +#### Steps to reproduce + +1. ? +2. ? + +#### Stacktrace + +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides used + +- ? + +#### Any additional information below + +Making sure to follow these steps will guarantee the quickest resolution possible. + +Thanks! + diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..f69f0c445 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/google-api-java-client/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. google-api-client version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..754e30c68 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 000000000..995869032 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..cbe6adac4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/google-api-java-client/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 000000000..1a23ea42b --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 000000000..c644a24e1 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,12 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' +ignoreAuthors: +- 'renovate-bot' +- 'yoshi-automation' +- 'release-please[bot]' +- 'gcf-owl-bot[bot]' diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 000000000..3cc5e9baf --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,8 @@ +bumpMinorPreMajor: true +handleGHRelease: true +releaseType: java-yoshi +branches: + - bumpMinorPreMajor: true + handleGHRelease: true + releaseType: java-lts + branch: 1.31.3-sp diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 000000000..d4ca94189 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 000000000..a8c5b3ed6 --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,43 @@ +rebaseMergeAllowed: false +squashMergeAllowed: true +mergeCommitAllowed: false +branchProtectionRules: + - pattern: master + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - units (7) + - units (8) + - units (11) + - windows + - dependencies (8) + - dependencies (11) + - linkage-monitor + - lint + - clirr + - cla/google + - pattern: 1.31.3-sp + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - units (7) + - units (8) + - units (11) + - windows + - dependencies (8) + - dependencies (11) + - linkage-monitor + - lint + - clirr + - cla/google +permissionRules: + - team: yoshi-admins + permission: admin + - team: yoshi-java-admins + permission: admin + - team: yoshi-java + permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 000000000..a0ba1f7d9 --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,3 @@ +trustedContributors: +- renovate-bot +- gcf-owl-bot[bot] diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml new file mode 100644 index 000000000..7513acaeb --- /dev/null +++ b/.github/workflows/approve-readme.yaml @@ -0,0 +1,54 @@ +on: + pull_request: +name: auto-merge-readme +jobs: + approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + script: | + // only approve PRs from yoshi-automation + if (context.payload.pull_request.user.login !== "yoshi-automation") { + return; + } + + // only approve PRs like "chore: release " + if (!context.payload.pull_request.title === "chore: regenerate README") { + return; + } + + // only approve PRs with README.md and synth.metadata changes + const files = new Set( + ( + await github.paginate( + github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + ) + ).map(file => file.filename) + ); + if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { + return; + } + + // approve README regeneration PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped PR!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach automerge label + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['automerge'] + }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 000000000..9b4fd4d83 --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,88 @@ +on: + pull_request: +name: auto-release +jobs: + approve: + runs-on: ubuntu-latest + if: contains(github.head_ref, 'release-please') + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + debug: true + script: | + // only approve PRs from release-please[bot] + if (context.payload.pull_request.user.login !== "release-please[bot]") { + return; + } + + // only approve PRs like "chore: release " + if ( !context.payload.pull_request.title.startsWith("chore: release") ) { + return; + } + + // only approve PRs with pom.xml and versions.txt changes + const filesPromise = github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const changed_files = await github.paginate(filesPromise) + + if ( changed_files.length < 1 ) { + console.log( "Not proceeding since PR is empty!" ) + return; + } + + if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { + console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) + return; + } + + // trigger auto-release when + // 1) it is a SNAPSHOT release (auto-generated post regular release) + // 2) there are dependency updates only + // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) + if ( + context.payload.pull_request.body.includes("Fix") || + context.payload.pull_request.body.includes("Build") || + context.payload.pull_request.body.includes("Documentation") || + context.payload.pull_request.body.includes("BREAKING CHANGES") || + context.payload.pull_request.body.includes("Features") + ) { + console.log( "Not auto-releasing since it is not a dependency-update-only release." ); + return; + } + + const promise = github.pulls.list.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const open_pulls = await github.paginate(promise) + + if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { + for ( const pull of open_pulls ) { + if ( pull.title.startsWith("deps: update dependency") ) { + console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); + return; + } + } + } + + // approve release PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped release!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach kokoro:force-run and automerge labels + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['kokoro:force-run', 'automerge'] + }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..cc337f60d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,102 @@ +on: + push: + branches: + - master + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + matrix: + java: [7, 8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/install_dependencies.sh + - run: .kokoro/build.sh + env: + JOB_TYPE: test + windows: + runs-on: windows-latest + steps: + - name: git configuration to avoid automatic CRLF conversion + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - name: Install google-play-services artifact + shell: bash + run: | + mkdir play-services + cd play-services + curl --output play-services-basement-8.3.0.aar https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar + unzip play-services-basement-8.3.0.aar + mvn install:install-file \ + -Dfile=classes.jar \ + -DgroupId=com.google.android.google-play-services \ + -DartifactId=google-play-services \ + -Dversion=1 \ + -Dpackaging=jar + - run: .kokoro/build.sh + shell: bash + env: + JOB_TYPE: test + dependencies: + runs-on: ubuntu-latest + strategy: + matrix: + java: [8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/install_dependencies.sh + - run: .kokoro/dependencies.sh + linkage-monitor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/install_dependencies.sh + - name: Install artifacts to local Maven repository + run: .kokoro/build.sh + shell: bash + - name: Validate dependencies with regard to com.google.cloud:libraries-bom (latest release) + uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: java -version + - run: .kokoro/install_dependencies.sh + - run: .kokoro/build.sh + env: + JOB_TYPE: lint + clirr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/install_dependencies.sh + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr \ No newline at end of file diff --git a/.gitignore b/.gitignore index 809cc8f28..2d6752757 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,30 @@ -target/ -bin/ +.gitignore + +# Packages +dist +bin +var +sdist +target + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject +*.iml +.idea +.settings +.DS_Store +.classpath + + +# Python utilities +*.pyc diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 88774422d..000000000 --- a/.hgignore +++ /dev/null @@ -1,6 +0,0 @@ - -syntax: regexp -^(.*/)?target$ - -syntax: regexp -^(.*/)?bin$ diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 000000000..05826ad93 --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 000000000..5bcd551cf --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +samples) + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -Penable-samples \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_FLAKYBOT}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-api-java-client +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 000000000..46edbf7f2 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2019 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. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 000000000..7ba13c29d --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 000000000..ace89f45a --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2020 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. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 000000000..81ac96db0 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/java10.cfg b/.kokoro/continuous/java10.cfg new file mode 100644 index 000000000..6e2f1f5fa --- /dev/null +++ b/.kokoro/continuous/java10.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java10" +} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 000000000..495cc7bac --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/continuous/propose_release.sh b/.kokoro/continuous/propose_release.sh new file mode 100755 index 000000000..a67b3ce2b --- /dev/null +++ b/.kokoro/continuous/propose_release.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Copyright 2019 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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + # Groom the release PR as new commits are merged. + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ + --repo-url=googleapis/google-api-java-client \ + --package-name="google-api-client" \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ + --release-type=java-yoshi +fi diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 000000000..9030ba8f9 --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail +shopt -s nullglob + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dmaven.javadoc.skip=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in **/.flattened-pom.xml +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/install_dependencies.sh b/.kokoro/install_dependencies.sh new file mode 100755 index 000000000..a0439dd7d --- /dev/null +++ b/.kokoro/install_dependencies.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# Install the android SDK +mvn dependency:get -Dartifact=com.google.android:android:4.1.1.4 + +# Install the appengine SDK +mvn dependency:get -Dartifact=com.google.appengine:appengine-api-1.0-sdk:1.9.65 + +# Install play services +mvn dependency:get -Dartifact=com.google.android.google-play-services:google-play-services:1 -o -DremoteRepositories=file:~/.m2 || \ + (wget https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar && \ + unzip play-services-basement-8.3.0.aar && \ + mvn install:install-file \ + -Dfile=classes.jar \ + -DgroupId=com.google.android.google-play-services \ + -DartifactId=google-play-services \ + -Dversion=1 \ + -Dpackaging=jar) diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 000000000..81ac96db0 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 000000000..e51c7b4c6 --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 000000000..709f2b4c7 --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 000000000..cb24f44ee --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 000000000..59d051c1b --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-java-client/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 000000000..a4d91e3ca --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-java-client/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 000000000..495cc7bac --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 000000000..9761fd864 --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 000000000..f52514257 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 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. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 000000000..ec572442e --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 000000000..4e28721be --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 000000000..e23bcb07e --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 000000000..dded67a9d --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/java10.cfg b/.kokoro/presubmit/java10.cfg new file mode 100644 index 000000000..6e2f1f5fa --- /dev/null +++ b/.kokoro/presubmit/java10.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java10" +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 000000000..709f2b4c7 --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 000000000..cb24f44ee --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 000000000..59d051c1b --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-java-client/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 000000000..a4d91e3ca --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-java-client/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 000000000..495cc7bac --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/java9.cfg b/.kokoro/presubmit/java9.cfg new file mode 100644 index 000000000..3b9c408d6 --- /dev/null +++ b/.kokoro/presubmit/java9.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java9" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 000000000..5bb77dd41 --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 000000000..6d323c8ae --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 000000000..01e096004 --- /dev/null +++ b/.kokoro/presubmit/samples.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh new file mode 100755 index 000000000..d2bc9736a --- /dev/null +++ b/.kokoro/readme.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2020 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. + +set -eo pipefail + +cd ${KOKORO_ARTIFACTS_DIR}/github/google-api-java-client + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Kokoro exposes this as a file, but the scripts expect just a plain variable. +export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) + +# Setup git credentials +echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials +git config --global credential.helper 'store --file ~/.git-credentials' + +python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool + +set +e +python3.6 -m autosynth.synth \ + --repository=googleapis/google-api-java-client \ + --synth-file-name=.github/readme/synth.py \ + --metadata-path=.github/readme/synth.metadata \ + --pr-title="chore: regenerate README" \ + --branch-suffix="readme" + +# autosynth returns 28 to signal there are no changes +RETURN_CODE=$? +if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] +then + exit ${RETURN_CODE} +fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 000000000..d192d119e --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/bump_snapshot.sh b/.kokoro/release/bump_snapshot.sh new file mode 100755 index 000000000..6ebc38ad0 --- /dev/null +++ b/.kokoro/release/bump_snapshot.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2019 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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + # Groom the snapshot release PR immediately after publishing a release + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ + --repo-url=googleapis/google-api-java-client \ + --package-name="google-api-client" \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ + --snapshot \ + --release-type=java-auth-yoshi +fi diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 000000000..ea8de3624 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-api-java-client/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 000000000..7f78ee414 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 000000000..4b17d187a --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 000000000..742ec1a88 --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 000000000..7f210a7d2 --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 000000000..3cac3d8a9 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 000000000..512780c53 --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,23 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" + +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/publish_javadoc.sh" +} + + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 000000000..ac6b4d649 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-api-client +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B -q + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg new file mode 100644 index 000000000..9d466b639 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.cfg @@ -0,0 +1,30 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# cloud-rad production +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2" +} + +# Configure the docker image for kokoro-trampoline +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/publish_javadoc11.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh new file mode 100755 index 000000000..19d42a7bc --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# Copyright 2021 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-api-client +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# V3 generates docfx yml from javadoc +# generate yml +mvn clean site -B -q -P docFX + +# copy README to docfx-yml dir and rename index.md +cp README.md target/docfx-yml/index.md +# copy CHANGELOG to docfx-yml dir and rename history.md +cp CHANGELOG.md target/docfx-yml/history.md + +pushd target/docfx-yml + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --xrefs devsite://java/gax \ + --xrefs devsite://java/google-cloud-core \ + --xrefs devsite://java/api-common \ + --xrefs devsite://java/proto-google-common-protos \ + --xrefs devsite://java/google-api-client \ + --xrefs devsite://java/google-http-client \ + --xrefs devsite://java/protobuf \ + --language java + +# upload yml to production bucket +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 000000000..166c105ba --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 000000000..1f55b7702 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 000000000..329861871 --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-java-client/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/google-api-java-client/target/nexus-staging/staging/*.properties" + strip_prefix: "github/google-api-java-client" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 000000000..77dc4e8f0 --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 000000000..8b69b793c --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 000000000..fe101bec7 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,10 @@ +{ + "name": "google-api-client", + "name_pretty": "Google API Java Client", + "client_documentation": "https://googleapis.dev/java/google-api-client/latest/", + "release_level": "ga", + "language": "java", + "repo": "googleapis/google-api-java-client", + "repo_short": "google-api-java-client", + "distribution_name": "com.google.api-client:google-api-client" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..c08c119ec --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,212 @@ +# Changelog + +### [1.32.1](https://www.github.com/googleapis/google-api-java-client/compare/v1.32.0...v1.32.1) (2021-06-24) + + +### Bug Fixes + +* bring comment up to date with code ([#1838](https://www.github.com/googleapis/google-api-java-client/issues/1838)) ([f150c5a](https://www.github.com/googleapis/google-api-java-client/commit/f150c5aa6e2de0c6cbad7461f4b76be8e0027567)) +* Update dependencies.sh to not break on mac ([#1830](https://www.github.com/googleapis/google-api-java-client/issues/1830)) ([97940b3](https://www.github.com/googleapis/google-api-java-client/commit/97940b3fd96e343df3985630398811f3c417afcc)) + + +### Dependencies + +* don't use sp versions in the regular release ([#1840](https://www.github.com/googleapis/google-api-java-client/issues/1840)) ([94cde71](https://www.github.com/googleapis/google-api-java-client/commit/94cde719e9ad845bcd186595e06279e2b7c19096)) + +## [1.32.0](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.5...v1.32.0) (2021-06-22) + + +### Features + +* add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#1813](https://www.github.com/googleapis/google-api-java-client/issues/1813)) ([56f5b8b](https://www.github.com/googleapis/google-api-java-client/commit/56f5b8be0a60cb1cf0b279743d85ef57d9aa46b6)) + + +### Bug Fixes + +* add reason field to Details in GoogleJsonErrorObject ([#1831](https://www.github.com/googleapis/google-api-java-client/issues/1831)) ([5e92b4c](https://www.github.com/googleapis/google-api-java-client/commit/5e92b4c22e0d45686a58de58977d20c96593e901)) + +### [1.31.5](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.4...v1.31.5) (2021-05-10) + + +### Bug Fixes + +* release scripts from issuing overlapping phases ([#1769](https://www.github.com/googleapis/google-api-java-client/issues/1769)) ([3174ff9](https://www.github.com/googleapis/google-api-java-client/commit/3174ff9ddf0c7428b90bff766c6b18bf17d1feac)) +* remove deprecated parent pom ([#1785](https://www.github.com/googleapis/google-api-java-client/issues/1785)) ([5da3355](https://www.github.com/googleapis/google-api-java-client/commit/5da335518ff5076ea5dd4f40fd0494330458296c)) +* update GoogleJsonError object to accomodate all fields in Invalid parameter exception ([#1783](https://www.github.com/googleapis/google-api-java-client/issues/1783)) ([94c4570](https://www.github.com/googleapis/google-api-java-client/commit/94c4570e16324b4c654d4ec3f0f940926064d955)) + +### [1.31.4](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.3...v1.31.4) (2021-04-09) + + +### Bug Fixes + +* re-encode public keys from google.jks into p12 format for android ([#1738](https://www.github.com/googleapis/google-api-java-client/issues/1738)) ([83f3702](https://www.github.com/googleapis/google-api-java-client/commit/83f37023ea50a643a76eb6e5230072e5c829a205)) +* wrap BatchRequest InputStream with BufferedInputStream ([#1749](https://www.github.com/googleapis/google-api-java-client/issues/1749)) ([07346d8](https://www.github.com/googleapis/google-api-java-client/commit/07346d8dfa955a40daf01b8fb17fe1d75dc2a998)) + + +### Dependencies + +* update guava ([#1762](https://www.github.com/googleapis/google-api-java-client/issues/1762)) ([2197258](https://www.github.com/googleapis/google-api-java-client/commit/219725878e9954e724a1832ee615553319771c54)) +* update project.http.version to v1.39.2 ([#1748](https://www.github.com/googleapis/google-api-java-client/issues/1748)) ([5f62a41](https://www.github.com/googleapis/google-api-java-client/commit/5f62a412dcaabe8cb17783b9add6366dde7d96be)) + +### [1.31.3](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.2...v1.31.3) (2021-03-01) + + +### Dependencies + +* update google-http-client to v1.39.0 ([#1731](https://www.github.com/googleapis/google-api-java-client/issues/1731)) ([918fc3b](https://www.github.com/googleapis/google-api-java-client/commit/918fc3bc2eb45d704edad6c02ca811348c6df922)) + +### [1.31.2](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.1...v1.31.2) (2021-01-14) + + +### Bug Fixes + +* remove unused code ([#1664](https://www.github.com/googleapis/google-api-java-client/issues/1664)) ([3e9169f](https://www.github.com/googleapis/google-api-java-client/commit/3e9169f1af87dd947d24440f82fd4e0d7d4e4e5a)) +* use Gson instead of Jackson ([#1661](https://www.github.com/googleapis/google-api-java-client/issues/1661)) ([63ed2ca](https://www.github.com/googleapis/google-api-java-client/commit/63ed2caecc200a407ef40b249bed158f18e2c5ae)) + + +### Documentation + +* Update the documentation link for GoogleCredential from deprecated version to newer version ([#1652](https://www.github.com/googleapis/google-api-java-client/issues/1652)) ([98db6ca](https://www.github.com/googleapis/google-api-java-client/commit/98db6ca0113396e715894a083227f062269ca93d)) + + +### Dependencies + +* update Guava to 30.0 ([#1645](https://www.github.com/googleapis/google-api-java-client/issues/1645)) ([9e34f37](https://www.github.com/googleapis/google-api-java-client/commit/9e34f37e2ef667507e03cb2d495b2c945851eb30)) +* update Guava to 30.1 ([#1658](https://www.github.com/googleapis/google-api-java-client/issues/1658)) ([677011e](https://www.github.com/googleapis/google-api-java-client/commit/677011ea4ec40e85d6e219de4e0d8d095b40acd8)) + +### [1.31.1](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.0...v1.31.1) (2020-11-16) + + +### Bug Fixes + +* socketfactory not registered for apache ([#1637](https://www.github.com/googleapis/google-api-java-client/issues/1637)) ([e886efa](https://www.github.com/googleapis/google-api-java-client/commit/e886efaa384bac106f2e5efcc3fb59901c251505)) + +## [1.31.0](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.11...v1.31.0) (2020-11-10) + + +### Features + +* add GoogleApacheHttpTransport that uses the v2 ApacheHttpTransport implementation ([#1568](https://www.github.com/googleapis/google-api-java-client/issues/1568)) ([d0dbca7](https://www.github.com/googleapis/google-api-java-client/commit/d0dbca720479f1ca8627c58eda195857ea0b2423)) +* add mtls support to GoogleNetHttpTransport and GoogleApacheHttpTransport ([#1619](https://www.github.com/googleapis/google-api-java-client/issues/1619)) ([1d8304c](https://www.github.com/googleapis/google-api-java-client/commit/1d8304c6311e910293b800ffdbf0bb6f19cf7fff)) + + +### Dependencies + +* update dependency com.google.appengine:appengine-api-1.0-sdk to v1.9.83 ([#1622](https://www.github.com/googleapis/google-api-java-client/issues/1622)) ([10bb904](https://www.github.com/googleapis/google-api-java-client/commit/10bb90441c90cb5ea7045a1ac5d39d669fad963d)) +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.31.2 ([#1623](https://www.github.com/googleapis/google-api-java-client/issues/1623)) ([5942561](https://www.github.com/googleapis/google-api-java-client/commit/594256120e4eb37b0f3ca386f69542b68b53d05b)) +* update google-http-client to v1.38.0 ([#1620](https://www.github.com/googleapis/google-api-java-client/issues/1620)) ([bb63ded](https://www.github.com/googleapis/google-api-java-client/commit/bb63ded8846cd515c993c288728063f35e226ec5)) + +### [1.30.11](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.10...v1.30.11) (2020-10-13) + + +### Dependencies + +* update dependency com.google.appengine:appengine-api-1.0-sdk to v1.9.82 ([#1518](https://www.github.com/googleapis/google-api-java-client/issues/1518)) ([d77e5fa](https://www.github.com/googleapis/google-api-java-client/commit/d77e5fad9db5bf0e4bc73e42299e86ea6d72709d)) +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.31.1 ([#1599](https://www.github.com/googleapis/google-api-java-client/issues/1599)) ([73f3a6d](https://www.github.com/googleapis/google-api-java-client/commit/73f3a6d2de662179d08d11cc48e843499758cb94)) +* update dependency com.google.protobuf:protobuf-java to v3.13.0 ([#1558](https://www.github.com/googleapis/google-api-java-client/issues/1558)) ([27b0359](https://www.github.com/googleapis/google-api-java-client/commit/27b0359568f780c65b8ffe9e893d40f6f748cff2)) +* update dependency commons-codec:commons-codec to v1.15 ([#1574](https://www.github.com/googleapis/google-api-java-client/issues/1574)) ([e453cdb](https://www.github.com/googleapis/google-api-java-client/commit/e453cdb272738196a561ee4395a567719594f656)) +* update google-http-client to v1.37.0 ([#1598](https://www.github.com/googleapis/google-api-java-client/issues/1598)) ([6504e79](https://www.github.com/googleapis/google-api-java-client/commit/6504e791d68c73ec1ca4d43f9ff9369b52f8c64f)) + +### [1.30.10](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.9...v1.30.10) (2020-07-08) + + +### Bug Fixes + +* cleanup checkstyle import rules ([#1503](https://www.github.com/googleapis/google-api-java-client/issues/1503)) ([ce22c0e](https://www.github.com/googleapis/google-api-java-client/commit/ce22c0ea7d02bd1807eae0076bfe55db1a3b754c)) +* cleanup commented code of version control ([#1504](https://www.github.com/googleapis/google-api-java-client/issues/1504)) ([5b1968d](https://www.github.com/googleapis/google-api-java-client/commit/5b1968d7bb05affd211b3403a6acc18c3d0c23d9)) + + +### Dependencies + +* remove excess dependencies ([#1502](https://www.github.com/googleapis/google-api-java-client/issues/1502)) ([dbe6287](https://www.github.com/googleapis/google-api-java-client/commit/dbe6287dac5b7340827a03c0977ad8f350b58eae)) +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.31.0 ([#1544](https://www.github.com/googleapis/google-api-java-client/issues/1544)) ([ebab80d](https://www.github.com/googleapis/google-api-java-client/commit/ebab80d1fec30bde241a5cb7a3146c89aca5359c)) +* update dependency com.google.protobuf:protobuf-java to v3.12.2 ([#1527](https://www.github.com/googleapis/google-api-java-client/issues/1527)) ([a4cdec7](https://www.github.com/googleapis/google-api-java-client/commit/a4cdec7afd3c5fb1b6cb4de05021e156dd9d0a14)) +* update google-http-client to v1.36.0 ([#1551](https://www.github.com/googleapis/google-api-java-client/issues/1551)) ([01c635a](https://www.github.com/googleapis/google-api-java-client/commit/01c635a21fc3d7b549b6a19cbf3359cacf04ef47)) +* update oauth client ([#1499](https://www.github.com/googleapis/google-api-java-client/issues/1499)) ([b9c222c](https://www.github.com/googleapis/google-api-java-client/commit/b9c222cfdc4578dabca48cfbe64068f4f70d3b18)) +* update to Guava 29.0 ([#1516](https://www.github.com/googleapis/google-api-java-client/issues/1516)) ([fda223d](https://www.github.com/googleapis/google-api-java-client/commit/fda223d5da5076396bc896db3227facde17e89e5)) + + +### Documentation + +* removes reference to deprecated service (Google+) ([#1530](https://www.github.com/googleapis/google-api-java-client/issues/1530)) ([b257207](https://www.github.com/googleapis/google-api-java-client/commit/b2572075418dbbb86b9da8901184c72966464520)) + +### [1.30.9](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.8...v1.30.9) (2020-02-18) + + +### Bug Fixes + +* use embedded Proguard configuration instead of compile-time annotation ([#1491](https://www.github.com/googleapis/google-api-java-client/issues/1491)) ([8a59ed0](https://www.github.com/googleapis/google-api-java-client/commit/8a59ed071f19d9b78d284cdc75181ee102ca9c61)), closes [#1467](https://www.github.com/googleapis/google-api-java-client/issues/1467) [#1489](https://www.github.com/googleapis/google-api-java-client/issues/1489) + +### [1.30.8](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.7...v1.30.8) (2020-01-31) + + +### Bug Fixes + +* future test breakage ([#1457](https://www.github.com/googleapis/google-api-java-client/issues/1457)) ([e7d5c83](https://www.github.com/googleapis/google-api-java-client/commit/e7d5c831a9d5c72206af6322142c338585698a78)) + + +### Dependencies + +* update dependency commons-codec:commons-codec to v1.14 ([#1463](https://www.github.com/googleapis/google-api-java-client/issues/1463)) ([97de688](https://www.github.com/googleapis/google-api-java-client/commit/97de688da9a0748e78f314f686a771852ed78459)) +* update guava to 28.2-android ([#1473](https://www.github.com/googleapis/google-api-java-client/issues/1473)) ([69a8d6f](https://www.github.com/googleapis/google-api-java-client/commit/69a8d6fb4146e85e8100c9e5fc220835f8ce12d9)) +* update http client ([#1482](https://www.github.com/googleapis/google-api-java-client/issues/1482)) ([232785a](https://www.github.com/googleapis/google-api-java-client/commit/232785a9aa8a4441129d74a08066bcb848153df3)) + +### [1.30.7](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.6...v1.30.7) (2019-12-17) + + +### Bug Fixes + +* update GoogleUtils#getVersion() to use stable logic ([#1452](https://www.github.com/googleapis/google-api-java-client/issues/1452)) ([744839f](https://www.github.com/googleapis/google-api-java-client/commit/744839f51a01301390297b4a5cb037547eefc4c0)) + + +### Dependencies + +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.30.5 ([#1453](https://www.github.com/googleapis/google-api-java-client/issues/1453)) ([b32a7d9](https://www.github.com/googleapis/google-api-java-client/commit/b32a7d95801e1e2e5617818a4f11853eca272c72)) + +### [1.30.6](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.5...v1.30.6) (2019-12-03) + + +### Bug Fixes + +* grab version from package metadata ([#1419](https://www.github.com/googleapis/google-api-java-client/issues/1419)) ([a6c6dec](https://www.github.com/googleapis/google-api-java-client/commit/a6c6decbd4a162ff4030e2c3f74c72eb6ac9eddb)) +* user-agent should use identifier/version ([#1425](https://www.github.com/googleapis/google-api-java-client/issues/1425)) ([bfb4d9c](https://www.github.com/googleapis/google-api-java-client/commit/bfb4d9cacdadd8065be07b1bf0c22ea7aeb94d97)) + + +### Documentation + +* fix link to media upload documentation ([#1442](https://www.github.com/googleapis/google-api-java-client/issues/1442)) ([21af62a](https://www.github.com/googleapis/google-api-java-client/commit/21af62a45eb167adcf4d6932b27f9e2b86fc06f3)) + + +### Dependencies + +* remove jackson-core-asl ([#1414](https://www.github.com/googleapis/google-api-java-client/issues/1414)) ([8e08249](https://www.github.com/googleapis/google-api-java-client/commit/8e082496d41ed271523b78df80e678a338f22a8a)) +* update dependency com.google.protobuf:protobuf-java to v3.11.0 ([#1431](https://www.github.com/googleapis/google-api-java-client/issues/1431)) ([c4be24d](https://www.github.com/googleapis/google-api-java-client/commit/c4be24d2f371c22aa12d47085e88f21774efa6e5)) +* update dependency com.google.protobuf:protobuf-java to v3.11.1 ([#1436](https://www.github.com/googleapis/google-api-java-client/issues/1436)) ([c1eaa85](https://www.github.com/googleapis/google-api-java-client/commit/c1eaa851d9bd4102a0cff21d972190923050fd5e)) +* update guava to 28.1-android ([#1410](https://www.github.com/googleapis/google-api-java-client/issues/1410)) ([1d37f32](https://www.github.com/googleapis/google-api-java-client/commit/1d37f325d3c0cf808cd7c006ba9414e4dd65e5b6)) + +### [1.30.5](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.4...v1.30.5) (2019-10-24) + + +### Bug Fixes + +* add details to GoogleJsonResponseExceptions created with GoogleJsonResponseExceptionFactoryTesting ([#1395](https://www.github.com/googleapis/google-api-java-client/issues/1395)) ([1ffdba6](https://www.github.com/googleapis/google-api-java-client/commit/1ffdba6071d716d9843fada802c3cb4d2dcaedf7)) +* specify Metadata-Flavor for metadata requests ([#1397](https://www.github.com/googleapis/google-api-java-client/issues/1397)) ([d3dcfe9](https://www.github.com/googleapis/google-api-java-client/commit/d3dcfe9c049f72207b30e75f073b4b8ccc14c46d)) + + +### Dependencies + +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.30.4 ([#1401](https://www.github.com/googleapis/google-api-java-client/issues/1401)) ([502cf1d](https://www.github.com/googleapis/google-api-java-client/commit/502cf1d1f2b7b6231ace109f3162c069c5f2234c)) + + +### Documentation + +* migrate docs from wiki ([#1399](https://www.github.com/googleapis/google-api-java-client/issues/1399)) ([173adca](https://www.github.com/googleapis/google-api-java-client/commit/173adcaed0d96b3771486ee59d0b4a4cf87df895)) + +### [1.30.4](https://www.github.com/googleapis/google-api-java-client/compare/v1.30.3...v1.30.4) (2019-09-20) + + +### Dependencies + +* update dependency com.google.oauth-client:google-oauth-client-bom to v1.30.3 ([#1386](https://www.github.com/googleapis/google-api-java-client/issues/1386)) ([3a9ba9a](https://www.github.com/googleapis/google-api-java-client/commit/3a9ba9a)) +* update dependency com.google.protobuf:protobuf-java to v3.10.0 ([#1379](https://www.github.com/googleapis/google-api-java-client/issues/1379)) ([309f8d4](https://www.github.com/googleapis/google-api-java-client/commit/309f8d4)) +* update google-http-client to v1.32.1 ([#1384](https://www.github.com/googleapis/google-api-java-client/issues/1384)) ([859570a](https://www.github.com/googleapis/google-api-java-client/commit/859570a)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..2add2547a --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..f2dbdee06 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,139 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +Code Samples must be bundled in separate Maven modules, and guarded by a +Maven profile with the name `enable-samples`. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 7 whereas samples have + a minimum Java version of Java 8. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn -Penable-samples clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-samples clean verify +``` + +### Profile Config + +1. To add samples in a profile to your Maven project, add the following to your +`pom.xml` + + ```xml + + [...] + + + enable-samples + + sample + + + + [...] + + ``` + +2. [Activate](#profile-activation) the profile. +3. Define your samples in a normal Maven project in the `samples/` directory. + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +### Profile Activation + +To include code samples when building and testing the project, enable the +`enable-samples` Maven profile. + +#### Command line + +To activate the Maven profile on the command line add `-Penable-samples` to your +Maven command. + +#### Maven `settings.xml` + +To activate the Maven profile in your `~/.m2/settings.xml` add an entry of +`enable-samples` following the instructions in [Active Profiles][2]. + +This method has the benefit of applying to all projects you build (and is +respected by IntelliJ IDEA) and is recommended if you are going to be +contributing samples to several projects. + +#### IntelliJ IDEA + +To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in +[Activate Maven profiles][3] to activate `enable-samples`. + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles diff --git a/LICENSE b/LICENSE index 980a15ac2..261eeb9e9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +178,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 589e1b932..b29c854aa 100644 --- a/README.md +++ b/README.md @@ -1,179 +1,119 @@ # Google APIs Client Library for Java -- [Overview](#Overview) -- [Highlighted Features](#Highlighted_Features) -- [Dependencies](#Dependencies) -- [Important Warnings](#Beta) - - [@Beta](#Beta) - - [Deprecations](#Deprecations) -- [Documentation](#Documentation) -- [Links](#Links) +## Description -## Overview - -The Google APIs Client Library for Java is a flexible, efficient, and powerful Java client library for accessing any HTTP-based API on the web, not just Google APIs. +The Google APIs Client Library for Java is a flexible, efficient, and powerful Java client library +for accessing any HTTP-based API on the web, not just Google APIs. The library has the following features: - - A powerful [OAuth 2.0](https://developers.google.com/api-client-library/java/google-api-java-client/oauth2) library with a consistent interface. + - A powerful [OAuth 2.0](https://github.com/googleapis/google-api-java-client/wiki/OAuth2) library with a consistent interface. - Lightweight, efficient XML and JSON data models that support any data schema. - Support for [protocol buffers](https://github.com/google/protobuf/). - - A set of [generated libraries for Google APIs](https://developers.google.com/api-client-library/java/apis/). + - A set of [generated libraries for Google APIs](https://github.com/googleapis/google-api-java-client-services#supported-google-apis). -### Accessing Google APIs +## Supported Java environments -To use Google's Java client libraries to call any Google API, you need two libraries: +- Java 7 (or higher) +- Android 1.6 (or higher) +- [Google App Engine](https://github.com/googleapis/google-api-java-client/wiki/App-Engine) - - The core Google APIs Client Library for Java (google-api-java-client), which is the generic runtime library described here. This library provides functionality common to all APIs, for example HTTP transport, error handling, authentication, JSON parsing, media download/upload, and batching. - - An auto-generated Java library for the API you are accessing, for example the [generated Java library for the BigQuery API](https://code.google.com/p/google-api-java-client/source/browse/bigquery-appengine-sample/?repo=samples#bigquery-appengine-sample%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fapi%2Fclient%2Fsample%2Fbigquery%2Fappengine%2Fdashboard%253Fstate%253Dclosed). These generated libraries include API-specific information such as the root URL, and classes that represent entities in the context of the API. These classes are useful for making conversions between JSON objects and Java objects. +## Usage -To find the generated library for a Google API, visit [Google APIs Client Library for Java](https://developers.google.com/api-client-library/java/apis/). The API-specific Java packages include both the core google-api-java-client and the client-specific libraries. +For detailed instructions on usage, please visit the [guide](https://googleapis.github.io/google-api-java-client/). -If you are using the old GData library, you need to [migrate](http://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient). +## Installation -### Developing for Android +The Google APIs Client Library for Java is easy to install. -If you are developing for Android and the Google API you want to use is included in the [Google Play Services library](https://developer.android.com/google/play-services/index.html), you should use that library for the best performance and experience. +To use Maven, add the following lines to your pom.xml file: -To access other Google APIs, you can use the Google APIs Client Library for Java, which supports [Android 1.5 (or higher)](https://developers.google.com/api-client-library/java/google-api-java-client/android). +[//]: # ({x-version-update-start:google-api-client:released}) + ```maven + + + + com.google.api-client + google-api-client + 1.32.1 + + + + ``` -### Other Java environments +To use Gradle, add the following lines to your build.gradle file: -In addition to Android 1.5 or higher, the Google APIs Client Library for Java supports the following Java environments: - - Java 5 (or higher), standard (SE) and enterprise (EE) - - [Google App Engine](https://developers.google.com/api-client-library/java/google-api-java-client/app-engine) +```gradle +repositories { + mavenCentral() + google() +} +dependencies { + compile 'com.google.api-client:google-api-client:1.32.1' +} +``` +[//]: # ({x-version-update-end}) -Not supported: Google Web Toolkit (GWT), Java mobile (ME), and Java 1.4 (or earlier). -## Highlighted Features -- **The library makes it simple to call Google APIs.** +## Building locally - You can call Google APIs using Google service-specific generated libraries with the Google APIs Client Library for Java. Here's an example that makes a call to the [Google Calendar API](https://developers.google.com/google-apps/calendar/): +## One time setup - ```java - // Show events on user's calendar. - View.header("Show Calendars"); - CalendarList feed = client.calendarList().list().execute(); - View.display(feed); - ``` +``` +mkdir /tmp/foo && cd /tmp/foo +wget https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar +unzip play-services-basement-8.3.0.aar +mvn install:install-file \ + -Dfile=classes.jar \ + -DgroupId=com.google.android.google-play-services \ + -DartifactId=google-play-services \ + -Dversion=1 \ + -Dpackaging=jar +cd - +``` -- **The library makes authentication easier.** - - The authentication library can reduce the amount of code needed to handle [OAuth 2.0](https://developers.google.com/api-client-library/java/google-api-java-client/oauth2), and sometimes a few lines is all you need. For example: - - ```java - /** Authorizes the installed application to access user's protected data. */ - private static Credential authorize() throws Exception { - // load client secrets - GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, - new InputStreamReader(CalendarSample.class.getResourceAsStream("/client_secrets.json"))); - // set up authorization code flow - GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( - httpTransport, JSON_FACTORY, clientSecrets, - Collections.singleton(CalendarScopes.CALENDAR)).setDataStoreFactory(dataStoreFactory) - .build(); - // authorize - return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); - } - ``` -- **The library makes batching and media upload/download easier.** +## CI Status - The library offers helper classes for [batching](https://developers.google.com/api-client-library/java/google-api-java-client/batch), [media upload](https://developers.google.com/api-client-library/java/google-api-java-client/media-upload), and [media download](https://developers.google.com/api-client-library/java/google-api-java-client/media-download). +Java Version | Status +------------ | ------ +Java 7 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.html) +Java 8 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.html) +Java 11 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java11.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java11.html) -- **The library runs on Google App Engine.** +## Dependencies +This library is built on top of two common libraries, also built by Google, and also designed to +work with any HTTP service on the web: - [App Engine-specific helpers](https://developers.google.com/api-client-library/java/google-api-java-client/app-engine) make quick work of authenticated calls to APIs, and you do not need to worry about exchanging code for tokens. For example: +- [Google HTTP Client Library for Java](https://github.com/googleapis/google-http-java-client) +- [Google OAuth Client Library for Java](https://github.com/googleapis/google-oauth-java-client) - ```java - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { - AppIdentityCredential credential = - new AppIdentityCredential(Arrays.asList(UrlshortenerScopes.URLSHORTENER)); - Urlshortener shortener = - new Urlshortener.Builder(new UrlFetchTransport(), new JacksonFactory(), credential) - .build(); - UrlHistory history = shortener.URL().list().execute(); - ... - } - ``` +## Important Warnings -- **The library runs on [Android (@Beta)](#@Beta).** - - If you are developing for Android and the Google API you want to use is included in the [Google Play Services library](https://developer.android.com/google/play-services/index.html), you should use that library for the best performance and experience. - - To access other Google APIs, you can use the Google Client Library for Java's Android-specific helper classes, which are are well-integrated with [Android AccountManager](http://developer.android.com/reference/android/accounts/AccountManager.html ). For example: - - ```java - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Google Accounts - credential = - GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS)); - SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); - credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); - // Tasks client - service = - new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential) - .setApplicationName("Google-TasksAndroidSample/1.0").build(); - } - ``` +### @Beta -- **The library is easy to install.** - - The Google APIs Client Library for Java is easy to install, and you can download the binary directly from the [Downloads page](https://developers.google.com/api-client-library/java/google-api-java-client/download), or you can use Maven or Gradle. - To use Maven, add the following lines to your pom.xml file: - - ```maven - - - - com.google.api-client - google-api-client - 1.18.0-rc - - - - ``` - - To use Gradle, add the following lines to your build.gradle file: - - ```gradle - repositories { - mavenCentral() - } - dependencies { - compile 'com.google.api-client:google-api-client:1.18.0-rc' - } - ``` +Features marked with the @Beta annotation at the class or method level are subject to change. They +might be modified in any way, or even removed, in any major release. You should not use beta features +if your code is a library itself (that is, if your code is used on the CLASSPATH of users outside +your own control). + +### Deprecations -## Dependencies -This library is built on top of two common libraries, also built by Google, and also designed to work with any HTTP service on the web: - * [Google HTTP Client Library for Java](https://github.com/google/google-http-java-client) - * [Google OAuth Client Library for Java](https://github.com/google/google-oauth-java-client) +Deprecated non-beta features will be removed eighteen months after the release in which they are +first deprecated. You must fix your usages before this time. If you don't, any type of breakage +might result, and you are not guaranteed a compilation error. -## Important Warnings +## Documentation -### @Beta +- [Libraries and Samples](https://github.com/googleapis/google-api-java-client-services/) +- [JavaDoc](https://googleapis.dev/java/google-api-client/latest/) -Features marked with the @Beta annotation at the class or method level are subject to change. They might be modified in any way, or even removed, in any major release. You should not use beta features if your code is a library itself (that is, if your code is used on the CLASSPATH of users outside your own control). +## Contributing -### Deprecations +Contributions to this library are always welcome and highly encouraged. -Deprecated non-beta features will be removed eighteen months after the release in which they are first deprecated. You must fix your usages before this time. If you don't, any type of breakage might result, and you are not guaranteed a compilation error. +See [CONTRIBUTING](CONTRIBUTING.md) documentation for more information on how to get started. -## Documentation -- [Developer's Guide](https://developers.google.com/api-client-library/java/google-api-java-client/dev-guide) -- [Libraries and Samples](https://developers.google.com/api-client-library/java/apis/) -- [JavaDoc](http://javadoc.google-api-java-client.googlecode.com/hg/index.html) -- [Get Help](https://developers.google.com/api-client-library/java/google-api-java-client/support) +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct](CODE_OF_CONDUCT.md) for more +information. -## Links -- Blogs - - [Announcements](http://google-api-java-client.blogspot.com/) - - [Announcements](http://googledevelopers.blogspot.com/) -- External Links - - [Project updates feed](http://code.google.com/feeds/p/google-api-java-client/updates/basic) - - [Samples updates feed](http://code.google.com/feeds/p/google-api-java-client/hgchanges/basic?repo=samples) - - [Library updates feed](http://code.google.com/feeds/p/google-api-java-client/hgchanges/basic?repo=default) -- Groups - - [Discuss]() +For questions or concerns, please file an issue in the GitHub repository. diff --git a/Resumable-Media-Upload-Sequence-Diagram.png b/Resumable-Media-Upload-Sequence-Diagram.png new file mode 100644 index 000000000..6cc9b3481 Binary files /dev/null and b/Resumable-Media-Upload-Sequence-Diagram.png differ diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..8b58ae9c0 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml index 350c453fe..143a6d04e 100644 --- a/checkstyle-suppressions.xml +++ b/checkstyle-suppressions.xml @@ -4,13 +4,8 @@ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> - - - - - - - + + diff --git a/checkstyle.xml b/checkstyle.xml index fffe1dc92..2fcb7a388 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -53,12 +53,11 @@ page at http://checkstyle.sourceforge.net/config.html --> - - - + + @@ -73,12 +72,8 @@ page at http://checkstyle.sourceforge.net/config.html --> - - - - @@ -184,22 +179,6 @@ page at http://checkstyle.sourceforge.net/config.html --> --> - - - - - - - - - - @@ -317,7 +296,23 @@ page at http://checkstyle.sourceforge.net/config.html --> --> + + + + + + + + + + diff --git a/clirr-ignored-differences.xml b/clirr-ignored-differences.xml index 114008428..a4a93043c 100644 --- a/clirr-ignored-differences.xml +++ b/clirr-ignored-differences.xml @@ -2,4 +2,8 @@ + + 8001 + com/google/api/client/googleapis/auth/clientlogin/** + diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 000000000..5724ea947 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 000000000..be445c594 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,2 @@ +theme: jekyll-theme-dinky +title: Google APIs Client Library for Java diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml new file mode 100644 index 000000000..4a92b7885 --- /dev/null +++ b/docs/_data/navigation.yml @@ -0,0 +1,23 @@ +toc: + - page: Overview + url: index.html + - page: Setup Instructions + url: setup.html + - page: Component Modules + url: component-modules.html + - page: Android + url: android.html + - page: Google App Engine + url: google-app-engine.html + - page: Batching + url: batching.html + - page: Media Download + url: media-download.html + - page: Media Upload + url: media-upload.html + - page: OAuth 2.0 + url: oauth-2.0.html + - page: Timeouts and Errors + url: errors.html + - page: Support + url: support.html \ No newline at end of file diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 000000000..b3e7d30e6 --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,54 @@ + + + + + + +{% seo %} + + + + + + +
+
+

{{ site.title | default: site.github.repository_name }}

+ + {% for entry in site.data.navigation.toc %} +
{{ entry.page }}
+ {% endfor %} +
+ + +
+ +
+ {{ content }} +
+ + +
+ + {% if site.google_analytics %} + + {% endif %} + + \ No newline at end of file diff --git a/docs/android.md b/docs/android.md new file mode 100644 index 000000000..9ed63abe0 --- /dev/null +++ b/docs/android.md @@ -0,0 +1,79 @@ +--- +title: Android +--- + +# Running on [Android (@Beta)](#@Beta) + +If you are developing for Android and the Google API you want to use is included +in the [Google Play Services library][play-services], use that library for the +best performance and experience. + +To access other Google APIs, use the Google APIs Client Library for Java's +Android-specific helper classes, which are well-integrated with +[Android AccountManager][account-manager]. + +For example: + +```java +@Override +public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // Google Accounts + credential = + GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS)); + SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); + credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); + // Tasks client + service = + new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential) + .setApplicationName("Google-TasksAndroidSample/1.0").build(); +} +``` + +## Getting started + +Begin by reading the [Android development instructions][http-client-android] for +the Google HTTP Client Library for Java. + +## Authentication + +As described in the [Android development instructions][http-client-android], the +best practice on Android is to use the [`AccountManager`][account-manager] class +(`@Beta`) for centralized identity management and credential token storage. + +For information about the OAuth 2.0 flow, see the +[OAuth 2.0 instructions for Android][oauth2-android]. + +## Partial response and update + +Google APIs support a partial-response protocol that allows you to specify which +fields are returned to you in the HTTP response. This can significantly reduce +the size of the response, thereby reducing network usage, parsing response time, +and memory usage. It works with both JSON and XML. + +The following snippet of code drawn from the [Google Drive API Quickstart][quickstart] +demonstrates how to use the partial-response protocol. The `setFields` method +identifies the fields you want returned: + +```java +// Print the names and IDs for up to 10 files. +FileList result = service.files().list() + .setPageSize(10) + .setFields("nextPageToken, files(id, name)") + .execute(); +List files = result.getFiles(); +if (files == null || files.isEmpty()) { + System.out.println("No files found."); +} else { + System.out.println("Files:"); + for (File file : files) { + System.out.printf("%s (%s)\n", file.getName(), file.getId()); + } +} +``` + +[play-services]: https://developer.android.com/google/play-services/index.html +[account-manager]: http://developer.android.com/reference/android/accounts/AccountManager.html +[http-client-android]: https://github.com/googleapis/google-http-java-client/wiki/Android +[oauth2-android]: https://github.com/googleapis/google-api-java-client#oauth2-android +[quickstart]: https://developers.google.com/drive/api/v3/quickstart/java diff --git a/docs/batching.md b/docs/batching.md new file mode 100644 index 000000000..52f943e8c --- /dev/null +++ b/docs/batching.md @@ -0,0 +1,43 @@ +--- +title: Batching +--- + +# Batching + +Each HTTP connection that your client makes results in overhead. To reduce +overhead, you can batch multiple API calls together into a single HTTP request. + +The main classes of interest are [BatchRequest][batch-request] and +[JsonBatchCallback][json-batch-callback]. The following example shows how to use +these classes with service-specific generated libraries: + +```java +JsonBatchCallback callback = new JsonBatchCallback() { + + public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) { + printCalendar(calendar); + addedCalendarsUsingBatch.add(calendar); + } + + public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { + System.out.println("Error Message: " + e.getMessage()); + } +}; + +... + +Calendar client = Calendar.builder(transport, jsonFactory, credential) + .setApplicationName("BatchExample/1.0").build(); +BatchRequest batch = client.batch(); + +Calendar entry1 = new Calendar().setSummary("Calendar for Testing 1"); +client.calendars().insert(entry1).queue(batch, callback); + +Calendar entry2 = new Calendar().setSummary("Calendar for Testing 2"); +client.calendars().insert(entry2).queue(batch, callback); + +batch.execute(); +``` + +[batch-request]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/batch/BatchRequest.html +[json-batch-callback]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/batch/json/JsonBatchCallback.html \ No newline at end of file diff --git a/docs/component-modules.md b/docs/component-modules.md new file mode 100644 index 000000000..264788217 --- /dev/null +++ b/docs/component-modules.md @@ -0,0 +1,64 @@ +--- +title: Component Modules +--- + +# Component Modules + +This libraries is composed of several modules: + +## google-api-client + +The Google API Client Library for Java (`google-api-client`) is designed to be +compatible with all supported Java platforms, including Android. + +## google-api-client-android + +Extensions to the Google API Client Library for Java +(`google-api-client-android`) support Java Google Android (only for SDK >= 2.1) +applications. This module depends on `google-api-client` and +`google-http-client-android`. + +## google-api-client-servlet + +Servlet and JDO extensions to the Google API Client Library for Java +(`google-api-client-servlet`) support Java servlet web applications. This module +depends on `google-api-client` and `google-oauth-client-servlet`. + +## google-api-client-appengine + +Google App Engine extensions to the Google API Client Library for Java +(`google-api-client-appengine`) support Java Google App Engine applications. +This module depends on `google-api-client`, `google-api-client-servlet`, +`google-oauth-client-appengine`, and `google-http-client-appengine`. + +## google-api-client-gson + +GSON extensions to the Google API Client Library for Java +(`google-api-client-gson`). This module depends on `google-api-client` and +`google-http-client-gson`. + +## google-api-client-jackson2 + +Jackson2 extensions to the Google API Client Library for Java +(`google-api-client-jackson2`). This module depends on `google-api-client` and +`google-http-client-jackson2`. + +## google-api-client-java6 + +Java 6 (and higher) extensions to the Google API Client Library for Java +(`google-api-client-java6`). This module depends on `google-api-client` and +`google-oauth-client-java6`. + +## google-api-client-protobuf + +[Protocol buffer][protobuf] extensions to the Google API Client Library for Java +(`google-api-client-protobuf`). This module depends on +`google-http-client-protobuf` and `google-api-client`. + +## google-api-client-xml + +XML extensions to the Google API Client Library for Java +(`google-api-client-xml`). This module depends on `google-api-client` and +`google-http-client-xml`. + +[protobuf]: https://developers.google.com/protocol-buffers/docs/overview diff --git a/docs/errors.md b/docs/errors.md new file mode 100644 index 000000000..b01620b71 --- /dev/null +++ b/docs/errors.md @@ -0,0 +1,49 @@ +--- +title: Timeout and Errors +--- + +# Timeout and Errors + +## Setting timeouts + +In the following example, which uses the +[Google Analytics API][google-analytics-api], the `setConnectTimeout` and +`setReadTimeout` methods are used to set the connect and read timeouts to three +minutes (in milliseconds) for all requests: + +```java +private HttpRequestInitializer setHttpTimeout(final HttpRequestInitializer requestInitializer) { + return new HttpRequestInitializer() { + @Override + public void initialize(HttpRequest httpRequest) throws IOException { + requestInitializer.initialize(httpRequest); + httpRequest.setConnectTimeout(3 * 60000); // 3 minutes connect timeout + httpRequest.setReadTimeout(3 * 60000); // 3 minutes read timeout + } +}; + +GoogleCredential credential = .... + +final Analytics analytics = Analytics.builder(new NetHttpTransport(), jsonFactory, setHttpTimeout(credential)).build(); +``` + +## Handling HTTP error responses from Google APIs + +When an error status code is detected in an HTTP response to a Google API that +uses the JSON format, the generated libraries throw a +[`GoogleJsonResponseException`][google-json-response-exception]. + +The following example shows one way that you can handle these exceptions: + +```java +Drive.Files.List listFiles = drive.files.list(); +try { + FileList response = listFiles.execute(); + ... +} catch (GoogleJsonResponseException e) { + System.err.println(e.getDetails()); +} +``` + +[google-analytics-api]: https://developers.google.com/analytics/ +[google-json-response-exception]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/json/GoogleJsonResponseException.html diff --git a/docs/google-app-engine.md b/docs/google-app-engine.md new file mode 100644 index 000000000..52a0a360d --- /dev/null +++ b/docs/google-app-engine.md @@ -0,0 +1,59 @@ +--- +title: Running on Google App Engine +--- + +# Running on Google App Engine + +App Engine-specific helpers make quick work of authenticated calls to APIs, and +you do not need to worry about exchanging code for tokens. + +For example: + +```java +@Override +protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + AppIdentityCredential credential = + new AppIdentityCredential(Arrays.asList(UrlshortenerScopes.URLSHORTENER)); + Urlshortener shortener = + new Urlshortener.Builder(new UrlFetchTransport(), new JacksonFactory(), credential) + .build(); + UrlHistory history = shortener.URL().list().execute(); + ... +} +``` + +## Auth helpers + +If you are building a web app that interacts with a user's data via an OAuth +2.0-enabled API, we've created some helpers to assist you with the process. The +helpers aim to: + +* Simplify the process of obtaining access tokens + ([`AuthorizationCodeFlow`][authorization-code-flow]). +* Manage tokens, after they are obtained, by marking them as + [`PersistenceCapable`][persistence-capable]. +* Simplify the process of making authenticated calls using the access token's + [credential][credential]. +* Insulate you from the details of authentication when writing servlets. + +## Getting started + +1. Install the Google API Client Library for Java: + * Follow the [download instructions][setup] and put the library jar files + into your war/WEB-INF/lib directory. + * Alternatively, you can use [Maven][setup]. +1. Learn about using [OAuth 2.0 with the authorization code flow for Google App Engine applications][oauth2]. +1. Learn about using [OAuth 2.0 with the Google App Engine Identity API][oauth2-gae]. +1. Take a look at the [Calendar App Engine sample][calendar-sample]. This sample + combines our Java library and auth helpers to show you how to access end-user + data from within a Google App Engine web app. The sample also uses [GWT][gwt] + for the user interface. + +[authorization-code-flow]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html +[persistence-capable]: https://cloud.google.com/appengine/docs/java/datastore/ +[credential]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/Credential.html +[setup]: https://github.com/googleapis/google-api-java-client/wiki/Setup +[oauth2]: https://github.com/googleapis/google-api-java-client/wiki/OAuth2 +[oauth2-gae]: https://github.com/googleapis/google-api-java-client/wiki/OAuth2#gae +[calendar-sample]: https://github.com/google/google-api-java-client-samples/tree/master/calendar-appengine-sample +[gwt]: http://www.gwtproject.org/gle-http-java-client/http-transport.html \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..106bc5e4f --- /dev/null +++ b/docs/index.md @@ -0,0 +1,77 @@ +--- +title: Overview +--- + +# Overview + +## Description + +The Google APIs Client Library for Java is a flexible, efficient, and powerful +Java client library for accessing any HTTP-based API on the web, not just Google +APIs. + +The library has the following features: + +- A powerful [OAuth 2.0][oauth2] library with a consistent interface. +- Lightweight, efficient XML and JSON data models that support any data schema. +- Support for [protocol buffers][protobuf]. +- A set of [generated libraries for Google APIs][service-clients]. + +The library supports the following Java environments: + +- Java 7 (or higher) +- Android 1.6 (or higher) +- [Google App Engine][app-engine] + +This library is built on top of two common libraries, also built by Google, and +also designed to work with any HTTP service on the web: + +- [Google HTTP Client Library for Java][http-client] +- [Google OAuth Client Library for Java][oauth-client] + +This is an open-source library, and [contributions][contributions] are welcome. + +## Accessing Google APIs + +To use Google's Java client libraries to call any Google API, you need two +libraries: + +- The core Google APIs Client Library for Java (`google-api-java-client`), which + is the generic runtime library described here. This library provides + functionality common to all APIs, for example HTTP transport, error handling, + authentication, JSON parsing, media download/upload, and batching. +- An auto-generated Java library for the API you are accessing, for example the + [generated Java library for the BigQuery API][bigquery]. These generated + libraries include API-specific information such as the root URL, and classes + that represent entities in the context of the API. These classes are useful + for making conversions between JSON objects and Java objects. + +To find the generated library for a Google API, visit +[Google APIs Client Library for Java][service-list]. +The API-specific Java packages include both the core google-api-java-client and +the client-specific libraries. + +## Beta Features + +Features marked with the `@Beta` annotation at the class or method level are +subject to change. They might be modified in any way, or even removed, in any +major release. You should not use beta features if your code is a library itself +(that is, if your code is used on the `CLASSPATH` of users outside your own +control). + +## Deprecated Features + +Deprecated non-beta features will be removed eighteen months after the release +in which they are first deprecated. You must fix your usages before this time. +If you don't, any type of breakage might result, and you are not guaranteed a +compilation error. + +[oauth2]: https://googleapis.github.io/google-api-java-client/oauth-2.0.html +[protobuf]: https://github.com/google/protobuf/ +[service-clients]: https://github.com/googleapis/google-api-java-client-services/ +[app-engine]: https://googleapis.github.io/google-api-java-client/google-app-engine.html +[http-client]: https://github.com/googleapis/google-http-java-client +[oauth-client]: https://github.com/googleapis/google-oauth-java-client +[contributions]: https://github.com/googleapis/google-api-java-client/wiki/CONTRIBUTING.md +[bigquery]: https://github.com/google/google-api-java-client-samples/tree/master/bigquery-appengine-sample/src/main/java/com/google/api/client/sample/bigquery/appengine/dashboard +[service-list]: https://github.com/googleapis/google-api-java-client-services#supported-google-apis diff --git a/docs/media-download.md b/docs/media-download.md new file mode 100644 index 000000000..088786828 --- /dev/null +++ b/docs/media-download.md @@ -0,0 +1,88 @@ +--- +title: Media Download +--- + +# Media Download + +## Resumable media downloads + +When you download a large media file from a server, use resumable media download +to download the file chunk by chunk. The Google API generated libraries contain +convenience methods for interacting with resumable media download, which was +introduced in the 1.9.0-beta version of the Google API Client Library for Java. + +The resumable media download protocol is similar to the resumable media upload +protocol, which is described in the +[Google Drive API documentation][google-drive-documentation]. + +### Implementation details + +The main classes of interest are [`MediaHttpDownloader`][media-http-downloader] +and [`MediaHttpDownloaderProgressListener`][media-http-downloader-progress-listener]. +Media content is downloaded in chunks, and chunk size is configurable. If a +server error is encountered in a request, then the request is retried. + +If methods in the service-specific generated libraries support download in the +Discovery document, then a convenient download method is created for these +methods that takes in an [`OutputStream`][output-stream]. (For more about using +media download with the Google APIs Discovery Service, see +[Media download][media-download].) + +For example: + +```java +class CustomProgressListener implements MediaHttpDownloaderProgressListener { + public void progressChanged(MediaHttpDownloader downloader) { + switch (downloader.getDownloadState()) { + case MEDIA_IN_PROGRESS: + System.out.println(downloader.getProgress()); + break; + case MEDIA_COMPLETE: + System.out.println("Download is complete!"); + } + } +} + +OutputStream out = new FileOutputStream("/tmp/driveFile.jpg"); + +DriveFiles.Get request = drive.files().get(fileId); +request.getMediaHttpDownloader().setProgressListener(new CustomProgressListener()); +request.executeMediaAndDownloadTo(out); +``` + +You can also use this feature without service-specific generated libraries. +Here is an example: + +```java +OutputStream out = new FileOutputStream("/tmp/Test.jpg"); + +MediaHttpDownloader downloader = new MediaHttpDownloader(transport, httpRequestInitializer); +downloader.setProgressListener(new CustomProgressListener()); +downloader.download(requestUrl, out); +``` + +## Direct media download + +Resumable media download is enabled by default, but you can disable it and use +direct media download instead, for example if you are downloading a small file. +Direct media download was introduced in the 1.9.0-beta version of the Google API +Client Library for Java. + +Direct media download downloads the whole media content in one HTTP request, as +opposed to the resumable media download protocol, which can download in multiple +requests. Doing a direct download reduces the number of HTTP requests but +increases the chance of failures (such as connection failures) that can happen +with large downloads. + +The usage is the same as what is described above, plus the following call that +tells [`MediaHttpDownloader`][media-http-downloader] to do direct downloads: + +```java +mediaHttpDownloader.setDirectDownloadEnabled(true); +``` + +[google-drive-documentation]: https://developers.google.com/drive/web/manage-uploads#resumable +[media-http-downloader]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/media/MediaHttpDownloader.html +[media-http-downloader-progress-listener]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/media/MediaHttpDownloaderProgressListener.html +[output-stream]: https://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html +[media-download]: https://developers.google.com/discovery/v1/using#discovery-doc-methods-mediadownload \ No newline at end of file diff --git a/docs/media-upload.md b/docs/media-upload.md new file mode 100644 index 000000000..8418ca160 --- /dev/null +++ b/docs/media-upload.md @@ -0,0 +1,112 @@ +--- +title: Media Upload +--- + +# Media Upload + +## Resumable media upload + +When you upload a large media file to a server, use resumable media upload to +send the file chunk by chunk. The Google API generated libraries contain +convenience methods for interacting with resumable media upload, which was +introduced in the 1.7.0-beta version of the Google API Client Library for Java. + +The resumable media upload protocol is similar to the resumable media upload +protocol described in the +[Google Drive API documentation][google-drive-documentation]. + +### Protocol design + +The following sequence diagram shows how the resumable media upload protocol +works: ![Resumable Media Upload Protocol Diagram][resumable-media-upload-protocol-diagram] + +### Implementation details + +The main classes of interest are [MediaHttpUploader][media-http-uploader] and +[MediaHttpProgressListener][media-http-progress-listener]. + +If methods in the service-specific generated libraries contain the `mediaUpload` +parameter in the Discovery document, then a convenience method is created for +these methods that takes an [InputStreamContent][input-stream-content] as a +parameter. (For more about using media upload with the Google APIs Discovery +Service, see [Media upload][media-upload].) + +For example, the `insert` method of the Drive API supports `mediaUpload`, and +you can use the following code to upload a file: + +```java +class CustomProgressListener implements MediaHttpUploaderProgressListener { + public void progressChanged(MediaHttpUploader uploader) throws IOException { + switch (uploader.getUploadState()) { + case INITIATION_STARTED: + System.out.println("Initiation has started!"); + break; + case INITIATION_COMPLETE: + System.out.println("Initiation is complete!"); + break; + case MEDIA_IN_PROGRESS: + System.out.println(uploader.getProgress()); + break; + case MEDIA_COMPLETE: + System.out.println("Upload is complete!"); + } + } +} + +File mediaFile = new File("/tmp/driveFile.jpg"); +InputStreamContent mediaContent = + new InputStreamContent("image/jpeg", + new BufferedInputStream(new FileInputStream(mediaFile))); +mediaContent.setLength(mediaFile.length()); + +Drive.Files.Insert request = drive.files().insert(fileMetadata, mediaContent); +request.getMediaHttpUploader().setProgressListener(new CustomProgressListener()); +request.execute(); +``` + +You can also use the resumable media upload feature without the service-specific +generated libraries. Here is an example: + +```java +File mediaFile = new File("/tmp/Test.jpg"); +InputStreamContent mediaContent = + new InputStreamContent("image/jpeg", + new BufferedInputStream(new FileInputStream(mediaFile))); +mediaContent.setLength(mediaFile.length()); + + +MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, transport, httpRequestInitializer); +uploader.setProgressListener(new CustomProgressListener()); +HttpResponse response = uploader.upload(requestUrl); +if (!response.isSuccessStatusCode()) { + throw GoogleJsonResponseException(jsonFactory, response); +} +``` + +## Direct media upload + +Resumable media upload is enabled by default, but you can disable it and use +direct media upload instead, for example if you are uploading a small file. +Direct media upload was introduced in the 1.9.0-beta version of the Google API +Client Library for Java. + +Direct media upload uploads the whole file in one HTTP request, as opposed to +the resumable media upload protocol, which uploads the file in multiple +requests. Doing a direct upload reduces the number of HTTP requests but +increases the chance of failures (such as connection failures) that can happen +with large uploads. + +The usage for direct media upload is the same as what is described above for +resumable media upload, plus the following call that tells +[MediaHttpUploader][media-http-uploader] to only do direct uploads: + +```java +mediaHttpUploader.setDirectUploadEnabled(true); +``` + +[google-drive-documentation]: https://developers.google.com/drive/web/manage-uploads#resumable +[media-http-uploader]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/media/MediaHttpUploader.html +[media-http-progress-listener]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/media/MediaHttpUploaderProgressListener.html +[input-stream-content]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/http/InputStreamContent.html +[media-upload]: https://developers.google.com/discovery/v1/using#discovery-doc-methods-mediaupload +[resumable-media-upload-protocol-diagram]: https://github.com/googleapis/google-api-java-client/raw/master/Resumable-Media-Upload-Sequence-Diagram.png diff --git a/docs/oauth-2.0.md b/docs/oauth-2.0.md new file mode 100644 index 000000000..56a72b165 --- /dev/null +++ b/docs/oauth-2.0.md @@ -0,0 +1,606 @@ +--- +title: OAuth 2.0 +--- + +# Using OAuth 2.0 with the Google API Client Library for Java + +This document explains how to use the [`GoogleCredential`][google-credential] +utility class to do OAuth 2.0 authorization with Google services. For +information about the generic [OAuth 2.0 functions that we provide, see OAuth +2.0 and the Google OAuth Client Library for Java][google-oauth-client-instructions]. + +To access protected data stored on Google services, use [OAuth 2.0][oauth2] for +authorization. Google APIs support OAuth 2.0 flows for different types of client +applications. In all of these flows, the client application requests an access +token that is associated with only your client application and the owner of the +protected data being accessed. The access token is also associated with a +limited scope that defines the kind of data your client application has access +to (for example "Manage your tasks"). An important goal for OAuth 2.0 is to +provide secure and convenient access to the protected data, while minimizing the +potential impact if an access token is stolen. + +The OAuth 2.0 packages in the Google API Client Library for Java are built on +the general-purpose +[Google OAuth 2.0 Client Library for Java][google-oauth-client-instructions]. + +For details, see the Javadoc documentation for the following packages: + +* [`com.google.api.client.googleapis.auth.oauth2`][javadoc-oauth2] (from `google-api-client`) +* [`com.google.api.client.googleapis.extensions.appengine.auth.oauth2`][javadoc-appengine-oauth2] (from google-api-client-appengine) + +## Google API Console + +Before you can access Google APIs, you need to set up a project on the +[Google API Console][console] for auth and billing purposes, whether your client +is an installed application, a mobile application, a web server, or a client +that runs in browser. + +For instructions on setting up your credentials properly, see the +[API Console Help][console-help]. + +## Credentials + +### GoogleCredentials + +[`GoogleCredentials`][google-credentials] is a thread-safe helper class for OAuth +2.0 for accessing protected resources using an access token. For example, if you +already have an access token, you can make a request in the following way: + +```java +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.books.Books; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.AccessToken; +import com.google.auth.oauth2.GoogleCredentials; + +GoogleCredentials credentials = + GoogleCredentials.newBuilder().setAccessToken(new AccessToken("token", null)).build(); + +Books books = + new Books.Builder( + GoogleNetHttpTransport.newTrustedTransport(), + GsonFactory.getDefaultInstance(), + new HttpCredentialsAdapter(credentials)) + .setApplicationName("BooksExample/1.0") + .build(); +``` + +### Google App Engine identity + +This alternative credential is based on the +[Google App Engine App Identity Java API][identity-api]. Unlike the credential +in which a client application requests access to an end-user's data, the App +Identity API provides access to the client application's own data. + +Use [`AppIdentityCredential`][app-identity-credential] (from +`google-api-client-appengine`). This credential is much simpler because Google +App Engine takes care of all of the details. You only specify the OAuth 2.0 +scope you need. + +```java +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.books.Books; +import com.google.appengine.api.appidentity.AppIdentityService; +import com.google.appengine.api.appidentity.AppIdentityServiceFactory; +import com.google.auth.appengine.AppEngineCredentials; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.util.Arrays; + +AppIdentityService appIdentityService = AppIdentityServiceFactory.getAppIdentityService(); + +GoogleCredentials credentials = + AppEngineCredentials.newBuilder() + .setScopes(Arrays.asList("scope1", "scope2", "scope3")) + .setAppIdentityService(appIdentityService) + .build(); + +Books books = + new Books.Builder( + GoogleNetHttpTransport.newTrustedTransport(), + GsonFactory.getDefaultInstance(), + new HttpCredentialsAdapter(credentials)) + .setApplicationName("BooksExample/1.0") + .build(); +``` + +## Data store + +An access token typically has an expiration date of 1 hour, after which you will +get an error if you try to use it. [GoogleCredentials][google-credentials] takes +care of automatically "refreshing" the token, which simply means getting a new +access token. This is done by means of a long-lived refresh token, which is +typically received along with the access token if you use the +`access_type=offline` parameter during the authorization code flow (see +[`GoogleAuthorizationCodeFlow.Builder.setAccessType(String)`][auth-code-flow-set-access-type]. + +Most applications will need to persist the credential's access token and/or +refresh token. To persist the credential's access and/or refresh tokens, you can +provide your own implementation of [`DataStoreFactory`][data-store-factory]) +with [`StoredCredential`][stored-credential]; or you can use one of the +following implementations provided by the library: + +* [`AppEngineDataStoreFactory`][appengine-data-store-factory]: persists the + credential using the Google App Engine Data Store API. +* [`MemoryDataStoreFactory`][memory-data-store-factory]: "persists" the + credential in memory, which is only useful as a short-term storage for the + lifetime of the process. +* [`FileDataStoreFactory`][file-data-store-factory]: persists the credential in + a file. + +### Google App Engine users + + +[`AppEngineCredentialStore`][appengine-credential-store] is deprecated and is being removed. + +We recommend that you use +[`AppEngineDataStoreFactory`][appengine-data-store-factory] with +[`StoredCredential`][stored-credential]. If you have credentials stored in the +old way, you can use the added helper methods +[`migrateTo(AppEngineDataStoreFactory)`][appengine-migrate] or +[`migrateTo(DataStore)`][datastore-migrate] to migrate. + +Use [`DataStoreCredentialRefreshListener`][datastore-credential-listener] and +set it for the credential using +[`GoogleCredential.Builder.addRefreshListener(CredentialRefreshListener)`][add-refresh-listener]. + +## Authorization code flow + +Use the authorization code flow to allow the end user to grant your application +access to their protected data. The protocol for this flow is specified in the +[Authorization Code Grant specification][authorization-code-grant]. + +This flow is implemented using [`AuthorizationCodeFlow`][authorization-code-flow]. +The steps are: + +* An end user logs in to your application. You need to associate that user with + a user ID that is unique for your application. +* Call [`AuthorizationCodeFlow.loadCredential(String)`][auth-code-flow-load], + based on the user ID, to check if the user's credentials are already known. + If so, you're done. +* If not, call [`AuthorizationCodeFlow.newAuthorizationUrl()`][auth-code-flow-new] + and direct the end user's browser to an authorization page where they can grant + your application access to their protected data. +* The web browser then redirects to the redirect URL with a "code" query + parameter that can then be used to request an access token using + [`AuthorizationCodeFlow.newTokenRequest(String)`][token-request]. +* Use + [`AuthorizationCodeFlow.createAndStoreCredential(TokenResponse, String)`][create-and-store] + to store and obtain a credential for accessing protected resources. + +Alternatively, if you are not using +[`AuthorizationCodeFlow`][authorization-code-flow], you may use the lower-level +classes: + +* Use [`DataStore.get(String)`][datastore-get] to load the credential from the + store, based on the user ID. +* Use [`AuthorizationCodeRequestUrl`][auth-code-request-url] to direct the + browser to the authorization page. +* Use [`AuthorizationCodeResponseUrl`][auth-code-response-url] to process the + authorization response and parse the authorization code. +* Use [`AuthorizationCodeTokenRequest`][auth-code-token-request] to request an + access token and possibly a refresh token. +* Create a new [`Credential`][credential] and store it using + [`DataStore.set(String, V)`][datastore-set]. +* Access protected resources using the [`Credential`][credential]. Expired access + tokens are automatically refreshed using the refresh token, if applicable. + Make sure to use + [`DataStoreCredentialRefreshListener`][datastore-credential-listener] and set + it for the credential using + [`Credential.Builder.addRefreshListener(CredentialRefreshListener)`][add-refresh-listener]. + +### Web server applications + +The protocol for this flow is explained in +[Using OAuth 2.0 for Web Server Applications][oauth-web-server]. + +This library provides servlet helper classes to significantly simplify the +authorization code flow for basic use cases. You just provide concrete subclasses +of [`AbstractAuthorizationCodeServlet`][abstract-code-servlet] +and [`AbstractAuthorizationCodeCallbackServlet`][abstract-code-callback-servlet] +(from `google-oauth-client-servlet`) and add them to your `web.xml` file. Note +that you still need to take care of user login for your web application and +extract a user ID. + +```java +public class CalendarServletSample extends AbstractAuthorizationCodeServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws IOException { + // do stuff + } + + @Override + protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException { + GenericUrl url = new GenericUrl(req.getRequestURL().toString()); + url.setRawPath("/oauth2callback"); + return url.build(); + } + + @Override + protected AuthorizationCodeFlow initializeFlow() throws IOException { + return new GoogleAuthorizationCodeFlow.Builder( + new NetHttpTransport(), GsonFactory.getDefaultInstance(), + "[[ENTER YOUR CLIENT ID]]", "[[ENTER YOUR CLIENT SECRET]]", + Collections.singleton(CalendarScopes.CALENDAR)).setDataStoreFactory( + DATA_STORE_FACTORY).setAccessType("offline").build(); + } + + @Override + protected String getUserId(HttpServletRequest req) throws ServletException, IOException { + // return user ID + } +} + +public class CalendarServletCallbackSample extends AbstractAuthorizationCodeCallbackServlet { + + @Override + protected void onSuccess(HttpServletRequest req, HttpServletResponse resp, Credential credential) + throws ServletException, IOException { + resp.sendRedirect("/"); + } + + @Override + protected void onError( + HttpServletRequest req, HttpServletResponse resp, AuthorizationCodeResponseUrl errorResponse) + throws ServletException, IOException { + // handle error + } + + @Override + protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException { + GenericUrl url = new GenericUrl(req.getRequestURL().toString()); + url.setRawPath("/oauth2callback"); + return url.build(); + } + + @Override + protected AuthorizationCodeFlow initializeFlow() throws IOException { + return new GoogleAuthorizationCodeFlow.Builder( + new NetHttpTransport(), GsonFactory.getDefaultInstance() + "[[ENTER YOUR CLIENT ID]]", "[[ENTER YOUR CLIENT SECRET]]", + Collections.singleton(CalendarScopes.CALENDAR)).setDataStoreFactory( + DATA_STORE_FACTORY).setAccessType("offline").build(); + } + + @Override + protected String getUserId(HttpServletRequest req) throws ServletException, IOException { + // return user ID + } +} +``` + +### Google App Engine applications + +The authorization code flow on App Engine is almost identical to the servlet +authorization code flow, except that we can leverage Google App Engine's +[Users Java API][users-api]. The user needs to be logged in for the Users Java +API to be enabled; for information about redirecting users to a login page if +they are not already logged in, see +[Security and Authentication][security-authentication] (in `web.xml`). + +The primary difference from the servlet case is that you provide concrete +subclasses of [`AbstractAppEngineAuthorizationCodeServlet`][abstract-gae-code-servlet] +and [`AbstractAppEngineAuthorizationCodeCallbackServlet`][abstract-gae-code-callback-servlet] +(from `google-oauth-client-appengine`). They extend the abstract servlet classes +and implement the `getUserId` method for you using the Users Java API. +[`AppEngineDataStoreFactory`][appengine-data-store-factory] (from +[Google HTTP Client Library for Java][google-http-client]) is a good option for +persisting the credential using the Google App Engine Data Store API. + +Example taken (slightly modified) from [calendar-appengine-sample][calendar-sample]: + +```java +public class CalendarAppEngineSample extends AbstractAppEngineAuthorizationCodeServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws IOException { + // do stuff + } + + @Override + protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException { + return Utils.getRedirectUri(req); + } + + @Override + protected AuthorizationCodeFlow initializeFlow() throws IOException { + return Utils.newFlow(); + } +} + +class Utils { + static String getRedirectUri(HttpServletRequest req) { + GenericUrl url = new GenericUrl(req.getRequestURL().toString()); + url.setRawPath("/oauth2callback"); + return url.build(); + } + + static GoogleAuthorizationCodeFlow newFlow() throws IOException { + return new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, + getClientCredential(), Collections.singleton(CalendarScopes.CALENDAR)).setDataStoreFactory( + DATA_STORE_FACTORY).setAccessType("offline").build(); + } +} + +public class OAuth2Callback extends AbstractAppEngineAuthorizationCodeCallbackServlet { + + private static final long serialVersionUID = 1L; + + @Override + protected void onSuccess(HttpServletRequest req, HttpServletResponse resp, Credential credential) + throws ServletException, IOException { + resp.sendRedirect("/"); + } + + @Override + protected void onError( + HttpServletRequest req, HttpServletResponse resp, AuthorizationCodeResponseUrl errorResponse) + throws ServletException, IOException { + String nickname = UserServiceFactory.getUserService().getCurrentUser().getNickname(); + resp.getWriter().print("

" + nickname + ", why don't you want to play with me?

"); + resp.setStatus(200); + resp.addHeader("Content-Type", "text/html"); + } + + @Override + protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException { + return Utils.getRedirectUri(req); + } + + @Override + protected AuthorizationCodeFlow initializeFlow() throws IOException { + return Utils.newFlow(); + } +} +``` + +For an additional sample, see +[storage-serviceaccount-appengine-sample][storage-sample]. + +### Service accounts + +[GoogleCredentials][google-credentials] also supports [service accounts][service-accounts]. +Unlike the credential in which a client application requests access to an +end-user's data, Service Accounts provide access to the client application's +own data. Your client application signs the request for an access token using +a private key downloaded from the [Google API Console][console]. + +For example, you can make a request in the following way: + +```java +HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); +JsonFactory jsonFactory = GsonFactory.getDefaultInstance(); + +//Build service account credential +GoogleCredentials googleCredentials = GoogleCredentials. + fromStream(new FileInputStream("/path/to/file")); +HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter(googleCredentials); + +Storage storage = new Storage.Builder(httpTransport, jsonFactory, requestInitializer) + .setApplicationName("MyProject-1234") + .build(); +``` + +For an additional sample, see [storage-serviceaccount-cmdline-sample][storage-sample]. + +**Note:** Although you can use service accounts in applications that run from a +Google Apps domain, service accounts are not members of your Google Apps account +and aren't subject to domain policies set by Google Apps administrators. For +example, a policy set in the Google Apps admin console to restrict the ability +of Apps end users to share documents outside of the domain would not apply to +service accounts. + +#### Impersonation + +You can also use the service account flow to impersonate a user in a domain that +you own. This is very similar to the service account flow above, but you +additionally call [`GoogleCredential.Builder.setServiceAccountUser(String)`][set-service-account-user]. + +### Installed applications + +This is the command-line authorization code flow described in [Using OAuth 2.0 for Installed Applications][oauth2-installed-app]. + +Example snippet from [plus-cmdline-sample][plus-sample]: + +```java +public static void main(String[] args) { + try { + httpTransport = GoogleNetHttpTransport.newTrustedTransport(); + dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR); + // authorization + Credential credential = authorize(); + // set up global Plus instance + plus = new Plus.Builder(httpTransport, JSON_FACTORY, credential).setApplicationName( + APPLICATION_NAME).build(); + // ... +} + +private static Credential authorize() throws Exception { + // load client secrets + GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, + new InputStreamReader(PlusSample.class.getResourceAsStream("/client_secrets.json"))); + // set up authorization code flow + GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( + httpTransport, JSON_FACTORY, clientSecrets, + Collections.singleton(PlusScopes.PLUS_ME)).setDataStoreFactory( + dataStoreFactory).build(); + // authorize + return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); +} +``` + +### Client-side applications + +To use the browser-based client flow described in +[Using OAuth 2.0 for Client-side Applications][oauth2-user-agent], you would +typically follow these steps: + +1. Redirect the end user in the browser to the authorization page using + [`GoogleBrowserClientRequestUrl`][browser-client-request] to grant your + browser application access to the end user's protected data. +1. Use the [Google API Client Library for JavaScript][javascript-client] to + process the access token found in the URL fragment at the redirect URI + registered at the [Google API Console][console]. + +Sample usage for a web application: + +```java +public void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException { + String url = new GoogleBrowserClientRequestUrl("812741506391.apps.googleusercontent.com", + "https://oauth2.example.com/oauthcallback", Arrays.asList( + "https://www.googleapis.com/auth/userinfo.email", + "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build(); + response.sendRedirect(url); +} +``` + +### Android (@Beta) + +**Which library to use with Android:** + +If you are developing for Android and the Google API you want to use is included +in the [Google Play Services library][play-services], use that library for the +best performance and experience. If the Google API you want to use with Android +is not part of the Google Play Services library, you can use the Google API +Client Library for Java, which supports Android 4.0 (Ice Cream Sandwich) +(or higher), and which is described here. The support for Android in the Google +API Client Library for Java is `@Beta`. + +**Background:** + +Starting with Eclair (SDK 2.1), user accounts are managed on an Android device +using the Account Manager. All Android application authorization is centrally +managed by the SDK using [AccountManager][account-manager]. You specify the +OAuth 2.0 scope your application needs, and it returns an access token to use. + +The OAuth 2.0 scope is specified via the `authTokenType` parameter as `oauth2:` +plus the scope. For example: + +``` +oauth2:https://www.googleapis.com/auth/tasks +``` + +This specifies read/write access to the Google Tasks API. If you need multiple +OAuth 2.0 scopes, use a space-separated list. + +Some APIs have special `authTokenType` parameters that also work. For example, +"Manage your tasks" is an alias for the `authtokenType` example shown above. + +You must also specify the API key from the [Google API Console][console]. +Otherwise, the token that the AccountManager gives you only provides you with +anonymous quota, which is usually very low. By contrast, by specifying an API +key you receive a higher free quota, and can optionally set up billing for usage +above that. + +Example code snippet taken from [tasks-android-sample][tasks-sample]: + +```java +com.google.api.services.tasks.Tasks service; + +@Override +public void onCreate(Bundle savedInstanceState) { + credential = + GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS)); + SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); + credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); + service = + new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential) + .setApplicationName("Google-TasksAndroidSample/1.0").build(); +} + +private void chooseAccount() { + startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); +} + +@Override +protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + switch (requestCode) { + case REQUEST_GOOGLE_PLAY_SERVICES: + if (resultCode == Activity.RESULT_OK) { + haveGooglePlayServices(); + } else { + checkGooglePlayServicesAvailable(); + } + break; + case REQUEST_AUTHORIZATION: + if (resultCode == Activity.RESULT_OK) { + AsyncLoadTasks.run(this); + } else { + chooseAccount(); + } + break; + case REQUEST_ACCOUNT_PICKER: + if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) { + String accountName = data.getExtras().getString(AccountManager.KEY_ACCOUNT_NAME); + if (accountName != null) { + credential.setSelectedAccountName(accountName); + SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); + SharedPreferences.Editor editor = settings.edit(); + editor.putString(PREF_ACCOUNT_NAME, accountName); + editor.commit(); + AsyncLoadTasks.run(this); + } + } + break; + } +} +``` + +[google-credentials]: https://googleapis.dev/java/google-auth-library/latest/index.html?com/google/auth/oauth2/GoogleCredentials.html +[google-oauth-client-instructions]: https://developers.google.com/api-client-library/java/google-oauth-java-client/oauth2 +[oauth2]: https://developers.google.com/accounts/docs/OAuth2 +[javadoc-oauth2]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/auth/oauth2/package-frame.html +[javadoc-appengine-oauth2]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/package-frame.html +[console]: https://console.developers.google.com/ +[console-help]: https://developer.google.com/console/help/console/ +[identity-api]: https://cloud.google.com/appengine/docs/java/appidentity/?csw=1#Asserting_Identity_to_Google_APIs +[app-identity-credential]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.html +[auth-code-flow-set-access-type]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeFlow.Builder.html#setAccessType-java.lang.String- +[data-store-factory]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/util/store/DataStoreFactory.html +[stored-credential]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/StoredCredential.html +[appengine-data-store-factory]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/extensions/appengine/datastore/AppEngineDataStoreFactory.html +[google-http-client]: https://github.com/googleapis/google-http-java-client +[memory-data-store-factory]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/util/store/MemoryDataStoreFactory.html +[file-data-store-factory]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/util/store/FileDataStoreFactory.html +[appengine-credential-store]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/appengine/auth/oauth2/AppEngineCredentialStore.html +[appengine-migrate]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/appengine/auth/oauth2/AppEngineCredentialStore.html#migrateTo-com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory- +[datastore-migrate]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/appengine/auth/oauth2/AppEngineCredentialStore.html#migrateTo-com.google.api.client.util.store.DataStore- +[datastore-credential-listener]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/DataStoreCredentialRefreshListener.html +[add-refresh-listener]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.Builder.html#addRefreshListener-com.google.api.client.auth.oauth2.CredentialRefreshListener- +[authorization-code-grant]: https://tools.ietf.org/html/rfc6749#section-4.1 +[authorization-code-flow]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html +[auth-code-flow-load]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html#loadCredential-java.lang.String- +[auth-code-flow-new]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html#newAuthorizationUrl-- +[token-request]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html#newTokenRequest-java.lang.String- +[create-and-store]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.html#createAndStoreCredential-com.google.api.client.auth.oauth2.TokenResponse-java.lang.String- +[datastore-get]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/util/store/DataStore.html#get-java.lang.String- +[auth-code-request-url]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeRequestUrl.html +[auth-code-response-url]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeResponseUrl.html +[auth-code-token-request]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/AuthorizationCodeTokenRequest.html +[datastore-set]: https://googleapis.dev/java/google-http-client/latest/com/google/api/client/util/store/DataStore.html#set(java.lang.String,%20V) +[credential]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/auth/oauth2/Credential.html +[oauth2-web-server]: https://developers.google.com/accounts/docs/OAuth2WebServer +[abstract-code-servlet]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/servlet/auth/oauth2/AbstractAuthorizationCodeServlet.html +[abstract-code-callback-servlet]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/servlet/auth/oauth2/AbstractAuthorizationCodeCallbackServlet.html +[users-api]: https://cloud.google.com/appengine/docs/java/users/ +[security-authentication]: https://cloud.google.com/appengine/docs/java/config/webxml#Security_and_Authentication +[abstract-gae-code-servlet]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/appengine/auth/oauth2/AbstractAppEngineAuthorizationCodeServlet.html +[abstract-gae-code-callback-servlet]: https://googleapis.dev/java/google-oauth-client/latest/com/google/api/client/extensions/appengine/auth/oauth2/AbstractAppEngineAuthorizationCodeCallbackServlet.html +[calendar-sample]: https://github.com/google/google-api-java-client-samples/tree/master/calendar-appengine-sample +[storage-sample]: https://github.com/GoogleCloudPlatform/cloud-storage-docs-xml-api-examples +[service-accounts]: https://developers.google.com/accounts/docs/OAuth2ServiceAccount +[plus-sample]: https://github.com/google/google-api-java-client-samples/tree/master/plus-serviceaccount-cmdline-sample +[set-service-account-user]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.Builder.html#setServiceAccountUser-java.lang.String- +[oauth2-installed-app]: https://developers.google.com/accounts/docs/OAuth2InstalledApp +[oauth2-user-agent]: https://developers.google.com/accounts/docs/OAuth2UserAgent +[browser-client-request]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/auth/oauth2/GoogleBrowserClientRequestUrl.html +[javascript-client]: https://developers.google.com/api-client-library/javascript/ +[play-services]: https://developer.android.com/google/play-services/index.html +[account-manager]: http://developer.android.com/reference/android/accounts/AccountManager.html +[tasks-sample]: https://github.com/google/google-api-java-client-samples/tree/master/tasks-android-sample \ No newline at end of file diff --git a/docs/setup.md b/docs/setup.md new file mode 100644 index 000000000..d62852330 --- /dev/null +++ b/docs/setup.md @@ -0,0 +1,79 @@ +--- +title: Setup Instructions +--- + +# Setup Instructions + +You can download the Google API Client Library for Java and its dependencies in +a zip file, or you can use a dependency manager such as Maven or gradle to +install the necessary jars from the Maven Central repository. + +## Maven + +The Google API Client Library for Java is in the central Maven repository. The +Maven `groupId` for all artifacts for this library is `com.google.api-client`. + +To ensure all dependency versions work together and to avoid having to manually +choose and specify versions for each dependency, we recommend first importing +the `com.google.cloud:libraries-bom` in the `dependencyManagement` section of +your `pom.xml`: + +```xml + + + + com.google.cloud + libraries-bom + 2.2.0 + pom + import + + + +``` + +Then you add the individual dependencies you need without version numbers to the +dependencies section: + +```xml + + com.google.api-client + google-api-client + +``` + +On Android, you may need to explicitly exclude unused dependencies: + +```xml + + com.google.api-client + google-api-client + + + xpp3 + xpp3 + + + httpclient + org.apache.httpcomponents + + + junit + junit + + + android + com.google.android + + + +``` + +## Download the library with dependencies + +Download the latest assembly zip file from Maven Central and extract it on your +computer. This zip contains the client library class jar files and the +associated source jar files for each artifact and their dependencies. You can +find dependency graphs and licenses for the different libraries in the +dependencies folder. For more details about the contents of the download, +see the contained `readme.html` file. diff --git a/docs/support.md b/docs/support.md new file mode 100644 index 000000000..e2806b871 --- /dev/null +++ b/docs/support.md @@ -0,0 +1,67 @@ +--- +title: Support +--- + +# Support + +## The Google API Client Library for Java community + +### Ask development questions + +Ask questions on StackOverflow: + +* When you ask questions about the Google API Client Library for Java, use the + [google-api-java-client][so-google-api-client] tag. Before you post a new + question, review the [most asked questions][so-maq]. +* For questions about Google APIs, use the [google-api][so-google-api] tag. +* Optionally include a tag to specify the language or platform, for example + [java][so-java], [android][so-android], or [google-app-engine][so-java-gae]. +* For tips on asking StackOverflow questions, see [How to Ask][so-how-to-ask]. + + + +### File feature requests and defects + +You can suggest features and report issues on our public [Issue Tracker][issues]. +This is a great place for the community to discuss and track implementations of +features or resolution of bug fixes, as well as share workarounds and patches. + +If you find a bug: + +* View [known bugs][bugs], and if a known bug corresponds to the issue you are + seeing, "star" it or comment on it. +* If the issue you are seeing has not yet been reported, + [file a bug report][new-issue]. + +If you have a feature request: + +* View [existing feature requests][feature-requests], and if a requested feature + corresponds to a feature you would like, "star" it or comment on it . +* If the feature has not yet been requested, + [file a feature request][new-issue]. + +### Contribute + +This is an [open-source][api-client] library, and [contributions][contributions] +are welcome. + +### Keep up with the library + +You can also take a look at the [release notes][releases]. + +[so-google-api-client]: http://stackoverflow.com/questions/tagged/google-api-java-client +[so-maq]: http://stackoverflow.com/questions/tagged/google-api-java-client?sort=faq&pagesize=50 +[so-google-api]: http://stackoverflow.com/questions/tagged/google-api +[so-java]: http://stackoverflow.com/questions/tagged/google-api-java-client+java +[so-android]: http://stackoverflow.com/questions/tagged/google-api-java-client+android +[so-java-gae]: http://stackoverflow.com/questions/tagged/google-api-java-client+java+google-app-engine +[so-how-to-ask]: http://stackoverflow.com/questions/ask +[issues]: https://github.com/googleapis/google-api-java-client/issues +[bugs]: https://github.com/googleapis/google-api-java-client/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+bug%22 +[feature-requests]: https://github.com/googleapis/google-api-java-client/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+feature+request%22 +[new-issue]: https://github.com/google/google-api-java-client/issues/new +[api-client]: https://github.com/googleapis/google-api-java-client +[contributions]: https://github.com/googleapis/google-api-java-client/blob/master/CONTRIBUTING.md +[releases]: https://github.com/googleapis/google-api-java-client/releases + diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml index 779eef93d..fb145e8f9 100644 --- a/findbugs-exclude.xml +++ b/findbugs-exclude.xml @@ -6,23 +6,18 @@ - - - - - - - + + - + - + @@ -88,26 +83,26 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/google-api-client-android/.classpath b/google-api-client-android/.classpath deleted file mode 100644 index 68a2c33fb..000000000 --- a/google-api-client-android/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/google-api-client-android/.project b/google-api-client-android/.project deleted file mode 100644 index 8c99250ab..000000000 --- a/google-api-client-android/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - google-api-client-android - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/google-api-client-android/.settings/org.eclipse.jdt.core.prefs b/google-api-client-android/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 511d24828..000000000 --- a/google-api-client-android/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,380 +0,0 @@ -#Thu Nov 17 08:38:45 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16|4|80 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_for_statement=16 -org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16 -org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=false -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=100 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=100 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false -org.eclipse.jdt.core.formatter.sort_member_annotations=false -org.eclipse.jdt.core.formatter.sort_package_annotations=false -org.eclipse.jdt.core.formatter.sort_parameter_annotations=false -org.eclipse.jdt.core.formatter.sort_type_annotations=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false -org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false -org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false diff --git a/google-api-client-android/.settings/org.eclipse.jdt.ui.prefs b/google-api-client-android/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 08ebc9764..000000000 --- a/google-api-client-android/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,119 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=false -cleanup.add_serial_version_id=true -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_google-api-java-client -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_google-api-java-client 100 -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=exception -org.eclipse.jdt.ui.gettersetter.use.is=false -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;;java;javax; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=999 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=999 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=false -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/google-api-client-android/pom.xml b/google-api-client-android/pom.xml index bc222da9d..778045245 100644 --- a/google-api-client-android/pom.xml +++ b/google-api-client-android/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.20.0 + 1.32.2-SNAPSHOT ../pom.xml google-api-client-android @@ -16,7 +16,7 @@ maven-javadoc-plugin - http://download.oracle.com/javase/1.5.0/docs/api/ + http://download.oracle.com/javase/7/docs/api/ ${project.name} ${project.version} ${project.artifactId} ${project.version} @@ -43,13 +43,9 @@ 4.1.1.4 provided - - com.google.api-client - google-api-client - com.google.http-client - google-http-client-android + google-http-client com.google.android.google-play-services diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/GoogleAccountManager.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/GoogleAccountManager.java index fde0d0933..3c7cd127e 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/GoogleAccountManager.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/GoogleAccountManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Google Inc. + * Copyright 2012 Google Inc. * * 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 @@ -14,15 +14,14 @@ package com.google.api.client.googleapis.extensions.android.accounts; -import com.google.api.client.util.Beta; -import com.google.api.client.util.Preconditions; - import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; +import com.google.api.client.util.Beta; +import com.google.api.client.util.Preconditions; /** - * {@link Beta}
+ * {@link Beta}
* Account manager wrapper for Google accounts. * * @since 1.11 @@ -37,16 +36,12 @@ public final class GoogleAccountManager { /** Account manager. */ private final AccountManager manager; - /** - * @param accountManager account manager - */ + /** @param accountManager account manager */ public GoogleAccountManager(AccountManager accountManager) { this.manager = Preconditions.checkNotNull(accountManager); } - /** - * @param context context from which to retrieve the account manager - */ + /** @param context context from which to retrieve the account manager */ public GoogleAccountManager(Context context) { this(AccountManager.get(context)); } diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/package-info.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/package-info.java index 71655b40c..853d1004e 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/package-info.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Google Inc. + * Copyright 2012 Google Inc. * * 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 @@ -13,7 +13,7 @@ */ /** - * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Utilities for Account Manager for Google accounts on Android Eclair (SDK 2.1) and later. * * @since 1.11 @@ -21,4 +21,3 @@ */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.android.accounts; - diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java index 5e911ce3a..647cc773d 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java @@ -12,6 +12,9 @@ package com.google.api.client.googleapis.extensions.android.gms.auth; +import android.accounts.Account; +import android.content.Context; +import android.content.Intent; import com.google.android.gms.auth.GoogleAuthException; import com.google.android.gms.auth.GoogleAuthUtil; import com.google.android.gms.auth.GooglePlayServicesAvailabilityException; @@ -30,34 +33,26 @@ import com.google.api.client.util.Joiner; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Sleeper; - -import android.accounts.Account; -import android.content.Context; -import android.content.Intent; - import java.io.IOException; import java.util.Collection; /** - * {@link Beta}
+ * {@link Beta}
* Manages authorization and account selection for Google accounts. * - *

- * When fetching a token, any thrown {@link GoogleAuthException} would be wrapped: + *

When fetching a token, any thrown {@link GoogleAuthException} would be wrapped: + * *

    - *
  • {@link GooglePlayServicesAvailabilityException} would be wrapped inside of - * {@link GooglePlayServicesAvailabilityIOException}
  • - *
  • {@link UserRecoverableAuthException} would be wrapped inside of - * {@link UserRecoverableAuthIOException}
  • - *
  • {@link GoogleAuthException} when be wrapped inside of {@link GoogleAuthIOException}
  • + *
  • {@link GooglePlayServicesAvailabilityException} would be wrapped inside of {@link + * GooglePlayServicesAvailabilityIOException} + *
  • {@link UserRecoverableAuthException} would be wrapped inside of {@link + * UserRecoverableAuthIOException} + *
  • {@link GoogleAuthException} when be wrapped inside of {@link GoogleAuthIOException} *
- *

* - *

- * Upgrade warning: in prior version 1.14 exponential back-off was enabled by default when I/O + *

Upgrade warning: in prior version 1.14 exponential back-off was enabled by default when I/O * exception was thrown inside {@link #getToken}, but starting with version 1.15 you need to call * {@link #setBackOff} with {@link ExponentialBackOff} to enable it. - *

* * @since 1.12 * @author Yaniv Inbar @@ -108,7 +103,6 @@ public GoogleAccountCredential(Context context, String scope) { * @param context context * @param scopes non empty OAuth 2.0 scope list * @return new instance - * * @since 1.15 */ public static GoogleAccountCredential usingOAuth2(Context context, Collection scopes) { @@ -130,8 +124,8 @@ public static GoogleAccountCredential usingAudience(Context context, String audi } /** - * Sets the selected Google account name (e-mail address) -- for example - * {@code "johndoe@gmail.com"} -- or {@code null} for none. + * Sets the selected Google account name (e-mail address) -- for example {@code + * "johndoe@gmail.com"} -- or {@code null} for none. */ public final GoogleAccountCredential setSelectedAccountName(String accountName) { selectedAccount = accountManager.getAccountByName(accountName); @@ -140,6 +134,18 @@ public final GoogleAccountCredential setSelectedAccountName(String accountName) return this; } + /** + * Sets the selected Google {@link Account} or {@code null} for none. + * + *

Caller must ensure the given Google account exists. + */ + public final GoogleAccountCredential setSelectedAccount(Account selectedAccount) { + this.selectedAccount = selectedAccount; + this.accountName = selectedAccount == null ? null : selectedAccount.name; + return this; + } + + @Override public void initialize(HttpRequest request) { RequestHandler handler = new RequestHandler(); request.setInterceptor(handler); @@ -172,8 +178,8 @@ public final Account getSelectedAccount() { } /** - * Returns the back-off policy which is used when an I/O exception is thrown inside - * {@link #getToken} or {@code null} for none. + * Returns the back-off policy which is used when an I/O exception is thrown inside {@link + * #getToken} or {@code null} for none. * * @since 1.15 */ @@ -212,8 +218,8 @@ public final GoogleAccountCredential setSleeper(Sleeper sleeper) { } /** - * Returns the selected Google account name (e-mail address), for example - * {@code "johndoe@gmail.com"}, or {@code null} for none. + * Returns the selected Google account name (e-mail address), for example {@code + * "johndoe@gmail.com"}, or {@code null} for none. */ public final String getSelectedAccountName() { return accountName; @@ -223,12 +229,11 @@ public final String getSelectedAccountName() { * Returns an intent to show the user to select a Google account, or create a new one if there are * none on the device yet. * - *

- * Must be run from the main UI thread. - *

+ *

Must be run from the main UI thread. */ public final Intent newChooseAccountIntent() { - return AccountPicker.newChooseAccountIntent(selectedAccount, + return AccountPicker.newChooseAccountIntent( + selectedAccount, null, new String[] {GoogleAccountManager.ACCOUNT_TYPE}, true, @@ -241,9 +246,7 @@ public final Intent newChooseAccountIntent() { /** * Returns an OAuth 2.0 access token. * - *

- * Must be run from a background thread, not the main UI thread. - *

+ *

Must be run from a background thread, not the main UI thread. */ public String getToken() throws IOException, GoogleAuthException { if (backOff != null) { @@ -266,14 +269,15 @@ public String getToken() throws IOException, GoogleAuthException { } } - @Beta class RequestHandler implements HttpExecuteInterceptor, HttpUnsuccessfulResponseHandler { /** Whether we've received a 401 error code indicating the token is invalid. */ boolean received401; + String token; + @Override public void intercept(HttpRequest request) throws IOException { try { token = getToken(); @@ -287,12 +291,17 @@ public void intercept(HttpRequest request) throws IOException { } } - public boolean handleResponse( - HttpRequest request, HttpResponse response, boolean supportsRetry) { - if (response.getStatusCode() == 401 && !received401) { - received401 = true; - GoogleAuthUtil.invalidateToken(context, token); - return true; + @Override + public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) + throws IOException { + try { + if (response.getStatusCode() == 401 && !received401) { + received401 = true; + GoogleAuthUtil.clearToken(context, token); + return true; + } + } catch (GoogleAuthException e) { + throw new GoogleAuthIOException(e); } return false; } diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAuthIOException.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAuthIOException.java index b51cabbec..5eccef1ce 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAuthIOException.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAuthIOException.java @@ -15,16 +15,13 @@ import com.google.android.gms.auth.GoogleAuthException; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; - import java.io.IOException; /** - * {@link Beta}
+ * {@link Beta}
* Wraps a {@link GoogleAuthException} into an {@link IOException} so it can be caught directly. * - *

- * Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}. - *

+ *

Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}. * * @since 1.12 * @author Yaniv Inbar @@ -36,8 +33,9 @@ public class GoogleAuthIOException extends IOException { /** * @param wrapped wrapped {@link GoogleAuthException} + * @since 1.21.0 */ - GoogleAuthIOException(GoogleAuthException wrapped) { + public GoogleAuthIOException(GoogleAuthException wrapped) { initCause(Preconditions.checkNotNull(wrapped)); } diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java index 7d35b661c..f06de0b27 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java @@ -12,36 +12,31 @@ package com.google.api.client.googleapis.extensions.android.gms.auth; +import android.app.Activity; import com.google.android.gms.auth.GooglePlayServicesAvailabilityException; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.api.client.util.Beta; - -import android.app.Activity; - import java.io.IOException; /** - * {@link Beta}
+ * {@link Beta}
* Wraps a {@link GooglePlayServicesAvailabilityException} into an {@link IOException} so it can be * caught directly. * - *

- * Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use - * {@link #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example - * usage: - *

+ *

Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use {@link + * #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example usage: * *

-    } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
-      myActivity.runOnUiThread(new Runnable() {
-        public void run() {
-          Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
-              availabilityException.getConnectionStatusCode(),
-              myActivity,
-              MyActivity.REQUEST_GOOGLE_PLAY_SERVICES);
-          dialog.show();
-        }
-      });
+ * } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
+ * myActivity.runOnUiThread(new Runnable() {
+ * public void run() {
+ * Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
+ * availabilityException.getConnectionStatusCode(),
+ * myActivity,
+ * MyActivity.REQUEST_GOOGLE_PLAY_SERVICES);
+ * dialog.show();
+ * }
+ * });
  * 
* * @since 1.12 @@ -52,7 +47,9 @@ public class GooglePlayServicesAvailabilityIOException extends UserRecoverableAu private static final long serialVersionUID = 1L; - GooglePlayServicesAvailabilityIOException(GooglePlayServicesAvailabilityException wrapped) { + /** @since 1.21.0 */ + public GooglePlayServicesAvailabilityIOException( + GooglePlayServicesAvailabilityException wrapped) { super(wrapped); } @@ -62,8 +59,8 @@ public GooglePlayServicesAvailabilityException getCause() { } /** - * Returns the error code to use with - * {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)}. + * Returns the error code to use with {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, + * int)}. */ public final int getConnectionStatusCode() { return getCause().getConnectionStatusCode(); diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java index c047d3ea1..280d80f79 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java @@ -12,29 +12,25 @@ package com.google.api.client.googleapis.extensions.android.gms.auth; -import com.google.android.gms.auth.UserRecoverableAuthException; -import com.google.api.client.util.Beta; - import android.app.Activity; import android.content.Intent; - +import com.google.android.gms.auth.UserRecoverableAuthException; +import com.google.api.client.util.Beta; import java.io.IOException; /** - * {@link Beta}
+ * {@link Beta}
* Wraps a {@link UserRecoverableAuthException} into an {@link IOException} so it can be caught * directly. * - *

- * Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use - * {@link #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage: - *

+ *

Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use {@link + * #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage: * *

-    } catch (UserRecoverableAuthIOException userRecoverableException) {
-      myActivity.startActivityForResult(
-          userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION);
-    }
+ * } catch (UserRecoverableAuthIOException userRecoverableException) {
+ * myActivity.startActivityForResult(
+ * userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION);
+ * }
  * 
* * @since 1.12 @@ -45,7 +41,8 @@ public class UserRecoverableAuthIOException extends GoogleAuthIOException { private static final long serialVersionUID = 1L; - UserRecoverableAuthIOException(UserRecoverableAuthException wrapped) { + /** @since 1.21.0 */ + public UserRecoverableAuthIOException(UserRecoverableAuthException wrapped) { super(wrapped); } @@ -55,8 +52,8 @@ public UserRecoverableAuthException getCause() { } /** - * Returns the {@link Intent} that when supplied to - * {@link Activity#startActivityForResult(Intent, int)} will allow user intervention. + * Returns the {@link Intent} that when supplied to {@link Activity#startActivityForResult(Intent, + * int)} will allow user intervention. */ public final Intent getIntent() { return getCause().getIntent(); diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/package-info.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/package-info.java index 5ad2c1838..c5ec537e1 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/package-info.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/package-info.java @@ -11,7 +11,7 @@ */ /** - * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Utilities based on Google * Play services. * @@ -20,4 +20,3 @@ */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.android.gms.auth; - diff --git a/google-api-client-appengine/.classpath b/google-api-client-appengine/.classpath deleted file mode 100644 index 2c81b2089..000000000 --- a/google-api-client-appengine/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/google-api-client-appengine/.project b/google-api-client-appengine/.project deleted file mode 100644 index a99e1411b..000000000 --- a/google-api-client-appengine/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - google-api-client-appengine - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/google-api-client-appengine/.settings/org.eclipse.jdt.core.prefs b/google-api-client-appengine/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1eb99c2ca..000000000 --- a/google-api-client-appengine/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,379 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24 -org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16|4|80 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_for_statement=16 -org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16 -org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=false -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=100 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=100 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false -org.eclipse.jdt.core.formatter.sort_member_annotations=false -org.eclipse.jdt.core.formatter.sort_package_annotations=false -org.eclipse.jdt.core.formatter.sort_parameter_annotations=false -org.eclipse.jdt.core.formatter.sort_type_annotations=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false -org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true -org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false -org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false diff --git a/google-api-client-appengine/.settings/org.eclipse.jdt.ui.prefs b/google-api-client-appengine/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index fea3eb890..000000000 --- a/google-api-client-appengine/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,119 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=true -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_google-api-java-client -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_google-api-java-client 100 -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=exception -org.eclipse.jdt.ui.gettersetter.use.is=false -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;;java;javax; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=999 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=999 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/google-api-client-appengine/pom.xml b/google-api-client-appengine/pom.xml index 2ef19f161..c4b828478 100644 --- a/google-api-client-appengine/pom.xml +++ b/google-api-client-appengine/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.20.0 + 1.32.2-SNAPSHOT ../pom.xml google-api-client-appengine @@ -15,10 +15,10 @@ maven-javadoc-plugin - http://download.oracle.com/javase/6/docs/api/ - http://code.google.com/appengine/docs/java/javadoc - http://javadoc.google-http-java-client.googlecode.com/hg/${project.http.version} - http://javadoc.google-oauth-java-client.googlecode.com/hg/${project.oauth.version} + http://download.oracle.com/javase/7/docs/api/ + https://cloud.google.com/appengine/docs/standard/java/javadoc/ + https://googleapis.dev/java/google-http-client/${project.http.version}/ + https://googleapis.dev/java/google-oauth-client/${project.oauth.version}/ ${project.name} ${project.version} ${project.artifactId} ${project.version} @@ -28,20 +28,36 @@ maven-jar-plugin + ${project.build.outputDirectory}/META-INF/MANIFEST.MF true + + google.api.client.appengine + + + + org.apache.felix + maven-bundle-plugin + 2.5.4 - jar - compile + bundle-manifest + process-classes - jar + manifest + + + https://googleapis.dev/java/google-api-client/${project.version}/index.html + App Engine extensions to the Google APIs Client Library for Java + com.google.api.client.appengine + + maven-source-plugin @@ -55,30 +71,14 @@ - - org.datanucleus - maven-datanucleus-plugin - 2.2.1 - - true - - - - process-classes - - enhance - - - - - + org.codehaus.mojo animal-sniffer-maven-plugin org.codehaus.mojo.signature - java16 + java17 1.0 @@ -91,9 +91,22 @@ appengine-api-1.0-sdk provided
+ + javax.servlet + servlet-api + provided + + + com.google.http-client + google-http-client + + + com.google.http-client + google-http-client-gson + com.google.oauth-client - google-oauth-client-appengine + google-oauth-client com.google.api-client @@ -113,30 +126,5 @@ junit test - - com.google.appengine - appengine-testing - test - - - com.google.appengine - appengine-api-labs - test - - - com.google.appengine - appengine-api-stubs - test - - - com.google.http-client - google-http-client-jackson2 - test - - - com.google.guava - guava-jdk5 - test - diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java index d714a6023..cf2772af7 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Google Inc. + * Copyright 2012 Google Inc. * * 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 @@ -15,6 +15,7 @@ package com.google.api.client.googleapis.extensions.appengine.auth.oauth2; import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; @@ -24,8 +25,8 @@ import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import com.google.appengine.api.appidentity.AppIdentityService; +import com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult; import com.google.appengine.api.appidentity.AppIdentityServiceFactory; - import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -35,26 +36,20 @@ * owns, based on Asserting Identity to Google APIs * - *

- * Intercepts the request by using the access token obtained from - * {@link AppIdentityService#getAccessToken(Iterable)}. - *

+ *

Intercepts the request by using the access token obtained from {@link + * AppIdentityService#getAccessToken(Iterable)}. * - *

- * Sample usage: - *

+ *

Sample usage: * *

-  public static HttpRequestFactory createRequestFactory(
-      HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) {
-    return transport.createRequestFactory(
-        new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener"));
-  }
+ * public static HttpRequestFactory createRequestFactory(
+ * HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) {
+ * return transport.createRequestFactory(
+ * new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener"));
+ * }
  * 
* - *

- * Implementation is immutable and thread-safe. - *

+ *

Implementation is immutable and thread-safe. * * @since 1.7 * @author Yaniv Inbar @@ -77,14 +72,15 @@ public AppIdentityCredential(Collection scopes) { /** * @param builder builder - * * @since 1.14 */ protected AppIdentityCredential(Builder builder) { // Lazily retrieved rather than setting as the default value in order to not add runtime // dependencies on AppIdentityServiceFactory unless it is actually being used. - appIdentityService = builder.appIdentityService == null - ? AppIdentityServiceFactory.getAppIdentityService() : builder.appIdentityService; + appIdentityService = + builder.appIdentityService == null + ? AppIdentityServiceFactory.getAppIdentityService() + : builder.appIdentityService; scopes = builder.scopes; } @@ -120,17 +116,15 @@ public final Collection getScopes() { /** * Builder for {@link AppIdentityCredential}. * - *

- * Implementation is not thread-safe. - *

+ *

Implementation is not thread-safe. * * @since 1.12 */ public static class Builder { /** - * App Identity Service that provides the access token or {@code null} to use - * {@link AppIdentityServiceFactory#getAppIdentityService()}. + * App Identity Service that provides the access token or {@code null} to use {@link + * AppIdentityServiceFactory#getAppIdentityService()}. */ AppIdentityService appIdentityService; @@ -148,8 +142,8 @@ public Builder(Collection scopes) { } /** - * Returns the App Identity Service that provides the access token or {@code null} to use - * {@link AppIdentityServiceFactory#getAppIdentityService()}. + * Returns the App Identity Service that provides the access token or {@code null} to use {@link + * AppIdentityServiceFactory#getAppIdentityService()}. * * @since 1.14 */ @@ -158,22 +152,18 @@ public final AppIdentityService getAppIdentityService() { } /** - * Sets the App Identity Service that provides the access token or {@code null} to use - * {@link AppIdentityServiceFactory#getAppIdentityService()}. + * Sets the App Identity Service that provides the access token or {@code null} to use {@link + * AppIdentityServiceFactory#getAppIdentityService()}. * - *

- * Overriding is only supported for the purpose of calling the super implementation and changing - * the return type, but nothing else. - *

+ *

Overriding is only supported for the purpose of calling the super implementation and + * changing the return type, but nothing else. */ public Builder setAppIdentityService(AppIdentityService appIdentityService) { this.appIdentityService = appIdentityService; return this; } - /** - * Returns a new {@link AppIdentityCredential}. - */ + /** Returns a new {@link AppIdentityCredential}. */ public AppIdentityCredential build() { return new AppIdentityCredential(this); } @@ -189,7 +179,7 @@ public final Collection getScopes() { } /** - * {@link Beta}
+ * {@link Beta}
* Credential wrapper for application identity that inherits from GoogleCredential. */ @Beta @@ -203,25 +193,26 @@ public static class AppEngineCredentialWrapper extends GoogleCredential { * * @param transport the transport for Http calls. * @param jsonFactory the factory for Json parsing and formatting. - * @throws IOException if the credential cannot be created for the current environment, - * such as when the AppIndentityService is not available. + * @throws IOException if the credential cannot be created for the current environment, such as + * when the AppIndentityService is not available. */ public AppEngineCredentialWrapper(HttpTransport transport, JsonFactory jsonFactory) throws IOException { // May be called via reflection to test whether running on App Engine, so fail even if // the type can be loaded but the service is not available. - this(getCheckedAppIdentityCredential(), Preconditions.checkNotNull(transport), + this( + getCheckedAppIdentityCredential(), + Preconditions.checkNotNull(transport), Preconditions.checkNotNull(jsonFactory)); } AppEngineCredentialWrapper( - AppIdentityCredential appIdentity, - HttpTransport transport, - JsonFactory jsonFactory) { - super(new GoogleCredential.Builder() - .setRequestInitializer(appIdentity) - .setTransport(transport) - .setJsonFactory(jsonFactory)); + AppIdentityCredential appIdentity, HttpTransport transport, JsonFactory jsonFactory) { + super( + new GoogleCredential.Builder() + .setRequestInitializer(appIdentity) + .setTransport(transport) + .setJsonFactory(jsonFactory)); this.appIdentity = appIdentity; Collection scopes = appIdentity.getScopes(); scopesRequired = (scopes == null || scopes.isEmpty()); @@ -255,5 +246,17 @@ public GoogleCredential createScoped(Collection scopes) { getTransport(), getJsonFactory()); } + + @Override + protected TokenResponse executeRefreshToken() throws IOException { + GetAccessTokenResult tokenResult = + appIdentity.getAppIdentityService().getAccessToken(appIdentity.getScopes()); + TokenResponse response = new TokenResponse(); + response.setAccessToken(tokenResult.getAccessToken()); + long expiresInSeconds = + (tokenResult.getExpirationTime().getTime() - System.currentTimeMillis()) / 1000; + response.setExpiresInSeconds(expiresInSeconds); + return response; + } } } diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/package-info.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/package-info.java index d63ca8d29..188dcee8c 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/package-info.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Google Inc. + * Copyright 2012 Google Inc. * * 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 @@ -18,6 +18,4 @@ * @since 1.7 * @author Yaniv Inbar */ - package com.google.api.client.googleapis.extensions.appengine.auth.oauth2; - diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java index 68e0da6f8..22324aa86 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Google Inc. + * Copyright 2013 Google Inc. * * 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 @@ -18,41 +18,34 @@ import com.google.api.client.googleapis.extensions.servlet.notifications.WebhookUtils; import com.google.api.client.util.Beta; import com.google.api.client.util.store.DataStoreFactory; - import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** - * {@link Beta}
+ * {@link Beta}
* Thread-safe Webhook App Engine Servlet to receive notifications. * - *

- * In order to use this servlet you need to register the servlet in your web.xml. You may optionally - * extend {@link AppEngineNotificationServlet} with custom behavior. - *

- * - *

- * It is a simple wrapper around {@link WebhookUtils#processWebhookNotification(HttpServletRequest, - * HttpServletResponse, DataStoreFactory)} that uses - * {@link AppEngineDataStoreFactory#getDefaultInstance()}, so you may alternatively call that method - * instead from your {@link HttpServlet#doPost} with no loss of functionality. - *

+ *

In order to use this servlet you need to register the servlet in your web.xml. You may + * optionally extend {@link AppEngineNotificationServlet} with custom behavior. * - * Sample web.xml setup: + *

It is a simple wrapper around {@link + * WebhookUtils#processWebhookNotification(HttpServletRequest, HttpServletResponse, + * DataStoreFactory)} that uses {@link AppEngineDataStoreFactory#getDefaultInstance()}, so you may + * alternatively call that method instead from your {@link HttpServlet#doPost} with no loss of + * functionality. Sample web.xml setup: * *

-  {@literal <}servlet{@literal >}
-      {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
-      {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.appengine.notifications.AppEngineNotificationServlet{@literal <}/servlet-class{@literal >}
-  {@literal <}/servlet{@literal >}
-  {@literal <}servlet-mapping{@literal >}
-      {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
-      {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >}
-  {@literal <}/servlet-mapping{@literal >}
+ * {@literal <}servlet{@literal >}
+ * {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
+ * {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.appengine.notifications.AppEngineNotificationServlet{@literal <}/servlet-class{@literal >}
+ * {@literal <}/servlet{@literal >}
+ * {@literal <}servlet-mapping{@literal >}
+ * {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
+ * {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >}
+ * {@literal <}/servlet-mapping{@literal >}
  * 
* * @author Yaniv Inbar diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/package-info.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/package-info.java index bc0e761ea..be058092c 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/package-info.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Google Inc. + * Copyright 2013 Google Inc. * * 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 @@ -13,7 +13,7 @@ */ /** - * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Support for subscribing to topics and receiving notifications on servlet-based platforms. * * @since 1.16 @@ -21,4 +21,3 @@ */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.appengine.notifications; - diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/MockAppIdentityService.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/MockAppIdentityService.java index 7d9f600e2..eb7538ff9 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/MockAppIdentityService.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/MockAppIdentityService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Google Inc. + * Copyright 2014 Google Inc. * * 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 @@ -18,11 +18,11 @@ import com.google.appengine.api.appidentity.AppIdentityService; import com.google.appengine.api.appidentity.AppIdentityServiceFailureException; import com.google.appengine.api.appidentity.PublicCertificate; - import java.util.Collection; +import java.util.Date; /** - * {@link Beta}
+ * {@link Beta}
* Mock implementation of AppIdentityService interface for testing. * * @since 1.19 @@ -33,8 +33,7 @@ public class MockAppIdentityService implements AppIdentityService { private int getAccessTokenCallCount = 0; private String accessTokenText = null; - public MockAppIdentityService() { - } + public MockAppIdentityService() {} public int getGetAccessTokenCallCount() { return getAccessTokenCallCount; @@ -70,7 +69,8 @@ public GetAccessTokenResult getAccessToken(Iterable scopes) { if (scopeCount == 0) { throw new AppIdentityServiceFailureException("No scopes specified."); } - return new GetAccessTokenResult(accessTokenText, null); + return new GetAccessTokenResult( + accessTokenText, new Date(System.currentTimeMillis() + 3600000)); } @Override @@ -87,4 +87,9 @@ public String getServiceAccountName() { public ParsedAppId parseFullAppId(String fullAppId) { return null; } + + @Override + public String getDefaultGcsBucketName() { + return null; + } } diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/package-info.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/package-info.java index 5b79c380b..64b65dcaf 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/package-info.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Google Inc. + * Copyright 2014 Google Inc. * * 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 @@ -13,7 +13,7 @@ */ /** - * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.extensions.appengine.auth.oauth2} * package. * @@ -21,4 +21,3 @@ */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.appengine.testing.auth.oauth2; - diff --git a/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredentialTest.java b/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredentialTest.java index 552789020..961a8ffe7 100644 --- a/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredentialTest.java +++ b/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredentialTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Google Inc. + * Copyright 2013 Google Inc. * * 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 @@ -20,15 +20,13 @@ import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.testing.http.MockHttpTransport; - -import junit.framework.TestCase; - import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import junit.framework.TestCase; /** * Tests {@link AppIdentityCredential}. @@ -58,12 +56,11 @@ public void testUsesAppIdentityService() throws IOException { builder.setAppIdentityService(appIdentity); AppIdentityCredential appCredential = builder.build(); HttpTransport transport = new MockHttpTransport(); - HttpRequest request = transport.createRequestFactory().buildRequest( - "get", null, null); + HttpRequest request = transport.createRequestFactory().buildRequest("get", null, null); appCredential.intercept(request); - assertEquals(appIdentity.getGetAccessTokenCallCount(), 1); + assertEquals(1, appIdentity.getGetAccessTokenCallCount()); HttpHeaders headers = request.getHeaders(); String authHeader = headers.getAuthorization(); Boolean headerContainsToken = authHeader.contains(expectedAccessToken); @@ -75,7 +72,7 @@ public void testAppEngineCredentialWrapper() throws IOException { final Collection emptyScopes = Collections.emptyList(); HttpTransport transport = new MockHttpTransport(); - JsonFactory jsonFactory = new JacksonFactory(); + JsonFactory jsonFactory = new GsonFactory(); MockAppIdentityService appIdentity = new MockAppIdentityService(); appIdentity.setAccessTokenText(expectedAccessToken); @@ -84,8 +81,8 @@ public void testAppEngineCredentialWrapper() throws IOException { builder.setAppIdentityService(appIdentity); AppIdentityCredential appCredential = builder.build(); - GoogleCredential wrapper = new - AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory); + GoogleCredential wrapper = + new AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory); HttpRequest request = transport.createRequestFactory().buildRequest("get", null, null); @@ -95,20 +92,39 @@ public void testAppEngineCredentialWrapper() throws IOException { fail("Should not be able to use credential without scopes."); } catch (Exception expected) { } - assertEquals(appIdentity.getGetAccessTokenCallCount(), 1); + assertEquals(1, appIdentity.getGetAccessTokenCallCount()); GoogleCredential scopedWrapper = wrapper.createScoped(SCOPES); assertNotSame(wrapper, scopedWrapper); scopedWrapper.intercept(request); - assertEquals(appIdentity.getGetAccessTokenCallCount(), 2); + assertEquals(2, appIdentity.getGetAccessTokenCallCount()); HttpHeaders headers = request.getHeaders(); String authHeader = headers.getAuthorization(); assertTrue(authHeader.contains(expectedAccessToken)); } + public void testAppEngineCredentialWrapperGetAccessToken() throws IOException { + final String expectedAccessToken = "ExpectedAccessToken"; + + HttpTransport transport = new MockHttpTransport(); + JsonFactory jsonFactory = new GsonFactory(); + + MockAppIdentityService appIdentity = new MockAppIdentityService(); + appIdentity.setAccessTokenText(expectedAccessToken); + + AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(SCOPES); + builder.setAppIdentityService(appIdentity); + AppIdentityCredential appCredential = builder.build(); + + GoogleCredential wrapper = + new AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory); + assertTrue(wrapper.refreshToken()); + assertEquals(expectedAccessToken, wrapper.getAccessToken()); + } + public void testAppEngineCredentialWrapperNullTransportThrows() throws IOException { - JsonFactory jsonFactory = new JacksonFactory(); + JsonFactory jsonFactory = new GsonFactory(); try { new AppIdentityCredential.AppEngineCredentialWrapper(null, jsonFactory); fail(); diff --git a/google-api-client-assembly/.project b/google-api-client-assembly/.project deleted file mode 100644 index adf989524..000000000 --- a/google-api-client-assembly/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - google-api-client-assembly - - - - - - - - diff --git a/google-api-client-assembly/android-properties/jackson-core-2.1.3.jar.properties b/google-api-client-assembly/android-properties/jackson-core-2.9.2.jar.properties similarity index 100% rename from google-api-client-assembly/android-properties/jackson-core-2.1.3.jar.properties rename to google-api-client-assembly/android-properties/jackson-core-2.9.2.jar.properties diff --git a/google-api-client-assembly/android-properties/jackson-core-asl-1.9.11.jar.properties b/google-api-client-assembly/android-properties/jackson-core-asl-1.9.11.jar.properties deleted file mode 100644 index d613b8e65..000000000 --- a/google-api-client-assembly/android-properties/jackson-core-asl-1.9.11.jar.properties +++ /dev/null @@ -1 +0,0 @@ -src=../libs-sources/jackson-core-asl-${project.jackson-core-asl.version}-sources.jar diff --git a/google-api-client-assembly/assembly.xml b/google-api-client-assembly/assembly.xml index 6578dd862..a239f8f8f 100644 --- a/google-api-client-assembly/assembly.xml +++ b/google-api-client-assembly/assembly.xml @@ -25,11 +25,102 @@ true google-api-java-client
+ + properties/google-api-client.jar.properties + google-api-client-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-api-client-android.jar.properties + google-api-client-android-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-api-client-gson.jar.properties + google-api-client-gson-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-api-client-jackson2.jar.properties + google-api-client-jackson2-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-api-client-protobuf.jar.properties + google-api-client-protobuf-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-api-client-xml.jar.properties + google-api-client-xml-${project.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client.jar.properties + google-http-client-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-android.jar.properties + google-http-client-android-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-gson.jar.properties + google-http-client-gson-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-jackson.jar.properties + google-http-client-jackson-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-jackson2.jar.properties + google-http-client-jackson2-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-jdo.jar.properties + google-http-client-jdo-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-protobuf.jar.properties + google-http-client-protobuf-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-http-client-xml.jar.properties + google-http-client-xml-${project.http.version}.jar.properties + google-api-java-client/libs + true + + + properties/google-oauth-client.jar.properties + google-oauth-client-${project.oauth.version}.jar.properties + google-api-java-client/libs + true + dependencies google-api-java-client/dependencies + true target/libs diff --git a/google-api-client-assembly/classpath-include b/google-api-client-assembly/classpath-include index e5be4f925..c6e53b922 100644 --- a/google-api-client-assembly/classpath-include +++ b/google-api-client-assembly/classpath-include @@ -26,7 +26,6 @@ - diff --git a/google-api-client-assembly/dependencies/BSD-LICENSE.txt b/google-api-client-assembly/dependencies/BSD-LICENSE.txt index 5ebe92c58..9473fba56 100644 --- a/google-api-client-assembly/dependencies/BSD-LICENSE.txt +++ b/google-api-client-assembly/dependencies/BSD-LICENSE.txt @@ -1,6 +1,6 @@ BSD License -Copyright (c) 2000-2006, www.hamcrest.org +Copyright 2000-2006, www.hamcrest.org All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/google-api-client-assembly/dependencies/google-api-client-android-dependencies.html b/google-api-client-assembly/dependencies/google-api-client-android-dependencies.html index 4ef231e1e..acd9a36ce 100644 --- a/google-api-client-assembly/dependencies/google-api-client-android-dependencies.html +++ b/google-api-client-assembly/dependencies/google-api-client-android-dependencies.html @@ -1,52 +1,52 @@ - - - - - - Project Dependencies - - - - - - - - - -
- -
-
-
+ + + + + + Project Dependencies + + + + + + + + + +
+ +
+
+

Project Dependencies

@@ -63,13 +63,13 @@

compile

com.google.api-client google-api-client -1.20.0 +${project.version} jar The Apache Software License, Version 2.0 com.google.http-client google-http-client-android -1.20.0 +${project.http.version} jar The Apache Software License, Version 2.0
@@ -109,64 +109,70 @@

compile

License com.fasterxml.jackson.core -jackson-core -2.1.3 +jackson-core +2.9.2 jar The Apache Software License, Version 2.0 com.google.code.findbugs jsr305 -1.3.9 +3.0.2 jar The Apache Software License, Version 2.0 com.google.guava -guava-jdk5 -13.0 +guava +26.0-android jar The Apache Software License, Version 2.0 com.google.http-client google-http-client -1.20.0 +${project.http.version} jar The Apache Software License, Version 2.0 com.google.http-client google-http-client-jackson2 -1.20.0 +${project.http.version} jar The Apache Software License, Version 2.0 +com.google.j2objc +j2objc-annotations +1.1 +jar +The Apache Software License, Version 2.0 + com.google.oauth-client google-oauth-client -1.20.0 +${project.oauth.version} jar The Apache Software License, Version 2.0 - + commons-codec -commons-codec -1.3 +commons-codec +1.10 jar -/LICENSE.txt - +Apache License, Version 2.0 + commons-logging commons-logging 1.1.1 jar The Apache Software License, Version 2.0 - + org.apache.httpcomponents httpclient -4.0.1 +4.5.5 jar -../LICENSE.txt - +Apache License, Version 2.0 + org.apache.httpcomponents -httpcore -4.0.1 +httpcore +4.4.9 jar -Apache License
+Apache License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

@@ -223,7 +229,7 @@

Project Dependency Graph