コード例 #1
0
 @Override
 public void completeVersions(ModuleVersionQuery query, ModuleVersionResult result) {
   // abort if not JVM
   if (query.getType() != ModuleQuery.Type.JVM) return;
   if (query.getName() == null || !JDK_MODULES.contains(query.getName())) return;
   if (query.getVersion() != null && !query.getVersion().equals(JDK_VERSION)) return;
   final ModuleVersionDetails newVersion = result.addVersion(JDK_VERSION);
   newVersion.setDoc(doc(query.getName()));
   newVersion.setVersion(JDK_VERSION);
 }
コード例 #2
0
ファイル: BytecodeUtils.java プロジェクト: lukehutch/ceylon
  @Override
  public ModuleVersionDetails readModuleInfo(
      String moduleName,
      String moduleVersion,
      File moduleArchive,
      boolean includeMembers,
      Overrides overrides) {
    Index index = readModuleIndex(moduleArchive, true);
    final AnnotationInstance moduleAnnotation = getAnnotation(index, moduleName, MODULE_ANNOTATION);
    if (moduleAnnotation == null) return null;

    AnnotationValue doc = moduleAnnotation.value("doc");
    AnnotationValue license = moduleAnnotation.value("license");
    AnnotationValue by = moduleAnnotation.value("by");
    AnnotationValue dependencies = moduleAnnotation.value("dependencies");
    String type = ArtifactContext.getSuffixFromFilename(moduleArchive.getName());

    final AnnotationInstance ceylonAnnotation = getAnnotation(index, moduleName, CEYLON_ANNOTATION);
    if (ceylonAnnotation == null) return null;

    AnnotationValue majorVer = ceylonAnnotation.value("major");
    AnnotationValue minorVer = ceylonAnnotation.value("minor");

    ModuleVersionDetails mvd =
        new ModuleVersionDetails(
            moduleName, getVersionFromFilename(moduleName, moduleArchive.getName()));
    mvd.setDoc(doc != null ? doc.asString() : null);
    mvd.setLicense(license != null ? license.asString() : null);
    if (by != null) {
      mvd.getAuthors().addAll(Arrays.asList(by.asStringArray()));
    }
    mvd.getDependencies()
        .addAll(getDependencies(dependencies, moduleName, mvd.getVersion(), overrides));
    ModuleVersionArtifact mva =
        new ModuleVersionArtifact(
            type, majorVer != null ? majorVer.asInt() : 0, minorVer != null ? minorVer.asInt() : 0);
    mvd.getArtifactTypes().add(mva);

    if (includeMembers) {
      mvd.setMembers(getMembers(index));
    }

    return mvd;
  }