Skip to content

Commit 1360d82

Browse files
Make annotation processor isolating (#31)
1 parent 7a264f8 commit 1360d82

File tree

58 files changed

+958
-777
lines changed

Some content is hidden

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

58 files changed

+958
-777
lines changed

CHANGELOG.md

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

4+
Version 1.4.0 *(2021-04-10)*
5+
----------------------------
6+
* Improve: Shortbread is now an _isolating_ annotation processor, which improves the performance of incremental annotation processing.
7+
Before, the processor was of type _aggregating_ and it would generate a single class `ShortbreadGenerated`. Now it generates one
8+
class for each activity that contains shortcuts, e.g. `MoviesActivity_Shortcuts`. The generated classes are still only used by the
9+
library itself, the consumer does not interact with them.
10+
* Improve: Shortcut methods/functions don't have to be `public` anymore. Any visibility higher than `private` is enough.
11+
* Fix: When using `R2`, resource values sometimes were not properly read when the incremental annotation processing was incremental
12+
* New: The module `:sample-library` shows how to use Shortbread in a library module
13+
14+
415
Version 1.3.0 *(2021-03-31)*
516
----------------------------
617
* New: Shortbread is now initialized automatically using [App Startup](https://developer.android.com/topic/libraries/app-startup)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ Shortbread is available on `mavenCentral()`.
9292
apply plugin: 'kotlin-kapt'
9393
9494
dependencies {
95-
implementation 'com.github.matthiasrobbers:shortbread:1.3.0'
96-
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.3.0'
95+
implementation 'com.github.matthiasrobbers:shortbread:1.4.0'
96+
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.4.0'
9797
}
9898
```
9999
</details>
@@ -102,8 +102,8 @@ dependencies {
102102

103103
```groovy
104104
dependencies {
105-
implementation 'com.github.matthiasrobbers:shortbread:1.3.0'
106-
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.3.0'
105+
implementation 'com.github.matthiasrobbers:shortbread:1.4.0'
106+
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.4.0'
107107
}
108108
```
109109
</details>
@@ -123,7 +123,7 @@ buildscript {
123123
mavenCentral()
124124
}
125125
dependencies {
126-
classpath 'com.github.matthiasrobbers:shortbread-gradle-plugin:1.3.0'
126+
classpath 'com.github.matthiasrobbers:shortbread-gradle-plugin:1.4.0'
127127
}
128128
}
129129
```

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1536m
22
android.useAndroidX=true
33

44
GROUP=com.github.matthiasrobbers
5-
VERSION_NAME=1.3.0
5+
VERSION_NAME=1.4.0
66

77
POM_URL=https://github.com/matthiasrobbers/shortbread
88
POM_SCM_URL=https://github.com/matthiasrobbers/shortbread

sample-library/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

sample-library/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
google()
5+
}
6+
7+
dependencies {
8+
classpath "com.github.matthiasrobbers:shortbread-gradle-plugin:1.3.0"
9+
}
10+
}
11+
12+
apply plugin: 'com.android.library'
13+
apply plugin: 'com.github.matthiasrobbers.shortbread'
14+
15+
android {
16+
compileSdkVersion project.compileSdkVersion
17+
buildToolsVersion project.buildToolsVersion
18+
19+
defaultConfig {
20+
minSdkVersion project.minSdkVersion
21+
}
22+
23+
compileOptions {
24+
sourceCompatibility = sourceCompatibilityVersion
25+
targetCompatibility = targetCompatibilityVersion
26+
}
27+
}
28+
29+
dependencies {
30+
implementation project(':shortbread')
31+
annotationProcessor project(':shortbread-compiler')
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.shortbread.songs">
4+
5+
<application>
6+
7+
<activity
8+
android:name="com.example.songs.SongsActivity"
9+
android:label="Songs" />
10+
</application>
11+
</manifest>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.example.songs;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.widget.TextView;
6+
7+
import com.example.shortbread.songs.R;
8+
import com.example.shortbread.songs.R2;
9+
10+
import shortbread.Shortcut;
11+
12+
@Shortcut(id = "songs", icon = R2.drawable.ic_shortcut_songs, shortLabelRes = R2.string.label_songs, rank = 5)
13+
public class SongsActivity extends Activity {
14+
15+
@Override
16+
protected void onCreate(Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
setContentView(R.layout.activity_sample);
19+
20+
((TextView) findViewById(R.id.text)).setText("Songs");
21+
}
22+
}

sample/src/main/res/drawable-xxhdpi/ic_shortcut_songs.png renamed to sample-library/src/main/res/drawable-xxhdpi/ic_shortcut_songs.png

File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:padding="16dp">
6+
7+
<TextView
8+
android:id="@+id/text"
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:layout_gravity="center"
12+
android:text="Shortbread"
13+
android:textSize="48sp" />
14+
</FrameLayout>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="label_songs">Songs</string>
5+
</resources>

0 commit comments

Comments
 (0)