File tree Expand file tree Collapse file tree 2 files changed +34
-4
lines changed
integTest/java/org/xtext/gradle/test
main/java/org/xtext/gradle/tasks Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,26 @@ class BuildingASimpleXtendProject extends AbstractXtendIntegrationTest {
56
56
57
57
snapshot. assertChangedClasses(" UpStream" , " DownStream" )
58
58
}
59
+
60
+ @Test
61
+ def generatorHandlesDeletionOfClasspathFolders () {
62
+ createFile(' src/main/java/UpStream.xtend' , ' ' '
63
+ class UpStream {}
64
+ ' ' ' )
65
+ createFile(' src/test/java/DownStream.xtend' , ' ' '
66
+ class DownStream{
67
+ }
68
+ ' ' ' )
69
+ build(" build" )
70
+ val snapshot = snapshot(projectDir)
71
+
72
+ // remove the main sources from the test classpath
73
+ buildFile << " sourceSets.test.compileClasspath = configurations.testCompileClasspath"
74
+ build(" build" )
75
+
76
+ snapshot. assertChangedClasses(" DownStream" )
77
+ }
78
+
59
79
60
80
@Test
61
81
def affectedResourcesAreDetectedAcrossXtendAndJava () {
Original file line number Diff line number Diff line change @@ -127,10 +127,20 @@ abstract class XtextGenerate extends DefaultTask {
127
127
request. dirtyFiles + = file
128
128
}
129
129
]
130
- inputs. getFileChanges(classpath). forEach [ change |
131
- // Gradle notifies us about individual .class files, but we only want their containing directory
132
- request. dirtyClasspathEntries + = classpath. files. findFirst[change. file. path. startsWith(it . path)]
133
- ]
130
+ val classpathRoots = classpath. files
131
+ inputs. getFileChanges(classpath)
132
+ . forEach[change |
133
+ if (change. normalizedPath. isEmpty) {
134
+ request. dirtyClasspathEntries + = change. file
135
+ } else {
136
+ val root = classpathRoots. findFirst[change. file. path. startsWith(it . path)]
137
+ if (root !== null ) {
138
+ request. dirtyClasspathEntries + = root
139
+ } else {
140
+ request. incremental = false
141
+ }
142
+ }
143
+ ]
134
144
}
135
145
136
146
def installDebugInfo (File classesDir ) {
You can’t perform that action at this time.
0 commit comments