GitOrigin-RevId: adcb7b5a259765d3a0881cdbfc788580ab6784c9
This commit is contained in:
Vladimir Krivosheev
2024-08-21 14:07:36 +02:00
committed by intellij-monorepo-bot
parent a5668011e9
commit f30e10cb77
13 changed files with 62 additions and 152 deletions

View File

@@ -1,18 +1,4 @@
/* // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2000-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
@@ -35,7 +21,7 @@ import java.io.File;
import java.util.*; import java.util.*;
public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescriptor> { public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescriptor> {
@NotNull private final JpsModule myModule; private final @NotNull JpsModule myModule;
CheckResourcesTarget(@NotNull JpsModule module, @NotNull Type targetType) { CheckResourcesTarget(@NotNull JpsModule module, @NotNull Type targetType) {
super(targetType); super(targetType);
@@ -47,9 +33,8 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
return myModule.getName(); return myModule.getName();
} }
@Nullable
@Override @Override
public GroovyResourceRootDescriptor findRootDescriptor(@NotNull String rootId, @NotNull BuildRootIndex rootIndex) { public @Nullable GroovyResourceRootDescriptor findRootDescriptor(@NotNull String rootId, @NotNull BuildRootIndex rootIndex) {
List<GroovyResourceRootDescriptor> descriptors = rootIndex.getRootDescriptors(new File(rootId), List<GroovyResourceRootDescriptor> descriptors = rootIndex.getRootDescriptors(new File(rootId),
Collections.singletonList((Type)getTargetType()), Collections.singletonList((Type)getTargetType()),
null); null);
@@ -61,9 +46,8 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
return ((Type)getTargetType()).myTests; return ((Type)getTargetType()).myTests;
} }
@NotNull
@Override @Override
public String getPresentableName() { public @NotNull String getPresentableName() {
return "Check Groovy Resources for '" + myModule.getName() + "' " + (isTests() ? "tests" : "production"); return "Check Groovy Resources for '" + myModule.getName() + "' " + (isTests() ? "tests" : "production");
} }
@@ -82,20 +66,18 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
return result; return result;
} }
@NotNull
@Override @Override
public List<GroovyResourceRootDescriptor> computeRootDescriptors(@NotNull JpsModel model, public @NotNull List<GroovyResourceRootDescriptor> computeRootDescriptors(@NotNull JpsModel model,
@NotNull ModuleExcludeIndex index, @NotNull ModuleExcludeIndex index,
@NotNull IgnoredFileIndex ignoredFileIndex, @NotNull IgnoredFileIndex ignoredFileIndex,
@NotNull BuildDataPaths dataPaths) { @NotNull BuildDataPaths dataPaths) {
ResourcesTarget target = new ResourcesTarget(myModule, ResourcesTargetType.getInstance(isTests())); ResourcesTarget target = new ResourcesTarget(myModule, ResourcesTargetType.getInstance(isTests()));
List<ResourceRootDescriptor> resources = target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths); List<ResourceRootDescriptor> resources = target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths);
return ContainerUtil.map(resources, descriptor -> new GroovyResourceRootDescriptor(descriptor, this)); return ContainerUtil.map(resources, descriptor -> new GroovyResourceRootDescriptor(descriptor, this));
} }
@NotNull
@Override @Override
public Collection<File> getOutputRoots(@NotNull CompileContext context) { public @NotNull Collection<File> getOutputRoots(@NotNull CompileContext context) {
return Collections.singletonList(getOutputRoot(context)); return Collections.singletonList(getOutputRoot(context));
} }
@@ -109,8 +91,7 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
public static final Type TESTS = new Type(true); public static final Type TESTS = new Type(true);
static final List<Type> TARGET_TYPES = Arrays.asList(PRODUCTION, TESTS); static final List<Type> TARGET_TYPES = Arrays.asList(PRODUCTION, TESTS);
@NotNull public @NotNull JpsModule getModule() {
public JpsModule getModule() {
return myModule; return myModule;
} }
@@ -140,23 +121,20 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
myTests = tests; myTests = tests;
} }
@NotNull
@Override @Override
public List<CheckResourcesTarget> computeAllTargets(@NotNull JpsModel model) { public @NotNull List<CheckResourcesTarget> computeAllTargets(@NotNull JpsModel model) {
return ContainerUtil.map(model.getProject().getModules(), module -> new CheckResourcesTarget(module, this)); return ContainerUtil.map(model.getProject().getModules(), module -> new CheckResourcesTarget(module, this));
} }
@NotNull
@Override @Override
public BuildTargetLoader<CheckResourcesTarget> createLoader(@NotNull JpsModel model) { public @NotNull BuildTargetLoader<CheckResourcesTarget> createLoader(@NotNull JpsModel model) {
final Map<String, JpsModule> modules = new HashMap<>(); final Map<String, JpsModule> modules = new HashMap<>();
for (JpsModule module : model.getProject().getModules()) { for (JpsModule module : model.getProject().getModules()) {
modules.put(module.getName(), module); modules.put(module.getName(), module);
} }
return new BuildTargetLoader<CheckResourcesTarget>() { return new BuildTargetLoader<CheckResourcesTarget>() {
@Nullable
@Override @Override
public CheckResourcesTarget createTarget(@NotNull String targetId) { public @Nullable CheckResourcesTarget createTarget(@NotNull String targetId) {
JpsModule module = modules.get(targetId); JpsModule module = modules.get(targetId);
return module != null ? new CheckResourcesTarget(module, Type.this) : null; return module != null ? new CheckResourcesTarget(module, Type.this) : null;
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.openapi.util.NlsSafe; import com.intellij.openapi.util.NlsSafe;
@@ -79,8 +79,7 @@ class EclipseOutputParser {
} }
} }
@Nullable private @Nullable CompilerMessage parseMessage(@NlsSafe String msgText) {
private CompilerMessage parseMessage(@NlsSafe String msgText) {
// message should look like this: // message should look like this:
// 1. WARNING in /Users/andrew/git-repos/foo/src/main/java/packAction.java (at line 47) // 1. WARNING in /Users/andrew/git-repos/foo/src/main/java/packAction.java (at line 47)
// public abstract class AbstractScmTagAction extends TaskAction implements BuildBadgeAction { // public abstract class AbstractScmTagAction extends TaskAction implements BuildBadgeAction {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.execution.process.BaseOSProcessHandler; import com.intellij.execution.process.BaseOSProcessHandler;
@@ -94,9 +94,8 @@ final class ForkedGroovyc implements GroovycFlavor {
); );
final Process process = Runtime.getRuntime().exec(ArrayUtilRt.toStringArray(cmd)); final Process process = Runtime.getRuntime().exec(ArrayUtilRt.toStringArray(cmd));
ProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmd, " "), null) { ProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmd, " "), null) {
@NotNull
@Override @Override
public Future<?> executeTask(@NotNull Runnable task) { public @NotNull Future<?> executeTask(@NotNull Runnable task) {
return SharedThreadPool.getInstance().submit(task); return SharedThreadPool.getInstance().submit(task);
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.execution.process.BaseOSProcessHandler; import com.intellij.execution.process.BaseOSProcessHandler;
@@ -73,8 +73,7 @@ public final class GreclipseBuilder extends ModuleLevelBuilder {
} }
@Nullable private @Nullable ClassLoader createGreclipseLoader(@Nullable String jar) {
private ClassLoader createGreclipseLoader(@Nullable String jar) {
if (StringUtil.isEmpty(jar)) return null; if (StringUtil.isEmpty(jar)) return null;
if (jar.equals(myGreclipseJar)) { if (jar.equals(myGreclipseJar)) {
@@ -99,9 +98,8 @@ public final class GreclipseBuilder extends ModuleLevelBuilder {
} }
@NotNull
@Override @Override
public List<String> getCompilableFileExtensions() { public @NotNull List<String> getCompilableFileExtensions() {
return Arrays.asList("groovy", "java"); return Arrays.asList("groovy", "java");
} }
@@ -290,9 +288,8 @@ public final class GreclipseBuilder extends ModuleLevelBuilder {
); );
final Process process = Runtime.getRuntime().exec(ArrayUtilRt.toStringArray(cmd)); final Process process = Runtime.getRuntime().exec(ArrayUtilRt.toStringArray(cmd));
ProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmd, " "), null) { ProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmd, " "), null) {
@NotNull
@Override @Override
public Future<?> executeTask(@NotNull Runnable task) { public @NotNull Future<?> executeTask(@NotNull Runnable task) {
return SharedThreadPool.getInstance().submit(task); return SharedThreadPool.getInstance().submit(task);
} }
@@ -413,9 +410,8 @@ public final class GreclipseBuilder extends ModuleLevelBuilder {
return StringUtil.join(cp, File.pathSeparator); return StringUtil.join(cp, File.pathSeparator);
} }
@NotNull
@Override @Override
public String getPresentableName() { public @NotNull String getPresentableName() {
return GroovyJpsBundle.message("compiler.name.greclipse"); return GroovyJpsBundle.message("compiler.name.greclipse");
} }

View File

@@ -1,18 +1,4 @@
/* // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2000-2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -31,14 +17,12 @@ public class GreclipseJpsCompilerSettings extends JpsCompositeElementBase<Grecli
mySettings = settings; mySettings = settings;
} }
@NotNull
@Override @Override
public GreclipseJpsCompilerSettings createCopy() { public @NotNull GreclipseJpsCompilerSettings createCopy() {
return new GreclipseJpsCompilerSettings(mySettings); return new GreclipseJpsCompilerSettings(mySettings);
} }
@Nullable public static @Nullable GreclipseSettings getSettings(@NotNull JpsProject project) {
public static GreclipseSettings getSettings(@NotNull JpsProject project) {
GreclipseJpsCompilerSettings extension = project.getContainer().getChild(ROLE); GreclipseJpsCompilerSettings extension = project.getContainer().getChild(ROLE);
return extension != null ? extension.mySettings : null; return extension != null ? extension.mySettings : null;
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
@@ -104,8 +104,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
return new File(context.getProjectDescriptor().dataManager.getDataPaths().getDataStorageRoot(), "groovyStubs"); return new File(context.getProjectDescriptor().dataManager.getDataPaths().getDataStorageRoot(), "groovyStubs");
} }
@Nullable static @Nullable Map<ModuleBuildTarget, String> getCanonicalModuleOutputs(CompileContext context, ModuleChunk chunk, Builder builder) {
static Map<ModuleBuildTarget, String> getCanonicalModuleOutputs(CompileContext context, ModuleChunk chunk, Builder builder) {
Map<ModuleBuildTarget, String> finalOutputs = new LinkedHashMap<>(); Map<ModuleBuildTarget, String> finalOutputs = new LinkedHashMap<>();
for (ModuleBuildTarget target : chunk.getTargets()) { for (ModuleBuildTarget target : chunk.getTargets()) {
File moduleOutputDir = target.getOutputDir(); File moduleOutputDir = target.getOutputDir();
@@ -142,9 +141,8 @@ public class GroovyBuilder extends ModuleLevelBuilder {
return path.endsWith("." + GROOVY_EXTENSION); return path.endsWith("." + GROOVY_EXTENSION);
} }
@NotNull
@Override @Override
public List<String> getCompilableFileExtensions() { public @NotNull List<String> getCompilableFileExtensions() {
return Collections.singletonList(GROOVY_EXTENSION); return Collections.singletonList(GROOVY_EXTENSION);
} }
@@ -154,8 +152,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
} }
@Override @Override
@NotNull public @NotNull String getPresentableName() {
public String getPresentableName() {
return myBuilderName; return myBuilderName;
} }

View File

@@ -1,18 +1,4 @@
/* // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2000-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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -27,21 +13,18 @@ import java.util.List;
public class GroovyBuilderService extends BuilderService { public class GroovyBuilderService extends BuilderService {
@NotNull
@Override @Override
public List<? extends BuildTargetType<?>> getTargetTypes() { public @NotNull List<? extends BuildTargetType<?>> getTargetTypes() {
return CheckResourcesTarget.TARGET_TYPES; return CheckResourcesTarget.TARGET_TYPES;
} }
@NotNull
@Override @Override
public List<? extends TargetBuilder<?, ?>> createBuilders() { public @NotNull List<? extends TargetBuilder<?, ?>> createBuilders() {
return Collections.singletonList(new GroovyResourceChecker()); return Collections.singletonList(new GroovyResourceChecker());
} }
@NotNull
@Override @Override
public List<? extends ModuleLevelBuilder> createModuleLevelBuilders() { public @NotNull List<? extends ModuleLevelBuilder> createModuleLevelBuilders() {
return Arrays.asList(new GroovyBuilder(true), new GroovyBuilder(false), new GreclipseBuilder()); return Arrays.asList(new GroovyBuilder(true), new GroovyBuilder(false), new GreclipseBuilder());
} }
} }

View File

@@ -1,4 +1,4 @@
// 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. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.util.xmlb.XmlSerializer; import com.intellij.util.xmlb.XmlSerializer;
@@ -12,9 +12,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public final class GroovyModelSerializerExtension extends JpsModelSerializerExtension { public final class GroovyModelSerializerExtension extends JpsModelSerializerExtension {
@NotNull
@Override @Override
public List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() { public @NotNull List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() {
return Arrays.asList(new JpsProjectExtensionSerializer("groovyc.xml", "GroovyCompilerProjectConfiguration") { return Arrays.asList(new JpsProjectExtensionSerializer("groovyc.xml", "GroovyCompilerProjectConfiguration") {
@Override @Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) { public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {

View File

@@ -1,4 +1,4 @@
// 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. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Key;
@@ -26,9 +26,8 @@ public class GroovyResourceChecker extends TargetBuilder<GroovyResourceRootDescr
super(CheckResourcesTarget.TARGET_TYPES); super(CheckResourcesTarget.TARGET_TYPES);
} }
@NotNull
@Override @Override
public String getPresentableName() { public @NotNull String getPresentableName() {
return GroovyJpsBundle.message("builder.resource.checker"); return GroovyJpsBundle.message("builder.resource.checker");
} }
@@ -38,9 +37,9 @@ public class GroovyResourceChecker extends TargetBuilder<GroovyResourceRootDescr
} }
@Override @Override
public void build(@NotNull final CheckResourcesTarget target, public void build(final @NotNull CheckResourcesTarget target,
@NotNull DirtyFilesHolder<GroovyResourceRootDescriptor, CheckResourcesTarget> holder, @NotNull DirtyFilesHolder<GroovyResourceRootDescriptor, CheckResourcesTarget> holder,
@NotNull final BuildOutputConsumer outputConsumer, final @NotNull BuildOutputConsumer outputConsumer,
@NotNull CompileContext context) throws ProjectBuildException, IOException { @NotNull CompileContext context) throws ProjectBuildException, IOException {
if (context.getBuilderParameter(CHECKING_RESOURCES_REBUILD.toString()) == null) { if (context.getBuilderParameter(CHECKING_RESOURCES_REBUILD.toString()) == null) {
return; return;
@@ -54,8 +53,7 @@ public class GroovyResourceChecker extends TargetBuilder<GroovyResourceRootDescr
}); });
} }
@NotNull private static @NotNull ModuleChunk singleModuleChunk(final JpsModule module) {
private static ModuleChunk singleModuleChunk(final JpsModule module) {
return new ModuleChunk(Collections.singleton(new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION))); return new ModuleChunk(Collections.singleton(new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION)));
} }
@@ -95,8 +93,7 @@ public class GroovyResourceChecker extends TargetBuilder<GroovyResourceRootDescr
return paths; return paths;
} }
@NotNull private @NotNull List<File> getVisibleResourceOutputs(CompileContext context, boolean tests) {
private List<File> getVisibleResourceOutputs(CompileContext context, boolean tests) {
List<File> resourceOutputs = new ArrayList<>(); List<File> resourceOutputs = new ArrayList<>();
JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(myTarget.getModule()). JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(myTarget.getModule()).
includedIn(JpsJavaClasspathKind.compile(tests)). includedIn(JpsJavaClasspathKind.compile(tests)).

View File

@@ -9,7 +9,7 @@ import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.util.Set; import java.util.Set;
class GroovyResourceRootDescriptor extends BuildRootDescriptor { final class GroovyResourceRootDescriptor extends BuildRootDescriptor {
private final CheckResourcesTarget myTarget; private final CheckResourcesTarget myTarget;
private final ResourceRootDescriptor myDescriptor; private final ResourceRootDescriptor myDescriptor;
@@ -24,8 +24,7 @@ class GroovyResourceRootDescriptor extends BuildRootDescriptor {
} }
@Override @Override
@NotNull public @NotNull FileFilter createFileFilter() {
public FileFilter createFileFilter() {
return myDescriptor.createFileFilter(); return myDescriptor.createFileFilter();
} }

View File

@@ -1,4 +1,4 @@
// 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. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.execution.process.ProcessOutputTypes; import com.intellij.execution.process.ProcessOutputTypes;
@@ -255,7 +255,7 @@ public class GroovycOutputParser {
final Collection<String> changedSources, final Collection<String> changedSources,
Collection<String> finalOutputs, Collection<String> finalOutputs,
Map<String, String> class2Src, Map<String, String> class2Src,
@Nullable final String encoding, final @Nullable String encoding,
List<String> patchers, List<String> patchers,
String classpath) throws IOException { String classpath) throws IOException {
File tempFile = FileUtil.createTempFile("ideaGroovyToCompile", ".txt", true); File tempFile = FileUtil.createTempFile("ideaGroovyToCompile", ".txt", true);

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.execution.process.ProcessOutputTypes; import com.intellij.execution.process.ProcessOutputTypes;
@@ -91,11 +91,10 @@ final class InProcessGroovyc implements GroovycFlavor {
return waitForStubGeneration(future, mailbox, parser, loader); return waitForStubGeneration(future, mailbox, parser, loader);
} }
@Nullable private static @Nullable GroovycContinuation waitForStubGeneration(Future<Void> future,
private static GroovycContinuation waitForStubGeneration(Future<Void> future, LinkedBlockingQueue<?> mailbox,
LinkedBlockingQueue<?> mailbox, GroovycOutputParser parser,
GroovycOutputParser parser, JointCompilationClassLoader loader) throws InterruptedException {
JointCompilationClassLoader loader) throws InterruptedException {
while (true) { while (true) {
Object msg = mailbox.poll(1, TimeUnit.MINUTES); Object msg = mailbox.poll(1, TimeUnit.MINUTES);
if (GROOVYC_FINISHED.equals(msg)) { if (GROOVYC_FINISHED.equals(msg)) {
@@ -116,15 +115,13 @@ final class InProcessGroovyc implements GroovycFlavor {
} }
} }
@NotNull private static @NotNull GroovycContinuation createContinuation(Future<Void> future,
private static GroovycContinuation createContinuation(Future<Void> future, @NotNull Queue<String> mailbox,
@NotNull Queue<String> mailbox, GroovycOutputParser parser,
GroovycOutputParser parser, @NotNull JointCompilationClassLoader loader) {
@NotNull JointCompilationClassLoader loader) {
return new GroovycContinuation() { return new GroovycContinuation() {
@NotNull
@Override @Override
public GroovyCompilerResult continueCompilation() throws Exception { public @NotNull GroovyCompilerResult continueCompilation() throws Exception {
loader.resetCache(); loader.resetCache();
parser.onContinuation(); parser.onContinuation();
mailbox.offer(GroovyRtConstants.JAVAC_COMPLETED); mailbox.offer(GroovyRtConstants.JAVAC_COMPLETED);
@@ -232,8 +229,7 @@ final class InProcessGroovyc implements GroovycFlavor {
return null; return null;
} }
@Nullable static @Nullable String evaluatePathToGroovyJarForParentClassloader(Collection<String> compilationClassPath) {
static String evaluatePathToGroovyJarForParentClassloader(Collection<String> compilationClassPath) {
if (!"true".equals(System.getProperty("groovyc.reuse.compiler.classes", "true"))) { if (!"true".equals(System.getProperty("groovyc.reuse.compiler.classes", "true"))) {
return null; return null;
} }
@@ -347,10 +343,9 @@ final class InProcessGroovyc implements GroovycFlavor {
return result; return result;
} }
@NotNull private static @NotNull PrintStream createStream(@NotNull GroovycOutputParser parser,
private static PrintStream createStream(@NotNull GroovycOutputParser parser, @NotNull Key<?> type,
@NotNull Key<?> type, @Nullable("null means not overridden") PrintStream overridden) throws IOException {
@Nullable("null means not overridden") PrintStream overridden) throws IOException {
final Thread thread = Thread.currentThread(); final Thread thread = Thread.currentThread();
OutputStream out = new OutputStream() { OutputStream out = new OutputStream() {
ByteArrayOutputStream line = new ByteArrayOutputStream(); ByteArrayOutputStream line = new ByteArrayOutputStream();

View File

@@ -1,18 +1,4 @@
/* // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2000-2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.groovy; package org.jetbrains.jps.incremental.groovy;
import com.intellij.util.xmlb.annotations.Tag; import com.intellij.util.xmlb.annotations.Tag;
@@ -54,14 +40,12 @@ public class JpsGroovySettings extends JpsElementBase<JpsGroovySettings> {
JpsJavaCompilerConfigurationSerializer.readExcludes(excludes, myExcludeFromStubGeneration); JpsJavaCompilerConfigurationSerializer.readExcludes(excludes, myExcludeFromStubGeneration);
} }
@NotNull
@Override @Override
public JpsGroovySettings createCopy() { public @NotNull JpsGroovySettings createCopy() {
return new JpsGroovySettings(this); return new JpsGroovySettings(this);
} }
@NotNull public static @NotNull JpsGroovySettings getSettings(@NotNull JpsProject project) {
public static JpsGroovySettings getSettings(@NotNull JpsProject project) {
JpsGroovySettings settings = project.getContainer().getChild(ROLE); JpsGroovySettings settings = project.getContainer().getChild(ROLE);
return settings == null ? new JpsGroovySettings() : settings; return settings == null ? new JpsGroovySettings() : settings;
} }