Skip to content

Commit

Permalink
Merge pull request #89 from chenenyu/dev
Browse files Browse the repository at this point in the history
1.4.3
  • Loading branch information
Half Stack committed Jun 11, 2018
2 parents 7deb946 + 6c3e17b commit deca602
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 234 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
## 2018.06.11

`router:1.4.3`:

Optimize implementation in for multi-thread call.
优化多线程下并发调用的解决方式。

## 2018.05.18

`router:1.4.2`:

1. Ordered interceptors.
Ordered interceptors.
拦截器现在是有序的。

## 2018.04.03

`router:1.4.1`:

1. fix ClassCastException in muilti-thread condition
Fix ClassCastException in multi-thread condition.
修复在多线程调用场景下的Exception。

## 2018.04.03

Expand Down
28 changes: 14 additions & 14 deletions Sample/app/src/main/java/com/chenenyu/router/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

EditText editRoute = (EditText) findViewById(R.id.edit_route);
btn0 = (Button) findViewById(R.id.btn0);
btn1 = (Button) findViewById(R.id.btn1);
btn2 = (Button) findViewById(R.id.btn2);
btn3 = (Button) findViewById(R.id.btn3);
btn4 = (Button) findViewById(R.id.btn4);
btn5 = (Button) findViewById(R.id.btn5);
btn6 = (Button) findViewById(R.id.btn6);
btn7 = (Button) findViewById(R.id.btn7);
btn8 = (Button) findViewById(R.id.btn8);
btn9 = (Button) findViewById(R.id.btn9);
btn10 = (Button) findViewById(R.id.btn10);
btn11 = (Button) findViewById(R.id.btn11);
EditText editRoute = findViewById(R.id.edit_route);
btn0 = findViewById(R.id.btn0);
btn1 = findViewById(R.id.btn1);
btn2 = findViewById(R.id.btn2);
btn3 = findViewById(R.id.btn3);
btn4 = findViewById(R.id.btn4);
btn5 = findViewById(R.id.btn5);
btn6 = findViewById(R.id.btn6);
btn7 = findViewById(R.id.btn7);
btn8 = findViewById(R.id.btn8);
btn9 = findViewById(R.id.btn9);
btn10 = findViewById(R.id.btn10);
btn11 = findViewById(R.id.btn11);

editRoute.addTextChangedListener(new TextWatcher() {
@Override
Expand Down Expand Up @@ -115,7 +115,7 @@ public void callback(RouteResult state, Uri uri, String message) {
} else if (v == btn9) {
Router.build("intercepted").go(this);
} else if (v == btn10) {
Router.build("intercepted").skipInterceptors("AInterceptor").go(this);
Router.build("intercepted").skipInterceptors().go(this);
} else if (v == btn11) {
Router.build("test").addInterceptors("AInterceptor").go(this);
}
Expand Down
2 changes: 1 addition & 1 deletion VERSION.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# router library version
ROUTER_VERSION=1.4.2
ROUTER_VERSION=1.4.3
# compiler library version
COMPILER_VERSION=1.4.0
# annotation library version
Expand Down
13 changes: 12 additions & 1 deletion annotation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@ apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

apply from: 'publish.gradle'
Properties config = new Properties()
config.load(project.file('../VERSION.properties').newDataInputStream())
def annoVersion = config.getProperty("ANNOTATION_VERSION")

ext {
GROUP = 'com.chenenyu.router' // required.
ARTIFACT = 'annotation' // required.
VERSION = annoVersion // required.
BINTRAY_NAME = 'annotation' // optional.
}

apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
59 changes: 0 additions & 59 deletions annotation/publish.gradle

This file was deleted.

1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}

Expand Down
10 changes: 9 additions & 1 deletion compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ tasks.withType(JavaCompile) {

Properties version = new Properties()
version.load(project.file('../VERSION.properties').newDataInputStream())
def compilerVersion = version.getProperty("COMPILER_VERSION")
def annoVersion = version.getProperty("ANNOTATION_VERSION")

dependencies {
Expand All @@ -18,4 +19,11 @@ dependencies {
sourceCompatibility = rootProject.ext.sourceCompatibility
targetCompatibility = rootProject.ext.targetCompatibility

apply from: 'publish.gradle'
ext {
GROUP = 'com.chenenyu.router' // required.
ARTIFACT = 'compiler' // required.
VERSION = compilerVersion // required.
BINTRAY_NAME = 'compiler' // optional.
}

apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
58 changes: 0 additions & 58 deletions compiler/publish.gradle

This file was deleted.

12 changes: 6 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# annotation
./gradlew :annotation:clean :annotation:pBPTML
./gradlew :annotation:bintrayUpload
./gradlew clean pBPTML -p annotation
./gradlew bintrayUpload -p annotation

# compiler
./gradlew :compiler:clean :compiler:pBPTML
./gradlew :compiler:bintrayUpload
./gradlew clean pBPTML -p compiler
./gradlew bintrayUpload -p compiler

# router
./gradlew :router:clean :router:install
./gradlew :router:bintrayUpload
./gradlew clean pBPTML -p router
./gradlew bintrayUpload -p router
13 changes: 10 additions & 3 deletions router/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@ android {

Properties version = new Properties()
version.load(project.file('../VERSION.properties').newDataInputStream())
def routerVersion = version.getProperty("ROUTER_VERSION")
def annoVersion = version.getProperty("ANNOTATION_VERSION")

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
compileOnly "com.android.support:support-v4:24.2.0"
// api project(':annotation')
// 这里不能使用implementation,因为pom依赖不识别
compile "com.chenenyu.router:annotation:${annoVersion}"
implementation "com.chenenyu.router:annotation:${annoVersion}"
}

apply from: 'publish.gradle'
ext {
GROUP = 'com.chenenyu.router' // required.
ARTIFACT = 'router' // required.
VERSION = routerVersion // required.
BINTRAY_NAME = 'router' // optional.
}

apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
86 changes: 0 additions & 86 deletions router/publish.gradle

This file was deleted.

14 changes: 13 additions & 1 deletion router/src/main/java/com/chenenyu/router/RealRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@
* Created by chenenyu on 2017/3/30.
*/
class RealRouter extends AbsRouter {
RealRouter() {

private static final ThreadLocal<RealRouter> mRouterThreadLocal = new ThreadLocal<RealRouter>() {
@Override
protected RealRouter initialValue() {
return new RealRouter();
}
};

private RealRouter() {
}

static RealRouter getInstance() {
return mRouterThreadLocal.get();
}

/**
Expand Down

0 comments on commit deca602

Please sign in to comment.