Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Triquetrum/Ptolemy/osgi-2-0"

(Instructions about how to sign the Ptolemy II jar files.)
(Link to the osgi-2-0-cq-1 p2 repo.)
(One intermediate revision by one other user not shown)
Line 5: Line 5:
 
* [http://terra.eecs.berkeley.edu:8080/job/ptIIosgi Ptolemy II osgi-2-0 Jenkins build]
 
* [http://terra.eecs.berkeley.edu:8080/job/ptIIosgi Ptolemy II osgi-2-0 Jenkins build]
 
* https://chess.eecs.berkeley.edu/triq/p2/osgi-2-0/ - Ptolemy II osgi-2-0 update site
 
* https://chess.eecs.berkeley.edu/triq/p2/osgi-2-0/ - Ptolemy II osgi-2-0 update site
 +
* https://chess.eecs.berkeley.edu/triq/p2/osgi-2-0-cq-1/ - Ptolemy II osgi-2-0 update site for jars and sources from the [https://github.com/eclipse/triquetrum/issues/70 | initial Ptolemy II contribution questionnaire]
  
 
== Setting up a nightly build ==
 
== Setting up a nightly build ==
Line 358: Line 359:
 
To verify that a jar is signed:
 
To verify that a jar is signed:
 
   jarsigner -verify -verbose -certs ./releng/org.ptolemy.tycho.update/target/repository/plugins/ptolemy.moml*.jar
 
   jarsigner -verify -verbose -certs ./releng/org.ptolemy.tycho.update/target/repository/plugins/ptolemy.moml*.jar
 +
 +
== Adding the source files to the p2 repo ==
 +
The p2 site for the first cq may be found at http://chess.eecs.berkeley.edu/triq/p2/osgi-2-0-cq-1
 +
 +
To create this:
 +
 +
1) osgi-2-0-cq-1/pom.xml was updated
 +
 +
<pre>
 +
      <!-- To create source bundles, run mvn org.eclipse.tycho:tycho-source-plugin:plugin-source     
 +
          See https://eclipse.org/tycho/sitedocs/tycho-source-plugin/plugin-info.html               
 +
        -->
 +
      <plugin>
 +
        <groupId>org.eclipse.tycho</groupId>
 +
        <artifactId>tycho-source-plugin</artifactId>
 +
<version>${tycho-version}</version>
 +
<executions>
 +
          <execution>
 +
            <id>plugin-source</id>
 +
            <goals>
 +
              <goal>plugin-source</goal>
 +
            </goals>
 +
          </execution>
 +
</executions>
 +
      </plugin>
 +
 +
      <!-- enable source feature generation -->
 +
      <plugin>
 +
<groupId>org.eclipse.tycho.extras</groupId>
 +
<artifactId>tycho-source-feature-plugin</artifactId>
 +
<version>${tycho.extras.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>attached-p2-metadata</id>
 +
            <phase>package</phase>
 +
            <goals>
 +
              <goal>p2-metadata</goal>
 +
            </goals>
 +
          </executions>
 +
</executions>
 +
      </plugin>
 +
</pre>
 +
 +
2) Build the repository:
 +
<pre>
 +
mvn verify
 +
</pre>
 +
 +
3) Update the website:
 +
<pre>
 +
cd ./releng/org.ptolemy.tycho.update/target/
 +
tar -zcf /tmp/repo.tar.gz repository/
 +
scp /tmp/repo.tar.gz moog:/tmp
 +
</pre>

Revision as of 18:11, 24 April 2017

This page is notes about how the Ptolemy II osgi-2-0 repository that contains the Ptolemy II sources used by Triquetrum was set up. It is probably not that useful to most people.

See Also

Setting up a nightly build

We would like to set up a nightly build, so we want to run Maven, create jar files and make them available somehow.

See Check out the ptII osgi-2-0 branch for getting access to the Ptolemy II osgi-2-0 repository

Creating pom files

POM-less Tycho Builds suggests creating osgi-2-0/.mvn/extensions.xml:

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
  <extension>
    <groupId>org.eclipse.tycho.extras</groupId>
    <artifactId>tycho-pomless</artifactId>
    <version>0.24.0</version>
  </extension>
