@@ -30,7 +30,7 @@ public enum ConnectionType {
3030 BROADCAST ,
3131 BINDER
3232 }
33-
33+ private static final String DEVICE_PLUGIN_SDK_VERSION_NAME = "2.8.4" ;
3434 private final String pluginModuleFolder = "plugin" ;
3535 private final String projectFolder = pluginModuleFolder + "/src/main" ;
3636 private final String sourceFolder = projectFolder + "/java" ;
@@ -42,17 +42,20 @@ public enum ConnectionType {
4242 private final String modelDocPath = "docs/" ;
4343
4444 {
45- putOption ("targetSdkVersion" , "" , "28 " );
45+ putOption ("targetSdkVersion" , "" , "29 " );
4646 putOption ("minSdkVersion" , "" , "19" );
47- putOption ("compileSdkVersion" , "" , "28" );
48- putOption ("deviceConnectPluginSdkVersion" , "" , "2.7.2" );
49- putOption ("deviceConnectSdkForAndroidVersion" , "" , "2.3.1" );
47+ putOption ("compileSdkVersion" , "" , "29" );
48+ putOption ("deviceConnectPluginSdkVersion" , "" , DEVICE_PLUGIN_SDK_VERSION_NAME );
49+ putOption ("deviceConnectSdkForAndroidVersion" , "" , "2.3.2" );
50+ putOption ("githubAccountName" , "" , "YOUR_NAME" );
51+ putOption ("githubAccountKey" , "" , "YOUR_KEY" );
5052 }
5153
5254 private void putOption (final String name , final String description , final String defaultValue ) {
5355 CliOption option = CliOption .newString (name , description );
5456 option .setDefault (defaultValue );
5557 this .cliOptions .add (option );
58+ this .additionalProperties .put (name , defaultValue );
5659 }
5760
5861 @ Override
@@ -277,7 +280,12 @@ public void processOpts() {
277280 String manifest = getManifestTemplateFile ();
278281 supportingFiles .add (new SupportingFile ("manifest/" + manifest , getProjectDir (), "AndroidManifest.xml" ));
279282 supportingFiles .add (new SupportingFile (getGradleTemplateDir ()+ "/root.build.gradle.mustache" , "" , "build.gradle" ));
280- supportingFiles .add (new SupportingFile (getGradleTemplateDir () + "/plugin.build.gradle.mustache" , getPluginModuleDir (), "build.gradle" ));
283+ if (getGradleTemplateFile ().indexOf (DEVICE_PLUGIN_SDK_VERSION_NAME ) != -1 ) {
284+ supportingFiles .add (new SupportingFile ("github.properties.mustache" , "" , "github.properties" ));
285+ supportingFiles .add (new SupportingFile (getGradleTemplateDir () + "/plugin.2.8.4.build.gradle.mustache" , getPluginModuleDir (), "build.gradle" ));
286+ } else {
287+ supportingFiles .add (new SupportingFile (getGradleTemplateDir () + "/plugin.build.gradle.mustache" , getPluginModuleDir (), "build.gradle" ));
288+ }
281289 supportingFiles .add (new SupportingFile ("gradle.properties.mustache" , "" , "gradle.properties" ));
282290 supportingFiles .add (new SupportingFile ("resource/xml/deviceplugin.xml.mustache" , getPluginResourceDir () + "/xml" , getDevicePluginXmlName () + ".xml" ));
283291 supportingFiles .add (new SupportingFile ("resource/values/strings.xml.mustache" , getPluginResourceDir () + "/values" , "strings.xml" ));
@@ -316,6 +324,22 @@ protected String getManifestTemplateFile() {
316324 return manifest ;
317325 }
318326
327+ protected String getGradleTemplateFile () {
328+ String gradleVersion ;
329+ final VersionName ver2_8_4 = VersionName .parse (DEVICE_PLUGIN_SDK_VERSION_NAME );
330+ String versionParam = (String ) additionalProperties .get ("deviceConnectPluginSdkVersion" );
331+ VersionName version = VersionName .parse (versionParam );
332+ if (version == null ) {
333+ version = ver2_8_4 ;
334+ }
335+ if (version .isEqualOrMoreThan (ver2_8_4 )) {
336+ gradleVersion = DEVICE_PLUGIN_SDK_VERSION_NAME + "." ;
337+ } else {
338+ gradleVersion = "" ;
339+ }
340+ return gradleVersion ;
341+ }
342+
319343 protected String getPluginSourceDir () {
320344 return sourceFolder ;
321345 }
0 commit comments