| <%-- | |
| 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)%> |