Skip to content

Commit

Permalink
Merge pull request #48 from Kolyall/master
Browse files Browse the repository at this point in the history
master
  • Loading branch information
orhanobut authored Feb 27, 2019
2 parents 3206641 + 2d81295 commit 0d2e1bc
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build/
*.iml
*.ipr
*.iws
**/.idea/
**/.idea/shelf
**/.idea/workspace.xml
**/.idea/tasks.xml
Expand Down
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

4 changes: 2 additions & 2 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- build-tools-28.0.3
- android-23
- android-24
- android-26

env:
- GRADLE_OPTS="-Xmx512m -XX:MaxPermSize=512m"
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add the following code block to in your app/build.gradle.
```groovy
buildscript {
dependencies {
classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.0.0'
classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.1.0'
}
}
Expand Down
17 changes: 10 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7'
classpath 'org.aspectj:aspectjtools:1.8.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'org.aspectj:aspectjtools:1.8.10'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -40,14 +41,16 @@ subprojects { project ->

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:3.3.0'
}
}

repositories {
google()
jcenter()
}
}
Expand All @@ -58,9 +61,9 @@ task clean(type: Delete) {

ext {
minSdkVersion = 10
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '25.0.2'
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = "28.0.3"
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=2.0.0
VERSION_NAME=2.1.0
GROUP=com.orhanobut.tracklytics

POM_DESCRIPTION=Android analytics tracklytics
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 28 14:50:46 CEST 2017
#Tue Jan 22 16:58:26 MSK 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
16 changes: 8 additions & 8 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {
mavenLocal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-3"
classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.1.0'
}
}

Expand All @@ -22,8 +22,8 @@ repositories {
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "28.0.3"

compileOptions {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand All @@ -33,7 +33,7 @@ android {
defaultConfig {
applicationId "com.orhanobut.sample"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
Expand All @@ -46,8 +46,8 @@ android {
}

dependencies {
testCompile deps.junit
testCompile deps.truth
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:0.28'

compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.20"
}
14 changes: 7 additions & 7 deletions tracklytics-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apply plugin: 'groovy'
apply plugin: 'nexus'

dependencies {
compile gradleApi()
compile localGroovy()
compile 'org.aspectj:aspectjtools:1.8.10'
compile 'org.aspectj:aspectjrt:1.8.10'
compile 'com.android.tools.build:gradle:2.3.0'
implementation gradleApi()
implementation localGroovy()
implementation 'org.aspectj:aspectjtools:1.8.10'
implementation 'org.aspectj:aspectjrt:1.8.10'
implementation 'com.android.tools.build:gradle:3.3.0'

testCompile deps.junit
testImplementation 'junit:junit:4.12'
}

modifyPom {
Expand All @@ -27,7 +27,7 @@ modifyPom {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
Distribution POM_LICENCE_DIST
distribution POM_LICENCE_DIST
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,72 @@ class TracklyticsPlugin implements Plugin<Project> {
void apply(Project project) {

project.dependencies {
compile 'org.aspectj:aspectjrt:1.8.10'
compile 'com.orhanobut.tracklytics:tracklytics-runtime:2.0.0'
implementation 'org.aspectj:aspectjrt:1.8.10'
implementation 'com.orhanobut.tracklytics:tracklytics-runtime:2.1.0'
}

project.android.applicationVariants.all { variant ->
JavaCompile javaCompile = variant.javaCompile
String[] args = [
"-showWeaveInfo",
"-1.7",
"-inpath", javaCompile.destinationDir.toString(),
"-aspectpath", javaCompile.classpath.asPath,
"-d", javaCompile.destinationDir.toString(),
"-classpath", javaCompile.classpath.asPath,
"-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)
]
JavaCompile javaCompile
if (variant.hasProperty('javaCompileProvider')) {
// Android 3.3.0+
javaCompile = variant.javaCompileProvider.get()
} else {
javaCompile = variant.javaCompile
}

// Gets the variant name and capitalize the first character
def variantName = variant.name[0].toUpperCase() + variant.name[1..-1].toLowerCase()

// Weave the binary for the actual code
// CompileSources task is invoked after java and kotlin compilers and copy kotlin classes
// That's the moment we have the finalized byte code and we can weave the aspects
project.tasks.findByName('compile' + variantName + 'Sources')?.doLast {
def destinationDir = javaCompile.destinationDir.toString()
def classPath = javaCompile.classpath.asPath
def bootClassPath = project.android.bootClasspath.join(File.pathSeparator)
String[] args = [
"-showWeaveInfo",
"-1.7",
"-inpath", destinationDir,
"-aspectpath", classPath,
"-d", destinationDir,
"-classpath", classPath,
"-bootclasspath", bootClassPath
]
new Main().run(args, new MessageHandler(true));
println("----------------------------------------------")
println("--------------Tracklytics Weave---------------")
println("----------------------------------------------")
println("destinationDir: $destinationDir")
println("classPath: $classPath")
println("bootClassPath: $bootClassPath")
println("----------------------------------------------")
}

// Weave the binary for unit tests
// compile unit tests task is invoked after the byte code is finalized
// This is the time that we can weave the aspects onto byte code
project.tasks.findByName('compile' + variantName + 'UnitTestSources')?.doLast {
def destinationDir = javaCompile.destinationDir.toString()
def classPath = javaCompile.classpath.asPath
def bootClassPath = project.android.bootClasspath.join(File.pathSeparator)
String[] args = [
"-showWeaveInfo",
"-1.7",
"-inpath", destinationDir,
"-aspectpath", classPath,
"-d", destinationDir,
"-classpath", classPath,
"-bootclasspath", bootClassPath
]
new Main().run(args, new MessageHandler(true));
println("----------------------------------------------")
println("--------------Tracklytics Weave---------------")
println("----------------------------------------------")
println("destinationDir: $destinationDir")
println("classPath: $classPath")
println("bootClassPath: $bootClassPath")
println("----------------------------------------------")
}
}
}
Expand Down
39 changes: 26 additions & 13 deletions tracklytics-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,47 @@ android {
textReport true
textOutput 'stdout'
}
buildToolsVersion '25.0.2'
buildToolsVersion "28.0.3"
}

dependencies {
provided deps.aspectjRuntime
compileOnly "org.aspectj:aspectjrt:1.8.10"

testCompile deps.junit
testCompile deps.truth
testCompile deps.mockito
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:0.28'
testImplementation "org.mockito:mockito-core:1.10.19"
}

android.libraryVariants.all { variant ->
JavaCompile javaCompile = variant.javaCompile
JavaCompile javaCompile
if (variant.hasProperty('javaCompileProvider')) {
// Android 3.3.0+
javaCompile = variant.javaCompileProvider.get()
} else {
javaCompile = variant.javaCompile
}
javaCompile.doLast {
def destinationDir = javaCompile.destinationDir.toString()
def classPath = javaCompile.classpath.asPath
def bootClassPath = project.android.bootClasspath.join(File.pathSeparator)
String[] args = [
"-showWeaveInfo",
"-1.7",
"-inpath", javaCompile.destinationDir.toString(),
"-aspectpath", javaCompile.classpath.asPath,
"-d", javaCompile.destinationDir.toString(),
"-classpath", javaCompile.classpath.asPath,
"-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)
"-showWeaveInfo",
"-1.7",
"-inpath", destinationDir,
"-aspectpath", classPath,
"-d", destinationDir,
"-classpath", classPath,
"-bootclasspath", bootClassPath
]

new Main().run(args, new MessageHandler(true));
println("----------------------------------------------")
println("---------Tracklytics-runtime Weave------------")
println("----------------------------------------------")
println("destinationDir: $destinationDir")
println("classPath: $classPath")
println("bootClassPath: $bootClassPath")
println("----------------------------------------------")
}
}

Expand Down

0 comments on commit 0d2e1bc

Please sign in to comment.