-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notice when app engine java components aren't installed #206
Changes from 2 commits
a90fcf3
3c470fd
7c7406e
301fcad
585f1ca
19503f7
a78d87b
34580ab
29147b0
b776b12
c70ea33
7d5e3a2
e9083c2
03f93f9
d1904ae
e21364a
b6fc0ed
97da3d0
124642d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.google.cloud.tools.appengine.cloudsdk; | ||
|
||
import com.google.cloud.tools.appengine.api.AppEngineException; | ||
|
||
public class AppEngineComponentsNotInstalledException extends AppEngineException { | ||
|
||
AppEngineComponentsNotInstalledException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ public class CloudSdk { | |
private static final String DEV_APPSERVER_PY = "bin/dev_appserver.py"; | ||
private static final String JAVA_APPENGINE_SDK_PATH = | ||
"platform/google_appengine/google/appengine/tools/java/lib"; | ||
private static final String JAVA_COMPONENTS_PATH = "platform/gcd/.appengine"; | ||
private static final String JAVA_TOOLS_JAR = "appengine-tools-api.jar"; | ||
private static final Map<String, Path> JAR_LOCATIONS = new HashMap<>(); | ||
private static final String WINDOWS_BUNDLED_PYTHON = "platform/bundledpython/python.exe"; | ||
|
@@ -181,6 +182,11 @@ private void logCommand(List<String> command) { | |
public Path getSdkPath() { | ||
return sdkPath; | ||
} | ||
|
||
// TODO does this work on windows? | ||
Path getJavaAppEngineComponentsPath() { | ||
return sdkPath.resolve(JAVA_COMPONENTS_PATH); | ||
} | ||
|
||
private Path getGCloudPath() { | ||
String gcloud = GCLOUD; | ||
|
@@ -262,6 +268,10 @@ public void validate() throws AppEngineException { | |
"Validation Error: Java Tools jar location '" | ||
+ JAR_LOCATIONS.get(JAVA_TOOLS_JAR) + "' is not a file."); | ||
} | ||
if (!Files.isDirectory(getJavaAppEngineComponentsPath())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my concern about having this here is that we can support deploy without needing the java components installed. A client should be able to get configure gcloud and do a deployment without install the components, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this only applies to Standard and Compat deployments, not pure Flex. |
||
throw new AppEngineComponentsNotInstalledException( | ||
"Validation Error: Java App Engine components not installed"); | ||
} | ||
} | ||
|
||
@VisibleForTesting | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it sufficient to just check for the existence of
JAVA_APPENGINE_SDK_PATH
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that seems to exist regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably check with the Cloud SDK team to see what they recommend using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would executing and parsing a
gcloud components list
be overkill?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markpell, @znewman01 can you comment on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to know whether or not the user ran:
gcloud components install app-engine-java
We've seen multiple user reports that trace back to not having done this.
This directory appears to be added/removed when the user installs/removes the component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW:
although my installation is out of date, I did havejust updated and I don't have anything inapp-engine-java
, butplatform/gcd
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since what we're actually using is the appengine-tools-api.jar, we should probably just check for its existence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So again, this is just checking for the wrong thing. That directory is for the legacy datastore emulator which has nothing to do with Java or any Java components.
How far are we from having the requiring staging code as separate artifacts on maven central? I don't think it's appropriate for the plugin to be grabbing individual jars from the SDK as this is not a public interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ludoch who would know when staging is going to make it to maven central.
To summarize what's being discussed:
For component detection we should be calling gcloud components list and not digging into the cloud SDK packaged files.
The staging question is not related to this CL but we are working on moving as many deps as possible away from using Cloud SDK paths.