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
017package org.jetbrains.jet.cli.common.modules;
018
019import com.intellij.util.SmartList;
020import org.jetbrains.annotations.NotNull;
021
022import java.util.List;
023
024/**
025 * This interface duplicates {@link jet.modules.Module}, because cli-common should not depend on kotlin-runtime.jar
026 */
027public interface ModuleDescription {
028
029    @NotNull
030    String getModuleName();
031
032    @NotNull
033    List<String> getSourceFiles();
034
035    @NotNull
036    List<String> getClasspathRoots();
037
038    @NotNull
039    List<String> getAnnotationsRoots();
040
041    class Impl implements ModuleDescription {
042
043        private String name;
044        private final List<String> sources = new SmartList<String>();
045        private final List<String> classpath = new SmartList<String>();
046        private final List<String> annotations = new SmartList<String>();
047
048        public void setName(String name) {
049            this.name = name;
050        }
051
052        public void addSourcePath(String path) {
053            sources.add(path);
054        }
055
056        public void addClassPath(String path) {
057            classpath.add(path);
058        }
059
060        public void addAnnotationPath(String path) {
061            annotations.add(path);
062        }
063
064        @NotNull
065        @Override
066        public String getModuleName() {
067            return name;
068        }
069
070        @NotNull
071        @Override
072        public List<String> getSourceFiles() {
073            return sources;
074        }
075
076        @NotNull
077        @Override
078        public List<String> getClasspathRoots() {
079            return classpath;
080        }
081
082        @NotNull
083        @Override
084        public List<String> getAnnotationsRoots() {
085            return annotations;
086        }
087
088        @Override
089        public String toString() {
090            return name + "\n\tsources=" + sources + "\n\tclasspath=" + classpath + "\n\tannotations=" + annotations;
091        }
092    }
093}