Skip to content

Commit

Permalink
Add JDK modules by default to non-strict modules; e.g. jars.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Jan 25, 2013
1 parent c533cdf commit 5a59e2f
Show file tree
Hide file tree
Showing 78 changed files with 751 additions and 16 deletions.
3 changes: 3 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

module.com.redhat.ceylon.maven-support.version=main

# ----- Javax XML Stream ---
javax-xml-stream.dir=javax/xml/stream/api

# ----- JBoss Modules ---
jboss-modules.version=1.1.3.GA
jboss-modules.jar=jboss-modules.jar
Expand Down
8 changes: 6 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@

<!-- module archives -->
<property name="ceylon.runtime.dir" value="${module.runtime.dir}/${module.ceylon.runtime.version}"/>
<property name="ceylon.runtime.jar" value="${ceylon.runtime.dir}/${module.runtime.name}-${module.ceylon.runtime.version}.jar"/>
<property name="ceylon.runtime.jar"
value="${ceylon.runtime.dir}/${module.runtime.name}-${module.ceylon.runtime.version}.jar"/>
<property name="ceylon.runtime.repo" value="${ceylon.repo.dir}/${ceylon.runtime.dir}"/>
<property name="ceylon.runtime.dist" value="${build.dist.repo}/${ceylon.runtime.dir}"/>

Expand Down Expand Up @@ -133,7 +134,10 @@
<!-- Copy the libraries -->
<copy file="${bootstrap.lib}" tofile="${build.dist.lib}/${bootstrap.jar}"/>
<!-- Copy the Ceylon runtime dependencies -->
<copy file="${jboss-modules.lib}" tofile="${build.dist.repo}/${jboss-modules.dir}/main/${jboss-modules.module}"/>
<copy file="${dist.dir}/repo/${javax-xml-stream.dir}/main/module.xml"
tofile="${build.dist.repo}/${javax-xml-stream.dir}/main/module.xml"/>
<copy file="${jboss-modules.lib}"
tofile="${build.dist.repo}/${jboss-modules.dir}/main/${jboss-modules.module}"/>
<copy file="${jboss-jandex.lib}" tofile="${build.dist.repo}/${jboss-jandex.dir}/main/${jboss-jandex.module}"/>
<copy file="${ceylon.common.lib}" tofile="${build.dist.repo}/${ceylon.common.jar}"/>
<copy file="${ceylon.language.lib}" tofile="${build.dist.repo}/${ceylon.language.car}"/>
Expand Down
1 change: 1 addition & 0 deletions dist/repo/com/redhat/ceylon/maven-support/main/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
</resources>

<dependencies>
<module name="javax.xml.stream.api"/>
</dependencies>
</module>
30 changes: 30 additions & 0 deletions dist/repo/javax/xml/stream/api/main/module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright 2012 Red Hat inc. and third party contributors as noted
~ by the author tags.
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<module xmlns="urn:jboss:module:1.1" name="javax.xml.stream.api">

<dependencies>
<system export="true">
<paths>
<path name="javax/xml/stream"/>
<path name="javax/xml/stream/events"/>
<path name="javax/xml/stream/util"/>
</paths>
</system>
</dependencies>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import com.redhat.ceylon.cmr.api.ImportType;
import com.redhat.ceylon.cmr.api.JDKUtils;
import com.redhat.ceylon.cmr.api.RepositoryManager;
import com.redhat.ceylon.cmr.api.VisibilityType;
import com.redhat.ceylon.common.Versions;

import org.jboss.modules.DependencySpec;
import org.jboss.modules.LocalLoader;
import org.jboss.modules.ModuleIdentifier;
Expand Down Expand Up @@ -194,13 +194,18 @@ protected ModuleSpec findModule(ModuleIdentifier moduleIdentifier) throws Module
builder.addDependency(lds); // local resources
deps.add(lds);

// used modules
Set<String> modules = new HashSet<String>();

