Implemented optional adding library sources in AbstractLibrariesTest.setUp()
This commit is contained in:
@@ -37,6 +37,8 @@ public abstract class AbstractLibrariesTest extends PlatformTestCase {
|
||||
protected static final String TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/libraries";
|
||||
protected VirtualFile myLibraryDir;
|
||||
|
||||
protected abstract boolean isWithSources();
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@@ -53,6 +55,11 @@ public abstract class AbstractLibrariesTest extends PlatformTestCase {
|
||||
|
||||
Library.ModifiableModel libraryModel = moduleModel.getModuleLibraryTable().getModifiableModel().createLibrary("myKotlinLib").getModifiableModel();
|
||||
libraryModel.addRoot(myLibraryDir, OrderRootType.CLASSES);
|
||||
if (isWithSources()) {
|
||||
VirtualFile sourceDir = LocalFileSystem.getInstance().findFileByPath(TEST_DATA_PATH + "/library");
|
||||
assert sourceDir != null;
|
||||
libraryModel.addRoot(sourceDir, OrderRootType.SOURCES);
|
||||
}
|
||||
libraryModel.commit();
|
||||
|
||||
moduleModel.commit();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -131,4 +131,9 @@ public class LibrariesWithoutSourcesTest extends AbstractLibrariesTest {
|
||||
assertNotNull(classFile);
|
||||
return classFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWithSources() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user