This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from kwin/feature/p2updatesite
Feature/p2updatesite
- Loading branch information
Showing
18 changed files
with
505 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
com.googlecode.cppcheclipse.repository/packaging-p2composite.ant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.