Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 283e7fb364f261d2dcaf280db5b4c5b8417f5b69 @achellies committed Oct 26, 2016
Showing with 5,860 additions and 0 deletions.
  1. +35 −0 .gitignore
  2. +18 −0 build.gradle
  3. +21 −0 gradle.properties
  4. BIN gradle/wrapper/gradle-wrapper.jar
  5. +6 −0 gradle/wrapper/gradle-wrapper.properties
  6. +206 −0 gradle_mvn_push.gradle
  7. +37 −0 library/build.gradle
  8. +4 −0 library/gradle.properties
  9. +7 −0 library/proguard-rules.pro
  10. 0 library/readme.md
  11. +9 −0 library/src/main/AndroidManifest.xml
  12. +67 −0 library/src/main/java/com/achellies/android/ultron/PatchUtils.java
  13. +37 −0 library/src/main/java/com/android/tools/fd/common/Log.java
  14. +94 −0 library/src/main/java/com/android/tools/fd/common/ProtocolConstants.java
  15. +64 −0 library/src/main/java/com/android/tools/fd/runtime/AbstractPatchesLoaderImpl.java
  16. +268 −0 library/src/main/java/com/android/tools/fd/runtime/AndroidInstantRuntime.java
  17. +56 −0 library/src/main/java/com/android/tools/fd/runtime/AppInfo.java
  18. +80 −0 library/src/main/java/com/android/tools/fd/runtime/ApplicationPatch.java
  19. +57 −0 library/src/main/java/com/android/tools/fd/runtime/BasicType.java
  20. +376 −0 library/src/main/java/com/android/tools/fd/runtime/BootstrapApplication.java
  21. +862 −0 library/src/main/java/com/android/tools/fd/runtime/FileManager.java
  22. +21 −0 library/src/main/java/com/android/tools/fd/runtime/IncrementalChange.java
  23. +176 −0 library/src/main/java/com/android/tools/fd/runtime/IncrementalClassLoader.java
  24. +32 −0 library/src/main/java/com/android/tools/fd/runtime/InstantReloadException.java
  25. +611 −0 library/src/main/java/com/android/tools/fd/runtime/MonkeyPatcher.java
  26. +22 −0 library/src/main/java/com/android/tools/fd/runtime/PatchesLoader.java
  27. +68 −0 library/src/main/java/com/android/tools/fd/runtime/Paths.java
  28. +308 −0 library/src/main/java/com/android/tools/fd/runtime/Restarter.java
  29. +591 −0 library/src/main/java/com/android/tools/fd/runtime/Server.java
  30. +20 −0 plugin/build.gradle
  31. +21 −0 plugin/gradle.properties
  32. +80 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/AndroidSDKUtils.groovy
  33. +98 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/GenerateInstantRunAppInfo.groovy
  34. +62 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/GradleUtils.groovy
  35. +197 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/ObfuscationTransformer.groovy
  36. +51 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/PatchHashManager.groovy
  37. +14 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/UltronExtension.groovy
  38. +173 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/UltronPlugin.groovy
  39. +575 −0 plugin/src/main/groovy/com/achellies/gradle/ultron/UltronTransform.groovy
  40. +1 −0 plugin/src/main/resources/META-INF/gradle-plugins/ultron.properties
  41. +22 −0 readme.md
  42. +84 −0 sample/build.gradle
  43. +4 −0 sample/hash.txt
  44. BIN sample/keystore/ultron.jks
  45. +74 −0 sample/proguard-rules.pro
  46. +25 −0 sample/src/main/AndroidManifest.xml
  47. +24 −0 sample/src/main/java/com/achellies/android/ultron/sample/MainActivity.java
  48. +73 −0 sample/src/main/java/com/achellies/android/ultron/sample/MyApplication.java
  49. +38 −0 sample/src/main/java/com/achellies/android/ultron/sample/TestModule.java
  50. +22 −0 sample/src/main/res/layout/activity_main.xml
  51. BIN sample/src/main/res/mipmap-hdpi/ic_launcher.png
  52. BIN sample/src/main/res/mipmap-mdpi/ic_launcher.png
  53. BIN sample/src/main/res/mipmap-xhdpi/ic_launcher.png
  54. BIN sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
  55. BIN sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  56. +9 −0 sample/src/main/res/values-v21/styles.xml
  57. +6 −0 sample/src/main/res/values-w820dp/dimens.xml
  58. +6 −0 sample/src/main/res/values/colors.xml
  59. +13 −0 sample/src/main/res/values/dimens.xml
  60. +8 −0 sample/src/main/res/values/drawables.xml
  61. +6 −0 sample/src/main/res/values/strings.xml
  62. +20 −0 sample/src/main/res/values/styles.xml
  63. +1 −0 settings.gradle
