Skip to content
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

Android #56

Merged
merged 7 commits into from
Dec 9, 2014
Merged

Android #56

merged 7 commits into from
Dec 9, 2014

Conversation

secondsun
Copy link
Contributor

I've added a second license plugin for working with the Android plugin instead of the Java plugin. It seems like Google got a bad case of NIH and their Android tooling is not compatible with Java plugins/tooling.

@secondsun
Copy link
Contributor Author

An Android Studio project using the plugin : https://github.com/secondsun/keycloak-android-authenticator/tree/license

@hierynomus
Copy link
Owner

Hi Hoyt,

What I'm wondering is, is why the regular plugin fails to work on android. If it is due to the use of the gradle java plugin, we should try to see whether we can remove the dependency on that one. Now there is a lot of copy-paste into the new Plugin class.

Couldn't we either:

  • Make the AndroidLicensePlugin class extend the LicensePlugin class and override the plugins it applies
  • Fix the LicensePlugin so that it does not depend on the JavaBasePlugin

I'm hesitant to merge this, mainly due to the large volume of duplication.

In commit 12a7d3d I've removed the dependency on Guava for compile/runtime, so you should not need to exclude that anymore in your project.

@secondsun
Copy link
Contributor Author

I think if you make LicensePlugin not dependant on JavaBasePlugin it loses the ability to sniff out the source sets. I'll see what I can do with some small defactoring and deduping

@hierynomus
Copy link
Owner

We could actually instead of blindly applying the java plugin make it use the whenPluginAdded(JavaBasePlugin) {...} construct. This would then setup the sourcesets if the Java plugin is / has been added. And use the same for when the AppPlugin is added.

@secondsun
Copy link
Contributor Author

Now with 50% less copypasta

@hierynomus
Copy link
Owner

Looks better! 👍 I'll have a look at this tomorrow and will merge it then.

@hierynomus
Copy link
Owner

Could you also add some tests for a project with an android plugin?

@secondsun
Copy link
Contributor Author

The Android Plugin requires Gradle 2.2. I've written some tests, but they will crash because the project uses Gradle 2.0. If I can update the wrapper to 2.2 then I can add some tests. Otherwise we will need to find a way around it.

@hierynomus
Copy link
Owner

Can we use a lower version of the android plugin for building/testing? It now depends on an RC version. Looking at their site, the 0.11.1 version should work with gradle versions as low as 1.10.

@hierynomus
Copy link
Owner

Just looked at the release notes a bit closer, it should work with Gradle 2.1... for the 1.0.0-rc-1 and up. Let's bump it to that version then.

@secondsun
Copy link
Contributor Author

Bump up the gradle version that the license plugin uses or bump down the android plugin?

@hierynomus
Copy link
Owner

Is the API the same for the lower android plugin version? If so, then I'd rather bump down the android plugin.

@secondsun
Copy link
Contributor Author

Here is a chart :
http://tools.android.com/tech-docs/new-build-system/version-compatibility

No version of the Android plugin works with Gradle 2.0 (the current version). The 1.0.0-x version requires Gradle 2.2.1 and up. The Android plugin does explicit version checks and will throw an Exception if it isn't running in the right Gradle version.

There are some minor nitpicks between .8 and 1.0.0 like the plugin being renamed and some Android properties getting renamed. Those don't seem to affect the behavior of the License plugin running on Android right now.

@hierynomus
Copy link
Owner

Let's bump it up to 2.2.1 and run with the 1.0.0 version of the gradle
plugin then.

Thanks!

2014-12-08 19:14 GMT+01:00 Hoyt Summers Pittman notifications@github.com:

Here is a chart :
http://tools.android.com/tech-docs/new-build-system/version-compatibility

No version of the Android plugin works with Gradle 2.0 (the current
version). The 1.0.0-x version requires Gradle 2.2.1 and up. The Android
plugin does explicit version checks and will throw an Exception if it isn't
running in the right Gradle version.

There are some minor nitpicks between .8 and 1.0.0 like the plugin being
renamed and some Android properties getting renamed. Those don't seem to
affect the behavior of the License plugin running on Android right now.


Reply to this email directly or view it on GitHub
#56 (comment)
.

@secondsun
Copy link
Contributor Author

tests added, gradle updates, and rebased.

hierynomus added a commit that referenced this pull request Dec 9, 2014
@hierynomus hierynomus merged commit c6f67f5 into hierynomus:master Dec 9, 2014
@hierynomus
Copy link
Owner

Merged! Thanks for the great PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants