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

Incremental Java compile is disabled when empty source folders are added #8203

Closed
hungvietnguyen opened this issue Jan 9, 2019 · 4 comments
Assignees
Milestone

Comments

@hungvietnguyen
Copy link

Environment

Gradle 5.1-rc-2 (in Gradle 5.1-rc-3 and above, the issue is masked by a different issue: #8194)

Steps to Reproduce

Use this sample Android project: MyApplication.tar.gz

  1. Run the first build: ./gradlew :app:compileDebugJavaWithJavac, it should succeed.
  2. In app/src/main/java, add package com.example.foo without any classes.
  3. Run the second build: ./gradlew :app:compileDebugJavaWithJavac --info, observe that Gradle performs full recompilation:
    Full recompilation is required because A resource changed. Analysis took 0.053 secs.

Expected Behavior

Gradle should perform incremental compile in the second build.

Context

I saw this issue a while ago but can only manage to reproduce it now while debugging #8194 and #8197. It doesn't happen on a HelloWorld project, but it does on this particular project. (I haven't examined how this project exposes the issue yet.)

@hungvietnguyen
Copy link
Author

Additional Request

The error message Full recompilation is required because A resource changed may be more helpful if it also points out exactly what resource has changed.

@wolfs
Copy link
Member

wolfs commented Jan 9, 2019

@oehme It looks like changes to directories (i.e. adding directories in source folders) are processed as resource changes:

File file = input.getFile();
if (hasExtension(file, ".java")) {
javaChangeProcessor.processChange(input, spec);
} else if (hasExtension(file, ".jar") || hasExtension(file, ".class")) {
annotationProcessorChangeProcessor.processChange(input, spec);
} else {
resourceChangeProcessor.processChange(input, spec);
}
}

Is this intentional? I guess it would be fine to only process actual files. WDYT?

@oehme
Copy link
Contributor

oehme commented Jan 10, 2019

Yes, good catch!

@oehme oehme added this to the 5.1.1 milestone Jan 10, 2019
@ljacomet ljacomet self-assigned this Jan 10, 2019
@ljacomet
Copy link
Member

@bigdaz Ended up taking a look at it and opened #8211 - feel free to take over after my day if that solution is not satisfactory

@oehme oehme modified the milestones: 5.1.1, 5.2 RC1 Jan 10, 2019
@oehme oehme assigned oehme and unassigned ljacomet and bigdaz Jan 10, 2019
ljacomet added a commit that referenced this issue Jan 10, 2019
That is we ignore some changes to directories, thus ignoring addition
and modifications of empty packages.

Fixes #8203
oehme pushed a commit that referenced this issue Jan 17, 2019
That is we ignore some changes to directories, thus ignoring addition
and modifications of empty packages.

Fixes #8203
@oehme oehme closed this as completed Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants