Lines 46-51
Link Here
|
46 |
import java.util.Map; |
46 |
import java.util.Map; |
47 |
import java.util.HashMap; |
47 |
import java.util.HashMap; |
48 |
import org.netbeans.api.java.classpath.ClassPath; |
48 |
import org.netbeans.api.java.classpath.ClassPath; |
|
|
49 |
import org.netbeans.api.java.classpath.JavaClassPathConstants; |
49 |
import org.netbeans.api.project.ProjectManager; |
50 |
import org.netbeans.api.project.ProjectManager; |
50 |
import org.netbeans.api.project.SourceGroup; |
51 |
import org.netbeans.api.project.SourceGroup; |
51 |
import org.netbeans.modules.java.api.common.SourceRoots; |
52 |
import org.netbeans.modules.java.api.common.SourceRoots; |
Lines 71-76
Link Here
|
71 |
private String distJar = "dist.jar"; // NOI18N |
72 |
private String distJar = "dist.jar"; // NOI18N |
72 |
private String buildTestClassesDir = "build.test.classes.dir"; // NOI18N |
73 |
private String buildTestClassesDir = "build.test.classes.dir"; // NOI18N |
73 |
private String[] javacClasspath = new String[]{"javac.classpath"}; //NOI18N |
74 |
private String[] javacClasspath = new String[]{"javac.classpath"}; //NOI18N |
|
|
75 |
private String[] processorClasspath = new String[]{ProjectProperties.JAVAC_PROCESSORPATH}; //NOI18N |
74 |
private String[] javacTestClasspath = new String[]{"javac.test.classpath"}; //NOI18N |
76 |
private String[] javacTestClasspath = new String[]{"javac.test.classpath"}; //NOI18N |
75 |
private String[] runClasspath = new String[]{"run.classpath"}; //NOI18N |
77 |
private String[] runClasspath = new String[]{"run.classpath"}; //NOI18N |
76 |
private String[] runTestClasspath = new String[]{"run.test.classpath"}; //NOI18N |
78 |
private String[] runTestClasspath = new String[]{"run.test.classpath"}; //NOI18N |
Lines 93-100
Link Here
|
93 |
* 6 - execute class path for dist.jar |
95 |
* 6 - execute class path for dist.jar |
94 |
* 7 - boot class path |
96 |
* 7 - boot class path |
95 |
* 8 - endorsed class path |
97 |
* 8 - endorsed class path |
|
|
98 |
* 9 - processor path |
99 |
* 10 - test processor path |
96 |
*/ |
100 |
*/ |
97 |
private final ClassPath[] cache = new ClassPath[9]; |
101 |
private final ClassPath[] cache = new ClassPath[11]; |
98 |
|
102 |
|
99 |
private final Map<String,FileObject> dirCache = new HashMap<String,FileObject>(); |
103 |
private final Map<String,FileObject> dirCache = new HashMap<String,FileObject>(); |
100 |
|
104 |
|
Lines 143-153
Link Here
|
143 |
String buildClassesDir, String distJar, String buildTestClassesDir, |
147 |
String buildClassesDir, String distJar, String buildTestClassesDir, |
144 |
String[] javacClasspath, String[] javacTestClasspath, String[] runClasspath, |
148 |
String[] javacClasspath, String[] javacTestClasspath, String[] runClasspath, |
145 |
String[] runTestClasspath, String[] endorsedClasspath) { |
149 |
String[] runTestClasspath, String[] endorsedClasspath) { |
|
|
150 |
this(helper, |
151 |
evaluator, |
152 |
sourceRoots, |
153 |
testSourceRoots, |
154 |
buildClassesDir, |
155 |
distJar, |
156 |
buildTestClassesDir, |
157 |
javacClasspath, |
158 |
javacClasspath, |
159 |
javacTestClasspath, |
160 |
runClasspath, |
161 |
runTestClasspath, |
162 |
new String[]{ProjectProperties.ENDORSED_CLASSPATH}); |
163 |
} |
164 |
|
165 |
/** |
166 |
* Constructor allowing customization of processorPath. |
167 |
* @since org.netbeans.modules.java.api.common/0 1.14 |
168 |
*/ |
169 |
public ClassPathProviderImpl(AntProjectHelper helper, PropertyEvaluator evaluator, |
170 |
SourceRoots sourceRoots, SourceRoots testSourceRoots, |
171 |
String buildClassesDir, String distJar, String buildTestClassesDir, |
172 |
String[] javacClasspath, String[] processorPath, String[] javacTestClasspath, String[] runClasspath, |
173 |
String[] runTestClasspath, String[] endorsedClasspath) { |
146 |
this(helper, evaluator, sourceRoots, testSourceRoots); |
174 |
this(helper, evaluator, sourceRoots, testSourceRoots); |
147 |
this.buildClassesDir = buildClassesDir; |
175 |
this.buildClassesDir = buildClassesDir; |
148 |
this.distJar = distJar; |
176 |
this.distJar = distJar; |
149 |
this.buildTestClassesDir = buildTestClassesDir; |
177 |
this.buildTestClassesDir = buildTestClassesDir; |
150 |
this.javacClasspath = javacClasspath; |
178 |
this.javacClasspath = javacClasspath; |
|
|
179 |
this.processorClasspath = processorPath; |
151 |
this.javacTestClasspath = javacTestClasspath; |
180 |
this.javacTestClasspath = javacTestClasspath; |
152 |
this.runClasspath = runClasspath; |
181 |
this.runClasspath = runClasspath; |
153 |
this.runTestClasspath = runTestClasspath; |
182 |
this.runTestClasspath = runTestClasspath; |
Lines 270-275
Link Here
|
270 |
return cp; |
299 |
return cp; |
271 |
} |
300 |
} |
272 |
|
301 |
|
|
|
302 |
private ClassPath getProcessorClasspath(FileObject file) { |
303 |
int type = getType(file); |
304 |
return this.getProcessorClasspath(type); |
305 |
} |
306 |
|
307 |
private synchronized ClassPath getProcessorClasspath(int type) { |
308 |
if (type < 0 || type > 1) { |
309 |
// Not a source file. |
310 |
return null; |
311 |
} |
312 |
ClassPath cp = cache[9+type]; |
313 |
if ( cp == null) { |
314 |
if (type == 0) { |
315 |
cp = ClassPathFactory.createClassPath( |
316 |
ProjectClassPathSupport.createPropertyBasedClassPathImplementation( |
317 |
projectDirectory, evaluator, processorClasspath)); // NOI18N |
318 |
} |
319 |
else { |
320 |
cp = ClassPathFactory.createClassPath( |
321 |
ProjectClassPathSupport.createPropertyBasedClassPathImplementation( |
322 |
projectDirectory, evaluator, /*XXX*/processorClasspath)); // NOI18N |
323 |
} |
324 |
cache[9+type] = cp; |
325 |
} |
326 |
return cp; |
327 |
} |
328 |
|
273 |
private ClassPath getRunTimeClasspath(FileObject file) { |
329 |
private ClassPath getRunTimeClasspath(FileObject file) { |
274 |
int type = getType(file); |
330 |
int type = getType(file); |
275 |
if (type < 0 || type > 4) { |
331 |
if (type < 0 || type > 4) { |
Lines 366-371
Link Here
|
366 |
public ClassPath findClassPath(FileObject file, String type) { |
422 |
public ClassPath findClassPath(FileObject file, String type) { |
367 |
if (type.equals(ClassPath.COMPILE)) { |
423 |
if (type.equals(ClassPath.COMPILE)) { |
368 |
return getCompileTimeClasspath(file); |
424 |
return getCompileTimeClasspath(file); |
|
|
425 |
} else if (type.equals(JavaClassPathConstants.PROCESSOR_PATH)) { |
426 |
return getProcessorClasspath(file); |
369 |
} else if (type.equals(ClassPath.EXECUTE)) { |
427 |
} else if (type.equals(ClassPath.EXECUTE)) { |
370 |
return getRunTimeClasspath(file); |
428 |
return getRunTimeClasspath(file); |
371 |
} else if (type.equals(ClassPath.SOURCE)) { |
429 |
} else if (type.equals(ClassPath.SOURCE)) { |
Lines 395-400
Link Here
|
395 |
l[1] = getCompileTimeClasspath(1); |
453 |
l[1] = getCompileTimeClasspath(1); |
396 |
return l; |
454 |
return l; |
397 |
} |
455 |
} |
|
|
456 |
if (JavaClassPathConstants.PROCESSOR_PATH.equals(type)) { |
457 |
ClassPath[] l = new ClassPath[2]; |
458 |
l[0] = getProcessorClasspath(0); |
459 |
l[1] = getProcessorClasspath(1); |
460 |
return l; |
461 |
} |
398 |
if (ClassPath.SOURCE.equals(type)) { |
462 |
if (ClassPath.SOURCE.equals(type)) { |
399 |
ClassPath[] l = new ClassPath[2]; |
463 |
ClassPath[] l = new ClassPath[2]; |
400 |
l[0] = getSourcepath(0); |
464 |
l[0] = getSourcepath(0); |
Lines 417-422
Link Here
|
417 |
if (ClassPath.COMPILE.equals(type)) { |
481 |
if (ClassPath.COMPILE.equals(type)) { |
418 |
return getCompileTimeClasspath(0); |
482 |
return getCompileTimeClasspath(0); |
419 |
} |
483 |
} |
|
|
484 |
if (JavaClassPathConstants.PROCESSOR_PATH.equals(type)) { |
485 |
return getProcessorClasspath(0); |
486 |
} |
420 |
if (ClassPath.SOURCE.equals(type)) { |
487 |
if (ClassPath.SOURCE.equals(type)) { |
421 |
return getSourcepath(0); |
488 |
return getSourcepath(0); |
422 |
} |
489 |
} |
Lines 437-443
Link Here
|
437 |
} |
504 |
} |
438 |
else if (ClassPath.EXECUTE.equals(type)) { |
505 |
else if (ClassPath.EXECUTE.equals(type)) { |
439 |
return runTestClasspath; |
506 |
return runTestClasspath; |
440 |
} |
507 |
}//XXX: processor path |
441 |
else { |
508 |
else { |
442 |
return null; |
509 |
return null; |
443 |
} |
510 |
} |
Lines 449-454
Link Here
|
449 |
else if (ClassPath.EXECUTE.equals(type)) { |
516 |
else if (ClassPath.EXECUTE.equals(type)) { |
450 |
return runClasspath; |
517 |
return runClasspath; |
451 |
} |
518 |
} |
|
|
519 |
else if (JavaClassPathConstants.PROCESSOR_PATH.equals(type)) { |
520 |
return processorClasspath; |
521 |
} |
452 |
else { |
522 |
else { |
453 |
return null; |
523 |
return null; |
454 |
} |
524 |
} |
Lines 469-474
Link Here
|
469 |
else if (ClassPath.EXECUTE.equals(type)) { |
539 |
else if (ClassPath.EXECUTE.equals(type)) { |
470 |
return runClasspath; |
540 |
return runClasspath; |
471 |
} |
541 |
} |
|
|
542 |
else if (JavaClassPathConstants.PROCESSOR_PATH.equals(type)) { |
543 |
return processorClasspath; |
544 |
} |
472 |
else { |
545 |
else { |
473 |
return null; |
546 |
return null; |
474 |
} |
547 |
} |