Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 05880b46b3eb66ef88a57a8c38a4fad8fbfb5eca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<%--
Copyright (c) 2020 Eclipse contributors and others.

This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0
--%>
<%@jet package="org.eclipse.justj.codegen.templates.plugin" class="P2Inf" imports="java.util.* org.eclipse.justj.codegen.model.* org.eclipse.justj.codegen.model.util.Generator" builder="StringBuilder builder = new StringBuilder()" minimize="true"%>
<%JVM jvm = (JVM)argument;
  String jvmName = jvm.getName();
  Model model = jvm.getModel();
  String modelName = model.getName();
  String version = jvm.getVersion();
  String minorlessVersion = version.replaceAll("\\.[0-9]$", ".0");
  String fullName = modelName + '.' + jvmName;%>
<%@include file="../copyright.properties.jetinc"%>

# Define an a.jre unit that can be used as a profile ID in a Tycho build.

units.0.id = a.jre.<%=fullName%>
units.0.version = <%=minorlessVersion%>

units.0.provides.0.namespace = org.eclipse.equinox.p2.iu
units.0.provides.0.name = a.jre.<%=fullName%>
units.0.provides.0.version = <%=minorlessVersion%>

<%int propertyCount = 1;
  for (Map.Entry<String, Set<String>> entry : Generator.getEECapabilities(version).entrySet()) {
    String eeName = entry.getKey();
    Set<String> versions = entry.getValue();
    for (String eeVersion : versions) {
      int capabilityNumber = propertyCount++;%>
units.0.provides.<%=capabilityNumber%>.namespace = osgi.ee
units.0.provides.<%=capabilityNumber%>.name = <%=eeName%>
units.0.provides.<%=capabilityNumber%>.version = <%=eeVersion%>

  <%}%>
<%}%>
<%Set<String> systemPackages = Generator.getSystemPackages(jvm);
  for (String systemPackage : systemPackages) {
    int capabilityNumber = propertyCount++;%>
units.0.provides.<%=capabilityNumber%>.namespace = java.package
units.0.provides.<%=capabilityNumber%>.name = <%=systemPackage%>
units.0.provides.<%=capabilityNumber%>.version = 0.0.0

<%}%>
# Ensure that the a.jre IU is published to the update site.

requires.0.namespace = org.eclipse.equinox.p2.iu
requires.0.name = a.jre.<%=fullName%>
requires.0.range = [<%=minorlessVersion%>,<%=minorlessVersion%>]
requires.0.filter = (<%=modelName%>.assembletime=true)
requires.0.greedy = true
requires.0.optional = true

# Ensure that the applicable implementation fragment gets installed automatically.

<%int count = 0;
  for (Variant variant : jvm.getVariants()) {
    ++count;
    String os = variant.getOs();
    String arch = variant.getArch();%>
requires.<%=count%>.namespace = org.eclipse.equinox.p2.iu
requires.<%=count%>.name = <%=fullName%>.<%=os%>.<%=arch%>
requires.<%=count%>.range = [$version$,$version$]
requires.<%=count%>.filter = (&(osgi.os=<%=os%>)(osgi.arch=<%=arch%>)(!(<%=modelName%>.buildtime=true)))

<%}%>
# Exclude the synthetic a.jre IUs from the p2 repositories; Tycho gets confused by negative requirements so filter this to avoid it at build time.
<%++count;%>
requires.<%=count%>.namespace = org.eclipse.equinox.p2.iu
requires.<%=count%>.name = a.jre
requires.<%=count%>.min = 0
requires.<%=count%>.max = 0
requires.<%=count%>.filter = (!(<%=modelName%>.buildtime=true))

# Exclude the synthetic a.jre.javase IUs from the p2 repositories; Tycho gets confused by negative requirements so filter this to avoid it at build time.
<%++count;%>
requires.<%=count%>.namespace = org.eclipse.equinox.p2.iu
requires.<%=count%>.name = a.jre.javase
requires.<%=count%>.min = 0
requires.<%=count%>.max = 0
requires.<%=count%>.filter = (!(<%=modelName%>.buildtime=true))

# Declare a capability that can be used to ensure mutually exclusive installation of IUs that set the -vm option.
provides.0.namespace = org.eclipse.justj
provides.0.name = jre
provides.0.version = $version$

# Exclude all other providers of this capability; the site depends on all the features so exclude this requirement at build time.
<%++count;%>
requires.<%=count%>.matchExp = providedCapabilities.exists(x | x.name == 'jre' && x.namespace == 'org.eclipse.justj') && !providedCapabilities.exists(x | x.name == '<%=fullName%>' && x.namespace == 'org.eclipse.equinox.p2.iu')
requires.<%=count%>.min = 0
requires.<%=count%>.max = 0
requires.<%=count%>.filter = (!(<%=modelName%>.buildtime=true))

properties.0.name = org.eclipse.justj.model
properties.0.value = <%=Generator.getModelXMLAsPropertyValue(jvm, NL)%>

Back to the top