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_LIBRARIES = "com.android.ide.eclipse.adt.LIBRARIES"; //$NON-NLS-1$ 69 70 71 /** Separator for workspace path, i.e. "/". */ 72 public final static String WS_SEP = "/"; //$NON-NLS-1$ 73 /** Separator character for workspace path, i.e. '/'. */ 74 public final static char WS_SEP_CHAR = '/'; 75 76 /** aapt's proguard output */ 77 public final static String FN_AAPT_PROGUARD = "proguard.txt"; //$NON-NLS-1$ 78 79 /** Temporary packaged resources file name, i.e. "resources.ap_" */ 80 public final static String FN_RESOURCES_AP_ = "resources.ap_"; //$NON-NLS-1$ 81 82 public final static String FN_TRACEVIEW = 83 (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ? 84 "traceview.bat" : "traceview"; //$NON-NLS-1$ //$NON-NLS-2$ 85 86 public final static String FN_HPROF_CONV = 87 (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ? 88 "hprof-conv.exe" : "hprof-conv"; //$NON-NLS-1$ //$NON-NLS-2$ 89 90 /** Absolute path of the workspace root, i.e. "/" */ 91 public final static String WS_ROOT = WS_SEP; 92 93 /** Absolute path of the resource folder, e.g. "/res".<br> This is a workspace path. */ 94 public final static String WS_RESOURCES = WS_SEP + SdkConstants.FD_RESOURCES; 95 96 /** Absolute path of the crunch cache folder, e.g. "/bin/res".<br> This is a workspace path. */ 97 public final static String WS_CRUNCHCACHE = WS_SEP + SdkConstants.FD_OUTPUT 98 + WS_SEP + SdkConstants.FD_RESOURCES; 99 100 /** Absolute path of the resource folder, e.g. "/assets".<br> This is a workspace path. */ 101 public final static String WS_ASSETS = WS_SEP + SdkConstants.FD_ASSETS; 102 103 /** Absolute path of the layout folder, e.g. "/res/layout".<br> This is a workspace path. */ 104 public final static String WS_LAYOUTS = WS_RESOURCES + WS_SEP + SdkConstants.FD_RES_LAYOUT; 105 106 /** Leaf of the javaDoc folder. Does not start with a separator. */ 107 public final static String WS_JAVADOC_FOLDER_LEAF = SdkConstants.FD_DOCS + "/" + //$NON-NLS-1$ 108 SdkConstants.FD_DOCS_REFERENCE; 109 110 /** Path of the samples directory relative to the sdk folder. 111 * This is an OS path, ending with a separator. 112 * FIXME: remove once the NPW is fixed. */ 113 public final static String OS_SDK_SAMPLES_FOLDER = SdkConstants.FD_SAMPLES + File.separator; 114 115 public final static String RE_DOT = "\\."; //$NON-NLS-1$ 116 /** Regexp for java extension, i.e. "\.java$" */ 117 public final static String RE_JAVA_EXT = "\\" + DOT_JAVA + "$"; //$NON-NLS-1$ //$NON-NLS-2$ 118 /** Regexp for aidl extension, i.e. "\.aidl$" */ 119 public final static String RE_AIDL_EXT = "\\" + DOT_AIDL + "$"; //$NON-NLS-1$ //$NON-NLS-2$ 120 /** Regexp for rs extension, i.e. "\.rs$" */ 121 public final static String RE_RS_EXT = "\\" + DOT_RS + "$"; //$NON-NLS-1$ //$NON-NLS-2$ 122 /** Regexp for rs extension, i.e. "\.fs$" */ 123 public final static String RE_FS_EXT = "\\" + DOT_FS + "$"; //$NON-NLS-1$ //$NON-NLS-2$ 124 /** Regexp for .d extension, i.e. "\.d$" */ 125 public final static String RE_DEP_EXT = "\\" + DOT_DEP + "$"; //$NON-NLS-1$ //$NON-NLS-2$ 126 127 /** 128 * Namespace pattern for the custom resource XML, i.e. "http://schemas.android.com/apk/res/%s" 129 * <p/> 130 * This string contains a %s. It must be combined with the desired Java package, e.g.: 131 * <pre> 132 * String.format(SdkConstants.NS_CUSTOM_RESOURCES, "android"); 133 * String.format(SdkConstants.NS_CUSTOM_RESOURCES, "com.test.mycustomapp"); 134 * </pre> 135 * 136 * Note: if you need an URI specifically for the "android" namespace, consider using 137 * {@link SdkConstants#NS_RESOURCES} instead. 138 */ 139 // TODO rename NS_CUSTOM_RESOURCES to NS_CUSTOM_RESOURCES_S (denoting it takes a %s) in 140 // another CL. 141 public final static String NS_CUSTOM_RESOURCES = "http://schemas.android.com/apk/res/%1$s"; //$NON-NLS-1$ 142 143 /** The old common plug-in ID. Please do not use for new features. */ 144 private static final String LEGACY_PLUGIN_ID = "com.android.ide.eclipse.common"; //$NON-NLS-1$ 145 146 /** Generic marker for ADT errors, only to be used in the {@link ResourceManagerBuilder} */ 147 public final static String MARKER_ADT = AdtPlugin.PLUGIN_ID + ".adtProblem"; //$NON-NLS-1$ 148 149 /** Marker for Android Target errors. 150 * This is not cleared on each build like other markers. Instead, it's cleared 151 * when an AndroidClasspathContainerInitializer has succeeded in creating an 152 * AndroidClasspathContainer */ 153 public final static String MARKER_TARGET = AdtPlugin.PLUGIN_ID + ".targetProblem"; //$NON-NLS-1$ 154 /** Marker for Android Build Tools errors. 155 * This is not cleared on each build like other markers. Instead, it's cleared 156 * when the build tools are setup in the projectState. */ 157 public final static String MARKER_BUILD_TOOLS = AdtPlugin.PLUGIN_ID + ".buildToolsProblem"; //$NON-NLS-1$ 158 /** Marker for Android Dependency errors. 159 * This is not cleared on each build like other markers. Instead, it's cleared 160 * when a LibraryClasspathContainerInitializer has succeeded in creating a 161 * LibraryClasspathContainer */ 162 public final static String MARKER_DEPENDENCY = AdtPlugin.PLUGIN_ID + ".dependencyProblem"; //$NON-NLS-1$ 163 164 165 /** aapt marker error when running the compile command, only to be used 166 * in {@link PreCompilerBuilder} */ 167 public final static String MARKER_AAPT_COMPILE = LEGACY_PLUGIN_ID + ".aaptProblem"; //$NON-NLS-1$ 168 169 /** XML marker error, only to be used in {@link PreCompilerBuilder} */ 170 public final static String MARKER_XML = LEGACY_PLUGIN_ID + ".xmlProblem"; //$NON-NLS-1$ 171 172 /** aidl marker error, only to be used in {@link PreCompilerBuilder} */ 173 public final static String MARKER_AIDL = LEGACY_PLUGIN_ID + ".aidlProblem"; //$NON-NLS-1$ 174 175 /** renderscript marker error, only to be used in {@link PreCompilerBuilder} */ 176 public final static String MARKER_RENDERSCRIPT = LEGACY_PLUGIN_ID + ".rsProblem"; //$NON-NLS-1$ 177 178 /** android marker error, only to be used in the Manifest parsing 179 * from the {@link PreCompilerBuilder} */ 180 public final static String MARKER_ANDROID = LEGACY_PLUGIN_ID + ".androidProblem"; //$NON-NLS-1$ 181 182 183 /** aapt marker error when running the package command, only to be used in 184 * {@link PostCompilerBuilder} */ 185 public final static String MARKER_AAPT_PACKAGE = LEGACY_PLUGIN_ID + ".aapt2Problem"; //$NON-NLS-1$ 186 187 /** final packaging error marker, only to be used in {@link PostCompilerBuilder} */ 188 public final static String MARKER_PACKAGING = AdtPlugin.PLUGIN_ID + ".packagingProblem"; //$NON-NLS-1$ 189 190 /** manifest merger error, only to be used in {@link PreCompilerBuilder} */ 191 public final static String MARKER_MANIFMERGER = AdtPlugin.PLUGIN_ID + ".manifMergerProblem"; //$NON-NLS-1$ 192 193 /** Marker for lint errors */ 194 public final static String MARKER_LINT = AdtPlugin.PLUGIN_ID + ".lintProblem"; //$NON-NLS-1$ 195 196 /** Name for the "type" marker attribute */ 197 public final static String MARKER_ATTR_TYPE = "android.type"; //$NON-NLS-1$ 198 /** Name for the "class" marker attribute */ 199 public final static String MARKER_ATTR_CLASS = "android.class"; //$NON-NLS-1$ 200 /** activity value for marker attribute "type" */ 201 public final static String MARKER_ATTR_TYPE_ACTIVITY = "activity"; //$NON-NLS-1$ 202 /** service value for marker attribute "type" */ 203 public final static String MARKER_ATTR_TYPE_SERVICE = "service"; //$NON-NLS-1$ 204 /** receiver value for marker attribute "type" */ 205 public final static String MARKER_ATTR_TYPE_RECEIVER = "receiver"; //$NON-NLS-1$ 206 /** provider value for marker attribute "type" */ 207 public final static String MARKER_ATTR_TYPE_PROVIDER = "provider"; //$NON-NLS-1$ 208 209 /** 210 * Preferred compiler level, i.e. "1.6". 211 */ 212 public final static String COMPILER_COMPLIANCE_PREFERRED = JavaCore.VERSION_1_6; 213 /** 214 * List of valid compiler level, i.e. "1.5" and "1.6" 215 */ 216 public final static String[] COMPILER_COMPLIANCE = { 217 JavaCore.VERSION_1_5, 218 JavaCore.VERSION_1_6, 219 }; 220 221 /** The base URL where to find the Android class & manifest documentation */ 222 public static final String CODESITE_BASE_URL = "http://code.google.com/android"; //$NON-NLS-1$ 223 224 public static final String LIBRARY_TEST_RUNNER = "android.test.runner"; //$NON-NLS-1$ 225 226 /** Documentation marker for elements, attributes etc that should be hidden */ 227 public static final String DOC_HIDE = "@hide"; //$NON-NLS-1$ 228 229 public static final String DEX_OPTIONS_FORCEJUMBO = "dex.force.jumbo"; //$NON-NLS-1$ 230 public static final String DEX_OPTIONS_DISABLE_MERGER = "dex.disable.merger"; //$NON-NLS-1$ 231 } 232