use of com.intellij.openapi.projectRoots.SdkModificator in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testAssets.
@JSTestOptions({ JSTestOption.WithFlexFacet })
public void testAssets() throws Throwable {
final String testName = getTestName(false);
final String fileRelPath = "pack/" + testName + ".mxml";
final VirtualFile swcFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + "/" + testName + ".swc");
final SdkModificator modificator = FlexTestUtils.getFlexSdkModificator(getModule());
modificator.addRoot(JarFileSystem.getInstance().getJarRootForLocalFile(swcFile), OrderRootType.CLASSES);
modificator.commitChanges();
final Module dependentModule = doCreateRealModule("dependent");
final VirtualFile contentRoot = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + "_dependent_module");
PsiTestUtil.addSourceRoot(dependentModule, contentRoot);
final String absPath = LocalFileSystem.getInstance().findFileByPath("").getPath();
myAfterCommitRunnable = () -> ApplicationManager.getApplication().runWriteAction(() -> {
replaceText(fileRelPath, "${SOME_ABSOLUTE_PATH}", absPath);
ModuleRootModificationUtil.addDependency(myModule, dependentModule);
});
doTestFor(true, getDefaultProjectRoot(testName), (Runnable) null, testName + "/" + fileRelPath);
}
use of com.intellij.openapi.projectRoots.SdkModificator in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testIgnoreClassesFromOnlySdkSources.
@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testIgnoreClassesFromOnlySdkSources() throws Exception {
final String testName = getTestName(false);
final VirtualFile srcFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + "/sdk_src/");
final SdkModificator modificator = FlexTestUtils.getFlexSdkModificator(myModule);
modificator.addRoot(srcFile, OrderRootType.SOURCES);
modificator.commitChanges();
doTestFor(true, testName + "/" + testName + ".mxml");
}
use of com.intellij.openapi.projectRoots.SdkModificator in project intellij-plugins by JetBrains.
the class FlexCompletionTest method testResourceBundleFromSdk.
@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testResourceBundleFromSdk() throws Exception {
final String testName = getTestName(false);
final Sdk flexSdk = FlexUtils.getSdkForActiveBC(getModule());
final SdkModificator sdkModificator = flexSdk.getSdkModificator();
final VirtualFile swcFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + "/" + getBasePath() + "/" + testName + ".swc");
sdkModificator.addRoot(JarFileSystem.getInstance().getJarRootForLocalFile(swcFile), OrderRootType.CLASSES);
sdkModificator.commitChanges();
doTest("", "as");
doTest("", "mxml");
}
use of com.intellij.openapi.projectRoots.SdkModificator in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testNamespacesFromSdkSwcs.
@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testNamespacesFromSdkSwcs() throws Exception {
final String name = getTestName(false);
final SdkModificator sdkModificator = FlexTestUtils.getFlexSdkModificator(getModule());
final VirtualFile swcFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + "/" + getBasePath() + "/" + name + ".swc");
sdkModificator.addRoot(JarFileSystem.getInstance().getJarRootForLocalFile(swcFile), OrderRootType.CLASSES);
sdkModificator.commitChanges();
doTestFor(true, name + ".mxml");
}
use of com.intellij.openapi.projectRoots.SdkModificator in project intellij-plugins by JetBrains.
the class AppTestBase method doSetupFlexSdk.
private void doSetupFlexSdk(final Module module, final String flexSdkRootPath, final TargetPlatform targetPlatform, final String sdkVersion) {
final String sdkName = generateSdkName(sdkVersion);
Sdk sdk = ProjectJdkTable.getInstance().findJdk(sdkName);
if (sdk == null) {
ApplicationManager.getApplication().runWriteAction(() -> {
FlexSdkType2 sdkType = FlexSdkType2.getInstance();
Sdk sdk1 = new ProjectJdkImpl(sdkName, sdkType, flexSdkRootPath, "");
ProjectJdkTable.getInstance().addJdk(sdk1);
Disposer.register(getSdkParentDisposable(), new Disposable() {
@Override
public void dispose() {
ApplicationManager.getApplication().runWriteAction(() -> {
ProjectJdkTable sdkTable = ProjectJdkTable.getInstance();
sdkTable.removeJdk(sdkTable.findJdk(sdkName));
});
}
});
final SdkModificator modificator = sdk1.getSdkModificator();
modificator.setVersionString(FlexSdkType2.getInstance().getVersionString(sdk1.getHomePath()));
modifySdk(sdk1, modificator);
modificator.commitChanges();
});
}
FlexTestUtils.modifyBuildConfiguration(module, bc -> {
bc.setNature(new BuildConfigurationNature(targetPlatform, false, getOutputType()));
bc.getDependencies().setSdkEntry(Factory.createSdkEntry(sdkName));
});
}
Aggregations