Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
add endpoints-framework-all uberjar artifact
Browse files Browse the repository at this point in the history
* endpoints-framework-all now has all transitive dependencies included
  in its JAR, repackaged to avoid dependency conflicts
* endpoints-framework-guice no longer has endpoints-framework as a
  dependency, so that one can use the artifact with endpoints-framework
  or endpoints-framework-all.
* endpoints-framework-guice has a small Preconditions class now so that
  it doesn't have to depend on Guava, which it previously was
  transitively.
* POM URLs have been fixed to be the correct address.
  • Loading branch information
tangiel committed Feb 13, 2017
1 parent 472085d commit e63c8a0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 7 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def configureMaven(project, projectName, projectDescription) {
url 'https://cloud.google.com/endpoints/docs/frameworks/java'

scm {
connection 'scm:git:https://github.com/cloudendpoints/endpoints-java-framework'
developerConnection 'scm:git:https://github.com/cloudendpoints/endpoints-java-framework'
url 'scm:git:https://github.com/cloudendpoints/endpoints-java-framework'
connection 'scm:git:https://github.com/cloudendpoints/endpoints-java'
developerConnection 'scm:git:https://github.com/cloudendpoints/endpoints-java'
url 'scm:git:https://github.com/cloudendpoints/endpoints-java'
}

licenses {
Expand Down
40 changes: 40 additions & 0 deletions endpoints-framework-all/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
plugins {
id 'com.github.johnrengelman.shadow' version '1.2.3'
}

configurations {
include
compile.extendsFrom include
}

jar {
from {
configurations.include.collect { it.isDirectory() ? it : zipTree(it) }
}
}

def repackagedDir = 'endpoints.repackaged'

shadowJar {
relocate 'org.apache', "${repackagedDir}.org.apache"
relocate 'org.yaml', "${repackagedDir}.org.yaml"
relocate 'org.joda', "${repackagedDir}.org.joda"
relocate 'com.fasterxml', "${repackagedDir}.com.fasterxml"
relocate 'io.swagger', "${repackagedDir}.io.swagger"
relocate 'com.google.common', "${repackagedDir}.com.google.common"
relocate 'com.google.api.client', "${repackagedDir}.com.google.api.client"
relocate 'org.slf4j', "${repackagedDir}.org.slf4j"

dependencies {
exclude(dependency('com.google.appengine:appengine-api-1.0-sdk:.*'))
exclude(dependency('javax.servlet:servlet-api:.*'))
}
}

dependencies {
include project(':endpoints-framework')
compile group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version: appengineVersion
compile group: 'javax.servlet', name: 'servlet-api', version: servletVersion
}

configureMaven(project, 'Endpoints Framework', 'A framework for building RESTful web APIs.')
2 changes: 1 addition & 1 deletion endpoints-framework-guice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ configureMaven(
'Extension to configure the Endpoints Framework via Guice.')

dependencies {
compile project(':endpoints-framework')
compileOnly project(':endpoints-framework')
compile group: 'com.google.inject', name: 'guice', version: guiceVersion
compile group: 'com.google.inject.extensions', name: 'guice-servlet', version: guiceVersion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.google.api.server.spi.guice;

import com.google.api.server.spi.EndpointsServlet;
import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.google.inject.Singleton;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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.
*/
package com.google.api.server.spi.guice;

/**
* Rather than shading all of Guava into an endpoints-framework-guice-all artifact, we include the
* necessary functionality in this small helper class to remove the dependency.
*/
final class Preconditions {
static <T> T checkNotNull(T ref, String errorMessage) {
if (ref == null) {
throw new NullPointerException(errorMessage);
}
return ref;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.google.api.server.spi.guice;

import com.google.common.base.Preconditions;
import com.google.inject.Binder;

import java.util.ArrayList;
Expand Down
1 change: 1 addition & 0 deletions endpoints-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@ dependencies {
testCompile group: 'org.springframework', name: 'spring-test', version: springtestVersion
testCompile group: 'com.google.guava', name: 'guava-testlib', version: guavaVersion
}

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':endpoints-framework', ':endpoints-framework-tools', ':endpoints-framework-guice', ':test-utils', ':discovery-client', ':test-compat', ':test-compat:legacy-app', ':test-compat:new-app', ':test-compat:new-app-guice'
include ':endpoints-framework', 'endpoints-framework-all', ':endpoints-framework-tools', ':endpoints-framework-guice', ':test-utils', ':discovery-client', ':test-compat', ':test-compat:legacy-app', ':test-compat:new-app', ':test-compat:new-app-guice'

0 comments on commit e63c8a0

Please sign in to comment.