Skip to content

Commit

Permalink
Merge pull request #741 from alibaba/dev
Browse files Browse the repository at this point in the history
+ update 0.8.7
  • Loading branch information
lomanyong authored Mar 24, 2017
2 parents 797c2bd + 5bfa9fe commit 95d14eb
Show file tree
Hide file tree
Showing 19 changed files with 121 additions and 104 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ local.properties
.DS_Store
build/
captures/
.idea/
.idea/
*.pyc
28 changes: 25 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ buildscript {
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.antfortune.freeline:gradle:0.8.6'
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.antfortune.freeline:gradle:1.0.0-SNAPSHOT'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -27,3 +26,26 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

def supportLibVersion = '25.1.1'

ext {
freelineDevVersion = '0.8.6-SNAPSHOT'
freelineReleaseVersion = '0.8.6'
minSdkVersion = 14
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = '25.0.2'
}

def deps = [
appcompatV7: "com.android.support:appcompat-v7:$supportLibVersion",
supportV4: "com.android.support:support-v4:$supportLibVersion",
recyclerview: "com.android.support:recyclerview-v7:$supportLibVersion",
design: "com.android.support:design:$supportLibVersion",

freelineRuntime: "com.antfortune.freeline:runtime:$freelineReleaseVersion",
freelineRuntimeNoOp: "com.antfortune.freeline:runtime-no-op:$freelineReleaseVersion"
]

ext.deps = deps
2 changes: 1 addition & 1 deletion freeline-gradle-plugin/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def developerEmail = '[email protected]'
def publishedGroupId = 'com.antfortune.freeline'
def artifact = 'gradle'
def libraryName = 'freeline-gradle'
def publishVersion = '0.8.6'
def publishVersion = FREELINE_RELEASE_VERSION

install {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion freeline-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'java'
apply from: 'bintray.gradle'

group 'com.antfortune.freeline'
version '0.8.6'
version FREELINE_RELEASE_VERSION

sourceCompatibility = 1.6
targetCompatibility = 1.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ class FreelineAnnotationCollector {
sAnnotationCollection.keySet().each { key ->
sAnnotationCollection[key].each { value ->
if (value['isJar']) {
modules.each { m, sep ->
if (value['path'].contains(sep)) {
value['module'] = m
value['java_path'] = findJavaPath(description, m as String, value['className'] as String)
return false
modules.each { m, mappers ->
for (String mapper : mappers) {
if (value['path'].contains(mapper)) {
value['module'] = m
value['java_path'] = findJavaPath(description, m as String, value['className'] as String)
return false
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.util.zip.ZipEntry
*/
class FreelineInjector {

public static void inject(List<String> excludeClasses, File file, Collection<String> modules) {
public static void inject(List<String> excludeClasses, File file, Collection<List<String>> modules) {
if (file.path.endsWith(".class")
&& !isExcluded(file.path, excludeClasses)) {
realInject(file)
Expand All @@ -28,8 +28,8 @@ class FreelineInjector {
}
}

public static boolean checkInjection(File file, Collection<String> modules) {
return (file.absolutePath.contains("intermediates" + File.separator + "exploded-aar" + File.separator)
public static boolean checkInjection(File file, Collection<List<String>> modules) {
return (file.absolutePath.contains("build" + File.separator + "intermediates" + File.separator)
&& !file.absolutePath.contains("com.antfortune.freeline")
&& !file.absolutePath.contains("com.android.support")
&& isProjectModuleJar(file.absolutePath, modules))
Expand All @@ -48,10 +48,12 @@ class FreelineInjector {
return false
}

private static boolean isProjectModuleJar(String path, Collection<String> modules) {
for (String module : modules) {
if (path.contains(module)) {
return true
private static boolean isProjectModuleJar(String path, Collection<List<String>> modules) {
for (List<String> mappers : modules) {
for (String mapper : mappers) {
if (path.contains(mapper)) {
return true
}
}
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.gradle.util.VersionNumber
*/
class FreelinePlugin implements Plugin<Project> {

String freelineVersion = "0.8.6"
String freelineVersion = "0.8.7"

@Override
void apply(Project project) {
Expand Down Expand Up @@ -47,7 +47,7 @@ class FreelinePlugin implements Plugin<Project> {
if (!project.plugins.hasPlugin("com.android.application")) {
throw new RuntimeException("Freeline plugin can only be applied for android application module.")
}

project.android.applicationVariants.each { variant ->
def extension = project.extensions.findByName("freeline") as FreelineExtension
def productFlavor = extension.productFlavor
Expand All @@ -57,7 +57,7 @@ class FreelinePlugin implements Plugin<Project> {
def applicationProxy = extension.applicationProxy
def aptEnabled = extension.aptEnabled
def retrolambdaEnabled = extension.retrolambdaEnabled
def freelineBuild = FreelineUtils.getProperty(project, "freelineBuild");
def freelineBuild = FreelineUtils.getProperty(project, "freelineBuild")

if (!"debug".equalsIgnoreCase(variant.buildType.name as String)) {
println "variant ${variant.name} is not debug, skip hack process."
Expand Down Expand Up @@ -285,7 +285,11 @@ class FreelinePlugin implements Plugin<Project> {
def modules = [:]
project.rootProject.allprojects.each { pro ->
//modules.add("exploded-aar" + File.separator + pro.group + File.separator + pro.name + File.separator)
modules[pro.name] = "exploded-aar" + File.separator + pro.group + File.separator + pro.name + File.separator
//modules[pro.name] = "exploded-aar" + File.separator + pro.group + File.separator + pro.name + File.separator
modules[pro.name] = [
"exploded-aar${File.separator}${pro.group}${File.separator}${pro.name}${File.separator}",
"${pro.name}${File.separator}build${File.separator}intermediates${File.separator}bundles${File.separator}"
]
}

if (preDexTask) {
Expand Down Expand Up @@ -333,6 +337,12 @@ class FreelinePlugin implements Plugin<Project> {
}

if (preDexTask == null) {
def providedConf = project.configurations.findByName("provided")
if (providedConf) {
def providedJars = providedConf.asPath.split(File.pathSeparator)
jarDependencies.addAll(providedJars)
}

jarDependencies.addAll(addtionalJars) // add all additional jars to final jar dependencies
def json = new JsonBuilder(jarDependencies).toPrettyString()
project.logger.info(json)
Expand Down Expand Up @@ -437,7 +447,10 @@ class FreelinePlugin implements Plugin<Project> {
project.rootProject.allprojects.each { p ->
if (p.hasProperty("android") && p.android.hasProperty("sourceSets")) {
def mapper = ["match" : "", "path" : []]
mapper.match = "exploded-aar${File.separator}${p.group}${File.separator}${p.name}${File.separator}"
mapper.match = [
"exploded-aar${File.separator}${p.group}${File.separator}${p.name}${File.separator}",
"${p.name}${File.separator}build${File.separator}intermediates${File.separator}bundles${File.separator}"
]
if (type == "resources") {
p.android.sourceSets.main.res.srcDirs.asList().collect(mapper.path) { it.absolutePath }
} else if (type == "assets") {
Expand All @@ -458,14 +471,16 @@ class FreelinePlugin implements Plugin<Project> {
if (f.exists() && f.isDirectory()) {
def path = f.absolutePath
println "find resource path: ${path}"
if (path.contains("exploded-aar")) {
if (path.contains("exploded-aar") || path.contains("build-cache") || path.contains("intermediates")) {
def marker = false
mappers.each { mapper ->
if (path.contains(mapper.match as String)) {
mapper.path.collect(resourcesDependencies.local_resources) {it}
println "add local resource: ${path}"
marker = true
return false
mapper.match.each { matcher ->
if (path.contains(matcher as String)) {
mapper.path.collect(resourcesDependencies.local_resources) {it}
println "add local resource: ${path}"
marker = true
return false
}
}
}
if (!marker) {
Expand Down
8 changes: 4 additions & 4 deletions freeline-runtime-no-op/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ group 'com.antfortune.freeline'
version FREELINE_RELEASE_VERSION

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10
versionName "0.7.0"
}
Expand Down
8 changes: 4 additions & 4 deletions freeline-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ group 'com.antfortune.freeline'
version FREELINE_RELEASE_VERSION

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10
versionName "0.7.0"
}
Expand Down
10 changes: 5 additions & 5 deletions freeline-sample/ThirdParty/payment/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -21,5 +21,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile deps.appcompatV7
}
10 changes: 5 additions & 5 deletions freeline-sample/ThirdParty/share/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -21,5 +21,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile deps.appcompatV7
}
34 changes: 13 additions & 21 deletions freeline-sample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
apply plugin: 'com.android.application'
apply plugin: 'com.antfortune.freeline'
apply plugin: 'android-apt'

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.antfortune.freeline.sample"
minSdkVersion 14
targetSdkVersion 24
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
manifestPlaceholders = [
SUPPORT_RTL: false
SUPPORT_RTL: false
]
}
buildTypes {
Expand Down Expand Up @@ -46,7 +45,6 @@ android {

productFlavors {
normal {

}

develop {
Expand All @@ -56,30 +54,24 @@ android {
useLibrary 'org.apache.http.legacy'
}

apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName "com.antfortune.freeline.sample"
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile deps.appcompatV7

compile project(":freeline-sample:common")
compile project(":freeline-sample:PureJavaLib")
compile project(":freeline-sample:ThirdParty:share")
compile project(":freeline-sample:ThirdParty:payment")

debugCompile project(":freeline-runtime")
releaseCompile project(":freeline-runtime-no-op")
testCompile project(":freeline-runtime-no-op")
monkeyCompile project(":freeline-runtime-no-op")
debugCompile deps.freelineRuntime
releaseCompile deps.freelineRuntimeNoOp
testCompile deps.freelineRuntimeNoOp
monkeyCompile deps.freelineRuntimeNoOp

compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

apt "org.androidannotations:androidannotations:4.1.0"
compile "org.androidannotations:androidannotations-api:4.1.0"
annotationProcessor "org.androidannotations:androidannotations:4.1.0"
}
10 changes: 5 additions & 5 deletions freeline-sample/common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -21,6 +21,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile deps.appcompatV7
compile project(":freeline-sample:resources")
}
Loading

0 comments on commit 95d14eb

Please sign in to comment.