Permalink
Browse files

Add JDK modules by default to non-strict modules; e.g. jars.

  • Loading branch information...
1 parent c533cdf commit 5a59e2f3e9a360077b5e9daf7d6064f7f0103892 @alesj alesj committed Jan 25, 2013
Showing with 751 additions and 16 deletions.
  1. +3 −0 build.properties
  2. +6 −2 build.xml
  3. +1 −0 dist/repo/com/redhat/ceylon/maven-support/main/module.xml
  4. +30 −0 dist/repo/javax/xml/stream/api/main/module.xml
  5. +36 −8 impl/src/main/java/ceylon/modules/jboss/runtime/CeylonModuleLoader.java
  6. +6 −1 testsuite/src/test/java/org/jboss/ceylon/test/modules/examples/test/ExamplesTestCase.java
  7. +3 −5 testsuite/src/test/java/org/jboss/ceylon/test/modules/repo/test/RepositoryTestCase.java
  8. BIN testsuite/src/test/resources/alternative/moduletest/0.1/moduletest-0.1.car
  9. +1 −0 testsuite/src/test/resources/alternative/moduletest/0.1/moduletest-0.1.car.sha1
  10. BIN testsuite/src/test/resources/alternative/moduletest/0.1/moduletest-0.1.src
  11. +1 −0 testsuite/src/test/resources/alternative/moduletest/0.1/moduletest-0.1.src.sha1
  12. BIN testsuite/src/test/resources/repo/hello/1.0.0/hello-1.0.0.car
  13. +1 −0 testsuite/src/test/resources/repo/hello/1.0.0/hello-1.0.0.car.sha1
  14. BIN testsuite/src/test/resources/repo/hello/1.0.0/hello-1.0.0.src
  15. +1 −0 testsuite/src/test/resources/repo/hello/1.0.0/hello-1.0.0.src.sha1
  16. BIN testsuite/src/test/resources/repo/org/h2/1.3.168/org.h2-1.3.168-jar.idx
  17. BIN testsuite/src/test/resources/repo/org/h2/1.3.168/org.h2-1.3.168.jar
  18. +33 −0 testsuite/src/test/resources/repo/org/h2/1.3.168/org.h2-1.3.168.jar.index
  19. +1 −0 testsuite/src/test/resources/repo/org/h2/1.3.168/org.h2-1.3.168.jar.sha1
  20. BIN testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.car
  21. BIN testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.car.idx
  22. +3 −0 testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.car.index
  23. +1 −0 testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.car.sha1
  24. +305 −0 testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.js
  25. BIN testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.src
  26. +1 −0 testsuite/src/test/resources/repo/test/ceylon/collection/0.5/test.ceylon.collection-0.5.src.sha1
  27. BIN testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.car
  28. BIN testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.car.idx
  29. +3 −0 testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.car.index
  30. +1 −0 testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.car.sha1
  31. BIN testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.src
  32. +1 −0 testsuite/src/test/resources/repo/test/ceylon/dbc/0.5/test.ceylon.dbc-0.5.src.sha1
  33. BIN testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.car
  34. BIN testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.car.idx
  35. +3 −0 testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.car.index
  36. +1 −0 testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.car.sha1
  37. BIN testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.src
  38. +1 −0 testsuite/src/test/resources/repo/test/ceylon/file/0.5/test.ceylon.file-0.5.src.sha1
  39. BIN testsuite/src/test/resources/repo/test/ceylon/interop/java/0.5/test.ceylon.interop.java-0.5.car
  40. +1 −0 testsuite/src/test/resources/repo/test/ceylon/interop/java/0.5/test.ceylon.interop.java-0.5.car.sha1
  41. BIN testsuite/src/test/resources/repo/test/ceylon/interop/java/0.5/test.ceylon.interop.java-0.5.src
  42. +1 −0 testsuite/src/test/resources/repo/test/ceylon/interop/java/0.5/test.ceylon.interop.java-0.5.src.sha1
  43. BIN testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.car
  44. BIN testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.car.idx
  45. +3 −0 testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.car.index
  46. +1 −0 testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.car.sha1
  47. BIN testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.src
  48. +1 −0 testsuite/src/test/resources/repo/test/ceylon/io/0.5/test.ceylon.io-0.5.src.sha1
  49. BIN testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.car
  50. BIN testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.car.idx
  51. +3 −0 testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.car.index
  52. +1 −0 testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.car.sha1
  53. +261 −0 testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.js
  54. BIN testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.src
  55. +1 −0 testsuite/src/test/resources/repo/test/ceylon/json/0.5/test.ceylon.json-0.5.src.sha1
  56. BIN testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.car
  57. BIN testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.car.idx
  58. +3 −0 testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.car.index
  59. +1 −0 testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.car.sha1
  60. BIN testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.src
  61. +1 −0 testsuite/src/test/resources/repo/test/ceylon/math/0.5/test.ceylon.math-0.5.src.sha1
  62. BIN testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.car
  63. BIN testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.car.idx
  64. +3 −0 testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.car.index
  65. +1 −0 testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.car.sha1
  66. BIN testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.src
  67. +1 −0 testsuite/src/test/resources/repo/test/ceylon/net/0.5/test.ceylon.net-0.5.src.sha1
  68. BIN testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.car
  69. BIN testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.car.idx
  70. +3 −0 testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.car.index
  71. +1 −0 testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.car.sha1
  72. BIN testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.src
  73. +1 −0 testsuite/src/test/resources/repo/test/ceylon/process/0.5/test.ceylon.process-0.5.src.sha1
  74. BIN testsuite/src/test/resources/repo/test/ceylon/test/0.5/test.ceylon.test-0.5.car
  75. +1 −0 testsuite/src/test/resources/repo/test/ceylon/test/0.5/test.ceylon.test-0.5.car.sha1
  76. +18 −0 testsuite/src/test/resources/repo/test/ceylon/test/0.5/test.ceylon.test-0.5.js
  77. BIN testsuite/src/test/resources/repo/test/ceylon/test/0.5/test.ceylon.test-0.5.src
  78. +1 −0 testsuite/src/test/resources/repo/test/ceylon/test/0.5/test.ceylon.test-0.5.src.sha1
View
@@ -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
View
@@ -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}"/>
@@ -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}"/>
@@ -22,5 +22,6 @@
</resources>
<dependencies>
+ <module name="javax.xml.stream.api"/>
</dependencies>
</module>
@@ -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>
@@ -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;
@@ -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)
@@ -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();
@@ -263,17 +280,28 @@ protected void createModuleDependency(Graph.Vertex<ModuleIdentifier, Boolean> ve
}
/**
+ * 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);
@@ -33,12 +33,17 @@ 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 {
car("client/1.0.0", Collections.<String, String>emptyMap());
@@ -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.
*
@@ -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
@@ -0,0 +1 @@
+bdc8b4df2c6d0190984734bb60178bcc6ec19858
@@ -0,0 +1 @@
+eaff0d565b580cff33440da7b3b3632b29e223b6
Binary file not shown.
@@ -0,0 +1 @@
+a525608bb5c3e7cce2e7242e75554f4c32db365a
Binary file not shown.
@@ -0,0 +1 @@
+28e07407475ac5de0d2e49460745270238750797
@@ -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
@@ -0,0 +1 @@
+eb32936a239d95220f5b2d2973a7b17372f98b54
@@ -0,0 +1,3 @@
+
+test/ceylon/collection
+META-INF
@@ -0,0 +1 @@
+784a0c3c44aed8e927d349a86206a434279ae15d
Oops, something went wrong.

0 comments on commit 5a59e2f

Please sign in to comment.