Skip to content

Commit 69fd4fd

Browse files
committed
Merge pull request GoogleCloudPlatform#88 from GoogleCloudPlatform/tswast-update-java-repo-tools
update java repo tools
2 parents 57ab41a + 85f6a77 commit 69fd4fd

File tree

7 files changed

+113
-55
lines changed

7 files changed

+113
-55
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jdk:
1717
- oraclejdk8
1818
script: mvn --batch-mode clean verify | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
1919
after_success:
20-
- mvn clean cobertura:cobertura coveralls:report
20+
- bash <(curl -s https://codecov.io/bash)
2121
branches:
2222
only:
2323
- master

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Getting started on Google Cloud Platform for Java®
22

3+
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/getting-started-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/getting-started-java)
4+
[![Coverage Status](https://codecov.io/gh/GoogleCloudPlatform/getting-started-java/branch/master/graph/badge.svg)](https://codecov.io/gh/GoogleCloudPlatform/getting-started-java)
5+
36
The code for the samples is contained in individual folders on this repository.
47
Follow the instructions at [Getting Started on Google Cloud Platform for Java](https://cloud.google.com/java/) or the README files in each folder for instructions on how to run locally and deploy.
58

codecov.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
codecov:
15+
branch: master
16+
17+
comment:
18+
branches:
19+
- master

java-repo-tools/README.md

+14-26
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,21 @@ git remote add java-repo-tools [email protected]:GoogleCloudPlatform/java-repo-tool
2727
git fetch java-repo-tools master
2828
```
2929

30-
To make it easier to push changes back upstream, create a new branch.
31-
32-
```
33-
git checkout -b java-repo-tools java-repo-tools/master
34-
```
35-
3630
We can then go back to the `my-java-samples` code and prepare a Pull Request to
37-
add the `java-repo-tools` code in a subtree.
38-
39-
```
40-
git checkout master
41-
# Making a new branch ia optional, but recommended to send a pull request to
42-
# start using java-repo-tools.
43-
git checkout -b use-java-repo-tools
44-
```
45-
46-
So that we can pull future updates from the `java-repo-tools` repository, we
47-
merge histories. This way we won't get unnecessary conflicts when pulling changes
48-
in.
31+
add the `java-repo-tools` code in a subtree. Making a new branch is optional, but
32+
recommended so that you can more easily send a pull request to start using
33+
`java-repo-tools`.
4934

5035
```
51-
git merge -s ours --no-commit java-repo-tools/master
36+
git checkout -b use-java-repo-tools origin/master
5237
```
5338

54-
Finally, read the `java-repo-tools` into a subtree.
39+
Finally, read the `java-repo-tools` into a subtree. So that you can pull future
40+
updates from the `java-repo-tools` repository, this command will merge histories.
41+
This way prevents unnecessary conflicts when pulling changes in.
5542

5643
```
57-
git read-tree --prefix=java-repo-tools/ -u java-repo-tools
44+
git subtree add --prefix=java-repo-tools java-repo-tools master
5845
```
5946

6047
Now all the content of `java-repo-tools` will be in the `java-repo-tools/`
@@ -143,13 +130,14 @@ Pull Request as you would in the normal flow.
143130
What if you make changes in your repository and now want to push them upstream?
144131

145132
Assuming you just commited changes in the `java-repo-tools/` directory of your
146-
`my-main-branch`, to merge the changes into the local `java-repo-tools` branch,
147-
we need to cherry pick this commit using the subtree strategy. It will ignore
148-
any changes to file not in the `java-repo-tools/` directory.
133+
`my-main-branch`, to split the `java-repo-tools` changes into their own branch.
134+
The first time using the `subtree` command, we may need to use the `--rejoin`
135+
argument.
149136

150137
```
151-
git checkout java-repo-tools
152-
git cherry-pick -x --strategy=subtree my-main-branch
138+
git subtree split --prefix=java-repo-tools -b java-repo-tools-update-from-java-docs-samples
139+
git checkout java-repo-tools-update-from-java-docs-samples
140+
git push java-repo-tools java-repo-tools-update-from-java-docs-samples
153141
```
154142

155143
After you have committed all the changes you want to your `java-repo-tools`

java-repo-tools/google-checks.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@
121121
value="Member name ''{0}'' must match pattern ''{1}''."/>
122122
</module>
123123
<module name="ParameterName">
124-
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
124+
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
125125
<message key="name.invalidPattern"
126126
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
127127
</module>
128128
<module name="LocalVariableName">
129129
<property name="tokens" value="VARIABLE_DEF"/>
130-
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
130+
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
131131
<property name="allowOneCharVarInForLoop" value="true"/>
132132
<message key="name.invalidPattern"
133133
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
@@ -213,8 +213,11 @@
213213
<module name="EmptyCatchBlock">
214214
<property name="exceptionVariableName" value="expected"/>
215215
</module>
216+
<module name="FileContentsHolder"/>
216217
</module>
217218

218219
<!-- Allow silencing rules with annotations http://stackoverflow.com/a/22556386/101923 -->
219220
<module name="SuppressWarningsFilter" />
221+
<!-- Allow silencing with comment http://stackoverflow.com/questions/4023185 -->
222+
<module name="SuppressionCommentFilter" />
220223
</module>

java-repo-tools/pom.xml

+19-26
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,25 @@ limitations under the License.
7575
<execution><goals><goal>check</goal></goals></execution>
7676
</executions>
7777
</plugin>
78-
<plugin>
79-
<groupId>org.eluder.coveralls</groupId>
80-
<artifactId>coveralls-maven-plugin</artifactId>
81-
<version>3.1.0</version>
82-
<configuration>
83-
<coberturaReports>
84-
<coberturaReport>${basedir}/target/coverage.xml</coberturaReport>
85-
</coberturaReports>
86-
</configuration>
87-
</plugin>
88-
<plugin>
89-
<groupId>org.codehaus.mojo</groupId>
90-
<artifactId>cobertura-maven-plugin</artifactId>
91-
<version>2.6</version>
92-
<configuration>
93-
<outputDirectory>${basedir}/target</outputDirectory>
94-
<formats>
95-
<format>xml</format>
96-
<format>html</format>
97-
</formats>
98-
<format>xml</format>
99-
<maxmem>256m</maxmem>
100-
<!-- aggregated reports for multi-module projects -->
101-
<aggregate>true</aggregate>
102-
</configuration>
103-
</plugin>
78+
<plugin>
79+
<groupId>org.jacoco</groupId>
80+
<artifactId>jacoco-maven-plugin</artifactId>
81+
<version>0.7.6.201602180812</version>
82+
<executions>
83+
<execution>
84+
<goals>
85+
<goal>prepare-agent</goal>
86+
</goals>
87+
</execution>
88+
<execution>
89+
<id>report</id>
90+
<phase>test</phase>
91+
<goals>
92+
<goal>report</goal>
93+
</goals>
94+
</execution>
95+
</executions>
96+
</plugin>
10497
</plugins>
10598
</build>
10699
</project>

java-repo-tools/test-devserver.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2016 Google Inc. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Usage:
17+
# test-devserver.sh path/to/project
18+
#
19+
# This script runs the local appengine:devserver Maven plugin and verifies that
20+
# a request to http://localhost:8080/ does not return an error code.
21+
#
22+
# As an example, this is useful for verifying that datastore-indexes.xml is
23+
# correct (only if autoGenerate=false and the / handler does all queries used),
24+
# as an example.
25+
26+
set -e
27+
set -x
28+
29+
if [ -z "$1" ]; then
30+
echo "Missing directory parameter."
31+
echo "Usage:"
32+
echo " $0 path/to/project"
33+
exit 1
34+
fi
35+
36+
(
37+
cd "$1"
38+
expect -c '
39+
spawn mvn --batch-mode clean appengine:devserver -DskipTests
40+
set timeout 600
41+
expect localhost:8080
42+
sleep 10
43+
spawn curl --silent --output /dev/stderr --write-out "%{http_code}" http://localhost:8080/
44+
expect {
45+
"200" {
46+
exit
47+
}
48+
}
49+
exit 1
50+
'
51+
)
52+

0 commit comments

Comments
 (0)