Skip to content

Commit d96a1e7

Browse files
TWiStErRobsjudd
authored andcommitted
Build improvements (#2426)
* Update Gradle version to latest * Fix typo in dependency name (Gradle was resolving support-annotations:{26}) * Bump Android Gradle Plugin version to latest stable * Remove deprecation warning during compile. (@SuppressWarnings("deprecation") has no effect on imports) * Force LF as the line separator to make sure checkstyle is runnable on Windows * Constrain deprecation of GlideModule to a single method (suppresses javac warning) * Make sure compiledJar's output is unique. archivePath was the same as jar's archivePath, which triggered a rebuild and re-proguard every time, even on incremental builds. * Move quality tool initializations near the tasks Extract version constant for PMD * Minor gradle improvements: warnings, Java compatiblity * Extract test JVM memory size to gradle.properties * Enable auto-completion in IDEA by using tasks.create instead of task shorthand * Reduce amount of hard-coded paths * Reduce amount of missing files when running findbugs * Add missing test for setMemoryCategory return value * Simplify JavaDoc classpath calculation * Change JavaDoc {@link}s to {@code} as they're not linkable. This reduces the noise during build. * Fix invalid missing references in JavaDoc. The equals/hashCode method doesn't exist in the classes, so need to reference the super-class. * Fix checkstyle, javadoc alignment, typo and codify class-name-like concepts.
1 parent 9018ae6 commit d96a1e7

File tree

23 files changed

+204
-148
lines changed

23 files changed

+204
-148
lines changed

annotation/compiler/build.gradle

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ dependencies {
2222
compile files(Jvm.current().getToolsJar())
2323
}
2424

25-
def repackagedJar = file("$buildDir/intermediates/repackaged.jar")
26-
def proguardedJar = file("$buildDir/intermediates/proguarded.jar")
25+
def packagingFolder = file("${buildDir}/intermediates")
26+
def repackagedJar = file("${packagingFolder}/repackaged.jar")
27+
def proguardedJar = file("${packagingFolder}/proguarded.jar")
2728

2829
task compiledJar(type: Jar, dependsOn: classes) {
30+
destinationDir = packagingFolder
31+
archiveName = 'compiled.jar'
2932
from sourceSets.main.output
3033
}
3134

@@ -49,7 +52,7 @@ task jarjar(dependsOn: [tasks.compiledJar, configurations.compileOnly]) {
4952
'META-INF/services/javax.annotation.processing.Processor'
5053
].join(','))
5154
}
52-
zipfileset(src: tasks.jar.archivePath)
55+
zipfileset(src: tasks.compiledJar.archivePath)
5356
def repackageIntoGlide = 'com.bumptech.glide.repackaged.@0'
5457
rule result: repackageIntoGlide, pattern: 'com.squareup.javapoet.**'
5558
rule result: repackageIntoGlide, pattern: 'com.google.auto.**'
@@ -71,7 +74,7 @@ task proguard(type: ProGuardTask, dependsOn: tasks.jarjar) {
7174
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
7275
}
7376

