Skip to content

Commit c50954c

Browse files
Merge pull request #1 from Tencent/master
sync
2 parents f8c4187 + 519657a commit c50954c

File tree

144 files changed

+8555
-1958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+8555
-1958
lines changed

.github/ISSUE_TEMPLATE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Issue/提问须知
2+
**在提交issue之前,我们应该先查询是否已经有相关的issue以及[常见问题](https://github.com/Tencent/tinker/wiki/Tinker-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)。提交issue时,我们需要写明issue的原因,以及编译或运行过程的日志(加载进程以及Patch进程)。issue需要以下面的格式:**
3+
4+
```
5+
异常类型:app运行时异常/编译异常
6+
7+
手机型号:如:Nexus 5(如是编译异常,则可以不填)
8+
9+
手机系统版本:如:Android 5.0 (如是编译异常,则可以不填)
10+
11+
tinker版本:如:1.7.7
12+
13+
gradle版本:如:2.10
14+
15+
是否使用热更新SDK: 如 TinkerPatch SDK 或者 Bugly SDK
16+
17+
系统:如:Mac
18+
19+
堆栈/日志:
20+
1. 如是编译异常,请在执行gradle命令时,加上--stacktrace;
21+
2. 日志我们需要过滤"Tinker."关键字;
22+
3. 对于合成失败的情况,请给出:patch进程的日志,这里需要将Android Moniter右上角设为No Filter。
23+
```
24+
25+
提问题时若使用`不能用/没效果/有问题/报错`此类模糊表达,但又没给出任何代码截图报错的,将绝对不会有任何反馈。这种issue也是一律直接关闭的,大家可以参阅[提问的智慧](https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way)
26+
27+
Tinker是一个开源项目,希望大家遇到问题时要学会先思考,看看sample与Tinker的源码,更鼓励大家给我们提pr.

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Tinker
22
[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/tinker/blob/master/LICENSE)
3-
[![Release Version](https://img.shields.io/badge/release-1.7.7-red.svg)](https://github.com/Tencent/tinker/releases)
3+
[![Release Version](https://img.shields.io/badge/release-1.9.5-red.svg)](https://github.com/Tencent/tinker/releases)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/tinker/pulls)
5-
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.7.7-red.svg)](https://github.com/Tencent/tinker/wiki)
5+
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.9.5-red.svg)](https://github.com/Tencent/tinker/wiki)
66

77
Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk.
88

@@ -14,7 +14,7 @@ Add tinker-gradle-plugin as a dependency in your main `build.gradle` in the root
1414
```gradle
1515
buildscript {
1616
dependencies {
17-
classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.7.7')
17+
classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.9.1')
1818
}
1919
}
2020
```
@@ -24,9 +24,9 @@ Then you need to "apply" the plugin and add dependencies by adding the following
2424
```gradle
2525
dependencies {
2626
//optional, help to generate the final application
27-
provided('com.tencent.tinker:tinker-android-anno:1.7.7')
27+
provided('com.tencent.tinker:tinker-android-anno:1.9.1')
2828
//tinker's main Android lib
29-
compile('com.tencent.tinker:tinker-android-lib:1.7.7')
29+
compile('com.tencent.tinker:tinker-android-lib:1.9.1')
3030
}
3131
...
3232
...

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ext {
2828
compileSdkVersion = 23
2929
targetSdkVersion = compileSdkVersion
3030
buildToolsVersion = '23.0.2'
31+
supportLibVersion = '23.0.1'
3132
javaVersion = JavaVersion.VERSION_1_7
3233

3334
GROUP = 'com.tencent.tinker'

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
VERSION_NAME_PREFIX=1.7.7
19+
VERSION_NAME_PREFIX=1.9.5
2020
VERSION_NAME_SUFFIX=

gradle/android-artifacts.gradle

+20
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ publishing {
8383
// Tell maven to prepare the generated "*.aar" file for publishing
8484
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
8585
artifact androidJavadocsJar
86+
pom.withXml {
87+
def dependenciesNode = asNode().appendNode('dependencies')
88+
configurations.compile.allDependencies.each {
89+
if (it.group != null && it.name != null) {
90+
def dependencyNode = dependenciesNode.appendNode('dependency')
91+
dependencyNode.appendNode('groupId', it.group)
92+
dependencyNode.appendNode('artifactId', it.name)
93+
dependencyNode.appendNode('version', it.version)
94+
95+
if (it.excludeRules.size() > 0) {
96+
def exclusionsNode = dependencyNode.appendNode('exclusions')
97+
it.excludeRules.each { rule ->
98+
def exclusionNode = exclusionsNode.appendNode('exclusion')
99+
exclusionNode.appendNode('groupId', rule.group)
100+
exclusionNode.appendNode('artifactId', rule.module)
101+
}
102+
}
103+
}
104+
}
105+
}
86106
}
87107
}
88108
}

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ include ':tinker-build:tinker-patch-lib'
77
include ':tinker-build:tinker-patch-gradle-plugin'
88
include ':third-party:aosp-dexutils'
99
include ':third-party:bsdiff-util'
10+
include ':third-party:tinker-ziputils'

third-party/bsdiff-util/src/main/java/com/tencent/tinker/bsdiff/BSPatch.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ public static int patchLessMemory(RandomAccessFile oldFile, int oldsize, byte[]
110110
return RETURN_DIFF_FILE_ERR;
111111
}
112112

113-
int commentLenPos = oldsize - extLen - 2;
114-
if (commentLenPos <= 2) {
115-
return RETURN_OLD_FILE_ERR;
116-
}
113+
// int commentLenPos = oldsize - extLen - 2;
114+
// if (commentLenPos <= 2) {
115+
// return RETURN_OLD_FILE_ERR;
116+
// }
117117

118118
DataInputStream diffIn = new DataInputStream(new ByteArrayInputStream(diffBuf, 0, diffSize));
119119

@@ -167,10 +167,10 @@ public static int patchLessMemory(RandomAccessFile oldFile, int oldsize, byte[]
167167
return RETURN_DIFF_FILE_ERR;
168168
}
169169
for (int i = 0; i < ctrl[0]; i++) {
170-
if (oldpos + i == commentLenPos) {
171-
oldBuffer[i] = 0;
172-
oldBuffer[i + 1] = 0;
173-
}
170+
// if (oldpos + i == commentLenPos) {
171+
// oldBuffer[i] = 0;
172+
// oldBuffer[i + 1] = 0;
173+
// }
174174

175175
if ((oldpos + i >= 0) && (oldpos + i < oldsize)) {
176176
buffer[i] += oldBuffer[i];
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
Original work Copyright (c) 2005-2008, The Android Open Source Project
2+
Modified work Copyright (C) 2016 THL A29 Limited, a Tencent company.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
13+
14+
Apache License
15+
Version 2.0, January 2004
16+
http://www.apache.org/licenses/
17+
18+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19+
20+
1. Definitions.
21+
22+
"License" shall mean the terms and conditions for use, reproduction,
23+
and distribution as defined by Sections 1 through 9 of this document.
24+
25+
"Licensor" shall mean the copyright owner or entity authorized by
26+
the copyright owner that is granting the License.
27+
28+
"Legal Entity" shall mean the union of the acting entity and all
29+
other entities that control, are controlled by, or are under common
30+
control with that entity. For the purposes of this definition,
31+
"control" means (i) the power, direct or indirect, to cause the
32+
direction or management of such entity, whether by contract or
33+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
34+
outstanding shares, or (iii) beneficial ownership of such entity.
35+
36+
"You" (or "Your") shall mean an individual or Legal Entity
37+
exercising permissions granted by this License.
38+
39+
"Source" form shall mean the preferred form for making modifications,
40+
including but not limited to software source code, documentation
41+
source, and configuration files.
42+
43+
"Object" form shall mean any form resulting from mechanical
44+
transformation or translation of a Source form, including but
45+
not limited to compiled object code, generated documentation,
46+
and conversions to other media types.
47+
48+
"Work" shall mean the work of authorship, whether in Source or
49+
Object form, made available under the License, as indicated by a
50+
copyright notice that is included in or attached to the work
51+
(an example is provided in the Appendix below).
52+
53+
"Derivative Works" shall mean any work, whether in Source or Object
54+
form, that is based on (or derived from) the Work and for which the
55+
editorial revisions, annotations, elaborations, or other modifications
56+
represent, as a whole, an original work of authorship. For the purposes
57+
of this License, Derivative Works shall not include works that remain
58+
separable from, or merely link (or bind by name) to the interfaces of,
59+
the Work and Derivative Works thereof.
60+
61+
"Contribution" shall mean any work of authorship, including
62+
the original version of the Work and any modifications or additions
63+
to that Work or Derivative Works thereof, that is intentionally
64+
submitted to Licensor for inclusion in the Work by the copyright owner
65+
or by an individual or Legal Entity authorized to submit on behalf of
66+
the copyright owner. For the purposes of this definition, "submitted"
67+
means any form of electronic, verbal, or written communication sent
68+
to the Licensor or its representatives, including but not limited to
69+
communication on electronic mailing lists, source code control systems,
70+
and issue tracking systems that are managed by, or on behalf of, the
71+
Licensor for the purpose of discussing and improving the Work, but
72+
excluding communication that is conspicuously marked or otherwise
73+
designated in writing by the copyright owner as "Not a Contribution."
74+
75+
"Contributor" shall mean Licensor and any individual or Legal Entity
76+
on behalf of whom a Contribution has been received by Licensor and
77+
subsequently incorporated within the Work.
78+
79+
2. Grant of Copyright License. Subject to the terms and conditions of
80+
this License, each Contributor hereby grants to You a perpetual,
81+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82+
copyright license to reproduce, prepare Derivative Works of,
83+
publicly display, publicly perform, sublicense, and distribute the
84+
Work and such Derivative Works in Source or Object form.
85+
86+
3. Grant of Patent License. Subject to the terms and conditions of
87+
this License, each Contributor hereby grants to You a perpetual,
88+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89+
(except as stated in this section) patent license to make, have made,
90+
use, offer to sell, sell, import, and otherwise transfer the Work,
91+
where such license applies only to those patent claims licensable
92+
by such Contributor that are necessarily infringed by their
93+
Contribution(s) alone or by combination of their Contribution(s)
94+
with the Work to which such Contribution(s) was submitted. If You
95+
institute patent litigation against any entity (including a
96+
cross-claim or counterclaim in a lawsuit) alleging that the Work
97+
or a Contribution incorporated within the Work constitutes direct
98+
or contributory patent infringement, then any patent licenses
99+
granted to You under this License for that Work shall terminate
100+
as of the date such litigation is filed.
101+
102+
4. Redistribution. You may reproduce and distribute copies of the
103+
Work or Derivative Works thereof in any medium, with or without
104+
modifications, and in Source or Object form, provided that You
105+
meet the following conditions:
106+
107+
(a) You must give any other recipients of the Work or
108+
Derivative Works a copy of this License; and
109+
110+
(b) You must cause any modified files to carry prominent notices
111+
stating that You changed the files; and
112+
113+
(c) You must retain, in the Source form of any Derivative Works
114+
that You distribute, all copyright, patent, trademark, and
115+
attribution notices from the Source form of the Work,
116+
excluding those notices that do not pertain to any part of
117+
the Derivative Works; and
118+
119+
(d) If the Work includes a "NOTICE" text file as part of its
120+
distribution, then any Derivative Works that You distribute must
121+
include a readable copy of the attribution notices contained
122+
within such NOTICE file, excluding those notices that do not
123+
pertain to any part of the Derivative Works, in at least one
124+
of the following places: within a NOTICE text file distributed
125+
as part of the Derivative Works; within the Source form or
126+
documentation, if provided along with the Derivative Works; or,
127+
within a display generated by the Derivative Works, if and
128+
wherever such third-party notices normally appear. The contents
129+
of the NOTICE file are for informational purposes only and
130+
do not modify the License. You may add Your own attribution
131+
notices within Derivative Works that You distribute, alongside
132+
or as an addendum to the NOTICE text from the Work, provided
133+
that such additional attribution notices cannot be construed
134+
as modifying the License.
135+
136+
You may add Your own copyright statement to Your modifications and
137+
may provide additional or different license terms and conditions
138+
for use, reproduction, or distribution of Your modifications, or
139+
for any such Derivative Works as a whole, provided Your use,
140+
reproduction, and distribution of the Work otherwise complies with
141+
the conditions stated in this License.
142+
143+
5. Submission of Contributions. Unless You explicitly state otherwise,
144+
any Contribution intentionally submitted for inclusion in the Work
145+
by You to the Licensor shall be under the terms and conditions of
146+
this License, without any additional terms or conditions.
147+
Notwithstanding the above, nothing herein shall supersede or modify
148+
the terms of any separate license agreement you may have executed
149+
with Licensor regarding such Contributions.
150+
151+
6. Trademarks. This License does not grant permission to use the trade
152+
names, trademarks, service marks, or product names of the Licensor,
153+
except as required for reasonable and customary use in describing the
154+
origin of the Work and reproducing the content of the NOTICE file.
155+
156+
7. Disclaimer of Warranty. Unless required by applicable law or
157+
agreed to in writing, Licensor provides the Work (and each
158+
Contributor provides its Contributions) on an "AS IS" BASIS,
159+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160+
implied, including, without limitation, any warranties or conditions
161+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162+
PARTICULAR PURPOSE. You are solely responsible for determining the
163+
appropriateness of using or redistributing the Work and assume any
164+
risks associated with Your exercise of permissions under this License.
165+
166+
8. Limitation of Liability. In no event and under no legal theory,
167+
whether in tort (including negligence), contract, or otherwise,
168+
unless required by applicable law (such as deliberate and grossly
169+
negligent acts) or agreed to in writing, shall any Contributor be
170+
liable to You for damages, including any direct, indirect, special,
171+
incidental, or consequential damages of any character arising as a
172+
result of this License or out of the use or inability to use the
173+
Work (including but not limited to damages for loss of goodwill,
174+
work stoppage, computer failure or malfunction, or any and all
175+
other commercial damages or losses), even if such Contributor
176+
has been advised of the possibility of such damages.
177+
178+
9. Accepting Warranty or Additional Liability. While redistributing
179+
the Work or Derivative Works thereof, You may choose to offer,
180+
and charge a fee for, acceptance of support, warranty, indemnity,
181+
or other liability obligations and/or rights consistent with this
182+
License. However, in accepting such obligations, You may act only
183+
on Your own behalf and on Your sole responsibility, not on behalf
184+
of any other Contributor, and only if You agree to indemnify,
185+
defend, and hold each Contributor harmless for any liability
186+
incurred by, or claims asserted against, such Contributor by reason
187+
of your accepting any such warranty or additional liability.
188+
189+
END OF TERMS AND CONDITIONS
190+
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apply plugin: 'java'
2+
3+
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
4+
5+
version rootProject.ext.VERSION_NAME
6+
group rootProject.ext.GROUP
7+
8+
task buildTinkerSdk(type: Copy, dependsOn: [build]) {
9+
group = "tinker"
10+
from('build/libs') {
11+
include '*.jar'
12+
exclude '*javadoc.jar'
13+
exclude '*-sources.jar'
14+
}
15+
into(rootProject.file("buildSdk/android"))
16+
}
17+
18+
apply from: rootProject.file('gradle/java-artifacts.gradle')
19+
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Tencent is pleased to support the open source community by making Tinker available.
3+
#
4+
# Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
5+
#
6+
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in
7+
# compliance with the License. You may obtain a copy of the License at
8+
#
9+
# https://opensource.org/licenses/BSD-3-Clause
10+
#
11+
# Unless required by applicable law or agreed to in writing, software distributed under the License is
12+
# distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
# either express or implied. See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
POM_ARTIFACT_ID=tinker-ziputils
18+
POM_NAME=Tinker Zip Utils
19+
POM_PACKAGING=jar

0 commit comments

Comments
 (0)