Skip to content

Commit

Permalink
init tinker repo
Browse files Browse the repository at this point in the history
  • Loading branch information
shwenzhang committed Sep 21, 2016
0 parents commit ddd547f
Show file tree
Hide file tree
Showing 318 changed files with 46,473 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.gradle
/build
# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

.DS_Store
node_modules

# Built application files
*.apk
*.ap_

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
*.iml
/*/*.iml
.idea
/*/.idea/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

/*/.idea

/buildSdk


60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing to Tinker
Welcome to [report Issues](https://github.com/Tencent/tinker/issues) or [pull requests](https://github.com/Tencent/tinker/pulls). It's recommended to read the following Contributing Guild first to make contributing earlier.

## issues
We use Git Issues to track public bugs and feature requests.

### Search Known Issues First
Please search the exist issues to see if any similar issue or feature request has already been filed. You shold try to make sure your issue doesn't already exist.

### Reporting New Issues
If you open an issue, the more information the better. Such as detailed description, screenshot or video of your problem, logcat or code blocks for your crash.

## Pull Requests
We strongly welcome your pull request to make tinker better.

### Branch Management
There are three main branch here:

1. `master` branch.
1. It is the latest (pre-)release branch. We use `master` for tag, with version number `1.1.0`, `1.2.0`, `1.3.0`...
2. **Don't submit any PR on `master` branch.**
2. `dev` branch.
1. It is our stable developing branch. After full testing, `dev` will publish to `master` branch for the next release.
2. **You are recommended to submit bugfix or feature PR on `dev` branch.**
3. `hotfix` branch.
1. It is the latest tag version for hot fix. If we accept your pull request, we may just tag with version number `1.1.1`, `1.2.3`.
2. **Only submit urgent PR on `hotfix` branch for next specific release.**

Normal bugfix or feature request should submit on `dev` branch. After full testing, we will merge them on `master` branch for the next release.

If you have some urgent bugfix on a published version, but the `master` branch have already far away with the latest tag version, you can submit a PR on hotfix. And it will be cherry picked to `dev` branch if it is possible.

```
master
dev <--- hotfix PR
feature/bugfix PR
```

### Make Pull Requests
The code team will monitor all pull request, we run some code check and test on it. After all tests passing, we will accecpt this pr. But it won't merge to `master` branch at once, which have some delay.

Before submitting a pull request, please make sure the following is done

1. Fork the repo and create your branch from `master` or `hotfix`.
2. Update code or documentation if you have changed APIs.
3. Add the copyright notice to the top of any new files you've added.
4. Make sure your code lints and checkstyles.
5. Test and test again your code.
6. Now, you can submit your pull request on `dev` or `hotfix` branch.

## Code Style Guide
Use [Code Style](https://github.com/Tencent/tinker/blob/master/checkstyle.xml) for Java and Android.

* 4 spaces for indentation rather than tabs

## License
By contributing to Tinker, you agree that your contributions will be licensed
under its [BSD LICENSE](https://github.com/Tencent/tinker/blob/master/LICENSE)
669 changes: 669 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
## Tinker
[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/tinker/blob/master/LICENSE)

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

![tinker.png](assets/tinker.png)

## Getting started
Add tinker-gradle-plugin as a dependency in your main `build.gradle` in the root of your project:

```gradle
buildscript {
dependencies {
classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.6.0')
}
}
```

Then you need to "apply" the plugin and add dependencies by adding the following lines to your `app/build.gradle`.

```gradle
dependencies {
//optional, help to gen the final application
compile('com.tencent.tinker:tinker-android-anno:1.6.0')
//tinker's main Android lib
compile('com.tencent.tinker:tinker-android-lib:1.6.0')
}
...
...
apply plugin: 'com.tencent.tinker.patch'
```

If your app has a class that subclasses android.app.Application, then you need to modify that class, and move all its implements to [SampleApplicationLike](https://github.com/Tencent/tinker/blob/master/tinker-sample-android/app/src/main/java/tinker/sample/android/app/SampleApplicationLike.java) rather than Application:

```java
-public class YourApplication extends Application {
+public class SampleApplicationLike extends DefaultApplicationLike
```

Now you should change your `Application` class, which will be a subclass of [TinkerApplication](https://github.com/Tencent/tinker/blob/master/tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/app/TinkerApplication.java). As you can see from its API, it is an abstract class that does not have a default constructor, so you must define a no-arg constructor as follows:

```java
public class SampleApplication extends TinkerApplication {
public SampleApplication() {
super(
//tinkerFlags, which types is supported
//dex only, library only, all support
ShareConstants.TINKER_ENABLE_ALL,
// This is passed as a string so the shell application does not
// have a binary dependency on your ApplicationLifeCycle class.
"tinker.sample.android.SampleApplicationLike");
}
}
```

Use `tinker-android-anno` to generate your `Application` is more recommended, you can just add an annotation for your [SampleApplicationLike](http://git.code.oa.com/tinker/tinker/blob/master/tinker-sample-android/app/src/main/java/tinker/sample/android/app/SampleApplicationLike.java) class

```java
@DefaultLifeCycle(
application = "tinker.sample.android.app.SampleApplication", //application name to generate
flags = ShareConstants.TINKER_ENABLE_ALL) //tinkerFlags above
public class SampleApplicationLike extends DefaultApplicationLike
```

How to install tinker? learn more at the sample [SampleApplicationLike](https://github.com/Tencent/tinker/blob/master/tinker-sample-android/app/src/main/java/tinker/sample/android/app/SampleApplicationLike.java).

For proguard, we have already change the proguard config automatic, and also generate the multiDex keep proguard file for you.

For more tinker configurations, learn more at the sample [app/build.gradle](https://github.com/Tencent/tinker/blob/master/tinker-sample-android/app/build.gradle).

## Support
Any problem?

1. Learn more from [tinker-sample-android](https://github.com/Tencent/tinker/tree/master/tinker-sample-android).
2. Read the [source code](https://github.com/Tencent/tinker/tree/master).
3. Read the [wiki](https://github.com/Tencent/tinker/wiki) or [FAQ](https://github.com/Tencent/tinker/wiki/Tinker-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) for help.
4. Contact us for help.

## Contributing
For more information about contributing issues or pull requests, see our [Tinker Contributing Guide](https://github.com/Tencent/tinker/blob/master/CONTRIBUTING.md).

## License
Tinker is under the BSD license. See the [LICENSE](https://github.com/Tencent/tinker/blob/master/LICENSE) file for details.
Binary file added assets/tinker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
}

tasks.withType(Javadoc).all {
enabled = false
options.setEncoding('UTF-8')
}

apply plugin: 'checkstyle'

checkstyle {
configFile rootProject.file('checkstyle.xml')
toolVersion '6.19'
ignoreFailures false
showViolations true
}

task('checkstyle', type: Checkstyle) {
source 'src/main/java'
include '**/*.java'
classpath = files()
}
}

ext {
minSdkVersion = 10
compileSdkVersion = 23
targetSdkVersion = compileSdkVersion
buildToolsVersion = '23.0.2'
javaVersion = JavaVersion.VERSION_1_7

GROUP = 'com.tencent.tinker'
VERSION_NAME = "${VERSION_NAME_PREFIX}${VERSION_NAME_SUFFIX}"

POM_PACKAGING = "pom"
POM_DESCRIPTION= "tinker"

POM_URL = "https://github.com/Tencent/tinker"
POM_SCM_URL = "https://github.com/Tencent/tinker.git"
POM_ISSUE_URL = 'https://github.com/Tencent/tinker/issues'

POM_LICENCE_NAME = "BSD License"
POM_LICENCE_URL = "https://opensource.org/licenses/BSD-3-Clause"
POM_LICENCE_DIST = "repo"

POM_DEVELOPER_ID="Tencent Wechat"
POM_DEVELOPER_NAME="Tencent Wechat, Inc."

BINTRAY_LICENCE= ['BSD 3-Clause']
BINTRAY_ORGANIZATION = "tinker"

}
Loading

0 comments on commit ddd547f

Please sign in to comment.