if (isDefault == false) {
Node<ArtifactResult> root = new Node<ArtifactResult>();
for (ArtifactResult i : artifact.dependencies()) {
final String name = i.name();
modules.add(name); // track used modules

if (i.importType() == ImportType.OPTIONAL) {
String path = i.name();
Node<ArtifactResult> current = root;
String[] tokens = path.split("\\.");
String[] tokens = name.split("\\.");
for (String token : tokens) {
Node<ArtifactResult> child = current.getChild(token);
if (child == null)
Expand Down Expand Up @@ -239,6 +244,18 @@ protected ModuleSpec findModule(ModuleIdentifier moduleIdentifier) throws Module
Graph.Vertex<ModuleIdentifier, Boolean> sdsv = graph.createVertex(RUNTIME, RUNTIME);
Graph.Edge.create(false, vertex, sdsv);

// add JDK modules to loose artifacts
if (artifact.visibilityType() == VisibilityType.LOOSE) {
Set<String> jdkModules = JDKUtils.getJDKModuleNames();
for (String module : jdkModules) {
if (modules.contains(module) == false) {
DependencySpec ds = getJDKDependency(module);
builder.addDependency(ds);
// no need to track system deps -- cannot be updated anyway
}
}
}

dependencies.put(moduleIdentifier, deps);

return builder.create();
Expand All @@ -262,18 +279,29 @@ protected void createModuleDependency(Graph.Vertex<ModuleIdentifier, Boolean> ve
Graph.Edge.create(false, vertex, lv);
}

/**
* Get JDK dependency.
*
* @param name the module name
* @return dependency spec
*/
DependencySpec getJDKDependency(String name) {
Set<String> paths = JDKUtils.getJDKPathsByModule(name);
return DependencySpec.createSystemDependencySpec(paths);
}

/**
* Create module dependency from import.
*
* @param i the import
* @return new module dependency
*/
DependencySpec createModuleDependency(ArtifactResult i) {
if (JDKUtils.isJDKModule(i.name())) {
Set<String> paths = JDKUtils.getJDKPathsByModule(i.name());
return DependencySpec.createSystemDependencySpec(paths);
} else if (JDKUtils.isOracleJDKModule(i.name())) {
Set<String> paths = JDKUtils.getOracleJDKPathsByModule(i.name());
final String name = i.name();
if (JDKUtils.isJDKModule(name)) {
return getJDKDependency(name);
} else if (JDKUtils.isOracleJDKModule(name)) {
Set<String> paths = JDKUtils.getOracleJDKPathsByModule(name);
return DependencySpec.createSystemDependencySpec(paths);
} else {
final ModuleIdentifier mi = createModuleIdentifier(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ public void testDummy() {
}

@Test
@Ignore // TODO -- fix module_ and run_
public void testHello() throws Throwable {
car("hello/1.0.0", Collections.<String, String>emptyMap());
}

@Test
@Ignore("@Steph -- weird Range ctor usage")
public void testIssue29() throws Throwable {
car("test.ceylon.dbc/0.5", Collections.<String, String>emptyMap());
}

@Test
@Ignore // TODO -- provide a client-1.0.0.car which depends on hello-1.0.0 module_
public void testClient() throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

package org.jboss.ceylon.test.modules.repo.test;

import java.util.ArrayList;
import java.util.List;

import ceylon.modules.spi.Argument;
import ceylon.modules.spi.Constants;
import org.jboss.ceylon.test.modules.ModulesTest;
import org.junit.Ignore;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
* Test different repository usage.
*
Expand All @@ -38,7 +37,6 @@ public void testDummy() {
}

@Test
@Ignore // TODO -- fix module_ and run_
public void testMultipleRepositories() throws Throwable {
List<String> extra = new ArrayList<String>();
// alternative
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bdc8b4df2c6d0190984734bb60178bcc6ec19858
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eaff0d565b580cff33440da7b3b3632b29e223b6
Binary file modified testsuite/src/test/resources/repo/hello/1.0.0/hello-1.0.0.car
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a525608bb5c3e7cce2e7242e75554f4c32db365a
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
28e07407475ac5de0d2e49460745270238750797
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
org/h2/constraint

org/h2/upgrade
org/h2/constant
org/h2/message
org/h2/result
org/h2/security
org/h2/command
org/h2/expression
org/h2/jdbcx
org/h2/value
org/h2/table
org/h2/compress
org/h2/store
org/h2/index
org/h2/jdbc
org/h2/util
org/h2/schema
org/h2/bnf
org/h2/api
META-INF
org/h2/command/dml
org/h2/tools
org/h2
org/h2/fulltext
org/h2/server/web
org/h2/engine
org/h2/server/pg
org/h2/store/fs
META-INF/services
org/h2/command/ddl
org/h2/server
org/h2/jmx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb32936a239d95220f5b2d2973a7b17372f98b54
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

test/ceylon/collection
META-INF
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
784a0c3c44aed8e927d349a86206a434279ae15d
Loading

0 comments on commit 5a59e2f

Please sign in to comment.