From 5979870021e11fff75d67678eaad463546624641 Mon Sep 17 00:00:00 2001 From: Chanseok Oh Date: Fri, 6 Jul 2018 13:38:46 -0400 Subject: [PATCH 1/3] keep appengine-api when converting old-style lib container --- .../appengine/compat/cte13/CloudToolsEclipseProjectUpdater.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/CloudToolsEclipseProjectUpdater.java b/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/CloudToolsEclipseProjectUpdater.java index 134e2934ae..3d84dbbbc1 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/CloudToolsEclipseProjectUpdater.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/CloudToolsEclipseProjectUpdater.java @@ -106,8 +106,6 @@ public static IStatus updateProject(IProject project, SubMonitor progress) { } progress.worked(5); - // remove "appengine-api" as appengine-api-1.0-sdk now included in the servlet container - libraryIds.remove("appengine-api"); //$NON-NLS-1$ // remove "googlecloudcore" and "googleapiclient" as they were utility definitions, now // pulled from library dependencies libraryIds.remove("googlecloudcore"); //$NON-NLS-1$ From 630f4dd12bc662428f2c2b7cbdfb85f1d7f7e748 Mon Sep 17 00:00:00 2001 From: Chanseok Oh Date: Fri, 6 Jul 2018 14:19:14 -0400 Subject: [PATCH 2/3] Cleanups --- .../cte13/UpdateCloudToolsEclipseProjectHandler.java | 6 +++--- .../appengine/localserver/launching/LaunchHelper.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/UpdateCloudToolsEclipseProjectHandler.java b/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/UpdateCloudToolsEclipseProjectHandler.java index 8a51ef6030..986d319455 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/UpdateCloudToolsEclipseProjectHandler.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.compat/src/com/google/cloud/tools/eclipse/appengine/compat/cte13/UpdateCloudToolsEclipseProjectHandler.java @@ -18,7 +18,6 @@ import com.google.cloud.tools.eclipse.appengine.compat.Messages; import com.google.cloud.tools.eclipse.ui.util.ProjectFromSelectionHelper; -import java.text.MessageFormat; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -34,11 +33,12 @@ public class UpdateCloudToolsEclipseProjectHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - final IProject project = ProjectFromSelectionHelper.getFirstProject(event); + IProject project = ProjectFromSelectionHelper.getFirstProject(event); if (!CloudToolsEclipseProjectUpdater.hasOldContainers(project)) { throw new ExecutionException(Messages.getString("project.appears.up.to.date")); //$NON-NLS-1$ } - Job updateJob = new WorkspaceJob(MessageFormat.format(Messages.getString("updating.project"), project.getName())) { //$NON-NLS-1$ + String jobName = Messages.getString("updating.project", project.getName()); //$NON-NLS-1$ + Job updateJob = new WorkspaceJob(jobName) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { return CloudToolsEclipseProjectUpdater.updateProject(project, SubMonitor.convert(monitor)); diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.localserver/src/com/google/cloud/tools/eclipse/appengine/localserver/launching/LaunchHelper.java b/plugins/com.google.cloud.tools.eclipse.appengine.localserver/src/com/google/cloud/tools/eclipse/appengine/localserver/launching/LaunchHelper.java index 84dad4c0db..929393901c 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.localserver/src/com/google/cloud/tools/eclipse/appengine/localserver/launching/LaunchHelper.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.localserver/src/com/google/cloud/tools/eclipse/appengine/localserver/launching/LaunchHelper.java @@ -25,7 +25,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -65,9 +64,10 @@ public void launch(IModule[] modules, String launchMode) throws CoreException { if (isRunning(existing)) { ILaunch launch = existing.getLaunch(); Preconditions.checkNotNull(launch, "A running server should have a launch"); //$NON-NLS-1$ - String detail = launchMode.equals(launch.getLaunchMode()) ? Messages.getString("SERVER_ALREADY_RUNNING") //$NON-NLS-1$ - : MessageFormat.format(Messages.getString("SERVER_ALREADY_RUNNING_IN_MODE"), //$NON-NLS-1$ - launch.getLaunchMode()); + String detail = launchMode.equals(launch.getLaunchMode()) + ? Messages.getString("SERVER_ALREADY_RUNNING") //$NON-NLS-1$ + : Messages.getString( + "SERVER_ALREADY_RUNNING_IN_MODE", launch.getLaunchMode()); //$NON-NLS-1$ throw new CoreException(StatusUtil.info(this, detail)); } server = existing; From f5d7aa7cae86b3ba22d4425460561bb3187bd453 Mon Sep 17 00:00:00 2001 From: Chanseok Oh Date: Fri, 6 Jul 2018 17:57:51 -0400 Subject: [PATCH 3/3] Add test --- ...ortNativeAppEngineStandardProjectTest.java | 52 ++++++++++++++---- ...d-library-container-with-appengine-api.zip | Bin 0 -> 10006 bytes 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 plugins/com.google.cloud.tools.eclipse.integration.appengine/test-projects/old-library-container-with-appengine-api.zip diff --git a/plugins/com.google.cloud.tools.eclipse.integration.appengine/src/com/google/cloud/tools/eclipse/integration/appengine/ImportNativeAppEngineStandardProjectTest.java b/plugins/com.google.cloud.tools.eclipse.integration.appengine/src/com/google/cloud/tools/eclipse/integration/appengine/ImportNativeAppEngineStandardProjectTest.java index 5c2d2f8764..5fc90e841a 100644 --- a/plugins/com.google.cloud.tools.eclipse.integration.appengine/src/com/google/cloud/tools/eclipse/integration/appengine/ImportNativeAppEngineStandardProjectTest.java +++ b/plugins/com.google.cloud.tools.eclipse.integration.appengine/src/com/google/cloud/tools/eclipse/integration/appengine/ImportNativeAppEngineStandardProjectTest.java @@ -34,10 +34,12 @@ import java.io.IOException; import java.net.URL; import java.util.concurrent.TimeUnit; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.jdt.core.IClasspathContainer; +import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; @@ -63,7 +65,7 @@ public class ImportNativeAppEngineStandardProjectTest extends BaseProjectTest { public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - public void importAppEngineStandardJava7_from1_3_1() throws IOException, CoreException { + public void testImportAppEngineStandardJava7_from1_3_1() throws IOException, CoreException { assertFalse(projectExists("AESv7")); ZipUtil.extractZip(new URL( "platform:/plugin/com.google.cloud.tools.eclipse.integration.appengine/test-projects/cte-1_3_1-appengine-standard-java7.zip"), @@ -71,10 +73,7 @@ public void importAppEngineStandardJava7_from1_3_1() throws IOException, CoreExc project = SwtBotAppEngineActions.importNativeProject(bot, "AESv7", tempFolder.getRoot()); assertTrue(project.exists()); - updateOldContainers(); - - ProjectUtils.waitForProjects(project); - ProjectUtils.waitUntilNoBuildErrors(project); + updateOldContainers(project); IFacetedProject facetedProject = ProjectFacetsManager.create(project); assertNotNull("should be a faceted project", facetedProject); @@ -90,7 +89,7 @@ public void importAppEngineStandardJava7_from1_3_1() throws IOException, CoreExc } @Test - public void importAppEngineStandardJava8_from1_3_1() throws IOException, CoreException { + public void testImportAppEngineStandardJava8_from1_3_1() throws IOException, CoreException { Assume.assumeTrue(JavaRuntimeUtils.hasJavaSE8()); assertFalse(projectExists("AESv8")); ZipUtil.extractZip(new URL( @@ -99,10 +98,7 @@ public void importAppEngineStandardJava8_from1_3_1() throws IOException, CoreExc project = SwtBotAppEngineActions.importNativeProject(bot, "AESv8", tempFolder.getRoot()); assertTrue(project.exists()); - updateOldContainers(); - - ProjectUtils.waitForProjects(project); - ProjectUtils.waitUntilNoBuildErrors(project); + updateOldContainers(project); IFacetedProject facetedProject = ProjectFacetsManager.create(project); assertNotNull("should be a faceted project", facetedProject); @@ -117,10 +113,44 @@ public void importAppEngineStandardJava8_from1_3_1() throws IOException, CoreExc facetedProject.getProjectFacetVersion(WebFacetUtils.WEB_FACET)); } - private void updateOldContainers() throws JavaModelException { + // https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/3202 + @Test + public void testImportProjectFrom131_oldStyleContainerWithAppEngineApi() + throws IOException, CoreException { + assertFalse(projectExists("old-library-container-with-appengine-api")); + ZipUtil.extractZip(new URL( + "platform:/plugin/com.google.cloud.tools.eclipse.integration.appengine/test-projects/old-library-container-with-appengine-api.zip"), + tempFolder.getRoot()); + project = SwtBotAppEngineActions.importNativeProject( + bot, "old-library-container-with-appengine-api", tempFolder.getRoot()); + assertTrue(project.exists()); + + updateOldContainers(project); + + assertTrue(hasAppEngineApi(project)); + } + + private static boolean hasAppEngineApi(IProject project) throws JavaModelException { + IJavaProject javaProject = JavaCore.create(project); + IClasspathContainer masterContainer = + JavaCore.getClasspathContainer(BuildPath.MASTER_CONTAINER_PATH, javaProject); + + for (IClasspathEntry entry : masterContainer.getClasspathEntries()) { + if (entry.getPath().lastSegment().startsWith("appengine-api-1.0-sdk")) { + return true; + } + } + return false; + } + + private static void updateOldContainers(IProject project) throws CoreException { assertTrue(CloudToolsEclipseProjectUpdater.hasOldContainers(project)); IStatus updateStatus = CloudToolsEclipseProjectUpdater.updateProject(project, SubMonitor.convert(null)); + + ProjectUtils.waitForProjects(project); + ProjectUtils.waitUntilNoBuildErrors(project); + assertTrue("Update failed: " + updateStatus.getMessage(), updateStatus.isOK()); assertFalse(CloudToolsEclipseProjectUpdater.hasOldContainers(project)); diff --git a/plugins/com.google.cloud.tools.eclipse.integration.appengine/test-projects/old-library-container-with-appengine-api.zip b/plugins/com.google.cloud.tools.eclipse.integration.appengine/test-projects/old-library-container-with-appengine-api.zip new file mode 100644 index 0000000000000000000000000000000000000000..447c7203faca221d09b1ebfd3db2f9197ca06b5a GIT binary patch literal 10006 zcmcgycRbYpA3rO56BQMaZ{jjaW}3E7v7NJNsXzGhh| zg^YZ4sgRO>pL4|-)tCDI&g0G9KlgmSp0D|Se&}gYP||@2FUVvwM8MZ5I7Qw5p{=S9Yi5$G!zK~J_GOIdyEWeK@=G;6wNY$qVr(08LLgPK%PM0*mx>MpV;;I>g(X^J*Pd4zIL>IPUC^#LjI2p;k zv2^j1LPM)w$#EuOo)=qh$)?RJP{&5m?%jaMZ0PsR?3Vi&96FHl=3-2VD2?zZM-2%i z6v3l>JJ7Esd-9%?gqUAAsPEka>ix0NzGdm5H%?h?OuZv=KsLdq^nGg^cTw(zrmdyE z2Wr1UyD&I`3j;D|PQ!GsKHB_1je>o%Ts?Wplu8O@_7OE3MyOrg9#74z_w|5r--yXs zwt%Lpq&u|(I8e3QNRpE&UdT;b=0-&*DoNYQy=k5DpI523x*D#6@HezP%T$UMm$D$UXg5*O}X|!Cy7z@F%l`%u-u7C>u6OeGD|Wr8Jh#`X{>z zA6lDZCJ%2kb=a5+%W`V$-|wpp39{aeJ;0G2g6UK_Mh7b|toBKJ(kXUJ=YE^?m3^~E zgl#Sgjs>@76ckj6)0|funNw#ph?%-~Wjb~)|AQV|(^f5TE)5OtBxPIe-Uujv9CY^` zr7-#CjK-kO?*2D$sYEOPk7To=xAz76Q=1+wym+QxMu}%YLoH^L13E*%x(Fi6%oo7m z9h#C3tBFf;vN(9LkY>7SlJ$OQzhA&J#jox%GYR2?6EDvlH9JMI7;Hj~lC}Z+_3>|u zat6atC>R0?wnd;^?Z8+R3gH5V+9Kd+7btk4dw_}U1rGg|AA}&iSQ)6r9R1Q8}3-2l7WHd|`iA?makW;++MO;0~(1yiQM!zEsrXh<3*K21n z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