-
Notifications
You must be signed in to change notification settings - Fork 6k
Replace maven settings for Android client with gradle #699
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
Conversation
@0legg do you see an issue with providing both scripts? |
@fehguy Actually no, but 95% of Android devs will just delete pom.xml asking "What is this stuff about?" |
Will this produce a fat jar? I'm all for going with the right conventions for the language. |
No, the jar will be fatter only by pom.xml (well, actually even this file will be removed from resulting apk, so there'll be no difference). I can return it easily, but I don't think that this is something more than tribute to history |
no i mean, will this script produce a single jar, which has been another request. I'll go ahead and merge this, thank you. |
Replace maven settings for Android client with gradle
I agree with this change, but this PR appears to have broken the build of the generated android client out of the box. This worked before PR (using mvn commands)
|
@who Oh, my bad. This PR generates only one module, but not the whole project. I'll try to figure out how to do it without including into templates all the typical Android project gradle-connected stuff like gradle wrapper and so on |
@0legg I don't think this should generate a module or a whole project. It should generate stand-alone code which can be compiled into a jar, and then the jar can be imported as a dependency into your Android app. |
This may be useful for a starting point. This
... yields this output ...
... and this file structure:
|
@who I've tried to apply this approach, but have failed to run the tests. Android internal version of HttpClient conflicts with provided one, this inconsistence leads to test failure. I'm trying to workaround this behavior. |
@0legg Yes, I found the same test failures, so I switched over to org.apache.httpcomponents.httpclient in the mean time. |
Guys, shall I roll this back? |
Here is a rudimentary console build integration test: cd $(mktemp -d /tmp/tmp.XXXXXX);
git clone https://github.com/swagger-api/swagger-codegen.git;
cd swagger-codegen;
git checkout develop_2.0;
./bin/android-java-petstore.sh;
cd ./samples/client/petstore/android-java;
gradle build; |
I think we can put back maven version alongside with gradle one, so that who needs to generate jar will use mvn package, otherwise will use it as android archived library or even as is |
@0legg No need to have mvn and gradle together - can't you just add |
So now I achieved my goal =) Tests are passed, gradle generates both jar and aar, and generated module can be used as android library without additional packaging. @fehguy, do I need to provide another pull request for these fixes? |
👍 @0legg I just pulled your fork and was able to pass my tests as well. |
@0legg - since it was already merged, another PR is required, yes. |
While being well-known and widely used in JEE development, Maven is very rare guest in Android projects. There is no official support for Maven from Google, while Gradle is standard de-facto for Android development.