Giter VIP home page Giter VIP logo

cloud-opensource-java's Introduction

unstable

This project explores common infrastructure and best practices for open source Java projects for the Google Cloud Platform (GCP).

Google Cloud Platform Java Dependency Dashboard

Google Cloud Platform Java Dependency Dashboard (runs daily; work in progress) shows multiple checks on the consistency among Google Cloud Java libraries. For manually generating the dashboard, see its README.

Google Best Practices for Java Libraries

Google Best Practices for Java Libraries are rules that minimize problems for consumers of interconnected Java libraries.

Linkage Checker

Linkage Checker Maven Enforcer Rule

Linkage Checker Enforcer Rule detects linkage errors in the current Maven project as part of build.

For its usage, see the enforcer rule documentation.

Linkage Checker Gradle Plugin

Linkage Checker Gradle Plugin provides the linkageCheck task that detects linkage errors in the current Gradle project.

For its usage, see the plugin documentation.

GCP Libraries BOM

The GCP Libraries BOM is a Bill-of-Materials (BOM) that provides consistent versions of Google Cloud Java libraries that work together without linkage errors.

Development

This project is built using Maven.

Requirements

  1. Maven 3.6.0 or later.

  2. JDK 8 or 11.

  3. git

  4. Clone the project to a local directory using git clone [email protected]:GoogleCloudPlatform/cloud-opensource-java.git.

Disclaimer

This is not an officially supported Google product.

cloud-opensource-java's People

Contributors

arunsathiya avatar blakeli0 avatar burkedavison avatar chanseokoh avatar chingor13 avatar dependabot[bot] avatar donhui avatar dzou avatar elefeint avatar elharo avatar garrettjonesgoogle avatar ian-lavallee avatar iruizm avatar lqiu96 avatar meltsufin avatar mpeddada1 avatar netdpb avatar pongad avatar renovate-bot avatar slachiewicz avatar stephenc avatar suztomo avatar vhrankina avatar zhumin8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-opensource-java's Issues

not picking up all deps

seems to be a bug in the last PR or 2 such that we're no longer picking up the managed deps:

$ ls /Users/elharo/cloud-opensource-java/target/dashboard
com.google.cloud_cloud-oss-bom_0.62.0-SNAPSHOT.html
dashboard.html

First Order BOM

Machine consumable file (likely Maven pom.xml) listing:

The immediate direct dependencies and versions of the libraries listed in #16

Test to verify this.

create Buganizer hotlist for upgrading/converging GCJ dependency versions

As a first step we can put this on the dashboard. In particular:

  1. Create a master list of all the dependency upgrade paths across all the libraries.
  2. Remove duplicates.
  3. Filter out any upgrades made moot by other upgrades.
  4. Possibly make sure dependencies on other things in the BOM are at BOM version.

Maybe even as a first pass do direct dependencies only with a require upper bounds type check across the whole BOM tree (minus testlibs).

Put it all on the dashboard.

General Tool for printing dependency tree

That is, something much like mvn dependency:tree except:

  1. Project may not be checked out or have source code available.
  2. Project may be built with gradle, ant, or bazel instead of maven.

That is, reads metadata from central repo instead of local filesystem.

172 managed dependencies is too many

Our code reports that com.google.cloud:google-cloud-bom:0.61.0-alpha has 172 managed dependencies:

  @Test
  public void tesReadBom() throws ArtifactDescriptorException {
    Artifact artifact = new DefaultArtifact("com.google.cloud:google-cloud-bom:0.61.0-alpha");
    List<Artifact> managedDependencies = RepositoryUtility.readBom(artifact);
    // Characterization test. As long as the artifact doesn't change (and it shouldn't)
    // the answer won't change.
    Assert.assertEquals(172, managedDependencies.size());
  }

I don't buy it. That's far too many. Most likely there's something we don't understand here. I'm not sure where the misunderstanding lies: in how a managedDependencies section is interpreted in Maven pom.xml? What Aether's ArtifactDescriptorResult.getManagedDependencies() method is reporting? Something else?

There's something fishy here.

