use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.
the class CeylonVersionTool method run.
@Override
public void run() throws IOException, RecognitionException {
// TODO if version is empty? Prompt? Or should --set have an optional argument?
TypeCheckerBuilder tcb = new TypeCheckerBuilder();
for (File path : this.sourceFolders) {
tcb.addSrcDirectory(applyCwd(path));
}
TypeChecker tc = tcb.getTypeChecker();
PhasedUnits pus = tc.getPhasedUnits();
pus.visitModules();
ArrayList<Module> moduleList = new ArrayList<Module>(pus.getModuleSourceMapper().getCompiledModules());
Collections.sort(moduleList, new Comparator<Module>() {
@Override
public int compare(Module m1, Module m2) {
if (match(m1) && !match(m2)) {
return -1;
} else if (!match(m1) && match(m2)) {
return +1;
}
int cmp = m1.getNameAsString().compareToIgnoreCase(m2.getNameAsString());
if (cmp == 0) {
cmp = m1.getVersion().compareTo(m2.getVersion());
}
return cmp;
}
});
// first update all module versions and remember which version we assigned to which module
// because the user can update every individual version
Map<String, String> updatedModuleVersions = new HashMap<String, String>();
for (Module module : moduleList) {
boolean isMatch = match(module);
if (newVersion == null) {
output(module, isMatch);
} else if (isMatch) {
if (!updateModuleVersion(module, updatedModuleVersions)) {
return;
}
}
}
// now do dependencies because we know which modules we did update
if (newVersion != null && !noUpdateDependencies) {
for (Module module : moduleList) {
if (!updateModuleImports(module, updatedModuleVersions)) {
return;
}
}
}
}
use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.
the class CeylonDocToolTests method moduleA.
private void moduleA(boolean includeNonShared) throws Exception {
String pathname = "test/ceylondoc";
String docname = "test/ceylondoc-doc";
String moduleName = "com.redhat.ceylon.ceylondoc.test.modules.single";
CeylonDocTool tool = tool(pathname, docname, moduleName, true, false);
tool.setIncludeNonShared(includeNonShared);
tool.setIncludeSourceCode(true);
tool.setHeader("<div class='navbar-inverse navbar-static-top'>" + "<div class='navbar-inner' style='color:white; font-style: italic; text-align: center'>" + "documentation under construction" + "</div>" + "</div>");
tool.setFooter("<p style='text-align: right;'>" + "Copyright © 2010-2013, Red Hat, Inc. or third-party contributors" + "</p>");
tool.run();
Module module = new Module();
module.setName(Arrays.asList(moduleName));
module.setVersion("3.1.4");
File destDir = getOutputDir(tool, module);
assertFileExists(destDir, includeNonShared);
assertBasicContent(destDir, includeNonShared);
assertConstructors(destDir, includeNonShared);
assertBy(destDir);
assertLicense(destDir);
assertParametersDocumentation(destDir);
assertParametersAssertions(destDir);
assertParametersLinks(destDir);
assertThrows(destDir);
assertSee(destDir);
assertIcons(destDir);
assertInnerTypesDoc(destDir);
assertDeprecated(destDir);
assertTagged(destDir);
assertDocumentationOfRefinedMember(destDir);
assertSequencedParameter(destDir);
assertCallableParameter(destDir);
assertTupleParameter(destDir);
assertDefaultedParametres(destDir);
assertAnythingReturnType(destDir);
assertFencedCodeBlockWithSyntaxHighlighter(destDir);
assertWikiStyleLinkSyntax(destDir, includeNonShared);
assertConstants(destDir);
assertLinksToRefinedDeclaration(destDir);
assertGenericTypeParams(destDir);
assertObjectPageDifferences(destDir);
assertSharedParameterOfClass(destDir);
assertAliases(destDir);
assertPackageNavigation(destDir);
assertSubpackages(destDir);
assertAnnotations(destDir);
assertAbstractClassModifier(destDir);
assertFinalClassModifier(destDir);
assertHeaderAndFooter(destDir);
assertExceptions(destDir);
assertNameAliases(destDir);
assertBug659ShowInheritedMembers(destDir);
assertBug691AbbreviatedOptionalType(destDir);
assertBug839(destDir);
assertBug927LoadingAndSortingInheritedMembers(destDir);
assertBug968(destDir);
assertBug1619BrokenLinkFromInheritedDoc(destDir);
assertBug1619BrokenLinkWithNewLine(destDir);
assertBug2307AliasedName(destDir);
}
use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.
the class CeylonDocToolTests method externalLinks.
private File externalLinks(String repoUrl, String... linkArgs) throws Exception {
compile("test/ceylondoc", "com.redhat.ceylon.ceylondoc.test.modules.dependency.b");
compile("test/ceylondoc", "com.redhat.ceylon.ceylondoc.test.modules.dependency.c");
List<String> modules = new ArrayList<String>();
modules.add("com.redhat.ceylon.ceylondoc.test.modules.dependency.b");
modules.add("com.redhat.ceylon.ceylondoc.test.modules.dependency.c");
modules.add("com.redhat.ceylon.ceylondoc.test.modules.externallinks");
CeylonDocTool tool = tool(Arrays.asList(new File("test/ceylondoc")), Collections.<File>emptyList(), modules, true, true, false, "build/ceylon-cars");
tool.setLinks(Arrays.asList(linkArgs));
tool.run();
Module module = new Module();
module.setName(Arrays.asList("com.redhat.ceylon.ceylondoc.test.modules.externallinks"));
module.setVersion("1.0");
File destDir = getOutputDir(tool, module);
assertExternalLinks(destDir, repoUrl);
return destDir;
}
use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.
the class CeylonDocToolTests method makeDefaultModule.
private Module makeDefaultModule() {
Module module = new Module();
module.setName(Arrays.asList(Module.DEFAULT_MODULE_NAME));
module.setDefault(true);
return module;
}
use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.
the class CeylonDocToolTests method documentDefaultModule.
@Test
public void documentDefaultModule() throws Exception {
String pathname = "test/ceylondoc";
String moduleName = "default";
CeylonDocTool tool = tool(pathname, moduleName, true, "build/ceylon-cars");
tool.setIncludeNonShared(true);
tool.run();
Module a = makeModule("com.redhat.ceylon.ceylondoc.test.modules.multi.a", "1");
File destDirA = getOutputDir(tool, a);
Module b = makeModule("com.redhat.ceylon.ceylondoc.test.modules.multi.b", "1");
File destDirB = getOutputDir(tool, b);
Module def = makeDefaultModule();
File destDirDef = getOutputDir(tool, def);
assertFileNotExists(destDirA, "index.html");
assertFileNotExists(destDirB, "index.html");
assertFileExists(destDirDef, "index.html");
assertFileExists(destDirDef, "com/redhat/ceylon/ceylondoc/test/modules/multi/goes/into/bar.object.html");
assertFileExists(destDirDef, "com/redhat/ceylon/ceylondoc/test/modules/multi/goes/into/defaultmodule/foo.object.html");
}
Aggregations