aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--p2gen/README.txt73
-rw-r--r--p2gen/pom.xml129
2 files changed, 202 insertions, 0 deletions
diff --git a/p2gen/README.txt b/p2gen/README.txt
new file mode 100644
index 0000000..3443b03
--- /dev/null
+++ b/p2gen/README.txt
@@ -0,0 +1,73 @@
+Summary:
+
+To generate p2 artifacts from jars, run:
+$ mvn --no-snapshot-updates --offline p2:site \
+ -Dmaven.repo.local=../../out/host/maven/localrepo
+The folder ${build.directory}/repository contains the resultant
+p2 repository. ${build.directory} is defined inside pom.xml
+
+Details:
+
+The Eclipse plugins in $root/sdk/eclipse/plugins depend on a number
+of jar files from:
+ $root/tools/base
+ $root/tools/swt
+ $root/prebuilts/tools/common/m2/repository
+
+In earlier versions, a script (create_all_symlinks.sh) knew about
+which plugins depended on which jars, and when executed, it would
+copy over those jars into the plugin's libs folder. Each plugin
+included the jars from its libs folder as part of its classpath,
+and the entire libs folder was bundled inside the plugin.
+
+Such a scheme has a number of issues:
+ - bundling jars inside libs/ folder inside each plugin is not
+ recommended by Eclipse. This causes performance degradation
+ at runtime.
+ - at build time, the script modifies the source folders to add
+ the contents inside libs folder. Ideally, the source folders
+ shouldn't be modified during build.
+ - the script has to maintain state about which plugin depends
+ on which jars.
+
+The approach suggested by Eclipse is to replace the regular jars
+with OSGI bundles, and for each plugin to explicitly add a dependency
+to the required OSGI bundles. In essence, this makes each of the
+jars to be similar to a plugin.
+
+This folder contains scripts that can be used to convert a set
+of jars into OSGI bundles using the p2-maven-plugin
+(https://github.com/reficio/p2-maven-plugin).
+
+$ mvn --no-snapshot-updates \
+ --offline \
+ -Dmaven.repo.local=../../out/host/maven/localRepo \
+ p2:site
+
+The pom.xml file lists the set of jars to be processed. The
+runtime options to Maven include:
+ --offline: We don't want Maven to fetch anything from the internet.
+ All required dependencies must be checked into git.
+ --no-snapshot-updates: If the tools artifacts have a -SNAPSHOT
+ in them, Maven will attempt to re-download those artifacts,
+ which would fail since we are running in offline mode. This
+ option instructs Maven to not attempt to download these
+ snapshots and use whatever is available in the local repositories.
+ -Dmaven.repo.local=path to the local repository that should be
+ used by maven. Without this, it'll use $HOME/.m2. This should
+ be initialized with all the necessary artifacts if running in
+ offline mode.
+
+Additional considerations for running in offline mode:
+
+When running in online mode, there are 3 sources from which files
+are downloaded by Maven:
+ 1 Maven Central
+ 2 the repository where the tools/base and tools/swt artifacts are
+ generated
+ 3 the prebuilts/tools/common/m2 repository (this is a subset of 1).
+Even though 2 and 3 are available locally, we cannot just use them
+in offline mode since Maven treats repositories with file:/// urls
+as remote as well. As a result, the only way to run offline is to
+first explicitly copy the contents of 2 and 3 into the local repository
+(-Dmaven.repo.local) before initiating an offline build.
diff --git a/p2gen/pom.xml b/p2gen/pom.xml
new file mode 100644
index 0000000..683b649
--- /dev/null
+++ b/p2gen/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This pom is used to take a set of files present in a Maven repo,
+ add OSGI manifest if necessary and put them in a p2 repository suitable
+ for consumption by the Eclipse Tycho builder.
+
+ See README.txt for more information and about invocation options.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.android.tools.rcp</groupId>
+ <artifactId>adt-eclipse</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0.0</version>
+
+ <properties>
+ <android.src.dir>${basedir}/../..</android.src.dir>
+ <android.out.dir>${basedir}/../../out</android.out.dir>
+ </properties>
+
+ <!--
+ Define two profiles: online and offline
+
+ The offline profile is default and will be used by the build server. For this
+ to work, all the required artifacts must already be in the local repository
+ pointed to by the settings.xml
+
+ The online profile could be used for testing/debugging purposes. It can be
+ activated by removing the offline option, and adding "-P online" to the list
+ of command line options. This allows downloading necessary artifacts either
+ from the internet, or from the prebuilts and generated artifacts of the gradle
+ builds.
+ -->
+ <profiles>
+ <profile>
+ <id>offline</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+
+ <profile>
+ <id>online</id>
+ <repositories>
+ <repository>
+ <id>tools</id>
+ <url>file:///${android.out.dir}/repo/</url>
+ </repository>
+ <repository>
+ <id>tools-prebuilts</id>
+ <url>file:///${android.src.dir}/prebuilts/tools/common/m2/repository/</url>
+ </repository>
+ </repositories>
+ </profile>
+ </profiles>
+
+ <build>
+ <!-- Remap the build folder to be something inside out -->
+ <directory>${basedir}/../../out/host/maven/p2gen</directory>
+
+ <plugins>
+ <plugin>
+ <!-- org.reficio:p2-maven-plugin:1.1.0 is checked into prebuils/tools/common/m2/repository -->
+ <groupId>org.reficio</groupId>
+ <artifactId>p2-maven-plugin</artifactId>
+ <version>1.1.0</version>
+
+ <executions>
+ <execution>
+ <id>default-cli</id>
+ <configuration>
+ <artifacts>
+ <!-- tools/base dependencies -->
+ <artifact> <id>com.android.tools.build:manifest-merger:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools.ddms:ddmlib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools.layoutlib:layoutlib-api:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools.lint:lint-api:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools.lint:lint-checks:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:asset-studio:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:common:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:dvlib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:ninepatch:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:rule-api:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:sdk-common:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:sdklib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:testutils:22.9.0-SNAPSHOT</id> </artifact>
+
+ <!-- tools/swt dependencies -->
+ <artifact> <id>com.android.tools.ddms:ddmuilib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:hierarchyviewer2lib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:sdkstats:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:sdkuilib:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:swtmenubar:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:traceview:22.9.0-SNAPSHOT</id> </artifact>
+ <artifact> <id>com.android.tools:uiautomatorviewer:22.9.0-SNAPSHOT</id> </artifact>
+
+ <!-- prebuilts -->
+ <artifact> <id>com.android.tools.external.lombok:lombok-ast:0.2.2</id> </artifact>
+ <artifact> <id>com.android.tools.external:ant-glob:1.0</id> </artifact>
+ <artifact> <id>com.android.tools.external:liblzf:1.0</id> </artifact>
+ <artifact> <id>com.android.tools.external:libprotobuf-java-lite:2.3.0</id> </artifact>
+ <artifact> <id>com.android.tools.external:propertysheet:1.0</id> </artifact>
+ <artifact> <id>com.google.guava:guava:15.0</id> </artifact>
+ <artifact> <id>commons-codec:commons-codec:1.4</id> </artifact>
+ <artifact> <id>commons-logging:commons-logging:1.1.1</id> </artifact>
+ <artifact> <id>jfree:jcommon:1.0.12</id> </artifact>
+ <artifact> <id>jfree:jfreechart-swt:1.0.9</id> </artifact>
+ <artifact> <id>jfree:jfreechart:1.0.9</id> </artifact>
+ <artifact> <id>net.sf.kxml:kxml2:2.3.0</id> </artifact>
+ <artifact> <id>net.sf.kxml:kxml2:2.3.0</id> </artifact>
+ <artifact> <id>org.apache.commons:commons-compress:1.0</id> </artifact>
+ <artifact> <id>org.apache.httpcomponents:httpclient:4.1.1</id> </artifact>
+ <artifact> <id>org.apache.httpcomponents:httpcore:4.1</id> </artifact>
+ <artifact> <id>org.apache.httpcomponents:httpmime:4.1</id> </artifact>
+ <artifact> <id>org.freemarker:freemarker:2.3.20</id> </artifact>
+ <artifact> <id>org.ow2.asm:asm-analysis:4.0</id> </artifact>
+ <artifact> <id>org.ow2.asm:asm-tree:4.0</id> </artifact>
+ <artifact> <id>org.ow2.asm:asm:4.0</id> </artifact>
+ </artifacts>
+ </configuration>
+
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>