Skip to content

Commit

Permalink
Finish GH-3
Browse files Browse the repository at this point in the history
  • Loading branch information
lex-em committed Feb 19, 2019
2 parents 43feec1 + 9890750 commit 41254cd
Show file tree
Hide file tree
Showing 21 changed files with 361 additions and 209 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: java
install: true
script: gradle build --continue
jdk:
- oraclejdk8
script: ./gradlew build --continue
before_install:
- chmod u+x gradlew
before_deploy:
- gradle generatePomFileForMavenPublication
- ./gradlew generatePomFileForMavenPublication
deploy:
key:
secure: Koqvbo26cGgG5QHR9zSGojtvkVtRMxkd3rTejEyWHXnmjbDAnWVLeJf81pz6Vn2lrHbZkCHx+Ec4t3Cptq+v5fXlrgKtjYUORirMK4KWKT0ZLwE41oFo37Y8YVtRLlUiIk7BIteUbY6+p9HTlcQE60TCo9DugVX6Kn8c5tvBtukjckq3uL2/K+IIhtVbHCL6IEMKlQ0O0Wzvhe2m2qTIhAyCjnHgrTM9TxWYqxU5K0ShpL/OgySzXPcJPxy49jPDjp1FmtiMU/Lu5L7l1pzJ8vfWay7rfwJuu0VOy4cCno+8NFNEz5To08eDSIMsHovyqD7CnWkOOeEp9Vkd+D/Td1m2+7xX4UO1HqPmoTaSi2JrBo6FLDdfW+MWd5QGFsSP66hRSaEVV6AicgC1qreFqQQJKxl7XeLlXBt/HCN3qMhh0mKWggN76gnVV9yQY3n1QmtxLR3xgn8DC4xcAepYiDyUsxibVk1k5q1YHmGTpn2AfkrxhB5Dw97f/T8FrG2iO32NopieiugKh7Ln60TEsgDzsscyVic9OGEhQpCHVBI34jSO+/alh8ui+ULcNpreltJNk+tQAGejvMqDTEcYpAXKcuij2CzlFGchnBXnVnJquXP9i/s0s8k/VxARlrY8zUy2AM2lOq0LjNCEPm1whstv2lM2WmUi8mUwdzCFngI=
Expand Down
69 changes: 32 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import java.time.LocalDate
import java.time.format.DateTimeFormatter

buildscript {
Expand All @@ -16,62 +17,58 @@ apply plugin: 'maven-publish'

// project properties
group 'ru.reliabletech'
def artifact = 'zuul-springfox-swagger'
def libName = 'zuul-springfox-swagger'
version '0.1.2-SNAPSHOT'
sourceCompatibility = 1.8
def currentDate = java.time.LocalDate.now().format(DateTimeFormatter.ISO_DATE)
def currentDate = LocalDate.now().format(DateTimeFormatter.ISO_DATE)

//tasks
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
}

task expandDescriptor(type: Copy) {
from 'descriptor.json'
into 'build'
expand(version: project.version, date: currentDate)
}

build.dependsOn expandDescriptor
compileJava.dependsOn(processResources)

// plugin settings
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
groupId project.group
artifactId artifact
artifactId libName
version project.version
}
}
}

model {
tasks.generatePomFileForMavenPublication {
destination = file("$buildDir/libs/$artifact-${version}.pom")
}
}
}

jar {
manifest {
attributes(
"Group": group,
"Artifact-Id": artifact,
"Artifact-Id": libName,
"Version": version,
"Source-Compatibility": sourceCompatibility,
"Build-Time": currentDate
)
}
}

//tasks
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
}

task expandDescriptor(type: Copy) {
from 'descriptor.json'
into 'build'
expand(version: project.version, date: currentDate)
}

build.dependsOn expandDescriptor
compileJava.dependsOn(processResources)

//dependency management
def springCloudVersion = 'Dalston.SR3'
def springCloudVersion = 'Finchley.SR1'

dependencyManagement {
imports {
Expand All @@ -84,13 +81,11 @@ repositories {
}

dependencies {
compile 'org.springframework.cloud:spring-cloud-starter-eureka'
compile 'org.springframework.cloud:spring-cloud-starter-zuul'
compile 'org.projectlombok:lombok:1.16.18'
compile 'io.springfox:springfox-swagger2:2.7.0'
compileOnly 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
compileOnly 'org.springframework.cloud:spring-cloud-starter-netflix-zuul'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
implementation 'org.projectlombok:lombok:1.18.4'
compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'io.springfox.ui:springfox-swagger-ui-rfc6570:1.0.0'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor:1.5.9.RELEASE'
}
task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
}
3 changes: 2 additions & 1 deletion descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"gpgSign": false
},
"files":[
{"includePattern": "build/libs/(.*)", "uploadPattern": "ru/reliabletech/zuul-springfox-swagger/${version}/\$1"}
{"includePattern": "build/libs/(.*)", "uploadPattern": "ru/reliabletech/zuul-springfox-swagger/${version}/\$1"},
{"includePattern": "build/publications/maven/pom-default.xml", "uploadPattern": "ru/reliabletech/zuul-springfox-swagger/${version}/pom-${version}.xml"}
],
"publish": true
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import org.springframework.context.annotation.Import;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;

/**
* Enabling ZuulSpringfoxSwaggerPlugin annotation.
*
* @author Alexandr Emelyanov <[email protected]>
* on 27.11.2017.
*/
Expand Down

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/ru/reliabletech/zuul/swagger/ServiceInfo.java

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/java/ru/reliabletech/zuul/swagger/SwaggerService.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
package ru.reliabletech.zuul.swagger;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.zuul.filters.discovery.ServiceRouteMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import ru.reliabletech.zuul.swagger.props.ServicesSwaggerInfo;
import ru.reliabletech.zuul.swagger.service.GenericRouteService;
import ru.reliabletech.zuul.swagger.service.RouteService;
import ru.reliabletech.zuul.swagger.service.ServiceRouteMapperRouteService;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
* Main configuration for ZuulSpringfoxPlugin
*
* @author Alexandr Emelyanov <[email protected]>
* on 27.11.2017.
*/
@Configuration
@ComponentScan(basePackageClasses = ZuulSpringfoxSwaggerConfiguration.class)
@EnableConfigurationProperties(ServicesSwaggerInfo.class)
public class ZuulSpringfoxSwaggerConfiguration {
Expand All @@ -28,4 +38,25 @@ public RestTemplate restTemplate() {
return new RestTemplate();
}

/**
* Configure automatically {@link ServiceRouteMapper } based {@link RouteService }
*
* @return
*/
@Bean
@ConditionalOnBean(ServiceRouteMapper.class)
public RouteService versionedRouteService() {
return new ServiceRouteMapperRouteService();
}

/**
* Default {@link RouteService}
*
* @return
*/
@Bean
@ConditionalOnMissingBean(RouteService.class)
public RouteService genericRouteService() {
return new GenericRouteService();
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 41254cd

Please sign in to comment.