This repository has been archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc7931d
commit 36dabb8
Showing
20 changed files
with
531 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// set up the build for the model implementation because it needs to be compiled | ||
// separately to use java6 instead of java7 like the main so the builder model can | ||
// be intergrated with tools that use java6 | ||
|
||
apply from: 'java6-mode.gradle' | ||
|
||
sourceSets { | ||
model | ||
main { | ||
compileClasspath += model.output | ||
runtimeClasspath += model.output | ||
} | ||
} | ||
|
||
setJava6Mode(compileModelJava) | ||
|
||
dependencies { | ||
modelCompile project(':builder-model') | ||
} | ||
|
||
jar { | ||
from { | ||
sourceSets.model.output | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apply plugin: 'maven' | ||
apply plugin: 'java' | ||
|
||
apply from: '../java6-mode.gradle' | ||
|
||
archivesBaseName = 'gradle-appengine-builder-model' | ||
group = 'com.google.appengine' | ||
version = '0.1.0' | ||
|
||
setJava6Mode(compileJava) | ||
|
||
jar { | ||
manifest { | ||
attributes 'Implementation-Title': 'Gradle App Engine Tooling Model', | ||
'Implementation-Version': version, | ||
'Built-By': System.getProperty('user.name'), | ||
'Built-JDK': System.getProperty('java.version'), | ||
'Built-Gradle': gradle.gradleVersion | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
builder-model/src/main/java/com/google/appengine/gradle/model/AppCfgOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2014 the original author or authors. | ||
* | ||
* 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 com.google.appengine.gradle.model; | ||
|
||
/** | ||
* Interface for the App Config Options in an App Engine gradle project | ||
* NOTE: If you change this, update the builder model version | ||
*/ | ||
public interface AppCfgOptions { | ||
public String getEmail(); | ||
public String getServer(); | ||
public String getHost(); | ||
public Boolean isNoCookies(); | ||
public Boolean isPassIn(); | ||
public String getPassword(); | ||
public String getHttpProxy(); | ||
public String getHttpsProxy(); | ||
public Boolean isOauth2(); | ||
public Boolean isUseJava7(); | ||
} |
37 changes: 37 additions & 0 deletions
37
builder-model/src/main/java/com/google/appengine/gradle/model/AppEngineModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2014 the original author or authors. | ||
* | ||
* 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 com.google.appengine.gradle.model; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
/** | ||
* Interface for the AppEngine Model | ||
* NOTE: If you change this, update the builder model version | ||
*/ | ||
public interface AppEngineModel { | ||
public String getModelVersion(); | ||
public String getHttpAddress(); | ||
public Integer getHttpPort(); | ||
public Boolean isDisableUpdateCheck(); | ||
public String getEnhancerVersion(); | ||
public String getEnhancerApi(); | ||
public List<String> getJvmFlags(); | ||
public File getWarDir(); | ||
public File getWebAppDir(); | ||
public String getAppEngineSdkRoot(); | ||
public AppCfgOptions getAppCfgOptions(); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Feb 19 08:54:57 EST 2014 | ||
#Thu May 01 15:19:26 EDT 2014 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Allows a compileJavaTask to run in Java6 mode. | ||
// Setting the system property "jdk6.home" to a JDK6 installation links the | ||
// compatibility libraries for the task, otherwise gradle throws a warning | ||
|
||
ext.setJava6Mode = { compileJavaTask -> | ||
compileJavaTask.sourceCompatibility = 1.6 | ||
compileJavaTask.targetCompatibility = 1.6 | ||
// if jdk6.home is defined use it | ||
def jdk6Home = System.properties['jdk6.home'] | ||
if(jdk6Home) { | ||
compileJavaTask.options.bootClasspath = (new File(jdk6Home,"/jre/lib/rt.jar")).canonicalPath | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ":builder-model" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/main/groovy/com/google/appengine/tooling/AppEngineToolingBuilderModel.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright 2014 the original author or authors. | ||
* | ||
* 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 com.google.appengine.tooling | ||
|
||
import com.google.appengine.AppEnginePlugin | ||
import com.google.appengine.AppEnginePluginConvention | ||
import com.google.appengine.task.AbstractTask | ||
import com.google.appengine.task.DownloadSdkTask | ||
import com.google.appengine.task.appcfg.AppConfigConvention; | ||
import com.google.appengine.gradle.model.AppCfgOptions | ||
import com.google.appengine.gradle.model.AppEngineModel | ||
import com.google.appengine.gradle.model.impl.DefaultAppCfgOptions; | ||
import com.google.appengine.gradle.model.impl.DefaultAppEngineModel; | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.UnknownConfigurationException | ||
import org.gradle.tooling.provider.model.ToolingModelBuilder; | ||
|
||
/** | ||
* AppEngine implementation of ToolingModelBuilder, populates the AppEngineModel | ||
*/ | ||
public class AppEngineToolingBuilderModel implements ToolingModelBuilder { | ||
@Override | ||
public boolean canBuild(String modelName) { | ||
return modelName.equals(AppEngineModel.class.getName()); | ||
} | ||
|
||
@Override | ||
public Object buildAll(String modelName, Project project) { | ||
AppEnginePluginConvention conf = project.convention.plugins.appengine | ||
AppConfigConvention appCfg = conf.getAppCfg() | ||
|
||
AppCfgOptions appCfgOptions = new DefaultAppCfgOptions(appCfg.email, | ||
appCfg.server, | ||
appCfg.host, | ||
appCfg.noCookies, | ||
appCfg.passIn, | ||
appCfg.password, | ||
appCfg.httpProxy, | ||
appCfg.httpsProxy, | ||
appCfg.oauth2, | ||
appCfg.update.useJava7) | ||
return new DefaultAppEngineModel(conf.httpAddress, | ||
conf.httpPort, | ||
conf.disableUpdateCheck, | ||
conf.enhancerVersion, | ||
conf.enhancerApi, | ||
conf.jvmFlags, | ||
conf.warDir ?: AppEnginePlugin.getExplodedAppDirectory(project), | ||
AppEnginePlugin.getAppDir(project), | ||
getSdkLocation(conf, project), | ||
appCfgOptions) | ||
|
||
} | ||
|
||
/** | ||
* Determine the App Engine SDK location | ||
* @return SDK location or null otherwise | ||
*/ | ||
static String getSdkLocation(AppEnginePluginConvention conf, Project project) { | ||
if(conf.downloadSdk) { | ||
try { | ||
def explodedSdkDir = AppEnginePlugin.getExplodedSdkDirectory(project) | ||
def zipFile = project.configurations.getByName(AppEnginePlugin.APPENGINE_SDK_CONFIGURATION_NAME).singleFile | ||
return DownloadSdkTask.getDownloadedSdkRoot(zipFile, explodedSdkDir) | ||
} catch (UnknownConfigurationException e) { | ||
// couldn't find download sdk config, try other methods | ||
} | ||
} | ||
String sdkRoot = System.getProperty(AbstractTask.APPENGINE_SDK_ROOT_SYS_PROP_KEY); | ||
if(!sdkRoot) { | ||
sdkRoot = System.getenv(AbstractTask.APPENGINE_HOME_ENV_PROP_KEY) | ||
} | ||
sdkRoot | ||
} | ||
} |
Oops, something went wrong.