Skip to content

Commit

Permalink
Adds CI test for mvn dependency:analyze and fixes missing deps (#738)
Browse files Browse the repository at this point in the history
* Add Kokoro CI config for testing for dependency declarations

* Fix missing and unused dependencies

* Fix used dependency which is only used for javadocs

* Ignore appengine-api-stubs test dependency
  • Loading branch information
chingor13 authored Jul 8, 2019
1 parent 5e191de commit c8326bf
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 29 deletions.
27 changes: 27 additions & 0 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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

cd github/google-http-java-client/

# Print out Java
java -version
echo $JOB_TYPE

export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

mvn install -DskipTests=true -B -V
mvn -B dependency:analyze -DfailOnWarning=true
12 changes: 12 additions & 0 deletions .kokoro/presubmit/dependencies.cfg
Original file line number Diff line number Diff line change
@@ -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-http-java-client/.kokoro/dependencies.sh"
}
13 changes: 3 additions & 10 deletions google-http-client-apache-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<configuration>
<links>
<link>https://download.oracle.com/javase/7/docs/api/</link>
<link>https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down Expand Up @@ -87,24 +86,18 @@
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand Down
13 changes: 8 additions & 5 deletions google-http-client-appengine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
</signature>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<!-- This artifact is needed by appengine-testing, but is not declared as a dependency -->
<ignoredUnusedDeclaredDependencies>com.google.appengine:appengine-api-stubs</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down Expand Up @@ -80,10 +88,5 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
21 changes: 17 additions & 4 deletions google-http-client-findbugs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<!-- This is needed for Javadoc linking, but is not used in the compiled bytecode -->
<ignoredUnusedDeclaredDependencies>com.google.http-client:google-http-client</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
Expand All @@ -58,5 +62,14 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>bcel-findbugs</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</dependency>
</dependencies>
</project>
5 changes: 0 additions & 5 deletions google-http-client-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@
<artifactId>google-http-client-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions google-http-client-jackson2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@
<artifactId>google-http-client-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions google-http-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@
<artifactId>httpclient</artifactId>
<version>${project.httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${project.httpcore.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -357,6 +362,11 @@
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -552,6 +562,7 @@
<project.xpp3.version>1.1.4c</project.xpp3.version>
<project.commons-logging.version>1.2</project.commons-logging.version>
<project.httpclient.version>4.5.9</project.httpclient.version>
<project.httpcore.version>4.4.11</project.httpcore.version>
<project.opencensus.version>0.21.0</project.opencensus.version>
<project.root-directory>..</project.root-directory>
<deploy.autorelease>false</deploy.autorelease>
Expand Down

0 comments on commit c8326bf

Please sign in to comment.