Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #77 from kwin/feature/p2updatesite
Browse files Browse the repository at this point in the history
Feature/p2updatesite
  • Loading branch information
kwin authored Jul 24, 2016
2 parents 922a4d0 + 36170f1 commit 6059e28
Show file tree
Hide file tree
Showing 18 changed files with 505 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: cppcheclipse Core Tests
Bundle-SymbolicName: com.googlecode.cppcheclipse.core.tests
Bundle-Version: 1.0.1.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: Konrad Windszus
Fragment-Host: com.googlecode.cppcheclipse.core;bundle-version="0.9.8"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.core.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>com.googlecode.cppcheclipse.parent</artifactId>
<groupId>com.googlecode.cppcheclipse</groupId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../com.googlecode.cppcheclipse.parent/pom.xml</relativePath>
</parent>
<artifactId>com.googlecode.cppcheclipse.core.tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: cppcheclipse Core
Bundle-SymbolicName: com.googlecode.cppcheclipse.core;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.googlecode.cppcheclipse.core.CppcheclipsePlugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0",
org.eclipse.ui;bundle-version="3.5.0",
Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>com.googlecode.cppcheclipse.parent</artifactId>
<groupId>com.googlecode.cppcheclipse</groupId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../com.googlecode.cppcheclipse.parent/pom.xml</relativePath>
</parent>
<artifactId>com.googlecode.cppcheclipse.core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="com.googlecode.cppcheclipse.feature"
label="cppcheclipse"
version="1.0.1.qualifier"
version="1.1.0.qualifier"
provider-name="Konrad Windszus"
plugin="com.googlecode.cppcheclipse.core">

Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>com.googlecode.cppcheclipse.parent</artifactId>
<groupId>com.googlecode.cppcheclipse</groupId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../com.googlecode.cppcheclipse.parent/pom.xml</relativePath>
</parent>
<artifactId>com.googlecode.cppcheclipse.feature</artifactId>
Expand Down
48 changes: 47 additions & 1 deletion com.googlecode.cppcheclipse.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.googlecode.cppcheclipse</groupId>
<artifactId>com.googlecode.cppcheclipse.parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<!-- tycho requires maven >= 3.0 -->
Expand All @@ -16,6 +16,7 @@
<properties>
<tycho-version>0.24.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
</properties>

<build>
Expand Down Expand Up @@ -85,6 +86,51 @@
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attach-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- generate qualifier -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<format>'v'yyyyMMdd'-'HHmm</format>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-versions-plugin</artifactId>
<version>${tycho-version}</version>
</plugin>
</plugins>
</build>

Expand Down
4 changes: 2 additions & 2 deletions com.googlecode.cppcheclipse.parent/release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ To release version x do the following steps:

