本文整理汇总了Java中com.intellij.openapi.compiler.CompilerPaths类的典型用法代码示例。如果您正苦于以下问题:Java CompilerPaths类的具体用法?Java CompilerPaths怎么用?Java CompilerPaths使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompilerPaths类属于com.intellij.openapi.compiler包,在下文中一共展示了CompilerPaths类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotationProcessorsGenerationPath
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
@Nullable
public static String getAnnotationProcessorsGenerationPath(Module module) {
final AnnotationProcessingConfiguration config =
JavaCompilerConfiguration.getInstance(module.getProject()).getAnnotationProcessingConfiguration(module);
final String sourceDirName = config.getGeneratedSourcesDirectoryName(false);
if (config.isOutputRelativeToContentRoot()) {
final String[] roots = ModuleRootManager.getInstance(module).getContentRootUrls();
if (roots.length == 0) {
return null;
}
if (roots.length > 1) {
Arrays.sort(roots, CompilerPaths.URLS_COMPARATOR);
}
return StringUtil.isEmpty(sourceDirName)
? VirtualFileManager.extractPath(roots[0])
: VirtualFileManager.extractPath(roots[0]) + "/" + sourceDirName;
}
final String path = CompilerPathsImpl.getModuleOutputPath(module, false);
if (path == null) {
return null;
}
return StringUtil.isEmpty(sourceDirName) ? path : path + "/" + sourceDirName;
}
示例2: defineModule
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
private ManModule defineModule( Module ijModule )
{
List<VirtualFile> sourceFolders = getSourceRoots( ijModule );
VirtualFile outputPath = CompilerPaths.getModuleOutputDirectory( ijModule, false );
return createModule( ijModule, getClassPaths( ijModule ),
sourceFolders.stream().map( this::toDirectory ).collect( Collectors.toList() ),
outputPath == null ? null : getFileSystem().getIDirectory( outputPath ) );
}
示例3: BindingsCache
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public BindingsCache(final Project project) {
final File cacheStoreDirectory = CompilerPaths.getCacheStoreDirectory(project);
try {
if (cacheStoreDirectory != null) {
FileUtil.createParentDirs(cacheStoreDirectory);
myCache = createCache(cacheStoreDirectory);
}
else {
myCache = null;
}
}
catch (IOException e) {
LOG.info(e);
for (File file : cacheStoreDirectory.listFiles()) {
if (file.getName().startsWith(BINDINGS_FILE_NAME)) {
FileUtil.delete(file);
}
}
try {
myCache = createCache(cacheStoreDirectory);
}
catch (IOException e1) {
LOG.info(e1);
myCache = null;
}
}
}
示例4: getBuildDirectoryPath
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
@Override
public String getBuildDirectoryPath() {
if(mavenProject != null) {
return mavenProject.getBuildDirectory();
} else {
// The build file is normally placed inside the parent folder of the module output directory
VirtualFile moduleOutputDirectory = CompilerPaths.getModuleOutputDirectory(module, false);
return moduleOutputDirectory.getParent().getPath();
}
}
示例5: getFullClassPath
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public static String getFullClassPath(Module m){
String cp = "";
String moduleOutputPath = CompilerPaths.getModuleOutputPath(m,false);
if(moduleOutputPath != null && new File(moduleOutputPath).exists()) {
cp += moduleOutputPath;
}
for(VirtualFile vf : OrderEnumerator.orderEntries(m).recursively().getClassesRoots()){
String entry = new File(vf.getPath()).getAbsolutePath();
if(entry.endsWith("!/")){ //not sure why it happens in the returned paths
entry = entry.substring(0,entry.length()-2);
}
if(entry.endsWith("!")){
entry = entry.substring(0,entry.length()-1);
}
if(entry.endsWith("zip")){
//for some reasons, Java src.zip can end up on dependencies...
continue;
}
if(! new File(entry).exists()){
continue;
}
if(cp==null || cp.isEmpty()){
cp = entry;
} else {
cp += File.pathSeparator + entry;
}
}
return cp;
}
示例6: addCommandLineOptions
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public static void addCommandLineOptions(@NotNull ModuleChunk chunk,
@NonNls List<String> commandLine,
@NotNull String outputPath,
@NotNull Sdk jdk,
boolean isAnnotationProcessingMode) throws IOException {
LanguageLevel languageLevel = chunk.getLanguageLevel();
CompilerUtil.addSourceCommandLineSwitch(jdk, languageLevel, commandLine);
commandLine.add("-verbose");
final String bootCp = chunk.getCompilationBootClasspath();
final String classPath = chunk.getCompilationClasspath();
commandLine.add("-bootclasspath");
addClassPathValue(commandLine, bootCp);
commandLine.add("-classpath");
addClassPathValue(commandLine, classPath);
if (isAnnotationProcessingMode) {
commandLine.add("-s");
commandLine.add(outputPath.replace('/', File.separatorChar));
final String moduleOutputPath = CompilerPaths.getModuleOutputPath(chunk.getModules()[0], false);
if (moduleOutputPath != null) {
commandLine.add("-d");
commandLine.add(moduleOutputPath.replace('/', File.separatorChar));
}
}
else {
commandLine.add("-d");
commandLine.add(outputPath.replace('/', File.separatorChar));
}
}
示例7: iterateModuleClassFiles
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public static void iterateModuleClassFiles(@NotNull final Module module, @NotNull final Consumer<File> fileConsumer) {
final VirtualFile moduleOutputDirectory = CompilerPaths.getModuleOutputDirectory(module, false);
if (moduleOutputDirectory == null) {
return;
}
final String canonicalPath = moduleOutputDirectory.getCanonicalPath();
if (canonicalPath == null) {
return;
}
final File root = new File(canonicalPath);
iterateClassFilesOverRoot(root, fileConsumer);
}
示例8: BindingsCache
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public BindingsCache(final Project project)
{
final File cacheStoreDirectory = CompilerPaths.getCacheStoreDirectory(project);
try
{
if(cacheStoreDirectory != null)
{
FileUtil.createParentDirs(cacheStoreDirectory);
myCache = createCache(cacheStoreDirectory);
}
else
{
myCache = null;
}
}
catch(IOException e)
{
LOG.info(e);
for(File file : cacheStoreDirectory.listFiles())
{
if(file.getName().startsWith(BINDINGS_FILE_NAME))
{
FileUtil.delete(file);
}
}
try
{
myCache = createCache(cacheStoreDirectory);
}
catch(IOException e1)
{
LOG.info(e1);
myCache = null;
}
}
}
示例9: getModuleOutputDirectory
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public VirtualFile getModuleOutputDirectory(Module module) {
return CompilerPaths.getModuleOutputDirectory(module, false);
}
示例10: getModuleOutputDirectoryForTests
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public VirtualFile getModuleOutputDirectoryForTests(Module module) {
return CompilerPaths.getModuleOutputDirectory(module, true);
}
示例11: getGenericCompilerCacheDir
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public static File getGenericCompilerCacheDir(Project project, GenericCompiler<?,?,?> compiler) {
return new File(CompilerPaths.getCacheStoreDirectory(project), compiler.getId());
}
示例12: moduleChanged
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public void moduleChanged(Module module) {
if (!hasIBIntegrator || !System.getProperty("os.name").toLowerCase().contains("mac os x")) {
return;
}
String moduleId = getModuleId(module);
IBIntegratorProxy proxy = daemons.get(moduleId);
if(proxy == null) {
try {
File buildDir = RoboVmPlugin.getModuleXcodeDir(module);
RoboVmPlugin.logInfo(module.getProject(), "Starting Interface Builder integrator daemon for module %s", moduleId);
proxy = new IBIntegratorProxy(RoboVmPlugin.getRoboVmHome(), RoboVmPlugin.getLogger(module.getProject()), moduleId, buildDir);
proxy.start();
daemons.put(moduleId, proxy);
} catch (Throwable e) {
RoboVmPlugin.logWarn(module.getProject(), "Failed to start Interface Builder integrator for module " + module.getName() + ": " + e.getMessage());
}
}
if(proxy != null) {
// set the classpath, excluding module output paths
OrderEnumerator classes = ModuleRootManager.getInstance(module).orderEntries().recursively().withoutSdk().compileOnly().productionOnly();
List<File> classPaths = new ArrayList<File>();
for(String path: classes.getPathsList().getPathList()) {
classPaths.add(new File(path));
}
proxy.setClasspath(classPaths);
// set the source paths
Set<File> moduleOutputPaths = new HashSet<File>();
for(Module dep: ModuleRootManager.getInstance(module).getDependencies(false)) {
moduleOutputPaths.add(new File(CompilerPaths.getModuleOutputPath(dep, false)));
}
moduleOutputPaths.add(new File(CompilerPaths.getModuleOutputPath(module, false)));
// we need to create the dirs here as they
// may not have been generated by IDEA yet
for(File file: moduleOutputPaths) {
file.mkdirs();
}
proxy.setSourceFolders(moduleOutputPaths);
// set the resource paths
proxy.setResourceFolders(RoboVmPlugin.getModuleResourcePaths(module));
// set the plist file location
File infoPlist = RoboVmPlugin.getModuleInfoPlist(module);
if(infoPlist != null) {
proxy.setInfoPlist(infoPlist);
}
}
}
示例13: getModuleOutputPath
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
private static String getModuleOutputPath(PageObjectRunConfig runConfig) {
Module module = runConfig.getConfigurationModule().getModule();
return FILE_PROTOCOL + CompilerPaths.getModuleOutputPath(module, false);
}
示例14: addCommandLineOptions
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
public static void addCommandLineOptions(ModuleChunk chunk, @NonNls List<String> commandLine, String outputPath, Sdk jdk,
boolean version1_0,
boolean version1_1,
List<File> tempFiles, boolean addSourcePath, boolean useTempFile,
boolean isAnnotationProcessingMode) throws IOException {
LanguageLevel languageLevel = chunk.getLanguageLevel();
CompilerUtil.addSourceCommandLineSwitch(jdk, languageLevel, commandLine);
CompilerUtil.addTargetCommandLineSwitch(chunk, commandLine);
commandLine.add("-verbose");
final String cp = chunk.getCompilationClasspath();
final String bootCp = chunk.getCompilationBootClasspath();
final String classPath;
if (version1_0 || version1_1) {
classPath = bootCp + File.pathSeparator + cp;
}
else {
classPath = cp;
commandLine.add("-bootclasspath");
addClassPathValue(jdk, false, commandLine, bootCp, "javac_bootcp", tempFiles, useTempFile);
}
commandLine.add("-classpath");
addClassPathValue(jdk, version1_0, commandLine, classPath, "javac_cp", tempFiles, useTempFile);
if (!version1_1 && !version1_0 && addSourcePath) {
commandLine.add("-sourcepath");
// this way we tell the compiler that the sourcepath is "empty". However, javac thinks that sourcepath is 'new File("")'
// this may cause problems if we have java code in IDEA working directory
if (isAnnotationProcessingMode) {
final int currentSourcesMode = chunk.getSourcesFilter();
commandLine.add(chunk.getSourcePath(currentSourcesMode == ModuleChunk.TEST_SOURCES? ModuleChunk.ALL_SOURCES : currentSourcesMode));
}
else {
commandLine.add("\"\"");
}
}
if (isAnnotationProcessingMode) {
commandLine.add("-s");
commandLine.add(outputPath.replace('/', File.separatorChar));
final String moduleOutputPath = CompilerPaths.getModuleOutputPath(chunk.getModules()[0], false);
if (moduleOutputPath != null) {
commandLine.add("-d");
commandLine.add(moduleOutputPath.replace('/', File.separatorChar));
}
}
else {
commandLine.add("-d");
commandLine.add(outputPath.replace('/', File.separatorChar));
}
}
示例15: getStubOutput
import com.intellij.openapi.compiler.CompilerPaths; //导入依赖的package包/类
private static File getStubOutput(Module module, boolean tests) {
final Project project = module.getProject();
final String rootPath = CompilerPaths.getGeneratedDataDirectory(project).getPath() + "/" + GROOVY_STUBS + "/";
return new File(rootPath + module.getName() + "/" + (tests ? "tests" : "production") + "/");
}