Skip to content

Commit

Permalink
release 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tangxiaolv committed Jun 5, 2017
1 parent e371289 commit ed6f975
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

|Lib|surgeon-plugin|surgeon-compile|
|:---:|:---|:---|
|最新版本|1.0.2|1.0.1|
|最新版本|1.0.3|1.0.1|

Surgeon是Android上一个简单,灵活,高性能的方法热替换框架。

Expand All @@ -18,7 +18,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.2'//version参照上表
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.3'//version参照上表
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ English | [中文](https://github.com/TangXiaoLv/Surgeon/blob/master/README-CN.m

|Lib|surgeon-plugin|surgeon-compile|
|:---:|:---|:---|
|latest|1.0.2|1.0.1|
|latest|1.0.3|1.0.1|

Surgeon is a hot function replace framework for Android which was simple to use,flexible,high-performance.

Expand All @@ -18,7 +18,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.2'
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.3'
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.2'
classpath 'com.tangxiaolv.surgeon:surgeon-plugin:1.0.3'

//jcenter push plugin
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void before(Object[] params) {

//params[0] = TargetHandle,The other is origin params
@Override
public String replace(Object[] params) {
public String replace(Object[] params) throws Throwable {
return super.replace(params);
}

Expand Down
2 changes: 1 addition & 1 deletion surgeon-core/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GROUP_ID=com.tangxiaolv.surgeon
#must be the same as MODULE name
ARTIFACT_ID=surgeon-core
#publicVersion
PUBLIC_VERSION=1.0.2
PUBLIC_VERSION=1.0.3
#jcenter repo library Name
LIBRARY_NAME=surgeon-core
#library description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Object findAndInvoke(String namespace,
String prefix,
String function,
Object target,
Object[] args) throws SurgeonException {
Object[] args) throws Throwable {
if (isEmpty(namespace) || isEmpty(function)) return Continue.class;
try {
String masterPath = PREFIX + namespace.replace(".", "_");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ public static void replace(String ref, Object result) {
public static void replace(String ref, Replacer replacer) {
InnerCache.getInstance().addReplaceWapper(ref, new ReplaceWapper(replacer, replacer != null));
}

/**
* Remove replaced result/function.
*
* @param ref namespace + "." + function
*/
public static void remove(String ref) {
InnerCache.getInstance().popReplaceWapper(ref);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface Replacer<T> {
* @param params The original function input params.
* @return new return result.
*/
T replace(Object[] params);
T replace(Object[] params) throws Throwable;

/**
* Called after original function called.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.surgeon.weaving.core.interfaces;

import com.surgeon.weaving.core.TargetHandle;

/**
* The implements of {@link Replacer}
*
Expand All @@ -12,9 +14,12 @@ public void before(Object[] params) {
//nothing
}

@SuppressWarnings("unchecked")
@Override
public T replace(Object[] params) {
return null;
public T replace(Object[] params) throws Throwable {
Object[] copy = new Object[params.length - 1];
System.arraycopy(params, 1, copy, 0, params.length - 1);
return (T) ((TargetHandle) params[0]).proceed(copy);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion surgeon-plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GROUP_ID=com.tangxiaolv.surgeon
#must be the same as MODULE name
ARTIFACT_ID=surgeon-plugin
#publicVersion
PUBLIC_VERSION=1.0.2
PUBLIC_VERSION=1.0.3
#jcenter repo library Name
LIBRARY_NAME=surgeon-plugin
#library description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SurgeonPlugin implements Plugin<Project> {

project.dependencies {
compile 'org.aspectj:aspectjrt:1.8.10'
compile 'com.tangxiaolv.surgeon:surgeon-core:1.0.2'
compile 'com.tangxiaolv.surgeon:surgeon-core:1.0.3'
}

project.extensions.create('surgeon', SurgeonExtension)
Expand Down

0 comments on commit ed6f975

Please sign in to comment.