Home | History | Annotate | Download | only in adt
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.adt;
     18 
     19 import static com.android.SdkConstants.DOT_AIDL;
     20 import static com.android.SdkConstants.DOT_DEP;
     21 import static com.android.SdkConstants.DOT_FS;
     22 import static com.android.SdkConstants.DOT_JAVA;
     23 import static com.android.SdkConstants.DOT_RS;
     24 
     25 import com.android.SdkConstants;
     26 import com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder;
     27 import com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder;
     28 import com.android.ide.eclipse.adt.internal.build.builders.ResourceManagerBuilder;
     29 
     30 import org.eclipse.jdt.core.JavaCore;
     31 
     32 import java.io.File;
     33 
     34 /**
     35  * Constant definition class.<br>
     36  * <br>
     37  * Most constants have a prefix defining the content.
     38  * <ul>
     39  * <li><code>WS_</code> Workspace path constant. Those are absolute paths,
     40  * from the project root.</li>
     41  * <li><code>OS_</code> OS path constant. These paths are different depending on the platform.</li>
     42  * <li><code>FN_</code> File name constant.</li>
     43  * <li><code>FD_</code> Folder name constant.</li>
     44  * <li><code>MARKER_</code> Resource Marker Ids constant.</li>
     45  * <li><code>EXT_</code> File extension constant. This does NOT include a dot.</li>
     46  * <li><code>DOT_</code> File extension constant. This start with a dot.</li>
     47  * <li><code>RE_</code> Regexp constant.</li>
     48  * <li><code>NS_</code> Namespace constant.</li>
     49  * <li><code>CLASS_</code> Fully qualified class name.</li>
     50  * </ul>
     51  *
     52  */
     53 public class AdtConstants {
     54     /**
     55      * The old Editors Plugin ID. It is still used in some places for compatibility.
     56      * Please do not use for new features.
     57      */
     58     public static final String EDITORS_NAMESPACE = "com.android.ide.eclipse.editors"; //$NON-NLS-1$
     59 
     60     /** Nature of default Android projects */
     61     public final static String NATURE_DEFAULT = "com.android.ide.eclipse.adt.AndroidNature"; //$NON-NLS-1$
     62 
     63     /** The container id for the android framework jar file */
     64     public final static String CONTAINER_FRAMEWORK =
     65         "com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"; //$NON-NLS-1$
     66 
     67     /** The container id for the libraries */
     68     public final static String CONTAINER_PRIVATE_LIBRARIES = "com.android.ide.eclipse.adt.LIBRARIES"; //$NON-NLS-1$
     69     public final static String CONTAINER_DEPENDENCIES = "com.android.ide.eclipse.adt.DEPENDENCIES";
     70 
     71 
     72     /** Separator for workspace path, i.e. "/". */
     73     public final static String WS_SEP = "/"; //$NON-NLS-1$
     74     /** Separator character for workspace path, i.e. '/'. */
     75     public final static char WS_SEP_CHAR = '/';
     76 
     77     /** aapt's proguard output */
     78     public final static String FN_AAPT_PROGUARD = "proguard.txt"; //$NON-NLS-1$
     79 
     80     /** Temporary packaged resources file name, i.e. "resources.ap_" */
     81     public final static String FN_RESOURCES_AP_ = "resources.ap_"; //$NON-NLS-1$
     82 
     83     public final static String FN_TRACEVIEW =
     84         (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ?
     85             "traceview.bat" : "traceview"; //$NON-NLS-1$ //$NON-NLS-2$
     86 
     87     public final static String FN_HPROF_CONV =
     88         (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ?
     89             "hprof-conv.exe" : "hprof-conv"; //$NON-NLS-1$ //$NON-NLS-2$
     90 
     91     /** Absolute path of the workspace root, i.e. "/" */
     92     public final static String WS_ROOT = WS_SEP;
     93 
     94     /** Absolute path of the resource folder, e.g. "/res".<br> This is a workspace path. */
     95     public final static String WS_RESOURCES = WS_SEP + SdkConstants.FD_RESOURCES;
     96 
     97     public final static String FD_CRUNCH = "crunch";  //$NON-NLS-1$
     98     public final static String FD_BC = "bc";  //$NON-NLS-1$
     99 
    100     /** Path of crunch cache folder relative to the output folder.<br> This is a workspace path. */
    101     public final static String WS_BIN_RELATIVE_CRUNCHCACHE = SdkConstants.FD_RESOURCES
    102                                                                 + WS_SEP + FD_CRUNCH;
    103 
    104     /** Path of bc output folder relative to the output folder.<br> This is a workspace path. */
    105     public final static String WS_BIN_RELATIVE_BC = SdkConstants.FD_RESOURCES
    106                                                         + WS_SEP + FD_BC;
    107 
    108     /** Path of rs libs output folder relative to the output folder.<br> This is a workspace path. */
    109     public final static String WS_BIN_RELATIVE_RS_LIBS = SdkConstants.FD_RS_LIBS;
    110 
    111     /** Absolute path of the resource folder, e.g. "/assets".<br> This is a workspace path. */
    112     public final static String WS_ASSETS = WS_SEP + SdkConstants.FD_ASSETS;
    113 
    114     /** Absolute path of the layout folder, e.g. "/res/layout".<br> This is a workspace path. */
    115     public final static String WS_LAYOUTS = WS_RESOURCES + WS_SEP + SdkConstants.FD_RES_LAYOUT;
    116 
    117     /** Leaf of the javaDoc folder. Does not start with a separator. */
    118     public final static String WS_JAVADOC_FOLDER_LEAF = SdkConstants.FD_DOCS + "/" + //$NON-NLS-1$
    119             SdkConstants.FD_DOCS_REFERENCE;
    120 
    121     /** Path of the samples directory relative to the sdk folder.
    122      *  This is an OS path, ending with a separator.
    123      *  FIXME: remove once the NPW is fixed. */
    124     public final static String OS_SDK_SAMPLES_FOLDER = SdkConstants.FD_SAMPLES + File.separator;
    125 
    126     public final static String RE_DOT = "\\."; //$NON-NLS-1$
    127     /** Regexp for java extension, i.e. "\.java$" */
    128     public final static String RE_JAVA_EXT = "\\" + DOT_JAVA + "$"; //$NON-NLS-1$ //$NON-NLS-2$
    129     /** Regexp for aidl extension, i.e. "\.aidl$" */
    130     public final static String RE_AIDL_EXT = "\\" + DOT_AIDL + "$"; //$NON-NLS-1$ //$NON-NLS-2$
    131     /** Regexp for rs extension, i.e. "\.rs$" */
    132     public final static String RE_RS_EXT = "\\" + DOT_RS + "$"; //$NON-NLS-1$ //$NON-NLS-2$
    133     /** Regexp for rs extension, i.e. "\.fs$" */
    134     public final static String RE_FS_EXT = "\\" + DOT_FS + "$"; //$NON-NLS-1$ //$NON-NLS-2$
    135     /** Regexp for .d extension, i.e. "\.d$" */
    136     public final static String RE_DEP_EXT = "\\" + DOT_DEP + "$"; //$NON-NLS-1$ //$NON-NLS-2$
    137 
    138     /**
    139      * Namespace pattern for the custom resource XML, i.e. "http://schemas.android.com/apk/res/%s"
    140      * <p/>
    141      * This string contains a %s. It must be combined with the desired Java package, e.g.:
    142      * <pre>
    143      *    String.format(SdkConstants.NS_CUSTOM_RESOURCES, "android");
    144      *    String.format(SdkConstants.NS_CUSTOM_RESOURCES, "com.test.mycustomapp");
    145      * </pre>
    146      *
    147      * Note: if you need an URI specifically for the "android" namespace, consider using
    148      * {@link SdkConstants#NS_RESOURCES} instead.
    149      */
    150     // TODO rename NS_CUSTOM_RESOURCES to NS_CUSTOM_RESOURCES_S (denoting it takes a %s) in
    151     // another CL.
    152     public final static String NS_CUSTOM_RESOURCES = "http://schemas.android.com/apk/res/%1$s"; //$NON-NLS-1$
    153 
    154     /** The old common plug-in ID. Please do not use for new features. */
    155     private static final String LEGACY_PLUGIN_ID = "com.android.ide.eclipse.common"; //$NON-NLS-1$
    156 
    157     /** Generic marker for ADT errors, only to be used in the {@link ResourceManagerBuilder} */
    158     public final static String MARKER_ADT = AdtPlugin.PLUGIN_ID + ".adtProblem"; //$NON-NLS-1$
    159 
    160     /** Marker for Android Target errors.
    161      * This is not cleared on each build like other markers. Instead, it's cleared
    162      * when an AndroidClasspathContainerInitializer has succeeded in creating an
    163      * AndroidClasspathContainer */
    164     public final static String MARKER_TARGET = AdtPlugin.PLUGIN_ID + ".targetProblem"; //$NON-NLS-1$
    165     /** Marker for Android Build Tools errors.
    166      * This is not cleared on each build like other markers. Instead, it's cleared
    167      * when the build tools are setup in the projectState. */
    168     public final static String MARKER_BUILD_TOOLS = AdtPlugin.PLUGIN_ID + ".buildToolsProblem"; //$NON-NLS-1$
    169     /** Marker for Android Dependency errors.
    170      * This is not cleared on each build like other markers. Instead, it's cleared
    171      * when a LibraryClasspathContainerInitializer has succeeded in creating a
    172      * LibraryClasspathContainer */
    173     public final static String MARKER_DEPENDENCY = AdtPlugin.PLUGIN_ID + ".dependencyProblem"; //$NON-NLS-1$
    174 
    175 
    176     /** aapt marker error when running the compile command, only to be used
    177      * in {@link PreCompilerBuilder} */
    178     public final static String MARKER_AAPT_COMPILE = LEGACY_PLUGIN_ID + ".aaptProblem"; //$NON-NLS-1$
    179 
    180     /** XML marker error, only to be used in {@link PreCompilerBuilder} */
    181     public final static String MARKER_XML = LEGACY_PLUGIN_ID + ".xmlProblem"; //$NON-NLS-1$
    182 
    183     /** aidl marker error, only to be used in {@link PreCompilerBuilder} */
    184     public final static String MARKER_AIDL = LEGACY_PLUGIN_ID + ".aidlProblem"; //$NON-NLS-1$
    185 
    186     /** renderscript marker error, only to be used in {@link PreCompilerBuilder} */
    187     public final static String MARKER_RENDERSCRIPT = LEGACY_PLUGIN_ID + ".rsProblem"; //$NON-NLS-1$
    188 
    189     /** android marker error, only to be used in the Manifest parsing
    190      * from the {@link PreCompilerBuilder} */
    191     public final static String MARKER_ANDROID = LEGACY_PLUGIN_ID + ".androidProblem"; //$NON-NLS-1$
    192 
    193 
    194     /** aapt marker error when running the package command, only to be used in
    195      * {@link PostCompilerBuilder} */
    196     public final static String MARKER_AAPT_PACKAGE = LEGACY_PLUGIN_ID + ".aapt2Problem"; //$NON-NLS-1$
    197 
    198     /** final packaging error marker, only to be used in {@link PostCompilerBuilder} */
    199     public final static String MARKER_PACKAGING = AdtPlugin.PLUGIN_ID + ".packagingProblem"; //$NON-NLS-1$
    200 
    201     /** manifest merger error, only to be used in {@link PreCompilerBuilder} */
    202     public final static String MARKER_MANIFMERGER = AdtPlugin.PLUGIN_ID + ".manifMergerProblem"; //$NON-NLS-1$
    203 
    204     /** Marker for lint errors */
    205     public final static String MARKER_LINT = AdtPlugin.PLUGIN_ID + ".lintProblem"; //$NON-NLS-1$
    206 
    207     /** Name for the "type" marker attribute */
    208     public final static String MARKER_ATTR_TYPE = "android.type"; //$NON-NLS-1$
    209     /** Name for the "class" marker attribute */
    210     public final static String MARKER_ATTR_CLASS = "android.class"; //$NON-NLS-1$
    211     /** activity value for marker attribute "type" */
    212     public final static String MARKER_ATTR_TYPE_ACTIVITY = "activity"; //$NON-NLS-1$
    213     /** service value for marker attribute "type" */
    214     public final static String MARKER_ATTR_TYPE_SERVICE = "service"; //$NON-NLS-1$
    215     /** receiver value for marker attribute "type" */
    216     public final static String MARKER_ATTR_TYPE_RECEIVER = "receiver"; //$NON-NLS-1$
    217     /** provider value for marker attribute "type" */
    218     public final static String MARKER_ATTR_TYPE_PROVIDER = "provider"; //$NON-NLS-1$
    219 
    220     /**
    221      * Preferred compiler level, i.e. "1.6".
    222      */
    223     public final static String COMPILER_COMPLIANCE_PREFERRED = JavaCore.VERSION_1_6;
    224     /**
    225      * List of valid compiler level, i.e. "1.5" and "1.6"
    226      */
    227     public final static String[] COMPILER_COMPLIANCE = {
    228         JavaCore.VERSION_1_5,
    229         JavaCore.VERSION_1_6,
    230     };
    231 
    232     /** The base URL where to find the Android class & manifest documentation */
    233     public static final String CODESITE_BASE_URL = "http://code.google.com/android";  //$NON-NLS-1$
    234 
    235     public static final String LIBRARY_TEST_RUNNER = "android.test.runner"; //$NON-NLS-1$
    236 
    237     /** Documentation marker for elements, attributes etc that should be hidden */
    238     public static final String DOC_HIDE = "@hide"; //$NON-NLS-1$
    239 
    240     public static final String DEX_OPTIONS_FORCEJUMBO = "dex.force.jumbo"; //$NON-NLS-1$
    241     public static final String DEX_OPTIONS_DISABLE_MERGER = "dex.disable.merger"; //$NON-NLS-1$
    242 }
    243