Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java [...] -metadataRepository file:\\E:\juno42rep -artifactRepository file:\\E:\juno42rep -source E:\juno42rep -publishArtifacts

 

Creating a Target Definition

To use the reference installation with private eclipse installations (e.g. on personal laptops) an eclipse target definition is required. As eclipse's tooling to create such a .target file is pretty much unusable, you are welcome to use the following script.

Code Block
languagebash
#!/bin/bash
#
# This script can be used to automatically create an eclipse target
# platform definition from the contents of a p2 repository.
#
# $NAME - The name of the created file
# $SEQ_N - A sequence number within the target definition. This should
#          be higher than the numbers used before as eclipse
#          uses it to cache states internally
# $TARGET_PLAT_* - Urls to the used p2 repositories
#

NAME="pragmatics_luna441.target"
SEQ_N=40
TARGET_PLAT="http://rtsys.informatik.uni-kiel.de/~kieler/repository/luna441/"
TARGET_PLAT_DELTA="http://rtsys.informatik.uni-kiel.de/~kieler/repository/luna441_delta/"

#
# Implementation below
#

# Ignore any platform specific fragments for the target definition.
# They will be resolved automatically.
IGNORE_FRAGMENTS="linux\|win\|cocoa\|mac\|solaris\|aix\|hpux"


# function to download the contents.jar from an p2 repository
# and extract all the installable units
# $1 - url of the p2 repository
function parseContent {

  TMP="tmp"
  mkdir $TMP
  wget -P $TMP "$1/content.jar" > /dev/null 2>&1
  unzip "$TMP/content.jar" -d $TMP  > /dev/null 2>&1

  CMD="cat $TMP/content.xml | grep -e '<unit .*' | grep -v -e '$IGNORE_FRAGMENTS' | sed \"s/singleton='false'//g\" | sed \"s/>/\/>/g\""
  UNITS=$(eval $CMD)

  rm -r $TMP

  echo -e "$UNITS"
}

# function assembling a location
# $1 - the url of the p2 repository
# $2 - a list of units that should be part of the target definition
function location {
  LOCATION='    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
        '$2'
      <repository location="'$1'"/>
    </location>
  '
  echo -e "$LOCATION"
}



HEAD='<?xml version="1.0" encoding="UTF-8" standalone="no"?> \n
      <?pde version="3.8"?> \n
    <target name="'$NAME'" sequenceNumber="'$SEQ_N'"> \n
        <locations> \n
     '

FOOT='
  </locations> \n
</target>'


# print the header of the target definition
echo -e $HEAD > $NAME

# parse the provided content.xml file
UNITS=$(parseContent "$TARGET_PLAT")
echo -e "$(location "$TARGET_PLAT" "$UNITS")" >> $NAME

UNITS=$(parseContent "$TARGET_PLAT_DELTA")
echo -e "$(location "$TARGET_PLAT_DELTA" "$UNITS")" >> $NAME


# finish the target definition
echo -e $FOOT >> $NAME