agit icon indicating copy to clipboard operation
agit copied to clipboard

Eclipse Build

Open cshorler opened this issue 14 years ago • 4 comments

Several changes are required in order to build within Eclipse, I'd suggest the first two should be fixed in the repository.

parent-agit pom: Some maven dependencies/goals (default-jar) are better handled within Eclipse using version 3.0.0 of the maven-android-plugin, I used version 3.0.0-SNAPSHOT.

The m2e-android connector also requires this (this should also be installed in Eclipse, via the connector selection dialog invoked from the pom page or via the catalog button in the preferences dialog) http://rgladwell.github.com/m2e-android

agit pom: in the agit pom - the relative directory path below causes an NPE in eclipse-m2e, possibly this could be resolved by specifying the path in a different manner or moving the involved files.

<!--  this causes a NPE in eclipse-m2e, it doesn't like ${basedir}/.. - in particular the '..' 
            <resource>
                <directory>${basedir}/..</directory>
                <targetPath>assets/</targetPath>
                <includes><include>CREDITS.*</include></includes>
            </resource>
-->

Proguard seems to get run regardless of the profile in-use - I haven't really understood this problem yet, possibly it's something to do with building the a module individually, or possibly something to do with using Eclipse. Will update with further comment when I understand what's going on.

Any other lifecycle-mapping errors can be resolved through the GUI - either installing missing m2e-connectors or ignoring (initially). The GUI provides quick-fixes for resolving / ignoring / executing unhandled plugins - e.g. Proguard. These have to be considered on a case by case basis. I disabled Proguard from the AGit pom error (where it manifests) but set it disabled in the parent pom - it can probably be safely enabled (which needs to be explicitly through the newly created lifecycle mapping by manually changing the ignore tag).

The default ignore entry looks like this currently (it's version dependent):

<plugin>
  <groupId>org.eclipse.m2e</groupId>
  <artifactId>lifecycle-mapping</artifactId>
  <version>1.0.0</version>
  <configuration>
    <lifecycleMappingMetadata>
      <pluginExecutions>
        <pluginExecution>
          <pluginExecutionFilter>
            <groupId>com.pyx4me</groupId>
            <artifactId>
              proguard-maven-plugin
            </artifactId>
            <versionRange>
              [2.0.4,)
            </versionRange>
            <goals>
              <goal>proguard</goal>
            </goals>
          </pluginExecutionFilter>
          <action>
            <ignore></ignore>
          </action>
        </pluginExecution>
      </pluginExecutions>
    </lifecycleMappingMetadata>
  </configuration>
</plugin>

cshorler avatar Aug 14 '11 11:08 cshorler

Hi @cshorler - you're right, the dev experience for Agit on Eclipse isn't great (which is why I use Intellij IDEA for Agit - works with the free edition: https://github.com/rtyley/agit/wiki/Building-Agit ). You've raised quite a few points, I'm going to address them in separate comments/commits...

rtyley avatar Aug 16 '11 07:08 rtyley

Proguard seems to get run regardless of the profile in-use

This isn't exactly intentional, but it does have one benefit: on my laptop, the following command:

agit-parent/agit$ mvn clean package android:deploy

...takes 35 seconds with ProGuard, and 37 seconds without. This is because the Android DEX compilation step is very slow, and running ProGuard beforehand gives it far few classes to compile.

So, if you actually want to generate an APK (not just run the robolectric unit tests, or do a compilation-check) then you definitely want ProGuard to run, regardless of whether you're creating a 'release' APK or not. This will probably stay true until the 'dex' step gets a lot faster...

If you just want a compilation check you can run:

agit-parent/agit$ mvn clean compile
  • this won't run either the ProGuard or dex steps, just the javac compile - you can probably configure Eclipse to run 'compile' rather than 'package' when you edit a file...?

rtyley avatar Aug 16 '11 08:08 rtyley

In my lunch break... mobile is not so easy to use on github!

http://groups.google.com/group/maven-android-developers/browse_thread/thread/2b5f6fa388a6d541

Speed - perhaps using the incremental builder will improve matters? I don't like the idea of a debug build effectively getting optimised, but I can see your reasoning.

Re Eclipse builds - one can define run and debug configurations in the project or across projects. These are ways to establish presets for the above compile, deploy etc.

cshorler avatar Aug 16 '11 11:08 cshorler

Just occurred to me you weren't talking about the speed in eclipse! So perhaps the configurator link is inappropriate!

cshorler avatar Aug 16 '11 11:08 cshorler