74-
// Create the standard jar artifact based on our repackaged and proguarded jar.
77+
// Create the standard jar artifact based on our compiled, repackaged and proguarded jar.
7578
jar {
7679
dependsOn proguard
7780
from zipTree(proguardedJar)

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/AppModuleProcessor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
/**
1717
* Runs the final steps of Glide's annotation process and generates the combined
18-
* {@link AppGlideModule}, {@link com.bumptech.glide.Glide},
19-
* {@link com.bumptech.glide.RequestManager}, and
20-
* {@link com.bumptech.glide.request.RequestOptions} classes.
18+
* {@code AppGlideModule}, {@code com.bumptech.glide.Glide},
19+
* {@code com.bumptech.glide.RequestManager}, and
20+
* {@code com.bumptech.glide.request.RequestOptions} classes.
2121
*/
2222
final class AppModuleProcessor {
2323
private static final String COMPILER_PACKAGE_NAME =

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/GlideAnnotationProcessor.java

+33-31
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* Generates classes based on Glide's annotations that configure Glide, add support for additional
1717
* resource types, and/or extend Glide's API.
1818
*
19-
* <p>This processor discovers all {@link AppGlideModule} and
20-
* {@link LibraryGlideModule} implementations that are
19+
* <p>This processor discovers all {@code AppGlideModule} and
20+
* {@code LibraryGlideModule} implementations that are
2121
* annotated with {@link com.bumptech.glide.annotation.GlideModule}. Any implementations missing the
2222
* annotation will be ignored.
2323
*
@@ -26,42 +26,42 @@
2626
*
2727
* <p>Multiple classes are generated by this processor:
2828
* <ul>
29-
* <li>For {@link LibraryGlideModule}s - A GlideIndexer class in a
29+
* <li>For {@code LibraryGlideModule}s - A GlideIndexer class in a
3030
* specific package that will later be used by the processor to discover all
31-
* {@link LibraryGlideModule} classes.
32-
* <li>For {@link AppGlideModule}s - A single
33-
* {@link AppGlideModule} implementation
34-
* ({@link com.bumptech.glide.GeneratedAppGlideModule}) that calls all
35-
* {@link LibraryGlideModule}s and the
36-
* original {@link AppGlideModule} in the correct order when Glide is
31+
* {@code LibraryGlideModule} classes.
32+
* <li>For {@code AppGlideModule}s - A single
33+
* {@code AppGlideModule} implementation
34+
* ({@code com.bumptech.glide.GeneratedAppGlideModule}) that calls all
35+
* {@code LibraryGlideModule}s and the
36+
* original {@code AppGlideModule} in the correct order when Glide is
3737
* initialized.
3838
* <li>{@link com.bumptech.glide.annotation.GlideExtension}s -
3939
* <ul>
40-
* <li>A {@link com.bumptech.glide.request.RequestOptions} implementation that contains
40+
* <li>A {@code com.bumptech.glide.request.RequestOptions} implementation that contains
4141
* static versions of all builder methods in the base class and both static and instance
4242
* versions of methods in all {@link com.bumptech.glide.annotation.GlideExtension}s.
4343
* <li>If one or more methods in one or more
4444
* {@link com.bumptech.glide.annotation.GlideExtension} annotated classes are annotated with
4545
* {@link GlideType}:
4646
* <ul>
47-
* <li>A {@link com.bumptech.glide.RequestManager} implementation containing a generated
47+
* <li>A {@code com.bumptech.glide.RequestManager} implementation containing a generated
4848
* method for each method annotated with
4949
* {@link GlideType}.
50-
* <li>A {@link com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory}
51-
* implementation that produces the generated {@link com.bumptech.glide.RequestManager}s.
52-
* <li>A {@link com.bumptech.glide.Glide} look-alike that implements all static methods in
53-
* the {@link com.bumptech.glide.Glide} singleton and returns the generated
54-
* {@link com.bumptech.glide.RequestManager} implementation when appropriate.
50+
* <li>A {@code com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory}
51+
* implementation that produces the generated {@code com.bumptech.glide.RequestManager}s.
52+
* <li>A {@code com.bumptech.glide.Glide} look-alike that implements all static methods in
53+
* the {@code com.bumptech.glide.Glide} singleton and returns the generated
54+
* {@code com.bumptech.glide.RequestManager} implementation when appropriate.
5555
* </ul>
5656
* </ul>
5757
* </ul>
5858
*
59-
* <p>{@link AppGlideModule} implementations must only be included in
59+
* <p>{@code AppGlideModule} implementations must only be included in
6060
* applications, not in libraries. There must be exactly one
61-
* {@link AppGlideModule} implementation per
62-
* Application. The {@link AppGlideModule} class is
61+
* {@code AppGlideModule} implementation per
62+
* Application. The {@code AppGlideModule} class is
6363
* used as a signal that all modules have been found and that the final merged
64-
* {@link com.bumptech.glide.GeneratedAppGlideModule} impl can be created.
64+
* {@code com.bumptech.glide.GeneratedAppGlideModule} impl can be created.
6565
*/
6666
@AutoService(Processor.class)
6767
public final class GlideAnnotationProcessor extends AbstractProcessor {
@@ -96,17 +96,19 @@ public SourceVersion getSupportedSourceVersion() {
9696
}
9797

9898
/**
99-
* Each round we do the following:
100-
* <ol>
101-
* <li>Find all AppGlideModules and save them to an instance variable (throw if > 1).
102-
* <li>Find all LibraryGlideModules
103-
* <li>For each LibraryGlideModule, write an Indexer with an Annotation with the class name.
104-
* <li>If we wrote any Indexers, return and wait for the next round.
105-
* <li>If we didn't write any Indexers and there is a AppGlideModule, write the
106-
* GeneratedAppGlideModule. Once the GeneratedAppGlideModule is written, we expect to be
107-
* finished. Any further generation of related classes will result in errors.
108-
* </ol>
109-
*/
99+
* Each round we do the following:
100+
* <ol>
101+
* <li>Find all {@code AppGlideModule}s and save them to an instance variable (throw if > 1).
102+
* <li>Find all {@code LibraryGlideModule}s
103+
* <li>For each {@code LibraryGlideModule},
104+
* write an {@code Indexer} with an Annotation with the class name.
105+
* <li>If we wrote any {@code Indexer}s, return and wait for the next round.
106+
* <li>If we didn't write any {@code Indexer}s and there is a {@code AppGlideModule},
107+
* write the {@code GeneratedAppGlideModule}.
108+
* Once the {@code GeneratedAppGlideModule} is written, we expect to be finished.
109+
* Any further generation of related classes will result in errors.
110+
* </ol>
111+
*/
110112
@Override
111113
public boolean process(Set<? extends TypeElement> set, RoundEnvironment env) {
112114
processorUtil.process();

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/GlideGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Generates a Glide look-alike that acts as the entry point to the generated API
2424
* (GlideApp.with(...)).
2525
*
26-
* <p>>Generated {@link com.bumptech.glide.Glide} look-alikes look like this (note that the name
26+
* <p>>Generated {@code com.bumptech.glide.Glide} look-alikes look like this (note that the name
2727
* is configurable in {@link com.bumptech.glide.annotation.GlideModule}):
2828
* <pre>
2929
* <code>

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/LibraryModuleProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* Generates Indexer classes annotated with {@link Index} for all
14-
* {@link LibraryGlideModule}s.
14+
* {@code LibraryGlideModule}s.
1515
*/
1616
final class LibraryModuleProcessor {
1717
private ProcessorUtil processorUtil;

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestBuilderGenerator.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import javax.lang.model.type.TypeMirror;
3434

3535
/**
36-
* Generates a {@link com.bumptech.glide.RequestBuilder} subclass containing all methods from
37-
* the base class, all methods from {@link com.bumptech.glide.request.RequestOptions} and all
36+
* Generates a {@code com.bumptech.glide.RequestBuilder} subclass containing all methods from
37+
* the base class, all methods from {@code com.bumptech.glide.request.RequestOptions} and all
3838
* non-override {@link GlideOption} annotated methods in {@link GlideExtension} annotated
3939
* classes.
4040
*
@@ -177,8 +177,8 @@ TypeSpec generate(String generatedCodePackageName, @Nullable TypeSpec generatedO
177177
}
178178

179179
/**
180-
* Generates overrides of all methods in {@link com.bumptech.glide.RequestBuilder} that return
181-
* {@link com.bumptech.glide.RequestBuilder} so that they return our generated subclass instead.
180+
* Generates overrides of all methods in {@code com.bumptech.glide.RequestBuilder} that return
181+
* {@code com.bumptech.glide.RequestBuilder} so that they return our generated subclass instead.
182182
*/
183183
private List<MethodSpec> generateRequestBuilderOverrides() {
184184
TypeMirror rawRequestBuilderType =
@@ -194,8 +194,8 @@ public MethodSpec apply(ExecutableElement input) {
194194
}
195195

196196
/**
197-
* Generates an override of a particular method in {@link com.bumptech.glide.RequestBuilder} that
198-
* returns {@link com.bumptech.glide.RequestBuilder} so that it returns our generated subclass
197+
* Generates an override of a particular method in {@code com.bumptech.glide.RequestBuilder} that
198+
* returns {@code com.bumptech.glide.RequestBuilder} so that it returns our generated subclass
199199
* instead.
200200
*/
201201
private MethodSpec generateRequestBuilderOverride(ExecutableElement methodToOverride) {
@@ -234,7 +234,7 @@ public String apply(VariableElement input) {
234234
* Generates methods with equivalent names and arguments to methods annotated with
235235
* {@link GlideOption} in
236236
* {@link com.bumptech.glide.annotation.GlideExtension}s that return our generated
237-
* {@link com.bumptech.glide.RequestBuilder} subclass.
237+
* {@code com.bumptech.glide.RequestBuilder} subclass.
238238
*/
239239
private List<MethodSpec> generateGeneratedRequestOptionsEquivalents(
240240
@Nullable final TypeSpec generatedOptions) {
@@ -260,10 +260,10 @@ public MethodSpec apply(MethodSpec input) {
260260

261261
/**
262262
* Returns {@code true} if the given {@link MethodSpec} is a useful method to have in our
263-
* {@link com.bumptech.glide.RequestBuilder} subclass.
263+
* {@code com.bumptech.glide.RequestBuilder} subclass.
264264
*
265265
* <p>Only newly generated methods will be included in the generated
266-
* {@link com.bumptech.glide.request.BaseRequestBuilder} subclass, so we only have to filter out
266+
* {@code com.bumptech.glide.request.BaseRequestBuilder} subclass, so we only have to filter out
267267
* methods that override other methods to avoid duplicates.
268268
*/
269269
private boolean isUsefulGeneratedRequestOption(MethodSpec requestOptionMethod) {
@@ -277,7 +277,7 @@ private boolean isUsefulGeneratedRequestOption(MethodSpec requestOptionMethod) {
277277

278278
/**
279279
* Generates a particular method with an equivalent name and arguments to the given method
280-
* from the generated {@link com.bumptech.glide.request.BaseRequestBuilder} subclass.
280+
* from the generated {@code com.bumptech.glide.request.BaseRequestBuilder} subclass.
281281
*/
282282
private MethodSpec generateGeneratedRequestOptionEquivalent(MethodSpec requestOptionMethod) {
283283
CodeBlock callRequestOptionsMethod = CodeBlock.builder()
@@ -369,7 +369,7 @@ private List<MethodSpec> generateConstructors() {
369369
}
370370

371371
/**
372-
* Overrides the protected downloadOnly method in {@link com.bumptech.glide.RequestBuilder} to
372+
* Overrides the protected downloadOnly method in {@code com.bumptech.glide.RequestBuilder} to
373373
* return our generated subclass instead.
374374
*/
375375
private MethodSpec generateDownloadOnlyRequestMethod() {

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestManagerFactoryGenerator.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
/**
1212
* Generates an implementation of
13-
* {@link com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory} that returns a
14-
* generated {@link com.bumptech.glide.RequestManager} implementation.
13+
* {@code com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory} that returns a
14+
* generated {@code com.bumptech.glide.RequestManager} implementation.
1515
*
16-
* <p>Generated {@link com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory}
16+
* <p>Generated {@code com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory}
1717
* classes look like this:
1818
* <pre>
1919
* <code>

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestManagerGenerator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
import javax.lang.model.util.Elements;
3131

3232
/**
33-
* Generates an implementation of {@link com.bumptech.glide.RequestManager} that contains generated
33+
* Generates an implementation of {@code com.bumptech.glide.RequestManager} that contains generated
3434
* methods from {@link GlideExtension}s and {@link GlideType}.
3535
*
36-
* <p>Generated {@link com.bumptech.glide.RequestManager} implementations look like this:
36+
* <p>Generated {@code com.bumptech.glide.RequestManager} implementations look like this:
3737
* <pre>
3838
* <code>
3939
* public final class GeneratedRequestManager extends RequestManager {

annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestOptionsGenerator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import javax.lang.model.element.VariableElement;
3939

4040
/**
41-
* Generates a new implementation of {@link com.bumptech.glide.request.RequestOptions}
41+
* Generates a new implementation of {@code com.bumptech.glide.request.RequestOptions}
4242
* containing static versions of methods included in the base class and static and instance versions
4343
* of all methods annotated with {@link GlideOption} in classes annotated with
4444
* {@link GlideExtension}.
@@ -327,7 +327,7 @@ private List<MethodAndStaticVar> generateStaticMethodOverridesForRequestOptions(
327327
* an existing method in RequestOptions.
328328
*
329329
* <p>The string names here just map between the static methods in
330-
* {@link com.bumptech.glide.request.RequestOptions} and the instance methods they call.
330+
* {@code com.bumptech.glide.request.RequestOptions} and the instance methods they call.
331331
*/
332332
private static String getInstanceMethodNameFromStaticMethodName(String staticMethodName) {
333333
String equivalentInstanceMethodName;

annotation/src/main/java/com/bumptech/glide/annotation/GlideModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public @interface GlideModule {
1717
/**
1818
* Returns the name of the class that will be used as a replacement for
19-
* {@link com.bumptech.glide.Glide} in Applications that depend on Glide's generated code.
19+
* {@code com.bumptech.glide.Glide} in Applications that depend on Glide's generated code.
2020
*/
2121
String glideName() default "GlideApp";
2222
}

annotation/src/main/java/com/bumptech/glide/annotation/GlideOption.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
/**
99
* Identifies methods in {@link GlideExtension} annotated classes that extend
10-
* {@link com.bumptech.glide.request.RequestOptions}.
10+
* {@code com.bumptech.glide.request.RequestOptions}.
1111
*
1212
* <p>All annotated methods will be added to a single
13-
* {@link com.bumptech.glide.request.RequestOptions} implementation generated per application.
13+
* {@code com.bumptech.glide.request.RequestOptions} implementation generated per application.
1414
* Overlapping method names in different extensions may cause errors at compile time.
1515
*
1616
* <p>Static equivalents of annotated methods will also be generated.
@@ -51,7 +51,7 @@
5151

5252
/**
5353
* {@code true} to indicate that it's safe to statically memoize the result of this method using
54-
* {@link com.bumptech.glide.request.RequestOptions#autoClone()}.
54+
* {@code com.bumptech.glide.request.RequestOptions#autoClone()}.
5555
*
5656
* <p>This method should only be used for no-arg methods where there's only a single possible
5757
* value.
@@ -65,8 +65,8 @@
6565
*
6666
* <p>By default static methods are generated for all methods annotated with
6767
* {@link GlideOption}. These static factory methods allow for a cleaner API when used
68-
* with {@link com.bumptech.glide.RequestBuilder#apply}. The static factory method by default
69-
* simply creates a new {@link com.bumptech.glide.request.RequestOptions} object, calls the
68+
* with {@code com.bumptech.glide.RequestBuilder#apply}. The static factory method by default
69+
* simply creates a new {@code com.bumptech.glide.request.RequestOptions} object, calls the
7070
* instance version of the method on it and returns it. For example:
7171
* <pre>
7272
* <code>

annotation/src/main/java/com/bumptech/glide/annotation/GlideType.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
/**
99
* Identifies methods in {@link GlideExtension} annotated classes that extend
10-
* {@link com.bumptech.glide.RequestManager}.
10+
* {@code com.bumptech.glide.RequestManager}.
1111
*
1212
* <p>If one or more method is found with this annotation, an additional API entry point that
13-
* exposes a generated {@link com.bumptech.glide.RequestManager} subclass will be created. The
13+
* exposes a generated {@code com.bumptech.glide.RequestManager} subclass will be created. The
1414
* generated API entry point acts as a drop in replacement for Glide. Glide.with(fragment) becomes
1515
* GlideApp.with(fragment). Although the Glide.with variant will still be available, only the new
1616
* API entry point will provide access to these additional methods.
@@ -22,7 +22,7 @@
2222
* with {@link GlideExtension}.
2323
*
2424
* <p>Methods annotated with GlideType must have a single parameter. The type of the
25-
* single parameter must be {@link com.bumptech.glide.request.RequestOptions}, with a type
25+
* single parameter must be {@code com.bumptech.glide.request.RequestOptions}, with a type
2626
* matching the value of {@link #value()}.
2727
*/
2828
@Target(ElementType.METHOD)
@@ -33,7 +33,7 @@
3333
/**
3434
* A Resource class name, like GifDrawable.class, Bitmap.class etc.
3535
*
36-
* <p>Must match the type of the {@link com.bumptech.glide.request.RequestOptions} parameter.
36+
* <p>Must match the type of the {@code com.bumptech.glide.request.RequestOptions} parameter.
3737
*/
3838
Class<?> value();
3939
}

checkstyle.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
</module>
1616

1717
<!-- Ensure trailling newline for compatibility -->
18-
<module name="NewlineAtEndOfFile" />
18+
<module name="NewlineAtEndOfFile">
19+
<property name="lineSeparator" value="lf"/>
20+
</module>
1921

2022
<!-- Space after 'for' and 'if' -->
2123
<module name="RegexpSingleline">

0 commit comments

Comments
 (0)