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/synth.py b/.github/.OwlBot.yaml similarity index 64% rename from synth.py rename to .github/.OwlBot.yaml index cb1a283f1..8c5f03b4d 100644 --- a/synth.py +++ b/.github/.OwlBot.yaml @@ -1,4 +1,4 @@ -# Copyright 2019 Google LLC +# 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. @@ -11,14 +11,6 @@ # 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 is used to synthesize generated parts of this library.""" -import synthtool.languages.java as java - -java.common_templates(excludes=[ - "README.md", - "java.header", - "checkstyle.xml", - "license-checks.xml", - ".github/workflows/samples.yaml", -]) +docker: + image: "gcr.io/repo-automation-bots/owlbot-java:latest" diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 2176b0543..1a23ea42b 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -1,5 +1,5 @@ # Configuration for the Blunderbuss GitHub app. For more info see -# https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss assign_prs_by: - labels: - samples diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2425d7234..3becb5c02 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,7 @@ on: push: branches: - - main + - master pull_request: name: ci jobs: @@ -9,15 +9,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11, 17] + java: [8, 11] steps: - uses: actions/checkout@v2 - uses: stCarolas/setup-maven@v4 with: maven-version: 3.8.1 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v1 with: - distribution: zulu java-version: ${{matrix.java}} - run: java -version - run: .kokoro/build.sh @@ -30,9 +29,8 @@ jobs: - uses: stCarolas/setup-maven@v4 with: maven-version: 3.8.1 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v1 with: - distribution: zulu java-version: 8 - run: java -version - run: .kokoro/build.bat @@ -42,15 +40,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11, 17] + java: [8, 11] steps: - uses: actions/checkout@v2 - uses: stCarolas/setup-maven@v4 with: maven-version: 3.8.1 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v1 with: - distribution: zulu java-version: ${{matrix.java}} - run: java -version - run: .kokoro/dependencies.sh @@ -61,9 +58,8 @@ jobs: - uses: stCarolas/setup-maven@v4 with: maven-version: 3.8.1 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v1 with: - distribution: zulu java-version: 8 - run: java -version - run: .kokoro/build.sh @@ -76,9 +72,8 @@ jobs: - uses: stCarolas/setup-maven@v4 with: maven-version: 3.8.1 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v1 with: - distribution: zulu java-version: 8 - run: java -version - run: .kokoro/build.sh diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 9a5105d7e..9030ba8f9 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -28,28 +28,7 @@ source ${scriptDir}/common.sh java -version echo $JOB_TYPE -function determineMavenOpts() { - local javaVersion=$( - # filter down to the version line, then pull out the version between quotes, - # then trim the version number down to its minimal number (removing any - # update or suffix number). - java -version 2>&1 | grep "version" \ - | sed -E 's/^.*"(.*?)".*$/\1/g' \ - | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' - ) - - case $javaVersion in - "17") - # MaxPermSize is no longer supported as of jdk 17 - echo -n "-Xmx1024m" - ;; - *) - echo -n "-Xmx1024m -XX:MaxPermSize=128m" - ;; - esac -} - -export MAVEN_OPTS=$(determineMavenOpts) +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" # this should run maven enforcer retry_with_backoff 3 10 \ diff --git a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactoryTest.java b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactoryTest.java index 9357ffdd0..0665acc2a 100644 --- a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactoryTest.java +++ b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactoryTest.java @@ -15,7 +15,6 @@ import com.google.api.client.json.JsonFactory; import com.google.api.client.test.json.AbstractJsonFactoryTest; - import java.util.ArrayList; /** @@ -24,16 +23,31 @@ * @author Yaniv Inbar */ public class AndroidJsonFactoryTest extends AbstractJsonFactoryTest { - + private static final String GSON_LINE_SEPARATOR = "\n"; private static final String JSON_ENTRY_PRETTY = "{" + GSON_LINE_SEPARATOR + " \"title\": \"foo\"" + GSON_LINE_SEPARATOR + "}"; - private static final String JSON_FEED_PRETTY = "{" + GSON_LINE_SEPARATOR + " \"entries\": [" - + GSON_LINE_SEPARATOR + " {" + GSON_LINE_SEPARATOR + " \"title\": \"foo\"" - + GSON_LINE_SEPARATOR + " }," + GSON_LINE_SEPARATOR + " {" - + GSON_LINE_SEPARATOR + " \"title\": \"bar\"" + GSON_LINE_SEPARATOR + " }" - + GSON_LINE_SEPARATOR + " ]" + GSON_LINE_SEPARATOR + "}"; + private static final String JSON_FEED_PRETTY = + "{" + + GSON_LINE_SEPARATOR + + " \"entries\": [" + + GSON_LINE_SEPARATOR + + " {" + + GSON_LINE_SEPARATOR + + " \"title\": \"foo\"" + + GSON_LINE_SEPARATOR + + " }," + + GSON_LINE_SEPARATOR + + " {" + + GSON_LINE_SEPARATOR + + " \"title\": \"bar\"" + + GSON_LINE_SEPARATOR + + " }" + + GSON_LINE_SEPARATOR + + " ]" + + GSON_LINE_SEPARATOR + + "}"; public AndroidJsonFactoryTest(String name) { super(name); @@ -61,5 +75,4 @@ public final void testToPrettyString_Feed() throws Exception { feed.entries.add(entryBar); assertEquals(JSON_FEED_PRETTY, newFactory().toPrettyString(feed)); } - } diff --git a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/FakeTest.java b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/FakeTest.java index 755613857..e917e114b 100644 --- a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/FakeTest.java +++ b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/FakeTest.java @@ -26,6 +26,5 @@ public FakeTest(String name) { super(name); } - public final void test() throws Exception { - } + public final void test() throws Exception {} } diff --git a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/package-info.java b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/package-info.java index 8fdf668d9..7ecefd770 100644 --- a/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/package-info.java +++ b/google-http-client-android-test/src/main/java/com/google/api/client/extensions/android/json/package-info.java @@ -17,6 +17,4 @@ * * @author Yaniv Inbar */ - package com.google.api.client.extensions.android.json; - diff --git a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/BetaClass.java b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/BetaClass.java index bd2ddb50e..13ed288cc 100644 --- a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/BetaClass.java +++ b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/BetaClass.java @@ -20,8 +20,7 @@ @Beta public class BetaClass { - public void method() { - } + public void method() {} @Beta public void betaMethod() { @@ -36,8 +35,7 @@ public BetaClass() { int field; - @Beta - int betaField; + @Beta int betaField; @Override public String toString() { diff --git a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaField.java b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaField.java index ea1c5315c..4ceb1cb17 100644 --- a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaField.java +++ b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaField.java @@ -19,12 +19,10 @@ /** A class which contains {@link Beta} fields. */ public class ClassWithBetaField { - @Beta - public int betaField; + @Beta public int betaField; public int field; - @Beta - public static final int betaStaticField = 10; + @Beta public static final int betaStaticField = 10; public static final int staticField = 20; public ClassWithBetaField() { diff --git a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaMethod.java b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaMethod.java index 85082217b..3c80ee4be 100644 --- a/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaMethod.java +++ b/google-http-client-findbugs/google-http-client-findbugs-test/src/main/java/com/google/api/client/findbugs/test/ClassWithBetaMethod.java @@ -19,8 +19,7 @@ /** A class which contains {@link Beta} methods. */ public class ClassWithBetaMethod { - @Beta - int betaField = 10; + @Beta int betaField = 10; @Beta public void betaMethod() { diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 000000000..8a64e3837 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,32 @@ +# 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 +# +# 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. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates( + excludes=[ + "README.md", + "java.header", + "checkstyle.xml", + "license-checks.xml", + ".github/workflows/samples.yaml", + ] +) diff --git a/renovate.json b/renovate.json index 93a8a717a..eeedeff5f 100644 --- a/renovate.json +++ b/renovate.json @@ -70,5 +70,8 @@ } ], "semanticCommits": true, - "dependencyDashboard": true + "dependencyDashboard": true, + "dependencyDashboardLabels": [ + "type: process" + ] } diff --git a/samples/snippets/src/main/java/com/example/json/YouTubeSample.java b/samples/snippets/src/main/java/com/example/json/YouTubeSample.java index aad2b8a99..56107f943 100644 --- a/samples/snippets/src/main/java/com/example/json/YouTubeSample.java +++ b/samples/snippets/src/main/java/com/example/json/YouTubeSample.java @@ -18,7 +18,6 @@ import com.google.api.client.http.HttpResponse; import com.google.api.client.util.Key; - import java.io.IOException; import java.util.List; import java.util.Map; @@ -28,8 +27,7 @@ public static class ListResponse { @Key("items") private List searchResults; - @Key - private PageInfo pageInfo; + @Key private PageInfo pageInfo; public List getSearchResults() { return searchResults; @@ -41,11 +39,9 @@ public PageInfo getPageInfo() { } public static class PageInfo { - @Key - private long totalResults; + @Key private long totalResults; - @Key - private long resultsPerPage; + @Key private long resultsPerPage; public long getTotalResults() { return totalResults; @@ -57,14 +53,12 @@ public long getResultsPerPage() { } public static class SearchResult { - @Key - private String kind; + @Key private String kind; @Key("id") private VideoId videoId; - @Key - private Snippet snippet; + @Key private Snippet snippet; public String getKind() { return kind; @@ -80,11 +74,9 @@ public Snippet getSnippet() { } public static class VideoId { - @Key - private String kind; + @Key private String kind; - @Key - private String videoId; + @Key private String videoId; public String getKind() { return kind; @@ -96,20 +88,15 @@ public String getVideoId() { } public static class Snippet { - @Key - private String publishedAt; + @Key private String publishedAt; - @Key - private String channelId; + @Key private String channelId; - @Key - private String title; + @Key private String title; - @Key - private String description; + @Key private String description; - @Key - private Map thumbnails; + @Key private Map thumbnails; public String getPublishedAt() { return publishedAt; @@ -133,14 +120,11 @@ public Map getThumbnails() { } public static class Thumbnail { - @Key - private String url; + @Key private String url; - @Key - private long width; + @Key private long width; - @Key - private long height; + @Key private long height; public String getUrl() { return url; @@ -171,5 +155,4 @@ public static ListResponse parseJson(HttpResponse httpResponse) throws IOExcepti } return listResponse; } - -} \ No newline at end of file +} diff --git a/samples/snippets/src/test/java/com/example/json/YouTubeSampleTest.java b/samples/snippets/src/test/java/com/example/json/YouTubeSampleTest.java index 8454437f5..92ed5ab3a 100644 --- a/samples/snippets/src/test/java/com/example/json/YouTubeSampleTest.java +++ b/samples/snippets/src/test/java/com/example/json/YouTubeSampleTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import org.junit.Test; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; @@ -36,12 +32,17 @@ import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.common.base.Preconditions; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; +import org.junit.Test; public class YouTubeSampleTest { @Test public void testParsing() throws IOException { - final InputStream contents = getClass().getClassLoader().getResourceAsStream("youtube-search.json"); + final InputStream contents = + getClass().getClassLoader().getResourceAsStream("youtube-search.json"); Preconditions.checkNotNull(contents); HttpTransport transport = new MockHttpTransport() { @@ -91,4 +92,4 @@ public LowLevelHttpResponse execute() throws IOException { } } } -} \ No newline at end of file +}