Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

Commit ea61874

Browse files
authored
Merge pull request #188 from vimeo/develop
Release 2.6.0
2 parents 42c168b + 64ed936 commit ea61874

155 files changed

Lines changed: 2294 additions & 1138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
codecov:
2+
branch: develop

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jdk:
44
android:
55
components:
66
- tools
7-
- build-tools-27.0.2
8-
- android-27
7+
- build-tools-28.0.3
8+
- android-28
99
- extra-android-support
1010
- extra-android-m2repository
1111
# workaround for Google changing android-27 package and causing a checksum mismatch

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change Log
22
==========
33

4+
Version 2.6.0 *(2018-10-25)*
5+
----------------------------
6+
- Improved formatting of generated code.
7+
- Improved logging by putting all debug logging behind the `stagDebug` flag.
8+
- Improve integration of library by switching to new nullability annotations library.
9+
- Wrote unit tests for `KnownTypeAdapters`.
10+
- Fixed bug where code generation was non deterministic by switching to linked versions of `HashSet` and `HashMap`.
11+
- Added support for turning on/off serialization of `null` with `stag.serializeNulls` compiler option. Default is off, which is a behavior change from version 2.5.1.
12+
413
Version 2.5.1 *(2018-01-17)*
514
----------------------------
615
- Fixed bug where types with wildcards caused compilation to fail.

