Permalink
Browse files

JPS: don't parse project settings

  • Loading branch information...
pavelfatin committed Dec 20, 2012
1 parent 78ff38d commit b9a69207176dd79b45cd3ceea85e543b13cbcca4
@@ -6,14 +6,11 @@
import org.jetbrains.jps.incremental.scala.model.FacetSettings;
import org.jetbrains.jps.incremental.scala.model.FacetSettingsImpl;
import org.jetbrains.jps.incremental.scala.model.GlobalSettingsImpl;
-import org.jetbrains.jps.incremental.scala.model.ProjectSettingsImpl;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsGlobal;
-import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.serialization.JpsGlobalExtensionSerializer;
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
-import org.jetbrains.jps.model.serialization.JpsProjectExtensionSerializer;
import org.jetbrains.jps.model.serialization.facet.JpsFacetConfigurationSerializer;
import java.util.Collections;
@@ -29,12 +26,6 @@
return Collections.singletonList(new GlobalSettingsSerializer());
}
- @NotNull
- @Override
- public List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() {
- return Collections.singletonList(new ProjectSettingsSerializer());
- }
-
@Override
public List<? extends JpsFacetConfigurationSerializer<?>> getFacetConfigurationSerializers() {
return Collections.singletonList(new FacetSettingsSerializer());
@@ -58,27 +49,6 @@ public void saveExtension(@NotNull JpsGlobal jpsGlobal, @NotNull Element compone
}
}
- private static class ProjectSettingsSerializer extends JpsProjectExtensionSerializer {
- private static final String COMPILER_SETTINGS_COMPONENT_NAME = "ScalacSettings";
- private static final String COMPILER_SETTINGS_FILE = "scala_compiler.xml";
-
- public ProjectSettingsSerializer() {
- super(COMPILER_SETTINGS_FILE, COMPILER_SETTINGS_COMPONENT_NAME);
- }
-
- @Override
- public void loadExtension(@NotNull JpsProject jpsProject, @NotNull Element componentTag) {
- ProjectSettingsImpl.State state = XmlSerializer.deserialize(componentTag, ProjectSettingsImpl.State.class);
- ProjectSettingsImpl settings = new ProjectSettingsImpl(state == null ? new ProjectSettingsImpl.State() : state);
- SettingsManager.setProjectSettings(jpsProject, settings);
- }
-
- @Override
- public void saveExtension(@NotNull JpsProject jpsProject, @NotNull Element componentTag) {
- // do nothing
- }
- }
-
private static class FacetSettingsSerializer extends JpsFacetConfigurationSerializer<FacetSettings> {
public FacetSettingsSerializer() {
super(SettingsManager.FACET_SETTINGS_ROLE, "scala", null);
@@ -13,7 +13,6 @@
*/
public class SettingsManager {
public static final JpsElementChildRoleBase<GlobalSettings> GLOBAL_SETTINGS_ROLE = JpsElementChildRoleBase.create("scala global settings");
- public static final JpsElementChildRoleBase<ProjectSettings> PROJECT_SETTINGS_ROLE = JpsElementChildRoleBase.create("scala project settings");
public static final JpsElementChildRoleBase<FacetSettings> FACET_SETTINGS_ROLE = JpsElementChildRoleBase.create("scala facet settings");
public static GlobalSettings getGlobalSettings(JpsGlobal global) {
@@ -25,15 +24,6 @@ public static void setGlobalSettings(JpsGlobal global, GlobalSettings settings)
global.getContainer().setChild(GLOBAL_SETTINGS_ROLE, settings);
}
- public static ProjectSettings getProjectSettings(@NotNull JpsProject project) {
- ProjectSettings settings = project.getContainer().getChild(PROJECT_SETTINGS_ROLE);
- return settings == null ? ProjectSettingsImpl.DEFAULT : settings;
- }
-
- public static void setProjectSettings(@NotNull JpsProject project, ProjectSettings settings) {
- project.getContainer().setChild(PROJECT_SETTINGS_ROLE, settings);
- }
-
@Nullable
public static FacetSettings getFacetSettings(@NotNull JpsModule module) {
return module.getContainer().getChild(FACET_SETTINGS_ROLE);
@@ -1,10 +0,0 @@
-package org.jetbrains.jps.incremental.scala.model;
-
-import org.jetbrains.jps.model.JpsElement;
-
-/**
- * @author Pavel Fatin
- */
-public interface ProjectSettings extends JpsElement {
- Order getCompilationOrder();
-}
@@ -1,37 +0,0 @@
-package org.jetbrains.jps.incremental.scala.model;
-
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.model.ex.JpsElementBase;
-
-/**
- * @author Pavel Fatin
- */
-public class ProjectSettingsImpl extends JpsElementBase<ProjectSettingsImpl> implements ProjectSettings {
- public static final ProjectSettings DEFAULT = new ProjectSettingsImpl(new State());
-
- private State myState;
-
- public ProjectSettingsImpl(State state) {
- myState = state;
- }
-
- public Order getCompilationOrder() {
- return myState.SCALAC_BEFORE ? Order.ScalaThenJava : Order.JavaThenScala;
- }
-
- @NotNull
- @Override
- public ProjectSettingsImpl createCopy() {
- return new ProjectSettingsImpl(XmlSerializerUtil.createCopy(myState));
- }
-
- @Override
- public void applyChanges(@NotNull ProjectSettingsImpl compilerSettings) {
- // do nothing
- }
-
- public static class State {
- public boolean SCALAC_BEFORE = true;
- }
-}

0 comments on commit b9a6920

Please sign in to comment.