make sure there are no uncommitted changes
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=<version x>
build
copy to p2 update site
refresh category.xml (to point to feature in right version)
mvn clean verify -Prelease-composite (see also http://www.lorenzobettini.it/2016/02/publish-an-eclipse-p2-composite-repository-on-bintray/)
tag (from local workspace)
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=<version x+1>-SNAPSHOT
afterwards the category.xml has to be updated manually, due to the changed version of the referenced feature
Expand Down
173 changes: 173 additions & 0 deletions com.googlecode.cppcheclipse.repository/bintray.ant
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Handle p2 composite metadata from Bintray" basedir=".">

<!--
These must be set from outside
<property name="bintray.user" value="" />
<property name="bintray.apikey" value="" />
<property name="bintray.repo" value="" />
<property name="bintray.package" value="" />
<property name="bintray.releases.path" value="" />
<property name="bintray.composite.path" value="" />
<property name="bintray.zip.path" value="" />
-->

<property name="bintray.url" value="https://dl.bintray.com/${bintray.owner}/${bintray.repo}" />
<property name="bintray.package.version" value="${unqualifiedVersion}.${buildQualifier}" />
<property name="bintray.releases.target.path" value="${bintray.releases.path}/${bintray.package.version}" />

<property name="main.composite.url" value="${bintray.url}/${bintray.composite.path}" />
<property name="target" value="target" />
<property name="composite.repository.directory" value="composite-child" />
<property name="main.composite.repository.directory" value="composite-main" />

<property name="compositeArtifacts" value="compositeArtifacts.xml" />
<property name="compositeContent" value="compositeContent.xml" />

<property name="local.p2.repository" value="target/repository" />

<target name="getMajorMinorVersion">
<script language="javascript">
<![CDATA[
// getting the value
buildnumber = project.getProperty("unqualifiedVersion");
index = buildnumber.lastIndexOf(".");
counter = buildnumber.substring(0, index);
project.setProperty("majorMinorVersion",counter);
]]>
</script>
</target>

<!-- Take from the remote URL the possible existing metadata -->
<target name="get-composite-metadata" depends="getMajorMinorVersion" >
<get-metadata url="${main.composite.url}" dest="${target}/${main.composite.repository.directory}" />
<get-metadata url="${main.composite.url}/${majorMinorVersion}" dest="${target}/${composite.repository.directory}" />
<antcall target="preprocess-metadata" />
</target>

<macrodef name="get-metadata" description="Retrieve the p2 composite metadata">
<attribute name="url" />
<attribute name="dest" />
<sequential>
<echo message="Creating directory @{dest}..." />
<mkdir dir="@{dest}" />
<get-file file="${compositeArtifacts}" url="@{url}" dest="@{dest}" />
<get-file file="${compositeContent}" url="@{url}" dest="@{dest}" />
</sequential>
</macrodef>

<macrodef name="get-file" description="Use Ant Get task the file">
<attribute name="file" />
<attribute name="url" />
<attribute name="dest" />
<sequential>
<!-- If the remote file does not exist then fail gracefully -->
<echo message="Getting @{file} from @{url} into @{dest}..." />
<get dest="@{dest}" ignoreerrors="true">
<url url="@{url}/@{file}" />
</get>
</sequential>
</macrodef>

<!-- p2.atomic.composite.loading must be set to false otherwise we won't be able
to add a child to the composite repository without having all the children available -->
<target name="preprocess-metadata" description="Preprocess p2 composite metadata">
<replaceregexp byline="true">
<regexp pattern="property name='p2.atomic.composite.loading' value='true'" />
<substitution expression="property name='p2.atomic.composite.loading' value='false'" />
<fileset dir="${target}">
<include name="${composite.repository.directory}/*.xml" />
<include name="${main.composite.repository.directory}/*.xml" />
</fileset>
</replaceregexp>
</target>

<!-- p2.atomic.composite.loading must be set to true
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=356561 -->
<target name="postprocess-metadata" description="Preprocess p2 composite metadata">
<replaceregexp byline="true">
<regexp pattern="property name='p2.atomic.composite.loading' value='false'" />
<substitution expression="property name='p2.atomic.composite.loading' value='true'" />
<fileset dir="${target}">
<include name="${composite.repository.directory}/*.xml" />
<include name="${main.composite.repository.directory}/*.xml" />
</fileset>
</replaceregexp>
</target>

<target name="push-to-bintray" >
<antcall target="postprocess-metadata" />
<antcall target="push-p2-repo-to-bintray" />
<antcall target="push-p2-repo-zipped-to-bintray" />
<antcall target="push-composite-to-bintray" />
<antcall target="push-main-composite-to-bintray" />
</target>

<target name="push-p2-repo-to-bintray">
<apply executable="curl" parallel="false" relative="true" addsourcefile="false">
<arg value="-XPUT" />
<arg value="--verbose" />
<targetfile />

<fileset dir="${local.p2.repository}" />

<compositemapper>
<mergemapper to="-T" />
<globmapper from="*" to="${local.p2.repository}/*" />
<mergemapper to="-u${bintray.user}:${bintray.apikey}" />
<globmapper from="*" to="https://api.bintray.com/content/${bintray.owner}/${bintray.repo}/${bintray.releases.target.path}/*;bt_package=${bintray.package};bt_version=${bintray.package.version};publish=1" />
</compositemapper>
</apply>
</target>

<target name="push-p2-repo-zipped-to-bintray">
<apply executable="curl" parallel="false" relative="true" addsourcefile="false">
<arg value="-XPUT" />
<targetfile />

<fileset dir="${target}" includes="*.zip" />

<compositemapper>
<mergemapper to="-T" />
<globmapper from="*" to="${target}/*" />
<mergemapper to="-u${bintray.user}:${bintray.apikey}" />
<globmapper from="*" to="https://api.bintray.com/content/${bintray.owner}/${bintray.repo}/${bintray.zip.path}/*;bt_package=${bintray.package};bt_version=${bintray.package.version};publish=1" />
</compositemapper>
</apply>
</target>

<target name="push-composite-to-bintray" depends="getMajorMinorVersion" >
<apply executable="curl" parallel="false" relative="true" addsourcefile="false">
<arg value="-XPUT" />
<targetfile />

<fileset dir="${target}/${composite.repository.directory}" />

<compositemapper>
<mergemapper to="-T" />
<globmapper from="*" to="${target}/${composite.repository.directory}/*" />
<mergemapper to="-u${bintray.user}:${bintray.apikey}" />
<globmapper from="*" to="https://api.bintray.com/content/${bintray.owner}/${bintray.repo}/${bintray.composite.path}/${majorMinorVersion}/*;publish=1" />
</compositemapper>
</apply>
</target>

<target name="push-main-composite-to-bintray" >
<apply executable="curl" parallel="false" relative="true" addsourcefile="false">
<arg value="-XPUT" />
<targetfile />

<fileset dir="${target}/${main.composite.repository.directory}" />

<compositemapper>
<mergemapper to="-T" />
<globmapper from="*" to="${target}/${main.composite.repository.directory}/*" />
<mergemapper to="-u${bintray.user}:${bintray.apikey}" />
<globmapper from="*" to="https://api.bintray.com/content/${bintray.owner}/${bintray.repo}/${bintray.composite.path}/*;publish=1" />
</compositemapper>
</apply>
</target>

</project>
2 changes: 1 addition & 1 deletion com.googlecode.cppcheclipse.repository/category.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/com.googlecode.cppcheclipse.feature_1.0.1.qualifier.jar" id="com.googlecode.cppcheclipse.feature" version="1.0.1.qualifier">
<feature url="features/com.googlecode.cppcheclipse.feature_1.1.0.qualifier.jar" id="com.googlecode.cppcheclipse.feature" version="1.1.0.qualifier">
<category name="cppcheclipse"/>
</feature>
<category-def name="cppcheclipse" label="cppcheclipse"/>
Expand Down
82 changes: 82 additions & 0 deletions com.googlecode.cppcheclipse.repository/packaging-p2composite.ant
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0"?>
<project name="project">

<target name="getMajorMinorVersion">
<script language="javascript">
<![CDATA[
// getting the value
buildnumber = project.getProperty("unqualifiedVersion");
index = buildnumber.lastIndexOf(".");
counter = buildnumber.substring(0, index);
project.setProperty("majorMinorVersion",counter);
]]>
</script>
</target>

<target name="test_getMajorMinor" depends="getMajorMinorVersion">
<echo message="majorMinorVersion: ${majorMinorVersion}" />
</target>

<!--
site.label The name/title/label of the created composite site
unqualifiedVersion The version without any qualifier replacement
buildQualifier The build qualifier
child.repository.path.prefix The path prefix to access the actual p2 repo from the
child repo, e.g., if child repo is in /updates/1.0 and
the p2 repo is in /releases/1.0.0.something then this property
should be "../../releases/"
-->
<target name="compute.child.repository.data" depends="getMajorMinorVersion">
<property name="full.version" value="${unqualifiedVersion}.${buildQualifier}" />

<property name="site.composite.name" value="${site.label} ${majorMinorVersion}" />
<property name="main.site.composite.name" value="${site.label} All Versions" />

<!-- composite.base.dir The base directory for the local composite metadata,
e.g., from Maven, ${project.build.directory}
-->
<property name="composite.base.dir" value="target"/>

<property name="main.composite.repository.directory" location="${composite.base.dir}/composite-main" />
<property name="composite.repository.directory" location="${composite.base.dir}/composite-child" />

<property name="child.repository" value="${child.repository.path.prefix}${full.version}" />
</target>

<target name="p2.composite.add" depends="compute.child.repository.data">
<add.composite.repository.internal composite.repository.location="${main.composite.repository.directory}" composite.repository.name="${main.site.composite.name}" composite.repository.child="${majorMinorVersion}" />
<add.composite.repository.internal composite.repository.location="${composite.repository.directory}" composite.repository.name="${site.composite.name}" composite.repository.child="${child.repository}" />
</target>

<!-- = = = = = = = = = = = = = = = = =
macrodef: add.composite.repository.internal
= = = = = = = = = = = = = = = = = -->
<macrodef name="add.composite.repository.internal">
<attribute name="composite.repository.location" />
<attribute name="composite.repository.name" />
<attribute name="composite.repository.child" />
<sequential>

<echo message=" " />
<echo message="Composite repository : @{composite.repository.location}" />
<echo message="Composite name : @{composite.repository.name}" />
<echo message="Adding child repository : @{composite.repository.child}" />

<p2.composite.repository>
<repository compressed="false" location="@{composite.repository.location}" name="@{composite.repository.name}" />
<add>
<repository location="@{composite.repository.child}" />
</add>
</p2.composite.repository>

<echo file="@{composite.repository.location}/p2.index">version=1
metadata.repository.factory.order=compositeContent.xml,\!
artifact.repository.factory.order=compositeArtifacts.xml,\!
</echo>

</sequential>
</macrodef>

</project>
Loading

0 comments on commit 6059e28

Please sign in to comment.