Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aggregate functions (average , min , max) #712

Open
wants to merge 179 commits into
base: feature/updateInTx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
05051a2
Catching Throwable instead of ClassNotFoundException because Class.fo…
mitchyboy9 Jul 27, 2015
8eeaebe
cleaned Select from hardcoded Strings
RoyMontoya Oct 16, 2015
d038f6c
revert change on whereCond name
RoyMontoya Oct 16, 2015
da0a7a6
added test
RoyMontoya Oct 20, 2015
3cc5cf1
format fix
RoyMontoya Oct 20, 2015
25b9868
merge select-cleanup to test-fix
RoyMontoya Oct 20, 2015
4b08bf4
Merge pull request #1 from RoyMontoya/test-fix
RoyMontoya Oct 20, 2015
547c816
added group_by to toSQL
RoyMontoya Oct 20, 2015
f5ca5e3
Add MultiColumn Unique Table constraint support
alfmatos Sep 25, 2015
98f8df5
Filtered classes by DOMAIN_PACKAGE_NAME
Oct 28, 2015
7e451bc
Merge pull request #449 from satyan/feature/updateInTx
sibelius Dec 1, 2015
3a507b2
save record when update fails
sibelius Dec 1, 2015
d099ab3
Merge pull request #450 from satyan/feature/update_like_insert_update
sibelius Dec 1, 2015
d75c4de
Merge pull request #400 from RoyMontoya/select-cleanup
sibelius Dec 2, 2015
3d77449
refactor SchemaGenerator and adding some tests
sibelius Dec 2, 2015
e8ad00a
Merge pull request #451 from satyan/feature/testSchemaGenerator
sibelius Dec 2, 2015
171e14d
MultiUnique DSL to multicolumn table unique constraint
sibelius Dec 2, 2015
92f50f4
Merge branch 'alfmatos-master'
sibelius Dec 2, 2015
b8ad309
Add Gitter badge
gitter-badger Dec 2, 2015
a12d27a
Merge pull request #452 from gitter-badger/gitter-badge
sibelius Dec 2, 2015
7401679
update README.md
sibelius Dec 3, 2015
91ff7e6
Merge branch 'master' of github.com:satyan/sugar
sibelius Dec 3, 2015
93c2161
warn developer to upgrade database on missing colName
sibelius Dec 3, 2015
cf5f265
Merge pull request #453 from satyan/feature/warningOnMissingColumn
sibelius Dec 3, 2015
243ee4f
Travis
Dec 3, 2015
80baa64
travis error
nursultanturdaliev Dec 3, 2015
9e5d001
Jacoco
nursultanturdaliev Dec 3, 2015
a6f9bfc
Jacoco
nursultanturdaliev Dec 3, 2015
2a014a5
Travis Build fix
nursultanturdaliev Dec 3, 2015
1624af3
Travis Build fix
nursultanturdaliev Dec 3, 2015
2753947
Travis Build fix
nursultanturdaliev Dec 3, 2015
f64b71b
Travis Build fix
nursultanturdaliev Dec 3, 2015
3261371
Travis Build fix
nursultanturdaliev Dec 3, 2015
75db4fb
Travis Build fix
nursultanturdaliev Dec 3, 2015
f476390
Travis Build fix
nursultanturdaliev Dec 3, 2015
e7983f5
Travis Build fix
nursultanturdaliev Dec 3, 2015
1c9ca0d
Travis Build fix
nursultanturdaliev Dec 3, 2015
5761057
Travis Build fix
nursultanturdaliev Dec 3, 2015
d007a2f
Travis Build fix
nursultanturdaliev Dec 3, 2015
fdae8e7
Travis Build fix
nursultanturdaliev Dec 3, 2015
b087e0c
Travis Build fix
nursultanturdaliev Dec 3, 2015
0b138f6
Merge pull request #455 from nurolopher/master
sibelius Dec 3, 2015
9489846
JacocoReportTest
nursultanturdaliev Dec 4, 2015
0004c12
Merge pull request #457 from nurolopher/master
sibelius Dec 4, 2015
4d2df14
Multiline and single line comments on sql migration files.
nursultanturdaliev Dec 4, 2015
79bd040
Logging
nursultanturdaliev Dec 4, 2015
71444db
Merge pull request #459 from nurolopher/master
sibelius Dec 5, 2015
d06aafc
Removed unused imports and redundant variable value assignments.
nursultanturdaliev Dec 5, 2015
f8eb02e
Merge pull request #460 from nurolopher/master
sibelius Dec 6, 2015
7f881a8
Merge pull request #362 from mitchyboy9/master
sibelius Dec 7, 2015
297a838
removing static from callback interface
sibelius Dec 11, 2015
def9904
removing unique for auto generated add columns migrations
sibelius Dec 11, 2015
eed22a6
Merge branch 'jedld-master'
sibelius Dec 11, 2015
8156895
fix satyan/sugar#467
sibelius Dec 14, 2015
fff7ae0
fix executeScript on SchemaGenerator
sibelius Dec 14, 2015
9f371b3
update README, documentation is updated
sibelius Dec 14, 2015
7b210e1
Added retrolambda in classloader class lookup in ReflectionUtil.java
tkhduracell Jan 1, 2016
b183746
Merge pull request #486 from tkhduracell/fix-retrolamda
sibelius Jan 2, 2016
416df04
Fixing migration to single dex after multidex.
Jan 7, 2016
b461c0d
Merge pull request #492 from dnalves/fixingMultidexToSingle
sibelius Jan 7, 2016
5690f92
Added the @Target annotation for compile-time error checking.
tevjef Jan 12, 2016
3de393c
Merge pull request #498 from tevjef/master
sibelius Jan 12, 2016
5924594
added syntax highlighting in readme
hellerve Jan 21, 2016
1d944a2
Merge pull request #505 from hellerve/master
sibelius Jan 21, 2016
fafe384
Update README.md
enyciaa Feb 12, 2016
a975ec9
Merge pull request #521 from enyciaa/patch-1
sibelius Feb 12, 2016
473820e
Update CHANGELOG.md
sibelius Mar 7, 2016
1ca7267
Update README.md
sibelius Mar 7, 2016
784b3da
add save/update/delete usage for @Table annotations
redgetan Mar 18, 2016
a9d4b41
Merge pull request #547 from redgetan/master
sibelius Mar 19, 2016
fc285ac
change the type of the args list to String
fhernandezn Mar 24, 2016
8ee7cf3
Merge pull request #551 from frankweb/simplify-convert-args-method
sibelius Mar 28, 2016
619b5db
adding codetriage to sugar
sibelius Mar 28, 2016
941bd36
find works with true/false
egrado Mar 29, 2016
2358dae
removing iml from repo
sibelius Mar 31, 2016
ed4c817
add sqlite keywords support
Mar 31, 2016
8b80057
fix error
Apr 1, 2016
37bef8f
fix error
Apr 1, 2016
a0dc1cc
change list and output
Apr 2, 2016
55c125d
Merge pull request #557 from geracervantes/master
Apr 2, 2016
b9d826c
Make SugarContext getSugarDb public
Apr 2, 2016
ea76217
Changes in Select.java:
Apr 2, 2016
5007b36
Merge pull request #562 from JonatanSalas/master
Apr 2, 2016
4a5cbb5
General project update:
Apr 4, 2016
331f61c
Updated example app build.gradle file app-compat dependency
Apr 4, 2016
a814f31
Updated travis.yml buildTools version to 23.0.3
Apr 4, 2016
e776a3e
Added two test to keep coverage
Apr 4, 2016
94f296f
Minimal modifications in KeyWordUtil
Apr 4, 2016
cb84ec2
Merge pull request #563 from JonatanSalas/master
Apr 4, 2016
fbd7475
Merge pull request #553 from egrado/master
Apr 5, 2016
92301ea
Add Instant Run support
firaskafri Apr 5, 2016
e5d80b5
Merge pull request #564 from firasalkafri/master
sibelius Apr 5, 2016
519c83d
Class not found in getDomainClass https://github.com/satyan/sugar/iss…
Apr 5, 2016
ae9ca55
Merge pull request #565 from lupsyn/feature/application-context-fixing
Apr 5, 2016
86cd849
Remove unnecessary console spam, as result: speed up + 20-30%
Apr 6, 2016
02e15ed
Update SugarContext.java
Rexee Apr 6, 2016
233a6f9
moved to ManifestHelper
Rexee Apr 6, 2016
488c6b0
Update SugarRecord.java
Rexee Apr 6, 2016
e6752ac
Update SugarRecord.java
Rexee Apr 6, 2016
c81685c
Update ManifestHelper.java
Rexee Apr 6, 2016
a85264f
Update ManifestHelperTest.java
Rexee Apr 6, 2016
f025692
Update SugarContext.java
Rexee Apr 6, 2016
d630e39
Update ManifestHelper.java
Rexee Apr 6, 2016
0d3bed9
Update SugarContext.java
Rexee Apr 6, 2016
b16e653
Merge pull request #568 from Rexee/master
Apr 6, 2016
a4c94ef
Project Update:
Apr 6, 2016
795da2c
Project update:
Apr 6, 2016
46321ab
Added more Test methods to NamingHelperTest class
Apr 6, 2016
bb674ee
Start migration of test to library in order to increment coverage.
Apr 8, 2016
602e61f
Start migration of test to library in order to increment coverage.
Apr 8, 2016
dbcc272
Deleted DummyContext class
Apr 8, 2016
ba572f9
Added NumberComparatorTest
Apr 8, 2016
1a600ce
Solved bug with SugarTransactionHelper
Apr 8, 2016
b6fdb8e
Added SugarDbTest
Apr 8, 2016
e4a29d1
Deleted all test and classes from sample app
Apr 9, 2016
445c63b
Added static import to replace SugarRecord class import
Apr 9, 2016
2786aaa
try to fix error with Coverrals
Apr 9, 2016
e083fd4
only checks in library, not in example
Apr 9, 2016
584e9de
Updated gradle plugin to version 2.0.0
Apr 9, 2016
9828d51
call to gradle wrapper in travis.yml
Apr 9, 2016
914ca19
call to gradle wrapper in travis.yml
Apr 9, 2016
7743c6c
Updated build.gradle files
Apr 9, 2016
6b3182c
Added Test for SugarConfig
Apr 10, 2016
c9f21a5
Added test for private constructor in KeyWordUtil
Apr 10, 2016
a8e28b2
Commented test in ReflectionUtil
Apr 10, 2016
cb51e01
Added test in ReflectionUtil
Apr 10, 2016
6557f58
Added more test in ReflectionUtil
Apr 10, 2016
29fe48c
Added more test to ReflectionUtil
Apr 10, 2016
de7c38b
Added more tests to com.orm test package
Apr 10, 2016
3831f3f
Added more test to SchemaGeneratorTest
Apr 11, 2016
eede8a5
Solved error in ReflectionUtilTest
Apr 11, 2016
dec896a
Merge pull request #569 from JonatanSalas/master
Apr 11, 2016
e2396b0
add method afterTableCreated that executes a sql file with the name o…
Apr 13, 2016
f2ff627
refactoting executeScriptFile to receive a path that could be sugar_u…
Apr 13, 2016
4eb17aa
Updated build.gradle files to add support for RetroLambda
Apr 16, 2016
23587ee
Added delete, delete with params and deleteAll methods
Apr 16, 2016
f2bca5b
Deleted all future.isDone calls
Apr 17, 2016
776a33c
Added more tests to SugarDataSourceTest
Apr 17, 2016
cd1949b
Extracted retrolambda because of travis CI troubleshooting around JAV…
Apr 17, 2016
c7d3961
Added bulkInsert method
Apr 17, 2016
a716a34
Added class documentation
Apr 17, 2016
b85f226
Added more test
Apr 17, 2016
ae23fa6
modified count method
Apr 17, 2016
badf546
Added test to UpdateInTx
Apr 17, 2016
4059753
Added Interfaces documentation
Apr 17, 2016
d9bceb0
Added ThreadUtil documentation
Apr 17, 2016
7f60eb9
Deleted all null assigns
Apr 17, 2016
ce7d802
Merge pull request #577 from marcusbalbi/master
Apr 21, 2016
92b675e
Implement SugarRecord.sum()
SiebelsTim May 14, 2016
f43255f
Add tests for sum()
SiebelsTim May 16, 2016
dabff00
Make SugarRecord API more versatile
SiebelsTim May 16, 2016
59a2a91
Improve API
SiebelsTim May 16, 2016
0ada490
adding missing info of how to use master version
sibelius May 16, 2016
af9abfa
using ManifestHelper.isDebugEnabled() to disable logs based on meta-d…
sibelius Jun 16, 2016
8a4cd58
Merge pull request #600 from SiebelsTim/impl-sum
sibelius Jun 24, 2016
7434b98
Merge pull request #580 from JonatanSalas/master
sibelius Jun 24, 2016
5f3c63d
Added OneToMany relation support.
Vookash Aug 3, 2016
96c843a
Refactored sugar record inflation.
Vookash Aug 3, 2016
463bf3e
Refactored ObjectInflater name.
Vookash Aug 18, 2016
0f466d7
Improved tests.
Vookash Aug 18, 2016
1ca3ecc
Improved tests.
Vookash Aug 18, 2016
e93b2f1
Fixed NamingHelperTest.
Vookash Aug 22, 2016
cbd08b4
Improved tests and logging.
Vookash Aug 27, 2016
cdaefd4
Merge pull request #659 from Vookash/master
sibelius Sep 2, 2016
ca5dd14
Merge pull request #602 from SiebelsTim/improve-api
sibelius Sep 2, 2016
df12176
NullPointerException when try to add null foreign record fix
bioker Sep 28, 2016
d057a0c
fixes of tests for foreign record allow null integration
bioker Sep 29, 2016
d502791
Merge pull request #1 from satyan/master
RossinesP Oct 6, 2016
b800c4a
* The @MultiUnique annotation is now inherited, so that we can use it…
Oct 6, 2016
cb45742
Merge pull request #681 from RossinesP/master
sibelius Oct 6, 2016
f7f6b05
Merge pull request #677 from bioker/master
sibelius Nov 9, 2016
e261342
Update README.md
sibelius Dec 23, 2016
5dac151
initial commit for max & average feature
RahulRavindren Dec 25, 2016
d5b2086
min & max methods added
Dec 26, 2016
fecf736
sanity check for fields being null.
Dec 26, 2016
11cc497
raw query revert
Dec 27, 2016
da838b3
statement correction
Dec 27, 2016
72b4a6f
code changes
Dec 27, 2016
85de771
nomenclature change
Dec 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
language: android
jdk: oraclejdk7