</extensions>

The Eclipse Tycho Tutorial suggests:

 cd osgi-2-0
 mvn org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms -DgroupId=ptolemy

This creates osgi-2-0/pom.xml and other */pom.xml files.

We then remove the */pom.xml files that were created:

 rm */pom.xml

Running mvn

The Eclipse Tycho Tutorial suggests running

 mvn clean verify

The tutorial states:

"Tip: It is not recommended to use the mvn clean install command, instead you should use mvn clean verify. If you would use the install option, the build result would be installed in your local Maven repository and this can lead to build problems.

The tutorial states:

"Warning If you try to execute this POM file, the build fail because you have not yet configured your dependencies."

mvn clean fails

If we run

mvn clean

we get

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: diva 11.0.0.qualifier
[ERROR]   Missing requirement: diva 11.0.0.qualifier requires 'package org.w3c.dom.svg 1.1.0' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: ptolemy:diva:11.0.0-SNAPSHOT @ /Users/cxh/src/osgi-2-0/diva/.polyglot.build.properties: See log for details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException

So the next step is to fix the dependencies.

Fixing a dependency problem

Looking at Understanding Missing Requirement Messages and Using p2 update sites for dependencies resolutionUsing p2 update sites for dependencies resolution, the solution is to add the following to the osgi-2-0/pom.xml file:

  <repositories>
    <repository>
      <id>eclipse-mars</id>
      <url>http://download.eclipse.org/releases/mars</url>
      <layout>p2</layout>
    </repository>
  </repositories>

After that

 mvn clean

works

mvn verify fails

However,

 mvn verify 

fails:

[INFO] Building diva 11.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.w3c.dom.svg:svg-dom-java:jar:1.1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] osgi-2-0 ........................................... SUCCESS [  0.002 s]
[INFO] diva ............................................... FAILURE [  0.058 s]
[INFO] org.ptolemy.testsupport ............................ SKIPPED
[INFO] org.ptolemy.commons ................................ SKIPPED
[INFO] ptolemy.core ....................................... SKIPPED
[INFO] ptolemy.moml ....................................... SKIPPED
[INFO] ptolemy.actor.lib .................................. SKIPPED
[INFO] ptolemy.domains.sdf ................................ SKIPPED
[INFO] org.ptolemy.actor.gui.test ......................... SKIPPED
[INFO] ptolemy.domains.process ............................ SKIPPED
[INFO] org.ptolemy.core.test .............................. SKIPPED
[INFO] org.ptolemy.core.test.actor ........................ SKIPPED
[INFO] ptolemy.actor.lib.gui .............................. SKIPPED
[INFO] ptolemy.gui ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.218 s
[INFO] Finished at: 2016-06-28T16:32:25-07:00
[INFO] Final Memory: 92M/504M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project diva: Could not resolve dependencies for project ptolemy:diva:eclipse-plugin:11.0.0-SNAPSHOT: Failure to find org.w3c.dom.svg:svg-dom-java:jar:1.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :diva

The fix was to remove the following from osgi-2-0/pom.xml:

  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.axsl.org.w3c.dom.svg/svg-dom-java -->
    <dependency>
      <groupId>org.w3c.dom.svg</groupId>
      <artifactId>svg-dom-java</artifactId>
      <version>1.1.0</version>
    </dependency>
  </dependencies>

mvn verify fails because of GenerateHTMLTest

Running

 mvn verify

fails:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (
default-compile) on project org.ptolemy.actor.gui.test: Compilation failure: Compilation failure:
[ERROR] /Users/cxh/src/osgi-2-0/org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java:[39]
[ERROR] import ptolemy.actor.gui.GenerateCopyrights;
[ERROR] ^^^^^^^^^^^^^^^^^
[ERROR] The import ptolemy.actor.gui cannot be resolved
[ERROR] /Users/cxh/src/osgi-2-0/org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java:[59]
[ERROR] System.out.println(GenerateCopyrights.generateHTML(null));
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] GenerateCopyrights cannot be resolved
[ERROR] 2 problems (2 errors)

A workaround:

 rm org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java

However it seems like we don't have the dependencies properly set up.