Dashboard error message

figure out why this happens:

First question: when does this happen? Is this the output of our app, or something that happens on writes to GCS, or on reads from GCS?

{"error":{"errors":[{"domain":"global","reason":"badLockedDomainRequest","message":"Bad Locked Domain Request","debugInfo":"Error extracting locked domain from query string\ncom.google.api.server.core.Fault: ImmutableErrorDefinition{base=BAD_LOCKED_DOMAIN_REQUEST, category=USER_ERROR, cause=null, debugInfo=Error extracting locked domain from query string, domain=global, extendedHelp=null, httpHeaders={}, httpStatus=badRequest, internalReason=Reason{arguments={}, cause=null, code=null, createdByBackend=false, debugMessage=null, errorProtoCode=null, errorProtoDomain=null, filteredMessage=null, location=null, message=null, unnamedArguments=[]}, location=null, message=Bad Locked Domain Request, reason=badLockedDomainRequest, rpcCode=400} Bad Locked Domain Request: Error extracting locked domain from query string\n\tat com.google.api.server.responsesafety.ApiRequestUriCrypter.getEncryptedApiRequest(ApiRequestUriCrypter.java:197)\n\tat com.google.api.server.responsesafety.ApiRequestUriCrypter.unlock(ApiRequestUriCrypter.java:107)\n\tat com.google.api.server.responsesafety.LockedStrategy.lockedDomainInterceptorRequest(LockedStrategy.java:81)\n\tat com.google.api.server.responsesafety.LockedDomainInterceptor.processRequest(LockedDomainInterceptor.java:59)\n\tat com.google.api.server.core.intercept.AroundInterceptorWrapper.processRequest(AroundInterceptorWrapper.java:20)\n\tat com.google.api.server.stats.StatsBootstrap$InterceptorStatsRecorder.processRequest(StatsBootstrap.java:278)\n\tat com.google.api.server.core.intercept.Interceptions$AroundInterception.processRequest(Interceptions.java:159)\n\tat com.google.api.server.core.intercept.Interceptions$AroundInterception.invoke(Interceptions.java:135)\n\tat com.google.api.server.media.AbstractMediaClosure.continueRequest(AbstractMediaClosure.java:64)\n\tat com.google.api.server.media.batch.BatchAgent.continueRequest(BatchAgent.java:141)\n\tat com.google.api.server.media.batch.BatchAgent.onRequestReceived(BatchAgent.java:74)\n\tat com.google.uploader.agent.ScottyBatchAgent$ServiceParameters$1.handleRequest(ScottyBatchAgent.java:418)\n\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.runRpcInApplication(RpcServerInternalContext.java:577)\n\tat com.google.net.rpc3.impl.server.RpcServerChannel$1.apply(RpcServerChannel.java:879)\n\tat com.google.net.rpc3.impl.server.RpcServerChannel$1.apply(RpcServerChannel.java:867)\n\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:240)\n\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:230)\n\tat com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:117)\n\tat com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:455)\n\tat com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:462)\n\tat com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:323)\n\tat com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:313)\n\tat com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:459)\n\tat com.google.common.util.concurrent.MoreExecutors$5$1.run(MoreExecutors.java:1056)\n\tat com.google.api.server.thread.ThreadTrackers$ThreadTrackingRunnable.run(ThreadTrackers.java:126)\n\tat com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:455)\n\tat com.google.api.server.server.CommonModule$ContextCarryingExecutorService$1.runInContext(CommonModule.java:846)\n\tat com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:462)\n\tat com.google.tracing.CurrentContext.runInContext(CurrentContext.java:320)\n\tat com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:321)\n\tat com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:313)\n\tat com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:459)\n\tat com.google.gse.internal.DispatchQueueImpl$WorkerThread.run(DispatchQueueImpl.java:403)\n"}],"code":400,"message":"Bad Locked Domain Request"}}

Useful plugins to consider

  • dependency:analyze
    • This can detect unused dependencies
  • versions
    • This can help find & update to the newest versions of dependencies
  • checkstyle
    • Help find banned imports
  • compatibility
    • Clirr
    • japi-compliance-checker

