diff options
author | Appu Goundan <appu@google.com> | 2014-07-30 20:38:06 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-07-29 17:36:25 +0000 |
commit | 982597a585eca959cede0f26ecda3a0936ef1a81 (patch) | |
tree | d6cc9ecfbed5d5f22b2595487145874bad8b74eb | |
parent | a8d3d1fd4ffc9d0e0b11fc9ba2fa5c22873f0962 (diff) | |
parent | e4dde09bbfc813d6e2a72c0c96b2ca73f7f69bdd (diff) | |
download | cloud-982597a585eca959cede0f26ecda3a0936ef1a81.tar.gz |
Merge "App Engine Run with Gradle sync" into idea133
7 files changed, 138 insertions, 75 deletions
diff --git a/src/com/google/gct/idea/appengine/gradle/facet/AppEngineGradleFacetConfiguration.java b/src/com/google/gct/idea/appengine/gradle/facet/AppEngineGradleFacetConfiguration.java index 4a898f3..817393d 100644 --- a/src/com/google/gct/idea/appengine/gradle/facet/AppEngineGradleFacetConfiguration.java +++ b/src/com/google/gct/idea/appengine/gradle/facet/AppEngineGradleFacetConfiguration.java @@ -22,13 +22,12 @@ import com.intellij.facet.ui.FacetValidatorsManager; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; -import com.intellij.util.xmlb.XmlSerializer; import org.jdom.Element; import org.jetbrains.annotations.Nullable; /** - * Currently an empty configuration for App Engine Gradle configurations + * A configuration for App Engine Gradle Facets that is populated during gradle project import */ public class AppEngineGradleFacetConfiguration implements FacetConfiguration, PersistentStateComponent<AppEngineConfigurationProperties> { AppEngineConfigurationProperties myProperties = new AppEngineConfigurationProperties(); @@ -42,12 +41,12 @@ public class AppEngineGradleFacetConfiguration implements FacetConfiguration, Pe @Override public void readExternal(Element element) throws InvalidDataException { - XmlSerializer.deserializeInto(this, element); + //Deprecated abstract method, using persistent state component now } @Override public void writeExternal(Element element) throws WriteExternalException { - XmlSerializer.serializeInto(this, element); + //Deprecated abstract method, using persistent state component now } @Nullable diff --git a/src/com/google/gct/idea/appengine/gradle/project/IdeaAppEngineProject.java b/src/com/google/gct/idea/appengine/gradle/project/IdeaAppEngineProject.java index 97a0270..b54e7e7 100644 --- a/src/com/google/gct/idea/appengine/gradle/project/IdeaAppEngineProject.java +++ b/src/com/google/gct/idea/appengine/gradle/project/IdeaAppEngineProject.java @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; /** - * Project wrapper for App Engine Gradle Projects + * Transient project wrapper for App Engine Gradle Projects during gradle imports */ public class IdeaAppEngineProject { @NotNull private final String myModuleName; diff --git a/src/com/google/gct/idea/appengine/gradle/service/AppEngineGradleProjectDataService.java b/src/com/google/gct/idea/appengine/gradle/service/AppEngineGradleProjectDataService.java index 01a4602..94e2ce9 100644 --- a/src/com/google/gct/idea/appengine/gradle/service/AppEngineGradleProjectDataService.java +++ b/src/com/google/gct/idea/appengine/gradle/service/AppEngineGradleProjectDataService.java @@ -105,7 +105,7 @@ public class AppEngineGradleProjectDataService implements ProjectDataService<Ide facet.getConfiguration().getState().APPENGINE_SDKROOT = ideaAppEngineProject.getDelegate().getAppEngineSdkRoot(); facet.getConfiguration().getState().HTTP_ADDRESS = ideaAppEngineProject.getDelegate().getHttpAddress(); facet.getConfiguration().getState().HTTP_PORT = ideaAppEngineProject.getDelegate().getHttpPort(); - for(String flag : ideaAppEngineProject.getDelegate().getJvmFlags()) { + for (String flag : ideaAppEngineProject.getDelegate().getJvmFlags()) { facet.getConfiguration().getState().JVM_FLAGS.add(flag); } facet.getConfiguration().getState().WAR_DIR = ideaAppEngineProject.getDelegate().getWarDir().getAbsolutePath(); diff --git a/src/com/google/gct/idea/appengine/run/AppEngineRunConfiguration.java b/src/com/google/gct/idea/appengine/run/AppEngineRunConfiguration.java index 763eb1c..62ecf53 100644 --- a/src/com/google/gct/idea/appengine/run/AppEngineRunConfiguration.java +++ b/src/com/google/gct/idea/appengine/run/AppEngineRunConfiguration.java @@ -15,6 +15,8 @@ */ package com.google.gct.idea.appengine.run; +import com.google.gct.idea.appengine.gradle.facet.AppEngineConfigurationProperties; +import com.google.gct.idea.appengine.gradle.facet.AppEngineGradleFacet; import com.google.gct.idea.appengine.sdk.AppEngineSdk; import com.intellij.execution.ExecutionException; @@ -59,11 +61,13 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC private String myServerAddress = ""; private String mySdkPath = ""; private String myServerPort = ""; + private Boolean mySyncWithGradle = false; private String myVmArgs = ""; private String myWarPath = ""; private static final String KEY_SERVER_ADDRESS = "serverAddress"; private static final String KEY_SERVER_PORT = "serverPort"; + private static final String KEY_SYNC = "sync"; private static final String KEY_SDK_PATH = "sdkPath"; private static final String KEY_VM_ARGS = "vmArgs"; private static final String KEY_WAR_PATH = "warPath"; @@ -100,6 +104,14 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC this.myServerPort = serverPort; } + public Boolean getSyncWithGradle() { + return mySyncWithGradle; + } + + public void setSyncWithGradle(Boolean syncWithGradle) { + mySyncWithGradle = syncWithGradle; + } + public String getVmArgs() { return myVmArgs; } @@ -108,6 +120,7 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC this.myVmArgs = vmArgs; } + public AppEngineRunConfiguration(String name, Project project, ConfigurationFactory factory) { super(name, new JavaRunConfigurationModule(project, false), factory); } @@ -120,7 +133,7 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC ArrayList<Module> res = new ArrayList<Module>(); for (Module module : modules) { Facet[] facetList = FacetManager.getInstance(module).getAllFacets(); - for(Facet f : facetList) { + for (Facet f : facetList) { if (f.getTypeId() == AppEngineGradleFacet.TYPE_ID) { res.add(module); break; @@ -149,6 +162,23 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC return state; } + // Syncs a run configuration with information from build.gradle via the App Engine Gradle facet + protected void syncWithBuildFileViaFacet() { + Module module = getConfigurationModule().getModule(); + if (module != null) { + AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(module); + if (facet != null) { + AppEngineConfigurationProperties model = facet.getConfiguration().getState(); + if (model != null) { + myServerPort = model.HTTP_PORT.toString(); + myServerAddress = model.HTTP_ADDRESS; + mySdkPath = model.APPENGINE_SDKROOT; + myWarPath = model.WAR_DIR; + } + } + } + } + @Override public final void checkConfiguration() throws RuntimeConfigurationException { JavaRunConfigurationModule configurationModule = getConfigurationModule(); @@ -158,11 +188,21 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC if (module == null) { return; } - /* this will be useful in future when we enable the appengine gradle facet AppEngineGradleFacet facet = AppEngineGradleFacet.getAppEngineFacetByModule(module); if (facet == null) { - throw new RuntimeConfigurationError("No App-Engine Facet"); - }*/ + throw new RuntimeConfigurationError( + "App Engine Gradle configuration not detected on module, maybe you need to Sync Project with Gradle"); + } + + if (mySyncWithGradle && + (facet.getConfiguration().getState() == null || StringUtil.isEmpty(facet.getConfiguration().getState().WEB_APP_DIR))) { + throw new RuntimeConfigurationError( + "App Engine Gradle configuration does not appear to be loaded, please Sync Project with Gradle files before running"); + } + + if (mySyncWithGradle) { + syncWithBuildFileViaFacet(); + } if (mySdkPath == null || mySdkPath.trim().isEmpty() || !new AppEngineSdk(mySdkPath).canRunDevAppServer()) { throw new RuntimeConfigurationError("Invalid App-Engine SDK Path"); @@ -255,6 +295,7 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC myServerPort = StringUtil.notNullize(JDOMExternalizer.readString(element, KEY_SERVER_PORT)); myVmArgs = StringUtil.notNullize(JDOMExternalizer.readString(element, KEY_VM_ARGS)); myWarPath = StringUtil.notNullize(JDOMExternalizer.readString(element, KEY_WAR_PATH)); + mySyncWithGradle = JDOMExternalizer.readBoolean(element, KEY_SYNC); } @Override @@ -266,6 +307,7 @@ public class AppEngineRunConfiguration extends ModuleBasedConfiguration<JavaRunC JDOMExternalizer.write(element, KEY_SERVER_PORT, myServerPort); JDOMExternalizer.write(element, KEY_VM_ARGS, myVmArgs); JDOMExternalizer.write(element, KEY_WAR_PATH, myWarPath); + JDOMExternalizer.write(element, KEY_SYNC, mySyncWithGradle); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); } } diff --git a/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.form b/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.form index aef286c..02fe9d7 100644 --- a/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.form +++ b/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.form @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.google.gct.idea.appengine.run.AppEngineRunConfigurationSettingsEditor"> - <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> - <xy x="17" y="25" width="500" height="169"/> + <xy x="17" y="25" width="500" height="285"/> </constraints> <properties/> <border type="none"/> <children> <component id="78f2" class="javax.swing.JLabel"> <constraints> - <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="War Path"/> @@ -18,7 +18,7 @@ </component> <component id="80c76" class="javax.swing.JLabel"> <constraints> - <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="Server Port"/> @@ -26,7 +26,7 @@ </component> <component id="84c27" class="javax.swing.JTextField" binding="myServerPortField"> <constraints> - <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> + <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <preferred-size width="150" height="-1"/> </grid> </constraints> @@ -36,29 +36,15 @@ </component> <component id="9770e" class="javax.swing.JLabel"> <constraints> - <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="App Engine SDK"/> </properties> </component> - <component id="2305e" class="javax.swing.JLabel"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="Module"/> - </properties> - </component> - <component id="f369c" class="javax.swing.JComboBox" binding="myModuleComboBox"> - <constraints> - <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - <properties/> - </component> <component id="4f254" class="javax.swing.JLabel"> <constraints> - <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="VM Args"/> @@ -66,7 +52,7 @@ </component> <component id="2344d" class="javax.swing.JTextField" binding="myVmArgsField"> <constraints> - <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> + <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <preferred-size width="150" height="-1"/> </grid> </constraints> @@ -74,19 +60,19 @@ </component> <component id="786dc" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myAppEngineSdkField"> <constraints> - <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties/> </component> <component id="b37fb" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myWarPathField"> <constraints> - <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties/> </component> <component id="fa285" class="javax.swing.JTextField" binding="myServerAddressField"> <constraints> - <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> + <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <preferred-size width="150" height="-1"/> </grid> </constraints> @@ -96,12 +82,39 @@ </component> <component id="d19b0" class="javax.swing.JLabel"> <constraints> - <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="Server Address"/> </properties> </component> + <component id="2305e" class="javax.swing.JLabel"> + <constraints> + <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + </constraints> + <properties> + <text value="Module"/> + </properties> + </component> + <vspacer id="5f8a6"> + <constraints> + <grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> + </constraints> + </vspacer> + <component id="f369c" class="javax.swing.JComboBox" binding="myModuleComboBox"> + <constraints> + <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/> + </constraints> + <properties/> + </component> + <component id="3e43f" class="javax.swing.JCheckBox" binding="mySynchronizeWithBuildGradleCheckBox" default-binding="true"> + <constraints> + <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + </constraints> + <properties> + <text value="Synchronize with build.gradle configuration"/> + </properties> + </component> </children> </grid> </form> diff --git a/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.java b/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.java index eb9d315..160c604 100644 --- a/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.java +++ b/src/com/google/gct/idea/appengine/run/AppEngineRunConfigurationSettingsEditor.java @@ -25,10 +25,13 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import org.jetbrains.annotations.NotNull; +import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** GUI for configuring App Engine Run Configurations */ public class AppEngineRunConfigurationSettingsEditor extends SettingsEditor<AppEngineRunConfiguration> { @@ -39,28 +42,57 @@ public class AppEngineRunConfigurationSettingsEditor extends SettingsEditor<AppE private TextFieldWithBrowseButton myWarPathField; private TextFieldWithBrowseButton myAppEngineSdkField; private JTextField myServerAddressField; + private JCheckBox mySynchronizeWithBuildGradleCheckBox; private final Project myProject; private final ConfigurationModuleSelector moduleSelector; public AppEngineRunConfigurationSettingsEditor(Project project) { - this.myProject = project; + myProject = project; moduleSelector = new ConfigurationModuleSelector(project, myModuleComboBox); + myModuleComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + updateSync(); + } + }); + mySynchronizeWithBuildGradleCheckBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + updateSync(); + } + }); myAppEngineSdkField.addBrowseFolderListener("Select App Engine Sdk Root", null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor()); myWarPathField.addBrowseFolderListener("Select Exploded War Root", null, myProject, FileChooserDescriptorFactory.createSingleFolderDescriptor()); } - // TODO: unused currently, but useful once gradle facet for App Engine is completely set up. + protected void updateSync() { + boolean isSync = mySynchronizeWithBuildGradleCheckBox.isSelected(); + if (isSync) { + syncWithBuildFile(); + } + myWarPathField.setEditable(!isSync); + myServerAddressField.setEditable(!isSync); + myServerPortField.setEditable(!isSync); + myAppEngineSdkField.setEditable(!isSync); + } + + // Syncs a run configuration with information from build.gradle via the App Engine Gradle facet + // This is also a near-duplicate of the sync in AppEngineRunConfiguration, but this is required + // here to update the UI correctly when "sync" is checked and turned on, if we didn't reflect the + // configuration in the UI, we wouldn't need this. protected void syncWithBuildFile() { + AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(moduleSelector.getModule()); - if(facet != null) { - // proof of concept of usefulness of Gradle model + if (facet != null) { AppEngineConfigurationProperties model = facet.getConfiguration().getState(); - myServerPortField.setText(model.HTTP_PORT.toString()); - myServerAddressField.setText(model.HTTP_ADDRESS); - myAppEngineSdkField.setText(model.APPENGINE_SDKROOT); - myWarPathField.setText(model.WAR_DIR); + if (model != null) { + myServerPortField.setText(model.HTTP_PORT.toString()); + myServerAddressField.setText(model.HTTP_ADDRESS); + myAppEngineSdkField.setText(model.APPENGINE_SDKROOT); + myWarPathField.setText(model.WAR_DIR); + } } } @@ -76,6 +108,8 @@ public class AppEngineRunConfigurationSettingsEditor extends SettingsEditor<AppE myServerAddressField.setText(configuration.getServerAddress()); myVmArgsField.setText(configuration.getVmArgs()); moduleSelector.reset(configuration); + mySynchronizeWithBuildGradleCheckBox.setSelected(configuration.getSyncWithGradle()); + updateSync(); } @Override @@ -86,6 +120,7 @@ public class AppEngineRunConfigurationSettingsEditor extends SettingsEditor<AppE configuration.setServerPort(myServerPortField.getText()); configuration.setVmArgs(myVmArgsField.getText()); configuration.setWarPath(myWarPathField.getText()); + configuration.setSyncWithGradle(mySynchronizeWithBuildGradleCheckBox.isSelected()); } @NotNull diff --git a/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java b/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java index 98f9096..d93e6ea 100644 --- a/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java +++ b/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java @@ -116,7 +116,6 @@ public class NewAppEngineModuleAction extends AnAction { } ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override public void run() { List<File> allFilesToOpen = new ArrayList<File>(); @@ -132,18 +131,14 @@ public class NewAppEngineModuleAction extends AnAction { GradleProjectImporter projectImporter = GradleProjectImporter.getInstance(); projectImporter.requestProjectSync(project, new GradleSyncListener.Adapter() { + @Override public void syncSucceeded(@NotNull final Project project) { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { Module module = ModuleManager.getInstance(project).findModuleByName(moduleName); - - Parameter appEngineVersionParam = template.getMetadata().getParameter("appEngineVersion"); - String appEngineVersion = (appEngineVersionParam == null) ? "unknown" : appEngineVersionParam.initial; - - createRunConfiguration(project, module, moduleRoot, appEngineVersion); - addAppEngineGradleFacet(); + createRunConfiguration(project, module); } }); } @@ -213,7 +208,7 @@ public class NewAppEngineModuleAction extends AnAction { return null; } - private static void createRunConfiguration(Project project, Module module, File moduleRoot, String appEngineVersion) { + private static void createRunConfiguration(Project project, Module module) { // Create a run configuration for this module final RunManagerEx runManager = RunManagerEx.getInstanceEx(project); final RunnerAndConfigurationSettings settings = runManager. @@ -221,30 +216,9 @@ public class NewAppEngineModuleAction extends AnAction { settings.setSingleton(true); final AppEngineRunConfiguration configuration = (AppEngineRunConfiguration)settings.getConfiguration(); configuration.setModule(module); - configuration.setWarPath(new File(moduleRoot, "build/exploded-app").getAbsolutePath()); - String gradleHomePath = GradleSettings.getInstance(project).getServiceDirectoryPath(); - if (StringUtil.isEmpty(gradleHomePath)) { - gradleHomePath = new File(System.getProperty("user.home"), ".gradle").getAbsolutePath(); - } - // This is a little strange because the sdk is "downloaded", but in our templates that's where the sdk is - // TODO, perhaps extract this from the build.gradle - // TODO, add support for the appengine environment/system properties (probably in the runconfig not here) - configuration.setSdkPath(new File(gradleHomePath, "/appengine-sdk/appengine-java-sdk-" + appEngineVersion).getAbsolutePath()); - configuration.setServerPort("8080"); + // pull configuration out of gradle + configuration.setSyncWithGradle(true); runManager.addConfiguration(settings, false); } - - private static void addAppEngineGradleFacet() { - // Module does not have AppEngine-Gradle facet. Create one and add it. - // Commented out for now, ENABLE when AppEngine Gradle facet is ready. - // FacetManager facetManager = FacetManager.getInstance(module); - // ModifiableFacetModel model = facetManager.createModifiableModel(); - //try { - // Facet facet = facetManager.createFacet(AppEngineGradleFacet.getFacetType(), AppEngineGradleFacet.NAME, null); - // model.addFacet(facet); - //} finally { - // model.commit(); - //} - } } |