Editing osgi-2-0/org.ptolemy.actor.gui.test/META-INF/MANIFEST.MF and adding a trailing comma and

  ptolemy.gui;bundle-version="10.1.0"

so that we have

Require-Bundle: org.ptolemy.testsupport;bundle-version="10.1.0",
 ptolemy.core;bundle-version="10.1.0",
 ptolemy.actor.lib;bundle-version="10.1.0",
 ptolemy.domains.sdf;bundle-version="10.1.0",
 ptolemy.gui;bundle-version="10.1.0"

IconAttribute

Running:

 mvn verify 

fails with:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (
default-compile) on project ptolemy.gui: Compilation failure: Compilation failure:
[ERROR] /Users/cxh/src/osgi-2-0/ptolemy.gui/src/ptolemy/vergil/icon/EditorIcon.java:[52]
[ERROR] import ptolemy.kernel.util.IconAttribute;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The type 'IconAttribute' is not API (restriction on classpath entry '/Users/cxh/src/osgi-2-0/ptolemy.core/target/classes')

Access restriction on class due to restriction on required library rt.jar? (Stackoverflow) refers to What is the latest on "Access restriction" compilation errors, which suggests adding:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-compiler-plugin</artifactId>
    <version>${tycho.version}</version>
    <configuration>
        <compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
    </configuration>
</plugin>

The ${tycho.version} was causing problems, so at the top of pom.xml we added:

  <properties>
    <target-version>0.1.0-SNAPSHOT</target-version>
    <tycho-version>0.24.0</tycho-version>
  </properties>

and then added the following to the plugins section

      <!-- See http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03670.html -->
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
        </configuration>
      </plugin>

Now

 mvn verify

works!

No explicit target runtime environment configuration

Running

 mvn verify

produces

[WARNING] No explicit target runtime environment configuration. Build is platform dependent.

So we add the following:

      <!-- This configures the target platform and the supported architectures. -->
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <environments>
            <environment>
              <os>linux</os>
              <ws>gtk</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>linux</os>
              <ws>gtk</ws>
              <arch>x86_64</arch>
            </environment>
            <environment>
              <os>win32</os>
              <ws>win32</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>win32</os>
              <ws>win32</ws>
              <arch>x86_64</arch>
            </environment>
            <environment>
              <os>macosx</os>
              <ws>cocoa</ws>
              <arch>x86_64</arch>
            </environment>
          </environments>
        </configuration>
      </plugin>

See the triquetrum pom.xml for an additional target section that could go in this plugin:

        <target>
          <artifact>
            <groupId>triquetrum</groupId>
            <artifactId>org.eclipse.triquetrum.target.platform</artifactId>
            <version>0.1.0-SNAPSHOT</version>
          </artifact>
        </target>

Clearly, the artifactId would need to be changed.

The Ptolemy II osgi-2-0 p2 repository

The Ptolemy II osgi-2-0 p2 repository is at https://chess.eecs.berkeley.edu/triq/p2/osgi-2-0/


Setting up the p2 repository

We want to create a p2 repository for these files, see Bug #114: Create a p2 site for the Ptolemy II bundles]

This was a bit tricky. Follow the Eclipse Tycho Tutorial

I followed the releng/ and features/ subdirectory structure proposed by the tutorial, but this might not be necessary.

Below are the steps that were used to set up the releng/ and features/ directories. These steps are already done and the results are checked in to the osgi-2-0 repo.

  1. Checked out the repo with: svn co https://repo.eecs.berkeley.edu/svn/projects/eal/ptII/branches/osgi-2-0
  2. mkdir -p osgi-2-0/releng/org.ptolemy.tycho.update
  3. Create the org.ptolemy.tycho.update project in the above directory
  4. Create osgi-2-0/releng/pom.xml
  5. mkdir -p osgi-2-0/features/org.ptolemy.tycho.feature
  6. Create the org.ptolemy.tycho.feature project in the above directory
  7. Create osgi-2-0/features/pom.xml
  8. Running "mvn verify" creates ./releng/org.ptolemy.tycho.update/target/repository/plugins/diva_11.0.0.201606291522.jar

