Skip to content

Commit

Permalink
+ update 0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lomanyong committed Nov 6, 2016
1 parent 3d81728 commit 7c3c4ab
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 6 deletions.
2 changes: 1 addition & 1 deletion freeline_core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

VERSION_FORMATTER = '{}({})'
FREELINE_VERSION = 'v0.8.0'
FREELINE_VERSION = 'v0.8.1'


def get_freeline_version():
Expand Down
2 changes: 1 addition & 1 deletion gradle/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.0'
def publishVersion = '0.8.1'

install {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/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.0'
version '0.8.1'

sourceCompatibility = 1.6
targetCompatibility = 1.6
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.antfortune.freeline

import groovy.json.JsonBuilder
import org.gradle.api.Project;

/**
* Created by huangyong on 16/11/3.
*/
class FreelineAnnotationCollector {

public static final def ANNOTATION_CLASSES = [
"Landroid/databinding/BindingAdapter;",
"Landroid/databinding/BindingConversion;",
"Landroid/databinding/Bindable;",
]

public static final def ANNOTATION_TARGETS = [
"Landroid/databinding/BindingAdapter;": "BindingAdapter",
"Landroid/databinding/BindingConversion;": "BindingConversion",
"Landroid/databinding/Bindable;": "Bindable"
]

private static def sAnnotationCollection = [:]

public static void addNewAnno(String anno, String path, String className, String entry, boolean isJar) {
String key = ANNOTATION_TARGETS[anno]
if (!sAnnotationCollection.containsKey(key)) {
sAnnotationCollection[key] = []
}

sAnnotationCollection[key].add(['path': path, 'className': className, 'entry': entry, 'isJar': isJar])
}

public static void saveCollections(Project project, String buildCacheDirPath, Map modules) {
def description = FreelineUtils.readProjectDescription(project)
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
}
}
} else {
value['module'] = project.name
value['java_path'] = findJavaPath(description, project.name, value['className'] as String)
}
}
}

def json = new JsonBuilder(sAnnotationCollection).toPrettyString()
println json
FreelineUtils.saveJson(json, FreelineUtils.joinPath(buildCacheDirPath, "freeline_annotation_info.json"), true)

sAnnotationCollection.clear()
}

private static String findJavaPath(def description, String module, String className) {
if (description != null) {
if (description['project_source_sets'].containsKey(module)) {
def relatedPath = className.replace("/", File.separator).replace(".class", ".java")
if (!relatedPath.endsWith(".java")) {
relatedPath = relatedPath + ".java"
}

def javaPath = null
description['project_source_sets'][module]['main_src_directory'].each { path ->
File file = new File(FreelineUtils.joinPath(path as String, relatedPath))
if (file.exists()) {
javaPath = file.absolutePath
return false
}
}

if (javaPath != null) {
return javaPath
}
}
}
return null
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.gradle.util.VersionNumber
*/
class FreelinePlugin implements Plugin<Project> {

String freelineVersion = "0.8.0"
String freelineVersion = "0.8.1"

@Override
void apply(Project project) {
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.antfortune.freeline:gradle:0.8.0'
classpath 'com.antfortune.freeline:gradle:0.8.1'
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'
Expand Down
2 changes: 1 addition & 1 deletion sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
FREELINE_RELEASE_VERSION=0.8.0
FREELINE_RELEASE_VERSION=0.8.1

0 comments on commit 7c3c4ab

Please sign in to comment.