README.md

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ buildscript {
3636
apply plugin: 'net.ltgt.apt'
3737
3838
dependencies {
39-
def stagVersion = '2.5.1'
39+
def stagVersion = '2.6.0'
4040
compile "com.vimeo.stag:stag-library:$stagVersion"
4141
apt "com.vimeo.stag:stag-library-compiler:$stagVersion"
4242
}
@@ -45,19 +45,42 @@ dependencies {
4545
gradle.projectsEvaluated {
4646
tasks.withType(JavaCompile) {
4747
aptOptions.processorArgs = [
48-
stagAssumeHungarianNotation: "true",
49-
stagGeneratedPackageName : "com.vimeo.sample.stag.generated",
50-
stagDebug : "true"
48+
"stagAssumeHungarianNotation": "true",
49+
"stagGeneratedPackageName" : "com.vimeo.sample.stag.generated",
50+
"stagDebug " : "true",
51+
"stag.serializeNulls" : "true",
5152
]
5253
}
5354
}
5455
```
5556

56-
### Android Gradle
57+
### Kotlin Gradle
58+
```groovy
59+
apply plugin: 'kotlin-kapt'
60+
61+
dependencies {
62+
def stagVersion = '2.6.0'
63+
compile "com.vimeo.stag:stag-library:$stagVersion"
64+
kapt "com.vimeo.stag:stag-library-compiler:$stagVersion"
65+
}
66+
67+
kapt {
68+
correctErrorTypes = true
69+
// Optional annotation processor arguments (see below)
70+
arguments {
71+
arg("stagDebug", "true")
72+
arg("stagGeneratedPackageName", "com.vimeo.sample.stag.generated")
73+
arg("stagAssumeHungarianNotation", "true")
74+
arg("stag.serializeNulls", "true")
75+
}
76+
}
77+
```
78+
79+
### Android Gradle (Java)
5780

5881
```groovy
5982
dependencies {
60-
def stagVersion = '2.5.1'
83+
def stagVersion = '2.6.0'
6184
compile "com.vimeo.stag:stag-library:$stagVersion"
6285
annotationProcessor "com.vimeo.stag:stag-library-compiler:$stagVersion"
6386
}
@@ -70,9 +93,10 @@ android {
7093
javaCompileOptions {
7194
annotationProcessorOptions {
7295
arguments = [
73-
stagAssumeHungarianNotation: 'true'
74-
stagGeneratedPackageName : 'com.vimeo.sample.stag.generated',
75-
stagDebug : 'true'
96+
"stagAssumeHungarianNotation": 'true',
97+
"stagGeneratedPackageName" : 'com.vimeo.sample.stag.generated',
98+
"stagDebug" : 'true',
99+
"stag.serializeNulls" : 'true'
76100
]
77101
}
78102
}
@@ -91,6 +115,10 @@ android {
91115
Stag will look for members named `set[variable_name]` and `get[variable_name]`. If your member variables are named using Hungarian notation,
92116
then you will need to pass true to this parameter so that for a field named `mField`, Stag will look for `setField` and `getField` instead
93117
of `setMField` and `getMField`. Default is false.
118+
- `stag.serializeNulls`: By default this is set to false. If an object has a null field and you send it to be serialized by Gson, it is optional
119+
whether or not that field is serialized into the JSON. If this field is set to `false` null fields will not be serialized, and if set to `true`,
120+
they will be serialized. Prior to stag version 2.6.0, null fields were always serialized to JSON. This should not affect most models. However, if
121+
you have a model that has a nullable field that also has a non null default value, then it might be a good idea to turn this option on.
94122

95123
## Features
96124

@@ -228,7 +256,7 @@ class Herd {
228256
* You parse the list from JSON using
229257
* Gson.
230258
*/
231-
MyParsingClass {
259+
class MyParsingClass {
232260
private Gson gson = new GsonBuilder()
233261
.registerTypeAdapterFactory(new Stag.Factory())
234262
.create();

build.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
21
buildscript {
3-
4-
ext.kotlinVersion = '1.2.20'
5-
ext.jacocoVersion = '0.7.9' // See http://www.eclemma.org/jacoco/
6-
ext.gsonVersion = '2.8.2'
7-
8-
// android dependencies
9-
ext.targetSdk = 27
10-
ext.minSdk = 14
11-
ext.buildTools = "27.0.2"
12-
2+
ext {
3+
kotlinVersion = '1.2.71'
4+
jacocoVersion = '0.7.9' // See http://www.eclemma.org/jacoco/
5+
gsonVersion = '2.8.2'
6+
assertJ = '3.9.1'
7+
8+
// android dependencies
9+
targetSdk = 28
10+
minSdk = 14
11+
buildTools = "28.0.3"
12+
}
1313
repositories {
1414
google()
1515
jcenter()
1616
mavenCentral()
1717
maven { url "https://plugins.gradle.org/m2/" }
1818
}
1919
dependencies {
20-
classpath 'com.android.tools.build:gradle:3.0.1'
20+
classpath 'com.android.tools.build:gradle:3.2.1'
2121
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
2222
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
2323
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
24-
classpath "net.ltgt.gradle:gradle-apt-plugin:0.11"
24+
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.15'
2525
}
2626
}
2727

@@ -43,5 +43,5 @@ allprojects {
4343

4444
subprojects {
4545
group = 'com.vimeo.stag'
46-
version = '2.5.1'
46+
version = '2.6.0'
4747
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Oct 25 13:24:54 EDT 2017
1+
#Thu Oct 25 11:29:47 EDT 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

integration-test-android/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ android {
3333
}
3434

3535
dependencies {
36-
testImplementation 'junit:junit:4.12'
37-
38-
implementation 'com.android.support:appcompat-v7:27.0.2'
39-
implementation 'com.android.support:support-annotations:27.0.2'
36+
implementation 'org.jetbrains:annotations-java5:16.0.2@jar'
37+
implementation 'com.android.support:appcompat-v7:28.0.0'
38+
implementation 'com.android.support:support-annotations:28.0.0'
4039

4140
implementation project(':stag-library')
4241
annotationProcessor project(':stag-library-compiler')
4342

4443
implementation "com.google.code.gson:gson:$gsonVersion"
44+
45+
testImplementation 'junit:junit:4.12'
4546
}
4647

4748
gradle.projectsEvaluated {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<manifest
2-
package="com.vimeo.integration_test_android"
3-
xmlns:android="http://schemas.android.com/apk/res/android" />
1+
<manifest package="com.vimeo.integration_test_android" />

integration-test-android/src/test/java/com/vimeo/integration_test_android/ClassWithMapTypesTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.junit.Test;
44

5+
import verification.Utils;
6+
57
/**
68
* Created by restainoa on 2/2/17.
79
*/
@@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception {
1214
Utils.verifyTypeAdapterGeneration(ClassWithMapTypes.class);
1315
}
1416

15-
}
17+
}

integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassExtendedTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import org.junit.Test;
44

5+
import verification.Utils;
6+
57
public class ComplexGenericClassExtendedTest {
68

79
@Test
810
public void typeAdapterWasGenerated() throws Exception {
911
Utils.verifyTypeAdapterGeneration(ComplexGenericClassExtended.class);
1012
}
1113

12-
}
14+
}

0 commit comments

Comments
 (0)