In the osgi-2-0 Jenkins build, one of the steps publishes artifacts to a SSH site on moog. The contents of releng/org.ptolemy.tycho.update/target/** are copied to ~www/cvswww/chess.eecs.berkeley.edu/triq/. A symbolic link from ~www/cvswww/chess.eecs.berkeley.edu/triq/p2/osgi-2-0 to ../releng/org.ptolemy.tycho.update/target/repository was created.

Signing the Ptolemy II osgi-2-0 Jar Files

Bug #178 Sign the Ptolemy Plug-ins wanted the Ptolemy II files in https://chess.eecs.berkeley.edu/ptexternal/src/p2/osgi-2-0/ to be signed.

To do this, Apache Maven Jarsigner Plugin suggested how to edit pom.xml:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jarsigner-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <id>sign</id>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- storetype etc. are defined in ~/.m2/settings.xml.                                       
               See http://stackoverflow.com/questions/3598424/jar-signing-strategy-in-maven-projects   
               mvn -Pcodesigning -Dkeystore.password=`cat ~/.certpw` package                           
          -->
          <storetype>${keystore.type}</storetype>
          <!-- See /users/ptII/adm/certs/ptkeystore on terra.eecs.berkeley.edu -->
          <keystore>${keystore.path}</keystore>
          <!-- Use 'keytool -list -keystore ptkeystore -storepass xxxx' to get the alias. -->
          <alias>${keystore.alias}</alias>
          <!-- See ~jenkins/.certpw on terra.eecs.berkeley.edu -->
          <storepass>${keystore.store.password}</storepass>
          <keypass>${keystore.key.password}</keypass>
        </configuration>
      </plugin>

http://stackoverflow.com/questions/3598424/jar-signing-strategy-in-maven-projects suggested using a profile and variables:

The ~/.m2/settings.xml file:

<settings>                                                                                             
  <profiles>
    <profile>
      <id>codesigning</id>
      <properties>
          <!-- See /users/ptII/adm/certs/ptkeystore on terra.eecs.berkeley.edu -->
        <keystore.path>/Users/cxh/txt/ptkeystore</keystore.path>
        <!-- Use 'keytool -list -keystore ptkeystore -storepass xxxx' to get the alias. -->
        <keystore.alias>ptolemy</keystore.alias>
        <keystore.type>JKS</keystore.type>
        <!-- See ~jenkins/.certpw on terra.eecs.berkeley.edu -->
        <keystore.store.password>${keystore.password}</keystore.store.password>
        <keystore.key.password>${keystore.password}</keystore.key.password>
      </properties>
    </profile>
  </profiles
</settings>

To sign the jars:

 mvn -Pcodesigning -Dkeystore.password=`cat ~/.certpw` package

To verify that a jar is signed:

 jarsigner -verify -verbose -certs ./releng/org.ptolemy.tycho.update/target/repository/plugins/ptolemy.moml*.jar

Adding the source files to the p2 repo

The p2 site for the first cq may be found at http://chess.eecs.berkeley.edu/triq/p2/osgi-2-0-cq-1

To create this:

1) osgi-2-0-cq-1/pom.xml was updated

      <!-- To create source bundles, run mvn org.eclipse.tycho:tycho-source-plugin:plugin-source       
           See https://eclipse.org/tycho/sitedocs/tycho-source-plugin/plugin-info.html                 
        -->
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-source-plugin</artifactId>
	<version>${tycho-version}</version>
	<executions>
          <execution>
            <id>plugin-source</id>
            <goals>
              <goal>plugin-source</goal>
            </goals>
          </execution>
	</executions>
      </plugin>

      <!-- enable source feature generation -->
      <plugin>
	<groupId>org.eclipse.tycho.extras</groupId>
	<artifactId>tycho-source-feature-plugin</artifactId>
	<version>${tycho.extras.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>attached-p2-metadata</id>
            <phase>package</phase>
            <goals>
              <goal>p2-metadata</goal>
            </goals>
          </executions>
	</executions>
      </plugin>

2) Build the repository:

mvn verify

3) Update the website:

cd ./releng/org.ptolemy.tycho.update/target/
tar -zcf /tmp/repo.tar.gz repository/
scp /tmp/repo.tar.gz moog:/tmp

Back to the top