env:
global:
- TERM=dumb
android:
components:
- sys-img-armeabi-v7a-android-23
- tools
- build-tools-23.0.2
- build-tools-23.0.3
- android-23

- extra-android-m2repository
before_script:
- sudo service postgresql stop || true
- sudo service mysql stop || true
- sudo service memcached stop || true
- sudo service bootlogd stop || true
- sudo service elasticsearch stop || true
- sudo service mongodb stop || true
- sudo service neo4j stop || true
- sudo service cassandra stop || true
- sudo service riak stop || true
- sudo service rsync stop || true
- sudo service x11-common stop || true
script:
- gradle clean build connectedCheck coveralls
- ./gradlew clean build connectedCheck coveralls

cache:
directories:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Sugar Releases

## [Unreleased]


## v1.5
### Added
* [#328](https://github.com/satyan/sugar/pull/328) @jedid auto add new columns during database upgrade, fix [#299](https://github.com/satyan/sugar/issues/299) and [#151](https://github.com/satyan/sugar/issues/151)
* [#389](https://github.com/satyan/sugar/pull/389) @alfmatos MultiUnique DSL to handle MultiColumn Unique Table constraint
* @sibeliusseraphini update, updateInTx methods based on Unique values of SugarRecord
* [#155](https://github.com/satyan/sugar/issues/155) @benohalloran adding Cursors for Cursor Adapters [Pull 312](https://github.com/satyan/sugar/pull/312)
* [#430](https://github.com/satyan/sugar/pull/430) @sibeliusseraphini update to roboelectric 3.0 and target android-32
Expand All @@ -11,6 +16,8 @@
* [#423](https://github.com/satyan/sugar/pull/423) @sibeliusseraphini moving changelog of README.md to CHANGELOG.md

### Fixed
* [#362](https://github.com/satyan/sugar/pull/362) @mitchyboy9 fixed NoClassDefFoundError
* [#455](https://github.com/satyan/sugar/pull/455) @nurolopher fixed travis and coveralls config
* [#434](https://github.com/satyan/sugar/pull/434) @bendaniel10 fix multi-dex
* [#410](https://github.com/satyan/sugar/pull/410) [#408](https://github.com/satyan/sugar/pull/408) @RoyMontoya simplify code
* [#327](https://github.com/satyan/sugar/pull/327) @tracytheron support multi-dex
Expand Down
96 changes: 83 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Sugar ORM [![Build Status](https://travis-ci.org/satyan/sugar.svg?branch=master)](https://travis-ci.org/satyan/sugar) [![Coverage Status](https://coveralls.io/repos/satyan/sugar/badge.svg?branch=master)](https://coveralls.io/r/satyan/sugar?branch=master)
# Sugar ORM [![Build Status](https://travis-ci.org/satyan/sugar.svg?branch=master)](https://travis-ci.org/satyan/sugar) [![Coverage Status](https://coveralls.io/repos/satyan/sugar/badge.svg?branch=master)](https://coveralls.io/r/satyan/sugar?branch=master) [![Code Triagers Badge](http://www.codetriage.com/satyan/sugar/badges/users.svg)](http://www.codetriage.com/satyan/sugar)

[![Join the chat at https://gitter.im/satyan/sugar](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/satyan/sugar?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Insanely easy way to work with Android databases.

Official documentation can be found [here](http://satyan.github.io/sugar). The example application is provided in the **example** folder in the source.
Official documentation can be found [here](http://satyan.github.io/sugar) - Check some examples below. The example application is provided in the **example** folder in the source.

## Looking for contributors
We need contributors to help maintain this project, ask @satyan for repo permission

Otherwise you can use another ORM, like https://github.com/requery/requery or https://realm.io/

## Features

Expand All @@ -21,7 +28,7 @@ There are four ways to install Sugar:
This is the preferred way. Simply add:

```groovy
compile 'com.github.satyan:sugar:1.4'
compile 'com.github.satyan:sugar:1.5'
```

to your project dependencies and run `gradle build` or `gradle assemble`.
Expand All @@ -34,7 +41,7 @@ Declare the dependency in Maven:
<dependency>
<groupId>com.github.satyan</groupId>
<artifactId>sugar</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
```

Expand All @@ -46,13 +53,52 @@ Download the source code and import it as a library project in Eclipse. The proj

Visit the [releases](https://github.com/satyan/sugar/releases) page to download jars directly. You can drop them into your `libs` folder and configure the Java build path to include the library. See this [tutorial](http://www.vogella.com/tutorials/AndroidLibraryProjects/article.html) for an excellent guide on how to do this.


### How to use master version
First, download sugar repository
```
git clone [email protected]:satyan/sugar.git
```

include this in your **settings.gradle**
```gradle
include ':app' // your module app
include ':sugar'

def getLocalProperty(prop) {
Properties properties = new Properties()
properties.load(new File(rootDir.absolutePath + '/local.properties').newDataInputStream())
return properties.getProperty(prop, '')
}

project(':sugar').projectDir = new File(getLocalProperty('sugar.dir'))

```

include this in your **local.properties**
```
sugar.dir=/path/to/sugar/library
```

add sugar project to the dependencies of your main project (build.gradle)
```gradle
dependencies {
compile project(':sugar')
}
```

You should also comment this line just comment this line (library/build.gradle): https://github.com/satyan/sugar/blob/master/library%2Fbuild.gradle#L2

```gradle
// apply from: '../maven_push.gradle'
```
===================

After installing, check out how to set up your first database and models [here](http://satyan.github.io/sugar/getting-started.html).
After installing, check out how to set up your first database and models [here](http://satyan.github.io/sugar/getting-started.html) **Outdated**. Check examples of 1.4 and master below:

## Examples
### SugarRecord
```
```java
public class Book extends SugarRecord {
@Unique
String isbn;
Expand All @@ -72,38 +118,49 @@ public class Book extends SugarRecord {
}
```
or
```
```java
@Table
public class Book { ... }
```

### Save Entity
```
```java
Book book = new Book("isbn123", "Title here", "2nd edition")
book.save();
```

### Load Entity
or
```java
SugarRecord.save(book); // if using the @Table annotation
```

### Load Entity
```java
Book book = Book.findById(Book.class, 1);
```

### Update Entity
```
```java
Book book = Book.findById(Book.class, 1);
book.title = "updated title here"; // modify the values
book.edition = "3rd edition";
book.save(); // updates the previous entry with new values.
```


### Delete Entity
```
```java
Book book = Book.findById(Book.class, 1);
book.delete();
```

### Update Entity based on Unique values
or
```java
SugarRecord.delete(book); // if using the @Table annotation
```

### Update Entity based on Unique values
```java
Book book = new Book("isbn123", "Title here", "2nd edition")
book.save();

Expand All @@ -114,15 +171,28 @@ sameBook.update();
book.getId() == sameBook.getId(); // true
```

### Bulk Insert
or
```java
SugarRecord.update(sameBook); // if using the @Table annotation
```

### Bulk Insert
```java
List<Book> books = new ArrayList<>();
books.add(new Book("isbn123", "Title here", "2nd edition"))
books.add(new Book("isbn456", "Title here 2", "3nd edition"))
books.add(new Book("isbn789", "Title here 3", "4nd edition"))
SugarRecord.saveInTx(books);
```

### When using ProGuard
```java
# Ensures entities remain un-obfuscated so table and columns are named correctly
-keep class com.yourpackage.yourapp.domainclasspackage.** { *; }
```

## [CHANGELOG](https://github.com/satyan/sugar/blob/master/CHANGELOG.md)

## Contributing

Please fork this repository and contribute back using [pull requests](https://github.com/satyan/sugar/pulls). Features can be requested using [issues](https://github.com/satyan/sugar/issues). All code, comments, and critiques are greatly appreciated.
27 changes: 18 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'java'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
}
}

def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}

test{
testLogging{
exceptionFormat = 'full'
}
}
allprojects {
version = VERSION_NAME
group = GROUP
Expand All @@ -33,7 +38,7 @@ subprojects { proj ->
version "0.7.1.201405082137"
}

task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
Expand All @@ -45,7 +50,7 @@ subprojects { proj ->
excludes: ['**/R*.class',
'**/BuildConfig*'])
sourceDirectories = files('src/main/java')
executionData = files('build/jacoco/testDebug.exec')
executionData = files('build/jacoco/testDebugUnitTest.exec')
doFirst {
files('build/intermediates/classes/debug').getFiles().each { file ->
if (file.name.contains('$$')) {
Expand All @@ -65,23 +70,27 @@ task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn(subprojects.jacocoTestReport)

additionalSourceDirs = files('example/src/main/java') + files('library/src/main/java')
sourceDirectories = files('example/src/main/java') + files('library/src/main/java')
classDirectories = files('example/build/intermediates/classes/debug') + files('library/build/intermediates/classes/debug')
additionalSourceDirs = files('library/src/main/java')
sourceDirectories = files('library/src/main/java')
classDirectories = files('library/build/intermediates/classes/debug')
executionData = files(subprojects.jacocoTestReport.executionData)

reports {
html.enabled = true
xml.enabled = true
}

onlyIf = {
true
}

doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}

coveralls {
sourceDirs = files('example/src/main/java').flatten() + files('library/src/main/java').flatten()
sourceDirs = files('library/src/main/java').flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}

Expand All @@ -91,4 +100,4 @@ tasks.coveralls {

dependsOn jacocoRootReport
onlyIf { System.env.'CI' }
}
}
30 changes: 5 additions & 25 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,24 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example"
minSdkVersion 9
targetSdkVersion 23
}

buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
abortOnError false
}
}

dependencies {
compile project (':library')
compile 'com.android.support:appcompat-v7:23.1.1'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}

//robolectric {
// // Configure includes / excludes
// include '**/*Tests.class'
// exclude '**/espresso/**/*.class'
//
// // Configure max heap size of the test JVM
// maxHeapSize = '2048m'
//
// // Configure the test JVM arguments - Does not apply to Java 8
// jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier'
//
// // configure whether failing tests should fail the build
// ignoreFailures true
//
// // use afterTest to listen to the test execution results
// afterTest { descriptor, result ->
// println "Executing test for ${descriptor.name} with result: ${result.resultType}"
// }
//}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.example.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.example.R;
Expand Down
Loading