Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
58,800
GradleProjectSettings (String path) { GradleProjectSettings projectSettings = new GradleProjectSettings(); projectSettings.setExternalProjectPath(path); projectSettings.setDistributionType(DistributionType.DEFAULT_WRAPPED); GradleSettings.getInstance(myProject).linkProject(projectSettings); return projectSettings; }
linkProject
58,801
void (@NotNull String moduleName, @NotNull String expectedTaskProjectPath) { assertTasksProjectPath(moduleName, expectedTaskProjectPath, ""); }
assertTasksProjectPath
58,802
void (@NotNull String moduleName, @NotNull String expectedTaskProjectPath, @NotNull String expectedTaskPrefix) { for (DataNode<TaskData> node : ExternalSystemApiUtil .findAll(GradleUtil.findGradleModuleData(getModule(moduleName)), ProjectKeys.TASK)) { TaskData taskData = node.getData(); String actualTaskProjectPath = t...
assertTasksProjectPath
58,803
void (@NotNull RunConfigurationImporter testExtension) { ExtensionTestUtil.maskExtensions(RunConfigurationImporter.EP_NAME, Collections.singletonList(testExtension), getTestRootDisposable()); }
maskRunImporter
58,804
void (String moduleName) { assertCompileClasspathOrdering(moduleName, false); }
assertCompileClasspathOrdering
58,805
void (String moduleName) { assertCompileClasspathOrdering(moduleName, true); }
maybeAssertCompileClasspathOrderingWithEnabledClasspathPackaging
58,806
void (String moduleName, boolean useCompileClasspathPackaging) { Module module = getModule(moduleName); String sourceSetName = getSourceSetName(module); assertNotNull("Can not find the sourceSet for the module", sourceSetName); ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings(); se...
assertCompileClasspathOrdering
58,807
void (@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { if (!stdOut || text.isBlank()) return; if (text.contains("Gradle Daemon")) return; gradleClasspath.append(text); }
onTaskOutput
58,808
void (String moduleName, String depName, String ... roots) { List<LibraryOrderEntry> deps = getModuleLibDeps(moduleName, depName); assertThat(deps).hasSize(1); LibraryEx library = (LibraryEx)deps.get(0).getLibrary(); assertThat(library.getUrls(OrderRootType.CLASSES)).hasSize(1); String[] excludedRootUrls = library.getE...
assertLibraryExcludedRoots
58,809
void (File zipFile, File unzipDir) { new ZipFile(zipFile).withCloseable { zip -> def outputDirectoryCanonicalPath = unzipDir.canonicalPath for (entry in zip.entries()) { unzipEntryTo(unzipDir, outputDirectoryCanonicalPath, zip, entry) } } }
unzipTo
58,810
static (File outputDirectory, String outputDirectoryCanonicalPath, ZipFile zip, ZipEntry entry) { def output = new File(outputDirectory, entry.name) if (!output.canonicalPath.startsWith(outputDirectoryCanonicalPath)) { throw new ZipException("Zip entry '${entry.name}' is outside of the output directory") } if (entry.is...
unzipEntryTo
58,811
LibraryOrderEntry (String moduleName, String depName) { List<LibraryOrderEntry> moduleLibDeps = getModuleLibDeps(moduleName, depName); assertThat(moduleLibDeps).hasSize(1); return moduleLibDeps.iterator().next(); }
assertSingleLibraryOrderEntry
58,812
void (String task) { ExternalSystemTaskId taskId = ExternalSystemTaskId.create(GradleConstants.SYSTEM_ID, ExternalSystemTaskType.EXECUTE_TASK, myProject); String projectPath = getProjectPath(); GradleExecutionSettings settings = new GradleManager().getExecutionSettingsProvider().fun(new Pair<>(myProject, projectPath));...
runTask
58,813
void (@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { if (stdOut) { System.out.print(text); } else { System.err.print(text); } }
onTaskOutput
58,814
void (@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { gradleEnv.append(text); }
onTaskOutput
58,815
void () { ModuleManager moduleManager = ModuleManager.getInstance(myProject); for (Module module : moduleManager.getModules()) { System.out.println(module); ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); for (ContentEntry contentEntry : moduleRootManager.getContentEntries()) { System.out.p...
printProjectStructure
58,816
String (String config) { return config; // Do not inject anything }
injectRepo
58,817
void (@NotNull String moduleName, @NotNull String sourcePath) { SourceFolder sourceFolder = findSource(moduleName, sourcePath); assertNull("Source folder " + sourcePath + " found in module " + moduleName + "but shouldn't", sourceFolder); }
assertSourceNotExists
58,818
void (@NotNull String moduleName, @NotNull String sourcePath, @NotNull String packagePrefix) { SourceFolder sourceFolder = findSource(moduleName, sourcePath); assertNotNull("Source folder " + sourcePath + " not found in module " + moduleName, sourceFolder); assertEquals(packagePrefix, sourceFolder.getPackagePrefix()); ...
assertSourcePackagePrefix
58,819
Collection<Object[]> () { return Arrays.asList(new Object[][]{{BASE_GRADLE_VERSION}}); }
data
58,820
void (@NotNull Project project, @NotNull RunConfiguration runConfig, @NotNull Map<String, Object> cfg, @NotNull IdeModifiableModelsProvider modelsProvider) { myConfigs.put(runConfig.getName(), cfg); }
process
58,821
boolean (@NotNull String typeName) { return myTypeName.equals(typeName); }
canImport
58,822
ConfigurationFactory () { return UnknownConfigurationType.getInstance(); }
getConfigurationFactory
58,823
Collection<Facet> (@NotNull Module module, @NotNull String name, @NotNull Map<String, Object> cfg, @NotNull FacetManager facetManager) { myConfigs.put(name, cfg); return Collections.emptySet(); }
process
58,824
boolean (@NotNull String typeName) { return myTypeName.equals(typeName); }
canHandle
58,825
long (@NotNull Collection<Long> values) { long result = 0; for (Long value : values) { if (value != null) { result += value; } } return result; }
sum
58,826
void (@NotNull final Map<String, Long> trace, long time, int threshold) { final long tracedTime = trace.get("Gradle data obtained") + trace.get("Gradle project data processed") + trace.get("Data import total"); double percent = (double)tracedTime / time * 100; boolean condition = percent > threshold && percent < 100; i...
assertTracedTimePercentAtLeast
58,827
void (@NotNull final String traceName, long actual) { int indexOfBrace = name.getMethodName().indexOf("["); final String methodName = indexOfBrace > -1 ? name.getMethodName().substring(0, indexOfBrace) : name.getMethodName(); final String serviceMessage = String.format("##teamcity[buildStatisticValue key='trace.%s.%s.g...
reportTiming
58,828
long (Map<String, Long> trace, String prefix) { return trace.entrySet().stream() .filter(entry -> entry.getKey().startsWith(prefix)) .mapToLong(Map.Entry::getValue) .sum(); }
sumByPrefix
58,829
void () { directTransformationTest("compile 'group:artifact:1.0'", "2.14", getDependency("group", "artifact", "1.0", null, null)); directTransformationTest("compile 'group:artifact:1.0'", "3.3", getDependency("group", "artifact", "1.0", null, null)); directTransformationTest("compile 'group:artifact:1.0'", "3.3-rc-5", ...
testGradleDependencyScope
58,830
void () { String dependency = getDependency("group", "artifact", "1.0", null, null); String comment = "<!-- comment before dependency -->\n"; copyPasteTest("implementation 'group:artifact:1.0'", dependency); copyPasteTest("implementation 'group:artifact:1.0'", comment + dependency); }
testTrimLeadingComment
58,831
void () { copyPasteTest("runtime 'group:artifact:1.0'", getDependency("group", "artifact", "1.0", "runtime", null)); }
testPastedGradleDependency
58,832
void () { copyPasteTest("runtime 'group:artifact:1.0:jdk14'", getDependency("group", "artifact", "1.0", "runtime", "jdk14")); }
testDependencyWithClassifier
58,833
void () { String noArtifact = getDependency("group", null, "1.0", "runtime", null); configureFromFileText("pom.xml", noArtifact); selectWholeFile(); performCut(); configureGradleFile(); int old = CodeInsightSettings.getInstance().REFORMAT_ON_PASTE; try { CodeInsightSettings.getInstance().REFORMAT_ON_PASTE = CodeInsight...
test_DoNotConvertIfCoordinatesNotClear
58,834
void () { copyPasteTest("implementation 'group:artifact:1.0'", getDependency("group", "artifact", "1.0", null, null)); }
test_AddCompile
58,835
void () { copyPasteTest("compileOnly 'group:artifact:1.0'", getDependency("group", "artifact", "1.0", "provided", null)); }
test_AddProvided
58,836
void () { configureFromFileText("build.gradle", """ dependencies { <caret> }"""); }
configureGradleFile
58,837
void () { Document document = getEditor().getDocument(); getEditor().getSelectionModel().setSelection(0, document.getTextLength()); }
selectWholeFile
58,838
void () { EditorActionManager actionManager = EditorActionManager.getInstance(); EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_CUT); actionHandler.execute(getEditor(), null, getContext()); }
performCut
58,839
void () { EditorActionManager actionManager = EditorActionManager.getInstance(); EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_PASTE); actionHandler.execute(getEditor(), null, getContext()); }
performPaste
58,840
DataContext () { try { return DataManager.getInstance().getDataContextFromFocusAsync().blockingGet(100, TimeUnit.MILLISECONDS); } catch (Exception e) { ExceptionUtil.rethrow(e); } return null; }
getContext
58,841
String (@Nullable String groupId, @Nullable String artifactId, @Nullable String version, @Nullable String scope, @Nullable String classifier) { String dependency = "<dependency>\n"; if (groupId != null) { dependency += "<groupId>" + groupId + "</groupId>\n"; } if (artifactId != null) { dependency += "<artifactId>" + ar...
getDependency
58,842
void (@NotNull String gradleDependency, @NotNull String mavenDependency) { configureFromFileText("pom.xml", mavenDependency); selectWholeFile(); performCut(); configureGradleFile(); performPaste(); checkResultByText("dependencies {\n" + " " + gradleDependency + "\n" + "}"); }
copyPasteTest
58,843
void (@NotNull String gradleDependency, @NotNull String gradleVersion, @NotNull String mavenDependency) { String actualGradleDependency = toGradleDependency(mavenDependency, GradleVersion.version(gradleVersion)); assertEquals(gradleDependency, actualGradleDependency); }
directTransformationTest
58,844
void () { myMixer = new GradleLibraryNamesMixer(); }
setUp
58,845
void () { doTest( t("resources", "my-module-resources", "dir1/dir2/my-module/src/main/resources"), t("resources", "my-module-test-resources", "dir1/dir2/my-module/src/test/resources"), t("resources", "my-another-module-resources", "dir1/dir2/my-another-module/src/main/resources"), t("resources", "my-another-module-test...
sourceVsTest
58,846
void (TestDataEntry... entries) { Map<LibraryData, String> expected = new IdentityHashMap<>(); List<LibraryData> libraries = new ArrayList<>(); // TODO den implement // for (TestDataEntry entry : entries) { // LibraryData library = new LibraryData(entry.initialName); // library.addPath(LibraryPathType.BINARY, entry.pat...
doTest
58,847
TestDataEntry (@NotNull String initialName, @NotNull String expectedName, @NotNull String path) { return new TestDataEntry(initialName, expectedName, path); }
t
58,848
void () { List<String> originalArgs = ImmutableList.of( "--configure-on-demand", "-Pandroid.injected.invoked.from.ide=true", "-Pandroid.injected.signing.store.password=asdfghjkl;", "-Pandroid.injected.signing.key.alias=testKey", "-Pandroid.injected.signing.key.password=blabla", "/tmp/asLocalRepo1004.gradle" ); List<Str...
testPasswordObfuscation
58,849
void () { assertOrderedEquals(mergeJvmArgs(List.of("-X:foo"), emptyList()), List.of("-X:foo")); assertOrderedEquals(mergeJvmArgs(emptyList(), List.of("-X:foo")), List.of("-X:foo")); assertOrderedEquals(mergeJvmArgs(List.of("-Dp=val"), List.of("-Dp=newVal")), List.of("-Dp=newVal")); assertOrderedEquals( mergeJvmArgs(Lis...
testMergeJvmArgs
58,850
void () { final Module rootModule = createModuleMock("rootModule"); assertEquals(":", getGradleIdentityPathOrNull(rootModule)); final Module subModule = createModuleMock(":foo:subModule"); assertEquals(":foo:subModule", getGradleIdentityPathOrNull(subModule)); final Module compositeBuildSubModule = createModuleMock("co...
testGetGradlePath
58,851
Module (@Nullable String projectId) { return createModuleMock(projectId, null); }
createModuleMock
58,852
Module (@Nullable String projectId, @Nullable String moduleType) { ModuleBridge module = mock(ModuleBridge.class); Project project = mock(Project.class); when(module.getProject()).thenReturn(project); MutableEntityStorage builder = MutableEntityStorage.create(); ModuleEntity moduleEntity = builder.addEntity(ModuleEntit...
createModuleMock
58,853
void () { String causeMsg = "failed to find target current"; RuntimeException rootCause = new IllegalStateException(causeMsg); String locationMsg = "Build file '~/project/build.gradle' line: 86"; RuntimeException locationError = new RuntimeException(locationMsg, rootCause) { @NotNull @Override public String toString() ...
testGetUserFriendlyError
58,854
String () { return LocationAwareException.class.getName() + ": " + super.toString(); }
toString
58,855
void () { String causeMsg = "com.mypackage.MyImaginaryClass"; ClassNotFoundException rootCause = new ClassNotFoundException(causeMsg); Throwable error = new Throwable(rootCause); RuntimeException realCause = myErrorHandler.getUserFriendlyError(null, error, myProjectPath, null); assertTrue(realCause.getMessage().contain...
testGetUserFriendlyErrorWithClassNotFoundException
58,856
void (String[] args) { sayHello(); }
main
58,857
void () { System.out.println("Hello!"); }
sayHello
58,858
void () { System.out.println("Test!"); Main.sayHello(); }
test
58,859
int () { return 42; }
method
58,860
void () { new App().method(); }
test
58,861
int () { return 42; }
method
58,862
void (@NotNull ProjectTaskContext context) { context.enableCollectionOfGeneratedFiles(); }
started
58,863
void (@NotNull ProjectTaskManager.Result result) { result.getContext().getDirtyOutputPaths() .ifPresent(paths -> dirtyOutputRoots.addAll(paths.map(PathUtil::toSystemIndependentName).toList())); }
finished
58,864
int () { return 42; }
method
58,865
int () { return 42; }
method
58,866
void (String path) { assertThat(file(path)).exists(); }
assertCopied
58,867
void (String path, String content) { assertCopied(path); assertSameLinesWithFile(path(path), content); }
assertCopied
58,868
void (String path) { assertThat(file(path)).doesNotExist(); }
assertNotCopied
58,869
void (String artifactName, String expected) { final String basePath = getArtifactBaseOutputPath(myProject); super.assertArtifactOutputPath(artifactName, basePath + expected); }
assertArtifactOutputPath
58,870
void (Module module, String artifactName, String expected) { final String basePath = getArtifactBaseOutputPath(module); super.assertArtifactOutputPath(artifactName, basePath + expected); }
assertArtifactOutputPath
58,871
void (String artifactName, String path, String content) { final String basePath = getArtifactBaseOutputPath(myProject); assertSameLinesWithFile(basePath + path, content); }
assertArtifactOutputFile
58,872
void (String artifactName, String path) { final String basePath = getArtifactBaseOutputPath(myProject); assertExists(new File(basePath + path)); }
assertArtifactOutputFile
58,873
String (Project project) { return project.getBasePath() + "/out/artifacts"; }
getArtifactBaseOutputPath
58,874
String (Module module) { String outputUrl = ExternalSystemApiUtil.getExternalProjectPath(module) + "/build/libs"; return FileUtil.toSystemIndependentName(VfsUtilCore.urlToPath(outputUrl)); }
getArtifactBaseOutputPath
58,875
void () { // assert production resources assertCopied("out/production/resources/dir/file.xxx"); assertCopied("out/production/resources/file.yyy"); assertNotCopied("out/production/resources/dir/file.yyy"); assertNotCopied("out/production/resources/file.xxx"); assertNotCopied("out/production/resources/file.zzz"); // asse...
assertCopiedResources
58,876
int () { return 42; }
method
58,877
int () { return 42; }
method
58,878
int () { return 100_000; }
methodX
58,879
int () { return 42; }
method
58,880
void () {}
doNothing
58,881
int () { return 42; }
method
58,882
boolean () { return true; }
doSomething
58,883
void () {}
newImplMethod
58,884
void () { compileModules("project.main"); List<String> expected = new ArrayList<>(asList(apiJar)); if (isGradleOlderThan("3.5")) { expected.add(implJar); } if (isGradleNewerOrSameAs("7.1")) { expected.addAll(asList("build/tmp/compileJava/previous-compilation-data.bin", "api/build/tmp/compileJava/previous-compilation-da...
testBuildMainProject
58,885
void () { compileModules("project.test"); List<String> expected = new ArrayList<>(asList(apiJar)); if (isGradleOlderThan("3.5")) { expected.add(implJar); } if (isGradleNewerOrSameAs("7.1")) { expected.addAll(asList("build/tmp/compileJava/previous-compilation-data.bin", "build/tmp/compileTestJava/previous-compilation-da...
testBuildTestProject
58,886
void () { compileModules("project.main"); setFileContent(appFile, APP_JAVA_WITH_NEW_METHOD, false); clearOutputs(); compileModules("project.main"); if (isGradleNewerOrSameAs("7.1")) { assertThat(dirtyOutputRoots).as("Dirty output roots").containsExactlyInAnyOrder("build/tmp/compileJava/previous-compilation-data.bin"); ...
testIncrementalBuildMainProjectUpdatedClass
58,887
void () { compileModules("project.main"); setFileContent(appFile, APP_JAVA_WITH_INNER_CLASS, false); clearOutputs(); compileModules("project.main"); assertThat(generatedFiles).as("Generated files").containsOnly( Map.entry(mainRoot, Set.of("my/pack/App.class", "my/pack/App$NewInnerClass.class")) ); }
testIncrementalBuildMainProjectNewInnerClass
58,888
void () { setFileContent(appFile, APP_JAVA_WITH_INNER_CLASS, false); compileModules("project.main"); setFileContent(appFile, APP_JAVA_WITH_MODIFIED_INNER_CLASS, false); clearOutputs(); compileModules("project.main"); assertThat(generatedFiles).as("Generated files").containsOnly( Map.entry(mainRoot, Set.of("my/pack/App$...
testIncrementalBuildMainProjectUpdateInnerClass
58,889
void () { compileModules("project.main"); setFileContent(implFile, IMPL_JAVA_WITH_NEW_METHOD, false); clearOutputs(); compileModules("project.main"); List<String> expected = new ArrayList<>(); if (isGradleOlderThan("3.5")) { expected.add(implJar); } if (isGradleNewerOrSameAs("7.1")) { expected.add("impl/build/tmp/compi...
testRebuildMainProjectAfterChangingImpl
58,890
void () { compileModules("project.main"); clearOutputs(); compileModules("project.test"); if (isGradleNewerOrSameAs("7.1")) { assertThat(dirtyOutputRoots).as("Dirty output roots").containsExactlyInAnyOrder("build/tmp/compileTestJava/previous-compilation-data.bin"); } else { assertThat(dirtyOutputRoots).as("Dirty output...
testBuildTestProjectAfterMain
58,891
void () { compileModules("project.main"); setFileContent(appFile, """ package my.pack; public class App { public int method() { return 42; } public int methodX() { return 42; } }""", false); clearOutputs(); compileModules("project.main"); // revert file to previous value setFileContent(appFile, APP_JAVA, false); clearO...
testRebuildMainProjectAfterUndoingChange
58,892
int () { return 42; }
method
58,893
int () { return 42; }
methodX
58,894
void () { MessageBusConnection connection = myProject.getMessageBus().connect(getTestRootDisposable()); connection.subscribe(ProjectTaskListener.TOPIC, new ProjectTaskListener() { @Override public void started(@NotNull ProjectTaskContext context) { context.enableCollectionOfGeneratedFiles(); } @Override public void fin...
subscribeToProject
58,895
void (@NotNull ProjectTaskContext context) { context.enableCollectionOfGeneratedFiles(); }
started
58,896
void (@NotNull ProjectTaskManager.Result result) { result.getContext().getDirtyOutputPaths() .ifPresent(paths -> paths .map(path -> relativePath(path)) .forEach(dirtyOutputRoots::add)); result.getContext().getGeneratedFilesRoots() .forEach(generatedRoot -> { Set<String> generatedFilesRelativePaths = result.getContext()...
finished
58,897
String () { return "foo"; }
method
58,898
void () { new App().method(); }
test
58,899
int () { return 42; }
method