Skip to content

Commit

Permalink
Add dummy sources and Gradle profiler (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
oehme authored and kageiit committed Dec 18, 2016
1 parent e5ef2d9 commit ca88607
Show file tree
Hide file tree
Showing 140 changed files with 1,420 additions and 354 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ build
BUCK
.buckd
buck-out
profile-out*
gradle-user-home
**/src/
!**/src/*/AndroidManifest.xml
!gradle/SourceTemplate/app/src
2 changes: 1 addition & 1 deletion Padraig/arbitrate/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:synarchy')
compile project(':Padraig:follicle')
Expand Down
2 changes: 1 addition & 1 deletion Padraig/cuminoin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':Padraig:follicle')
}
2 changes: 1 addition & 1 deletion Padraig/decollete/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':subvola:remigrate')
compile project(':subvola:gorgoneum:unwincing')
Expand Down
2 changes: 1 addition & 1 deletion Padraig/emerse/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile deps.support.annotations
compile deps.support.appCompat
Expand Down
14 changes: 7 additions & 7 deletions Padraig/endocoele/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.apt.butterKnifeCompiler
apt deps.other.recyclerview
apt deps.apt.daggerCompiler
apt deps.other.appcompat
apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor deps.apt.butterKnifeCompiler
annotationProcessor deps.other.recyclerview
annotationProcessor deps.apt.daggerCompiler
annotationProcessor deps.other.appcompat
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')
compile project(':subvola:Dipnoi')
compile project(':subvola:wordsmith')
compile project(':subvola:Leporis')
Expand Down
14 changes: 7 additions & 7 deletions Padraig/follicle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
apply plugin: 'com.jakewharton.butterknife'
dependencies {
apt deps.apt.butterKnifeCompiler
apt deps.other.recyclerview
apt deps.apt.daggerCompiler
apt deps.other.appcompat
apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor deps.apt.butterKnifeCompiler
annotationProcessor deps.other.recyclerview
annotationProcessor deps.apt.daggerCompiler
annotationProcessor deps.other.appcompat
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')
compile project(':subvola:Dipnoi')
compile project(':subvola:liming')
compile project(':subvola:wordsmith')
Expand Down
2 changes: 1 addition & 1 deletion Padraig/limitary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:proctoral')
compile deps.support.annotations
Expand Down
2 changes: 1 addition & 1 deletion Padraig/paegle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:worldway')
compile project(':outissue:stupendly')
Expand Down
2 changes: 1 addition & 1 deletion Padraig/quaestor/triduum/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:phasmatid')
compile deps.support.annotations
Expand Down
4 changes: 2 additions & 2 deletions Padraig/ratafee/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.apt.daggerCompiler
annotationProcessor deps.apt.daggerCompiler

compile project (':Padraig:emerse')
compile project (':outissue:proctoral')
Expand Down
2 changes: 1 addition & 1 deletion Padraig/signist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':Padraig:ratafee')
compile project(':outissue:nutate')
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Also provides an alternative build path using [Buck](https://buckbuild.com/) to

[![Master branch build status](https://travis-ci.org/kageiit/android-studio-gradle-test.svg?branch=master)](https://travis-ci.org/kageiit/android-studio-gradle-test)

## Setup

Run `./gradlew addSources` to generate source code for all subprojects.

## To build all apps with gradle:
```bash
./buildWithGradle
Expand All @@ -26,3 +30,9 @@ Installation instructions for: [Ant](http://ant.apache.org/), [Watchman](https:/
```bash
./buildWithBuck
```

## Benchmarking and profiling

Use the Gradle profiler to `--benchmark` or `--profile` scenarios. The available scenarios are defined in `performance.scenarios`

Example usage: `./gradle-profiler --profile chrome-trace upToDateSingleVariant`
10 changes: 5 additions & 5 deletions Tripoline/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'com.android.application'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.application';
dependencies {
apt deps.other.recyclerview
apt deps.apt.daggerCompiler
apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor deps.other.recyclerview
annotationProcessor deps.apt.daggerCompiler
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')

compile project(':outissue:nutate')
compile project(':outissue:worldway');
Expand Down
86 changes: 76 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
buildscript {
repositories {
mavenLocal()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.uber:okbuck:0.12.1'
classpath ('com.uber:okbuck:0.12.1') {
exclude module: 'gradle'
}
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}

allprojects {
project -> project.apply from: rootProject.file('dependencies.gradle')
repositories {
project -> project.apply from: rootProject.file('dependencies.gradle')
repositories {
jcenter()
}

def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
repositories.maven {
url = file.toURI()
def androidHome = System.getenv("ANDROID_HOME")
repositories {
maven {
url "$androidHome/extras/android/m2repository/"
}
maven {
url "$androidHome/extras/google/m2repository/"
}
}
}
Expand Down Expand Up @@ -83,7 +87,7 @@ subprojects { project ->
exclude 'META-INF/LICENSE'
}
dexOptions {
javaMaxHeapSize "4g"
javaMaxHeapSize "2g"
}
}
}
Expand Down Expand Up @@ -154,3 +158,65 @@ gradle.buildFinished {
"zip -d ${archive} ${ENTRIES_TO_DELETE}".execute().waitFor()
}
}

task cleanSources {
doLast {
subprojects.each {
delete fileTree(new File(it.projectDir, "src/")).exclude("main/AndroidManifest.xml")
}
}
}

task addSources {
doLast {
subprojects.each {
if (it.plugins.hasPlugin('com.android.application') || it.plugins.hasPlugin('com.android.library')) {
def sourceFolder = new File(it.projectDir, 'src')
println "Adding sources to: " + sourceFolder
copy {
from fileTree(new File(project.rootDir, "gradle/SourceTemplate/app/src/")).exclude("main/AndroidManifest.xml")
into sourceFolder
}

def activityClass = new File(sourceFolder, "main/java/gradle/example/LoginActivity.java")

def hasButterknife = hasDependency(it, "butterknife-8")
def hasAutoService = hasDependency(it, "auto-service");
def hasButterknifePlugin = it.plugins.hasPlugin('com.jakewharton.butterknife')

if (!hasAutoService) {
new File(sourceFolder, "main/java/gradle/example/Service.java").delete()
}
if (!hasButterknife || (!hasButterknifePlugin && it.plugins.hasPlugin('com.android.library'))) {
activityClass.text = activityClass.text.replace("@butterknife.BindView(R.id.login_form)", "")
}

if (hasButterknife && hasButterknifePlugin) {
activityClass.text = activityClass.text.replace("@butterknife.BindView(R.id.login_form)", "@butterknife.BindView(R2.id.login_form)")
}

adjustPackage(it, "LoginActivity")
if (hasAutoService) {
adjustPackage(it, "Service")
}
}
}
}
}

boolean hasDependency(Project project, String name) {
project.configurations.getByName("compile").resolve().find { it.name.contains(name) } != null
}

def adjustPackage(Project project, String className) {
def sourceFolder = new File(project.projectDir, 'src')
def sourceFile = new File(sourceFolder, "main/java/gradle/example/${className}.java")
def manifest = new File(sourceFolder, "main/AndroidManifest.xml").text;
def projectPackage = manifest.substring(manifest.indexOf('package="') + 9, manifest.indexOf('" xmlns:android'))

def exampleClassFolder = new File(sourceFolder, "main/java/${projectPackage.replace('.', '/')}");
exampleClassFolder.mkdirs();

sourceFile.text = sourceFile.text.replaceAll("package gradle.example;", "package ${projectPackage};")
sourceFile.renameTo(new File(exampleClassFolder, "${className}.java"))
}
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def versions = [

def buildConfig = [
compileSdkVersion: 25,
minSdkVersion : 16,
minSdkVersion : 21,
targetSdkVersion : 25,
buildToolsVersion: '25.0.0',
]
Expand All @@ -24,11 +24,11 @@ def android = [
testUtils : "com.android.tools:testutils:${versions.androidToolsVersion}"
]

def apt = [
def annotationProcessor = [
androidApi : 'com.google.android:android:4.1.1.4',
autoCommon : 'com.google.auto:auto-common:0.4',
autoService : 'com.google.auto.service:auto-service:1.0-rc2',
autoValue : 'com.google.auto.value:auto-value:1.3-rc2',
autoValue : 'com.google.auto.value:auto-value:1.4-rc1',
autoValueAnnotations: 'com.jakewharton.auto.value:auto-value-annotations:1.2-update1',
butterKnifeCompiler : "com.jakewharton:butterknife-compiler:${versions.butterKnifeVersion}",
daggerCompiler : "com.google.dagger:dagger-compiler:${versions.daggerVersion}",
Expand Down Expand Up @@ -184,7 +184,7 @@ ext.config = [

ext.deps = [
"android" : android,
"apt" : apt,
"apt" : annotationProcessor,
"debug" : debug,
"external" : external,
"other" : other,
Expand Down
6 changes: 3 additions & 3 deletions fratry/Cosmati/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.other.recyclerview
apt deps.apt.daggerCompiler
annotationProcessor deps.other.recyclerview
annotationProcessor deps.apt.daggerCompiler
compile deps.external.dagger
compile deps.other.rxlifecycle
compile deps.other.locationServiceGoogle
Expand Down
4 changes: 2 additions & 2 deletions fratry/Krapina/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.apt.daggerCompiler
annotationProcessor deps.apt.daggerCompiler

compile project(':outissue:extended')
compile deps.apt.javaxInject
Expand Down
2 changes: 1 addition & 1 deletion fratry/Ormond/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:extended')
compile deps.other.butterknife
Expand Down
2 changes: 1 addition & 1 deletion fratry/assumpsit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile deps.external.rxjava
compile deps.external.rxrelay
Expand Down
2 changes: 1 addition & 1 deletion fratry/asteep/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile deps.external.rxjava
compile deps.external.rxrelay
Expand Down
2 changes: 1 addition & 1 deletion fratry/audience/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
compile project(':outissue:extended')
compile project(':fratry:endothys')
Expand Down
10 changes: 5 additions & 5 deletions fratry/cepaceous/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.apt.daggerCompiler
apt deps.other.appcompat
annotationProcessor deps.apt.daggerCompiler
annotationProcessor deps.other.appcompat

apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')

compile project(':outissue:tetragram')
compile project(':outissue:extended')
Expand Down
6 changes: 3 additions & 3 deletions fratry/crankum/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')

compile project(':outissue:stupendly')
compile project(':outissue:caricetum:skiapod')
Expand Down
4 changes: 2 additions & 2 deletions fratry/crapple/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.other.recyclerview
annotationProcessor deps.other.recyclerview

compile project(':outissue:caricetum:concher')
compile project(':fratry:matchy')
Expand Down
8 changes: 4 additions & 4 deletions fratry/crippling/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.library'; apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.library';
dependencies {
apt deps.apt.daggerCompiler
apt project(':outissue:caricetum:handbolt')
apt project(':outissue:caricetum:Chelura')
annotationProcessor deps.apt.daggerCompiler
annotationProcessor project(':outissue:caricetum:handbolt')
annotationProcessor project(':outissue:caricetum:Chelura')
compile project(':outissue:tetragram')
compile project(':outissue:stupendly');
compile project(':outissue:caricetum:midship')
Expand Down
Loading

0 comments on commit ca88607

Please sign in to comment.