Skip to content

Commit

Permalink
Merge pull request #2 from apache/master
Browse files Browse the repository at this point in the history
21212
  • Loading branch information
aswl8225 authored Dec 2, 2019
2 parents 56c3359 + a9746a0 commit 172b334
Show file tree
Hide file tree
Showing 1,343 changed files with 60,728 additions and 24,534 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target/
*.zip
*.tar
*.tar.gz
.flattened-pom.xml

# eclipse ignore
.settings/
Expand Down Expand Up @@ -35,3 +36,11 @@ Thumbs.db

# license check result
license-list

# grpc compiler
compiler/gradle.properties
compiler/build/*
compiler/.gradle/*

# protobuf
dubbo-serialization/dubbo-serialization-protobuf/build/*
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ cache:
install: true

script:
- rm -rf $HOME/.m2/repository/org/glassfish/javax.el/3.0.1-b08
- travis_wait 30 ./mvnw --batch-mode --no-transfer-progress clean install -DskipTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true

after_success:
- bash <(curl -s https://codecov.io/bash)

after_failure:
- if [ -f dubbo.log ]; then echo "------TAIL of dubbo.log------"; tail -n 1000 dubbo.log; echo "------END of dubbo.log------"; fi
- echo "build failed!"
52 changes: 52 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
# Release Notes

## 2.7.4.1

### Enhancement

* Enhance ProtobufTypeBuilder support generate type definition which contains Bytes List or Bytes Map. #5083
* Using the ID of Dubbo Config as the alias of Bean. #5094
* tag router supports anyhost. #4431
* optimize generic invoke. #4076
* dubbo zookeeper registry too slow #4828
* use consul with group and version. #4755
* qos support host config. #4720
* migrate http protocol #4781
* Some unit test optimization. #5026 #4803 #4687

### Bugfixes

* Apollo namespace optimization. #5105
* Simplify dubbo-common transitive dependencies. #5107
* Delete 'config.' prefix for url generated from ConfigCenterConfig. #5001
* fix set generic method error. #5079
* Add support for overriding Map properties in AbstractConfig.refresh. #4882
* Fix travis javax.ex dependency issue. (unit test)
* Fix: ExtensionLoader load duplicate filter,no log or exception. #4340
* When the provider interrupts abnormally, the consumer cannot return quickly and still waits for the timeout to end. #4694
* Fix register config not take effect because of url simplified。 #4397
* Don't support metadata for generic service. #4641
* Avoid resize in ClassUtils.java. #5009
* default attribute in <dubbo:registry> doesn't work as expected. #4412
* make RegistryDirectory can refresh the invokers when providers number become 0 when using nacos registry. #4793
* Multiple @Reference annotations only have one effect #4674
* Fix RpcContext.getContext().getRemoteApplicationName() returns null #4351
* Security issue: upgrade fastjson version to 1.2.60. #5018
* nacos-registry:serviceName split error #4974
* AbstractConfig.java-getMetaData set default depend on getmethod sequence #4678
* fix protocol register set false not work. #4776
* Fix: In Rest protocol, the limitation of Dubbo-Attachments. #4898
* The logic of org.apache.dubbo.config.MonitorConfig#isValid is incorrect #4892
* protostuff return stackoverflow and other error msg #4861
* fix method parameter bean generation. #3796
* replace hardcode with regex pattern #4810
* Fix warm up issue when provider's timestamp is bigger than local machine's timestamp. #4870
* Fix use generic invocation via API , lost #4238 ion" value #4784
* In consumer side the app cannot catch the exception from provider that is configured serialization="kryo". #4238
* fix StringUtils#isBlank #4725
* when the interfaceName of the Reference annotation has duplicated,the exception is puzzled #4160
* when anonymity bean is defined in spirng context,dubbo throw npe #
* add Thread ContextClassLoader #4712
* Fix judgment ipv4 address #4729
* The compilation of static methods should be excluded when generating the proxy. #4647
* check EOF of inputstream in IOUtils.write #4648


## 2.7.3

### Change List
Expand Down
27 changes: 24 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,27 @@ This product contains a modified portion of 'Netty', an event-driven asynchronou

For the org.apache.dubbo.common.utils.CIDRUtils :

This product contains a modified portion of 'edazdarevic.commons.net.CIDRUtils',
under a "MIT License" license, see https://github.com/edazdarevic/CIDRUtils/blob/master/CIDRUtils.java

This product contains a modified portion of 'edazdarevic.commons.net.CIDRUtils' published at
https://github.com/edazdarevic/CIDRUtils. The project is licensed under a MIT License:
* The MIT License
*
* Copyright (c) 2013 Edin Dazdarevic ([email protected])
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.

This product contains a modified portion of 'proto-gen-grpc-java' - a protobuf plugin used to generate grpc-java stubs,
under a "Apache License 2.0" license, see https://github.com/grpc/grpc-java/blob/v1.22.1/NOTICE.txt. All files are placed
under '/dubbo/compiler'
10 changes: 10 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ Please visit the Netty web site for more information:
* http://netty.io/

Copyright 2014 The Netty Project


This product contains code for the gRPC Project:

The gRPC Project
=================
Please visit the gRPC web site for more information:
* http://grpc.io/

Copyright 2014 The gRPC Project
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ There's a [README](https://github.com/apache/dubbo-samples/tree/master/dubbo-sam

```xml
<properties>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.4.1</dubbo.version>
</properties>

<dependencies>
Expand All @@ -66,7 +66,7 @@ There's a [README](https://github.com/apache/dubbo-samples/tree/master/dubbo-sam
package org.apache.dubbo.samples.api;

public interface GreetingService {
String sayHello(String name);
String sayHi(String name);
}
```

Expand Down
Binary file added compiler/.gradle/4.3/fileChanges/last-build.bin
Binary file not shown.
Binary file not shown.
Binary file added compiler/.gradle/4.3/fileContent/fileContent.lock
Binary file not shown.
Binary file added compiler/.gradle/4.3/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added compiler/.gradle/4.3/fileHashes/fileHashes.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added compiler/.gradle/4.3/taskHistory/taskHistory.bin
Binary file not shown.
Binary file added compiler/.gradle/4.3/taskHistory/taskHistory.lock
Binary file not shown.
Binary file added compiler/.gradle/4.9/fileChanges/last-build.bin
Binary file not shown.
Binary file not shown.
Binary file added compiler/.gradle/4.9/fileContent/fileContent.lock
Binary file not shown.
Binary file not shown.
Binary file added compiler/.gradle/4.9/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added compiler/.gradle/4.9/fileHashes/fileHashes.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added compiler/.gradle/4.9/taskHistory/taskHistory.bin
Binary file not shown.
Binary file added compiler/.gradle/4.9/taskHistory/taskHistory.lock
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions compiler/.gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Tue Oct 09 11:40:48 CST 2018
gradle.version=4.9
Binary file not shown.
Empty file.
12 changes: 12 additions & 0 deletions compiler/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cc_binary(
name = "grpc_java_plugin",
srcs = [
"src/java_plugin/cpp/java_generator.cpp",
"src/java_plugin/cpp/java_generator.h",
"src/java_plugin/cpp/java_plugin.cpp",
],
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//:protoc_lib",
],
)
202 changes: 202 additions & 0 deletions compiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# Dubbo customized version

## Get Started, how to use
1. Add maven dependency to your project
```xml
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.1</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>org.apache.dubbo:protoc-gen-dubbo-java:${proto_dubbo_plugin_version}:exe:${os.detected.classifier}</pluginArtifact>
<outputDirectory>build/generated/source/proto/main/java</outputDirectory>
<clearOutputDirectory>false</clearOutputDirectory>
<!-- supports 'dubbo' and 'grpc' -->
<pluginParameter>dubbo</pluginParameter>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
<goal>test-compile</goal>
<goal>test-compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>build/generated/source/proto/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
```

2. Decide which protocol to use: Dubbo or gRPC
* Dubbo, ` <pluginParameter>dubbo</pluginParameter>`
* gRPC, ` <pluginParameter>grpc</pluginParameter>`

3. Define service using IDL
```text
syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.apache.dubbo.demo";
option java_outer_classname = "DemoServiceProto";
option objc_class_prefix = "DEMOSRV";
package demoservice;
// The demo service definition.
service DemoService {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
```

4. Build
mvn clean compile

## Customized

1. Dubbo Interface
```java
public interface IGreeter {

default public io.grpc.examples.helloworld.HelloReply sayHello(io.grpc.examples.helloworld.HelloRequest request) {
throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
}

default public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloReply> sayHelloAsync(
io.grpc.examples.helloworld.HelloRequest request) {
throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
}

public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply> responseObserver);

}
```

2. Dubbo Stub
```java
public static DubboGreeterStub getDubboStub(io.grpc.Channel channel) {
return new DubboGreeterStub(channel);
}

public static class DubboGreeterStub implements IGreeter {

private GreeterBlockingStub blockingStub;
private GreeterFutureStub futureStub;
private GreeterStub stub;

public DubboGreeterStub(io.grpc.Channel channel) {
blockingStub = GreeterGrpc.newBlockingStub(channel);
futureStub = GreeterGrpc.newFutureStub(channel);
stub = GreeterGrpc.newStub(channel);
}

public io.grpc.examples.helloworld.HelloReply sayHello(io.grpc.examples.helloworld.HelloRequest request) {
return blockingStub.sayHello(request);
}

public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloReply> sayHelloAsync(
io.grpc.examples.helloworld.HelloRequest request) {
return futureStub.sayHello(requesthttps://github.com/apache/dubbo-samples.git);
}

public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply> responseObserver){
stub.sayHello(request, responseObserver);
}

}

```

3. XxxImplBase implements DubboInterface
```java
public static abstract class GreeterImplBase implements io.grpc.BindableService, IGreeter {

@java.lang.Override
public final io.grpc.examples.helloworld.HelloReply sayHello(io.grpc.examples.helloworld.HelloRequest request) {
throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
}

@java.lang.Override
public final com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloReply> sayHelloAsync(
io.grpc.examples.helloworld.HelloRequest request) {
throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
}

public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply> responseObserver) {
asyncUnimplementedUnaryCall(getSayHelloMethod(), responseObserver);
}

...
}
```

## Build locally

To compile the plugin:
```
$ ./gradlew java_pluginExecutable
```

To publish to local repository
```
$ ./gradlew publishToMavenLocal
```

## Publish to maven repository

Add gradle.properties
```properties
repositoryUser=user
repositoryPasword=pwd
```

Then, run
```
$ ../gradlew publishMavenPublicationToDubboRepository
```
Notice current groupId is `com.alibaba`.


Check [here](https://github.com/grpc/grpc-java/blob/master/compiler/README.md) for basic requirements and usage of protoc plugin.
Loading

0 comments on commit 172b334

Please sign in to comment.