1Contributing 2============ 3 41. **Please sign one of the contributor license agreements below.** 52. Fork the repo, develop and test your code changes, add docs. 63. Make sure that your commit messages clearly describe the changes. 74. Send a pull request. 8 9 10Here are some guidelines for hacking on google-cloud-java. 11 12Repository Structure 13-------------------- 14* `google-cloud-java` (`/pom.xml`) 15 * The root aggregator POM that lists all of the modules. 16 * Does not get released. 17* `google-cloud-pom-parent` 18 * Serves as the parent POM for the `gapic-libraries-bom` and module mini BOMs. 19 * Should not have any dependency management so as not to impact the BOMs. 20* `google-cloud-jar-parent` 21 * The root POM for all modules. 22 * The only POM where non-annotated versions should be managed using `dependencyManagement`. 23 * Contains common configuration for `jar` projects. 24* `generation` 25 * A collection of scripts that are used to make updates across modules. 26* `gapic-libraries-bom` 27 * A BOM for all non-preview libraries in the monorepo. 28* `java-*` 29 * Individual client libraries. 30 31Using maven for build/test 32-------------------------- 33 34To run the tests, you must have application default credentials in a JSON file on your development machine. 35[Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts) 36in the cloud console and download they key to a secure location on your development box. 37Then set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the location of the JSON file. 38For example: 39 40 ```bash 41 export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json 42 ``` 43 44After you clone the repository, use Maven for building and running the tests. 45 46Integration tests run tests against real services and take a long time to run. 47Consider `mvn install -DskipITs` to skip them when installing. 48Maven 3.0+ is required. 49 50It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere. 51To run tests on different platforms, try deploying the apps available on the [google-cloud-examples](https://github.com/googleapis/google-cloud-examples) repository. 52End-to-end tests should ensure that google-cloud-java works when running on the 53 54* App Engine production environment (see the docs for [uploading your app to production App Engine](https://cloud.google.com/appengine/docs/java/tools/maven#uploading_your_app_to_production_app_engine)) 55* App Engine development server (see the docs for [testing your app with the development server](https://cloud.google.com/appengine/docs/java/tools/maven#testing_your_app_with_the_development_server)) 56* Compute Engine (see the [Getting Started Guide](https://cloud.google.com/compute/docs/quickstart), and be sure to [enable the appropriate APIs](https://github.com/googleapis/google-cloud-common/tree/master/authentication#on-google-compute-engine)) 57* Your desktop (using `mvn exec:java`, for example) 58 59When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/googleapis/google-cloud-java#authentication) and [project ID docs](https://github.com/googleapis/google-cloud-java#specifying-a-project-id). 60 61Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated. 62 63**Please, do not use your production projects for executing integration tests.** While we do our best to make our tests independent of your project's state and content, they do perform create, modify and deletes, and you do not want to have your production data accidentally modified. 64 65Adding Features 66--------------- 67In order to add a feature to google-cloud-java: 68 69The feature must be fully documented using Javadoc and examples should be provided. 70The feature must work fully on Java 7 and above. 71The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, 72but new dependencies should be discussed). 73 74Adding Support for a New Service 75-------------------------------- 76See [SUPPORTING_NEW_SERVICES](./SUPPORTING_NEW_SERVICES.md) for guidelines on how to add support for a new Google Cloud service to `google-cloud-java`. 77 78Coding Style 79------------ 80Maintain the coding style in the project and in particular the modified files. 81Follow the Google Java [style](https://google.github.io/styleguide/javaguide.html). 82 83In pull requests, please run `mvn com.coveo:fmt-maven-plugin:format` to format your code diff. 84 85## Contributor License Agreements 86 87Before we can accept your pull requests you'll need to sign a Contributor 88License Agreement (CLA): 89 90- **If you are an individual writing original source code** and **you own the intellectual property**, 91then you'll need to sign an [individual CLA][indvcla]. 92- **If you work for a company that wants to allow you to contribute your work**, 93then you'll need to sign a [corporate CLA][corpcla]. 94 95You can sign these electronically (just scroll to the bottom). After that, 96we'll be able to accept your pull requests. 97 98## Code of Conduct 99 100Please 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] for more information. 101 102[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/ 103[indvcla]: https://developers.google.com/open-source/cla/individual 104[corpcla]: https://developers.google.com/open-source/cla/corporate 105[code-of-conduct]:https://github.com/googleapis/google-cloud-java/blob/master/CODE_OF_CONDUCT.md 106