001 /* 002 * Copyright 2010-2013 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jetbrains.jet.cli.common.modules; 018 019 import com.intellij.util.SmartList; 020 import org.jetbrains.annotations.NotNull; 021 022 import java.util.List; 023 024 /** 025 * This interface duplicates {@link kotlin.modules.Module}, because cli-common should not depend on kotlin-runtime.jar 026 */ 027 public interface ModuleDescription { 028 029 @NotNull 030 String getModuleName(); 031 032 @NotNull 033 String getOutputDir(); 034 035 @NotNull 036 List<String> getSourceFiles(); 037 038 @NotNull 039 List<String> getClasspathRoots(); 040 041 @NotNull 042 List<String> getAnnotationsRoots(); 043 044 class Impl implements ModuleDescription { 045 046 private String name; 047 private String outputDir; 048 private final List<String> sources = new SmartList<String>(); 049 private final List<String> classpath = new SmartList<String>(); 050 private final List<String> annotations = new SmartList<String>(); 051 052 public void setName(String name) { 053 this.name = name; 054 } 055 056 public void setOutputDir(String outputDir) { 057 this.outputDir = outputDir; 058 } 059 060 public void addSourcePath(String path) { 061 sources.add(path); 062 } 063 064 public void addClassPath(String path) { 065 classpath.add(path); 066 } 067 068 public void addAnnotationPath(String path) { 069 annotations.add(path); 070 } 071 072 @NotNull 073 @Override 074 public String getModuleName() { 075 return name; 076 } 077 078 @NotNull 079 @Override 080 public String getOutputDir() { 081 return outputDir; 082 } 083 084 @NotNull 085 @Override 086 public List<String> getSourceFiles() { 087 return sources; 088 } 089 090 @NotNull 091 @Override 092 public List<String> getClasspathRoots() { 093 return classpath; 094 } 095 096 @NotNull 097 @Override 098 public List<String> getAnnotationsRoots() { 099 return annotations; 100 } 101 102 @Override 103 public String toString() { 104 return name + 105 "\n\toutputDir=" + outputDir + 106 "\n\tsources=" + sources + 107 "\n\tclasspath=" + classpath + 108 "\n\tannotations=" + annotations; 109 } 110 } 111 }