mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 20:30:11 +08:00
fix intellij gradle build issue with incorrect file protocol syntax
This commit is contained in:
parent
ba951ce744
commit
7029579534
@ -171,18 +171,18 @@ public class EnablePrivateAccessTranslator extends BaseTranslator {
|
|||||||
cls = Class.forName(sourceClassFullName);
|
cls = Class.forName(sourceClassFullName);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
if (System.getProperty(IDEA_PATHS_SELECTOR) != null) {
|
if (System.getProperty(IDEA_PATHS_SELECTOR) != null) {
|
||||||
// fit for intellij 2020.3+
|
// fit for intellij build
|
||||||
String sourceFileWrapperString = clazz.sourcefile.toString();
|
String sourceFileWrapperString = clazz.sourcefile.toString();
|
||||||
String sourceFilePath = sourceFileWrapperString.substring(
|
String sourceFilePath = sourceFileWrapperString.substring(
|
||||||
sourceFileWrapperString.lastIndexOf("[") + 1, sourceFileWrapperString.indexOf("]"));
|
sourceFileWrapperString.lastIndexOf("[") + 1, sourceFileWrapperString.indexOf("]"));
|
||||||
int indexOfSrc = sourceFilePath.lastIndexOf(File.separator + "src" + File.separator);
|
int indexOfSrc = sourceFilePath.lastIndexOf(File.separator + "src" + File.separator);
|
||||||
String basePath = sourceFilePath.substring(0, indexOfSrc);
|
String basePath = sourceFilePath.substring(0, indexOfSrc);
|
||||||
String targetFolderPath = PathUtil.fitPathString(basePath + MAVEN_CLASS_FOLDER);
|
|
||||||
try {
|
try {
|
||||||
|
String targetFolderPath = PathUtil.fitPathString(basePath + MAVEN_CLASS_FOLDER);
|
||||||
cls = loadClass(targetFolderPath, sourceClassFullName);
|
cls = loadClass(targetFolderPath, sourceClassFullName);
|
||||||
} catch (ClassNotFoundException e2) {
|
} catch (ClassNotFoundException e2) {
|
||||||
targetFolderPath = PathUtil.fitPathString(basePath + GRADLE_CLASS_FOLDER);
|
String buildFolderPath = PathUtil.fitPathString(basePath + GRADLE_CLASS_FOLDER);
|
||||||
cls = loadClass(targetFolderPath, sourceClassFullName);
|
cls = loadClass(buildFolderPath, sourceClassFullName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// fit for gradle build
|
// fit for gradle build
|
||||||
|
@ -6,7 +6,7 @@ public class PathUtil {
|
|||||||
private static final String PROPERTY_OS_NAME = "os.name";
|
private static final String PROPERTY_OS_NAME = "os.name";
|
||||||
private static final String PATH_SPLIT_UNIX = "/";
|
private static final String PATH_SPLIT_UNIX = "/";
|
||||||
private static final String PATH_SPLIT_WIN = "\\\\";
|
private static final String PATH_SPLIT_WIN = "\\\\";
|
||||||
private static final String PROTOCOL_FILE = "file:/";
|
private static final String PROTOCOL_FILE = "file:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fit path according to operation system type
|
* Fit path according to operation system type
|
||||||
|
Loading…
Reference in New Issue
Block a user