Config.java 2.0 KB
Newer Older
P
Pavel Talanov 已提交
1
/*
A
Andrey Breslav 已提交
2
 * Copyright 2010-2012 JetBrains s.r.o.
P
Pavel Talanov 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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.
 */

P
Pavel Talanov 已提交
17 18 19 20
package org.jetbrains.k2js.config;

import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
21
import org.jetbrains.annotations.Nullable;
P
Pavel Talanov 已提交
22 23
import org.jetbrains.jet.lang.psi.JetFile;

P
pTalanov 已提交
24
import java.util.Arrays;
P
Pavel Talanov 已提交
25
import java.util.List;
P
Pavel Talanov 已提交
26 27 28

/**
 * @author Pavel Talanov
P
Pavel Talanov 已提交
29
 *         <p/>
P
Pavel V. Talanov 已提交
30
 *         Base class representing a configuration of translator.
P
Pavel Talanov 已提交
31
 */
P
Pavel Talanov 已提交
32 33 34
public abstract class Config {

    @NotNull
P
pTalanov 已提交
35
    protected static final List<String> LIB_FILE_NAMES = Arrays.asList(
36 37 38 39 40 41 42 43 44 45 46 47
        "/core/annotations.kt",
        "/jquery/common.kt",
        "/jquery/ui.kt",
        "/core/javautil.kt",
        "/core/javalang.kt",
        "/core/date.kt",
        "/core/core.kt",
        "/core/math.kt",
        "/core/json.kt",
        "/raphael/raphael.kt",
        "/html5/canvas.kt",
        "/html5/files.kt",
48 49
        "/html5/image.kt",
        "/stdlib/JUMaps.kt"
P
pTalanov 已提交
50 51
    );

A
Andrey Breslav 已提交
52
    protected static final String LIBRARIES_LOCATION = "js/js.libraries/src";
P
Pavel Talanov 已提交
53 54

    @NotNull
P
pTalanov 已提交
55
    private final Project project;
56 57
    @Nullable
    private List<JetFile> libFiles = null;
P
Pavel Talanov 已提交
58

P
pTalanov 已提交
59 60 61 62 63 64 65 66 67 68
    public Config(@NotNull Project project) {
        this.project = project;
    }

    @NotNull
    public Project getProject() {
        return project;
    }

    @NotNull
69 70 71 72 73 74 75 76 77
    protected abstract List<JetFile> generateLibFiles();

    @NotNull
    public final List<JetFile> getLibFiles() {
        if (libFiles == null) {
            libFiles = generateLibFiles();
        }
        return libFiles;
    }
P
Pavel Talanov 已提交
78
}