Second+ Order BOM

Machine consumable file (likely Maven pom.xml) listing:

The complete dependency list of the libraries in #17 along with their required versions.

Test to verify this.

Test artifacts exist

The BOM needs a test that all the artifacts referenced are in Maven Central.

Just realized I incorrectly hyphenated one. Found it in another test but there should be a direct test for this. The libraries.json tests in appengine-plugins-core have code like this.

Ordered list of necessary dependency updates

E..g com.google.foo needs to upgrade jsr305 to 3.0.2
...

start at the bottom of the dependency tree and work our way up.
How much of this can be farmed out?
Can this be autogenerated from the zeroth order dependency list?

This needs the zeroth order dependency list first.

see #30

Dashboard

  • build a test to check the status
  • find a way to actually display the status

Latest in dashboard

Consider whether we want to test the latest release in the dashboard or a specific version

See #37

Zeroth Order BOM

Machine consumable file (likely Maven pom.xml) listing:

All immediate libraries we commit to supporting along with versions that work together. E.g. most google-cloud-java libraries plus a few others that aren't yet pulled into google-cloud-java.

Should be in a new top-level directory.

Clarify JLBP-1 Scrutinize all dependency additions

I'm having trouble parsing this:

Scrutinize all dependency additions. Check the result of mvn dependency:tree (after running mvn install -DskipTests to build the library) to see which transitive dependencies are added by just adding a single dependency to your own library, and if you require all of the transitive dependencies

It's also unclear how exactly this applies to non-Maven projects. I think I get the intent, but let's take another pass at the language used to describe this.

Tool for generating list of needed dependency upgrades

E.g. start with beam; find the full transitive dependency graph; identify all dependencies with multiple versions; and identify the projects and artifacts that need to be updated to later versions.

Maybe even autogenerate PRs fr github.

Static Linkage Checker

We need a tool that can verify that a single artifact is linkage compatible. This should verify that all static references in a given classpath are valid. This is a necessary tool to verify that we're actually meeting the objective of not surfacing conflicts to users. (Verifying version agreement is not sufficient.)

The tool takes the Maven coordinates?/pom.xml file? as input. It resolves the dependency tree according to the usual Maven dependency mediation algorithm. Thus all artifacts are assigned specific versions. This is the runtime classpath. Then it checks this for linkage conflicts.

Linkage conflict: The signature of a non-private method or class in a dependency has changed in an incompatible way between the version supplied at compile time and the version invoked at runtime. For example, a public method may be removed from a class or a class may be made final. Linkage conflicts detected at runtime manifest as ReflectiveOperationException, NoClassDefFoundError, NoSuchFieldException, MethodNotFoundException, LinkageError, or other related exceptions.
Or, another perspective: In cases where binary compatibility and source compatibility are the same, a linkage conflict is when compilation would fail if the libraries in the classpath were all built together from their originating source code, or when reflection would fail.
Opposite: Linkage-compatible.
Sub-type: Static linkage conflict: A linkage conflict caused by a direct code reference (non-reflective).
Sub-type: Reflective linkage conflict: A linkage conflict caused by a reflective reference.

It runs through the classpath, finds every statically referenced class, interface, method, and field and verifies the signatures match up. E.g. no signature has changed or been removed in an incompatible way in the specific version found in the classpath.

We are not considering access via reflection.

Implementation: maven plugin? main() method? dashboard report? all of this?

Start with a one page design doc?

How does this differ from simple compilation checking?
Are these errors common in practice?

@garrettjonesgoogle Can you flesh this issue out a bit?

Experiment with dirty trees

Per https://maven.apache.org/resolver/apidocs/org/eclipse/aether/util/graph/transformer/ConflictResolver.html and https://github.com/apache/maven-resolver/blob/84a32a866ff27d4df75124074fd925588f4a574d/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java

it may be possible to have Maven retain conflicting dependencies like so:

    // uncomment to generate dirty trees
    // session.setDependencyGraphTransformer( null );

This might be faster than what we're doing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.