@@ -0,0 +1,35 @@
+# Built application files
+*.apk
+*.ap_
+
+# Files for the Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# IntelliJ project files
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# Misc
+.DS_Store
@@ -0,0 +1,18 @@
+buildscript {
+ repositories {
+ mavenLocal()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.2.0'
+ }
+}
+
+allprojects {
+ repositories {
+ mavenLocal()
+ jcenter()
+ }
+
+ tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
+}
@@ -0,0 +1,21 @@
+VERSION_NAME=0.0.1-SNAPSHOT
+
+POM_ARTIFACT_ID=ultron
+POM_PACKAGING=jar
+POM_NAME=ultron
+
+GROUP=com.achellies.android
+
+POM_DESCRIPTION=ultron
+POM_URL=
+POM_SCM_URL=
+POM_SCM_CONNECTION=
+POM_SCM_DEV_CONNECTION=
+POM_LICENCE_NAME=
+POM_LICENCE_URL=
+POM_LICENCE_DIST=repo
+POM_DEVELOPER_ID=achellies
+POM_DEVELOPER_NAME=achellies
+POM_DEVELOPER_EMAIL=achellies@163.com
+RELEASE_REPOSITORY_URL=
+SNAPSHOT_REPOSITORY_URL=
Binary file not shown.
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2015 achellies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply plugin: 'maven'
+apply plugin: 'signing'
+
+def isReleaseBuild() {
+ return VERSION_NAME.contains("SNAPSHOT") == false
+}
+
+def getReleaseRepositoryUrl() {
+ return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
+ : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+}
+
+def getSnapshotRepositoryUrl() {
+ return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
+ : "https://oss.sonatype.org/content/repositories/snapshots/"
+}
+
+def getRepositoryUsername() {
+ return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
+}
+
+def getRepositoryPassword() {
+ return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
+}
+
+afterEvaluate { project ->
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+ pom.groupId = GROUP
+ pom.artifactId = POM_ARTIFACT_ID
+ pom.version = VERSION_NAME
+
+ repository(url: getReleaseRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+ }
+ snapshotRepository(url: getSnapshotRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+ }
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+ }
+
+ signing {
+ required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
+ sign configurations.archives
+ }
+
+ if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) {
+ task install(type: Upload, dependsOn: assemble) {
+ repositories.mavenInstaller {
+ configuration = configurations.archives
+
+ pom.groupId = GROUP
+ pom.artifactId = POM_ARTIFACT_ID
+ pom.version = VERSION_NAME
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+
+ task androidJavadocs(type: Javadoc) {
+ failOnError false
+ source = android.sourceSets.main.java.source
+ classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+ }
+
+ task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
+ classifier = 'javadoc'
+ from androidJavadocs.destinationDir
+ }
+
+ task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.source
+ }
+ } else {
+ install {
+ repositories.mavenInstaller {
+ pom.groupId = GROUP
+ pom.artifactId = POM_ARTIFACT_ID
+ pom.version = VERSION_NAME
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+
+ task sourcesJar(type: Jar, dependsOn:classes) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+ }
+
+ task javadocJar(type: Jar, dependsOn:javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+ }
+ }
+
+ artifacts {
+ if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) {
+ archives androidSourcesJar
+ archives androidJavadocsJar
+ } else {
+// archives sourcesJar
+// archives javadocJar
+ }
+ }
+}
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.library'
+apply from: '../gradle_mvn_push.gradle'
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion '24.0.1'
+
+ defaultConfig {
+ minSdkVersion 15
+ targetSdkVersion 24
+ versionCode 1
+ versionName "1.0"
+ consumerProguardFiles 'proguard-rules.pro'
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile 'com.android.support:support-v4:24.1.1'
+ compile 'com.android.support:appcompat-v7:24.1.1'
+ compile 'com.android.support:support-annotations:24.1.1'
+}
+
@@ -0,0 +1,4 @@
+POM_NAME=ultron
+POM_ARTIFACT_ID=ultron
+POM_PACKAGING=aar
+
@@ -0,0 +1,7 @@
+-useuniqueclassmembernames
+-keep interface com.android.tools.fd.runtime.IncrementalChange { *; }
+-keep class * implements com.android.tools.fd.runtime.IncrementalChange { *; }
+-keep class com.android.tools.fd.** {*;}
+-keep public class com.android.tools.fd.runtime.AppPatchesLoaderImpl
+-keepclassmembers class * { public static volatile transient synthetic <fields>; }
+-keep class com.achellies.android.ultron.** {*;}
No changes.
@@ -0,0 +1,9 @@
+<manifest
+ package="com.achellies.android.ultron"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+
+ <application>
+ </application>
+
+</manifest>
Oops, something went wrong.

0 comments on commit 283e7fb

Please sign in to comment.