diff options
author | Alex Ruiz <alruiz@google.com> | 2014-08-11 17:18:47 -0700 |
---|---|---|
committer | Alex Ruiz <alruiz@google.com> | 2014-08-13 15:01:37 -0700 |
commit | bb618e2f139af18ef5346da5ab02e988b1ac300e (patch) | |
tree | eccaa4d2336ee443b87b16b80dbe6262c8a643cb /android/testData/guiTests | |
parent | f58a675ee343f5e0ae25e0a5459a2191b78dc148 (diff) | |
download | idea-bb618e2f139af18ef5346da5ab02e988b1ac300e.tar.gz |
Now we detect and fix if the wrong version of Gradle is used in the wrapper.
The next version of the Android Gradle plug-in (0.13.0) will require
Gradle 2.0 as a minimum. In this CL we detect if a project is using
plug-in 0.13.0 and check that the version specified in the Gradle wrapper
is 2.0. If the wrapper has an older version, the IDE will notify the
user about the new Gradle requirement and it will automatically fix the
wrapper before syncing the project with Gradle.
This CL only takes care of projects using the Gradle wrapper. To
properly ensure that the migration to 0.13.0 is smooth, the following
work needs to implemented in future CLs:
- Detect and fix Gradle version when using a local Gradle distribution
- Have a "quick fix" hyperlink in the "Messages" window, in case the
IDE was not able to update the wrapper and sync failed due to a wrong
version of Gradle
- Change the "recommended" version of the plug-in to be 0.13.0
- Update the current "quick fix" to update both the version of the
plug-in and Gradle.
The work in this CL required to reuse ProjectValidator. As part of this
CL I also fixed this related, existing bug
https://code.google.com/p/android/issues/detail?id=68698
Change-Id: Ia0b825383ce45753380a06dc6ad6bfc684ae48d3
Diffstat (limited to 'android/testData/guiTests')
16 files changed, 188 insertions, 0 deletions
diff --git a/android/testData/guiTests/CentralBuildDirectory/build.gradle b/android/testData/guiTests/CentralBuildDirectory/build.gradle index 9b8abe4fe13..e63466dbd1b 100644 --- a/android/testData/guiTests/CentralBuildDirectory/build.gradle +++ b/android/testData/guiTests/CentralBuildDirectory/build.gradle @@ -3,6 +3,9 @@ buildscript { repositories { jcenter() + if (System.getenv("MAVEN_URL") != null) { + maven {url System.getenv("MAVEN_URL")} + } } dependencies { classpath 'com.android.tools.build:gradle:0.12.2' diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/.gitignore b/android/testData/guiTests/PluginAndGradleUpgrade/.gitignore new file mode 100644 index 00000000000..072686df30f --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/.gitignore @@ -0,0 +1,10 @@ +.gradle +/gradle +/local.properties +/.idea +.DS_Store +/build +gradlew +gradlew.bat +*.iml +gradle.properties diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/.gitignore b/android/testData/guiTests/PluginAndGradleUpgrade/app/.gitignore new file mode 100644 index 00000000000..796b96d1c40 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/build.gradle b/android/testData/guiTests/PluginAndGradleUpgrade/app/build.gradle new file mode 100644 index 00000000000..2501efec2c2 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/build.gradle @@ -0,0 +1,24 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 20 + buildToolsVersion "19.1.0" + + defaultConfig { + applicationId "com.android.plugin.and.gradle.upgrade" + minSdkVersion 19 + targetSdkVersion 20 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/proguard-rules.pro b/android/testData/guiTests/PluginAndGradleUpgrade/app/proguard-rules.pro new file mode 100644 index 00000000000..e2f6a3ded07 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Applications/adt-bundle-mac-x86_64-20131030/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/AndroidManifest.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..e3e6f6d9db0 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.plugin.and.gradle.upgrade" > + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + <activity + android:name=".MyActivity" + android:label="@string/app_name" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/java/com/android/plugin/and/gradle/upgrade/MyActivity.java b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/java/com/android/plugin/and/gradle/upgrade/MyActivity.java new file mode 100644 index 00000000000..4cf48be68fd --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/java/com/android/plugin/and/gradle/upgrade/MyActivity.java @@ -0,0 +1,36 @@ +package com.android.plugin.and.gradle.upgrade; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + +public class MyActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_my); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.my, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + if (id == R.id.action_settings) { + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/drawable/ic_launcher.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/drawable/ic_launcher.xml new file mode 100644 index 00000000000..bebd9834a0e --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/drawable/ic_launcher.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8"?> +<color xmlns:android="http://schemas.android.com/apk/res/android" android:color="#ff0000" /> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/layout/activity_my.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/layout/activity_my.xml new file mode 100644 index 00000000000..c17166f4d34 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/layout/activity_my.xml @@ -0,0 +1,16 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".MyActivity"> + + <TextView + android:text="@string/hello_world" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</RelativeLayout> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/menu/my.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/menu/my.xml new file mode 100644 index 00000000000..bea58cc00be --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/menu/my.xml @@ -0,0 +1,8 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + tools:context=".MyActivity" > + <item android:id="@+id/action_settings" + android:title="@string/action_settings" + android:orderInCategory="100" + android:showAsAction="never" /> +</menu> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values-w820dp/dimens.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 00000000000..63fc8164446 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ +<resources> + <!-- Example customization of dimensions originally defined in res/values/dimens.xml + (such as screen margins) for screens with more than 820dp of available width. This + would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> + <dimen name="activity_horizontal_margin">64dp</dimen> +</resources> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/dimens.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000000..47c82246738 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<resources> + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> +</resources> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/strings.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/strings.xml new file mode 100644 index 00000000000..ac51c961379 --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">PluginAndGradleUpgrade</string> + <string name="hello_world">Hello world!</string> + <string name="action_settings">Settings</string> + +</resources> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/styles.xml b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/styles.xml new file mode 100644 index 00000000000..ff6c9d2c0fb --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- Customize your theme here. --> + </style> + +</resources> diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/build.gradle b/android/testData/guiTests/PluginAndGradleUpgrade/build.gradle new file mode 100644 index 00000000000..e7f10059acf --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/build.gradle @@ -0,0 +1,22 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + if (System.getenv("MAVEN_URL") != null) { + maven {url System.getenv("MAVEN_URL")} + } + } + dependencies { + classpath 'com.android.tools.build:gradle:0.13.+' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/android/testData/guiTests/PluginAndGradleUpgrade/settings.gradle b/android/testData/guiTests/PluginAndGradleUpgrade/settings.gradle new file mode 100644 index 00000000000..e7b4def49cb --- /dev/null +++ b/android/testData/guiTests/PluginAndGradleUpgrade/settings.gradle @@ -0,0 +1 @@ +include ':app' |