mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[build scripts] restore IdeaProjectLoader class which are still used in *.gant scripts
...via jps-build-script-dependencies-bootstrap library. It was deleted in d63b2fa6bb by mistake. GitOrigin-RevId: 50beb93ddf812f60f363560318c3e7e3e2f4ef3a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e9c2a0b88b
commit
e06b425787
@@ -0,0 +1,36 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.jps.idea;
|
||||
|
||||
import groovy.lang.Script;
|
||||
import org.jetbrains.jps.model.serialization.PathMacroUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class IdeaProjectLoader {
|
||||
/**
|
||||
* This method is still used in some *.gant scripts via jps-build-script-dependencies-bootstrap library
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static String guessHome(Script script) throws IOException, URISyntaxException {
|
||||
String uri = (String)script.getProperty("gant.file");
|
||||
File home = new File(new URI(uri).getSchemeSpecificPart());
|
||||
|
||||
while (home != null) {
|
||||
if (home.isDirectory() && new File(home, PathMacroUtil.DIRECTORY_STORE_NAME).exists()) {
|
||||
return home.getCanonicalPath();
|
||||
}
|
||||
|
||||
|
||||
home = home.getParentFile();
|
||||
}
|
||||
|
||||
|
||||
throw new IllegalArgumentException("Cannot guess project home from '" + uri + "'");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user