com.android.SdkConstants Java Examples

The following examples show how to use com.android.SdkConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LintClient.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns true if this project is a Gradle-based Android project
 *
 * @param project the project to check
 * @return true if this is a Gradle-based project
 */
public boolean isGradleProject(Project project) {
    // This is not an accurate test; specific LintClient implementations (e.g.
    // IDEs or a gradle-integration of lint) have more context and can perform a more accurate
    // check
    if (new File(project.getDir(), SdkConstants.FN_BUILD_GRADLE).exists()) {
        return true;
    }

    File parent = project.getDir().getParentFile();
    if (parent != null && parent.getName().equals(SdkConstants.FD_SOURCES)) {
        File root = parent.getParentFile();
        if (root != null && new File(root, SdkConstants.FN_BUILD_GRADLE).exists()) {
            return true;
        }
    }

    return false;
}
 
Example #2
Source File: FolderConfiguration.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the folder configuration as a unique key
 */
@NonNull
public String getUniqueKey() {
  StringBuilder result = new StringBuilder(100);

  for (ResourceQualifier qualifier : mQualifiers) {
    if (qualifier != null) {
      String segment = qualifier.getFolderSegment();
      if (segment != null && !segment.isEmpty()) {
        result.append(SdkConstants.RES_QUALIFIER_SEP);
        result.append(segment);
      }
    }
  }

  return result.toString();
}
 
Example #3
Source File: LocalDirInfo.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new immutable {@link LocalDirInfo}.
 *
 * @param fileOp The {@link FileOp} to use for all file-based interactions.
 * @param dir The platform/addon directory of the target. It should be a directory.
 */
public LocalDirInfo(@NonNull IFileOp fileOp, @NonNull File dir) {
    mFileOp = fileOp;
    mDir = dir;
    mDirModifiedTS = mFileOp.lastModified(dir);

    // Capture some info about the source.properties file if it exists.
    // We use propsModifiedTS == 0 to mean there is no props file.
    long propsChecksum = 0;
    long propsModifiedTS = 0;
    File props = new File(dir, SdkConstants.FN_SOURCE_PROP);
    if (mFileOp.isFile(props)) {
        propsModifiedTS = mFileOp.lastModified(props);
        propsChecksum = getFileChecksum(props);
    }
    mPropsModifiedTS = propsModifiedTS;
    mPropsChecksum = propsChecksum;
    mDirChecksum = getDirChecksum(mDir);
}
 
Example #4
Source File: RClassGenerator.java    From bazel with Apache License 2.0 6 votes vote down vote up
private String writeInnerClassHeader(
    String fullyQualifiedOuterClass, String innerClass, ClassWriter innerClassWriter) {
  String fullyQualifiedInnerClass = fullyQualifiedOuterClass + "$" + innerClass;
  innerClassWriter.visit(
      JAVA_VERSION,
      Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_SUPER,
      fullyQualifiedInnerClass,
      null, /* signature */
      SUPER_CLASS,
      null /* interfaces */);
  innerClassWriter.visitSource(SdkConstants.FN_RESOURCE_CLASS, null);
  writeConstructor(innerClassWriter);
  innerClassWriter.visitInnerClass(
      fullyQualifiedInnerClass,
      fullyQualifiedOuterClass,
      innerClass,
      Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_STATIC);
  return fullyQualifiedInnerClass;
}
 
Example #5
Source File: AndroidManifestParser.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Processes the instrumentation node.
 * @param attributes the attributes for the instrumentation node.
 */
private void processInstrumentationNode(Attributes attributes) {
    // lets get the class name, and check it if required.
    String instrumentationName = getAttributeValue(attributes,
            AndroidManifest.ATTRIBUTE_NAME,
            true /* hasNamespace */);
    if (instrumentationName != null) {
        String instrClassName = AndroidManifest.combinePackageAndClassName(
                mManifestData.mPackage, instrumentationName);
        String targetPackage = getAttributeValue(attributes,
                AndroidManifest.ATTRIBUTE_TARGET_PACKAGE,
                true /* hasNamespace */);
        mManifestData.mInstrumentations.add(
                new Instrumentation(instrClassName, targetPackage));
        if (mErrorHandler != null) {
            mErrorHandler.checkClass(mLocator, instrClassName,
                    SdkConstants.CLASS_INSTRUMENTATION, true /* testVisibility */);
        }
    }
}
 
Example #6
Source File: ResourceRepository.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Processes a folder and adds it to the list of existing folders.
 * @param folder the folder to process
 * @return the ResourceFolder created from this folder, or null if the process failed.
 */
@Nullable
public ResourceFolder processFolder(@NonNull IAbstractFolder folder) {
    ensureInitialized();

    // split the name of the folder in segments.
    String[] folderSegments = folder.getName().split(SdkConstants.RES_QUALIFIER_SEP);

    // get the enum for the resource type.
    ResourceFolderType type = ResourceFolderType.getTypeByName(folderSegments[0]);

    if (type != null) {
        // get the folder configuration.
        FolderConfiguration config = FolderConfiguration.getConfig(folderSegments);

        if (config != null) {
            return add(type, config, folder);
        }
    }

    return null;
}
 
Example #7
Source File: LocalSdk.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private void scanSources(File collectionDir, Collection<LocalPkgInfo> outCollection) {
    // The build-tool root folder contains a list of per-revision folders.
    for (File platformDir : mFileOp.listFiles(collectionDir)) {
        if (!shouldVisitDir(PkgType.PKG_SOURCE, platformDir)) {
            continue;
        }

        Properties props = parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP));
        MajorRevision rev = PackageParserUtils.getPropertyMajor(props, PkgProps.PKG_REVISION);
        if (rev == null) {
            continue; // skip, no revision
        }

        try {
            AndroidVersion vers = new AndroidVersion(props);

            LocalSourcePkgInfo pkgInfo =
                    new LocalSourcePkgInfo(this, platformDir, props, vers, rev);
            outCollection.add(pkgInfo);
        } catch (AndroidVersionException e) {
            continue; // skip invalid or missing android version.
        }
    }
}
 
Example #8
Source File: LocalSdk.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Try to find a docs package at the given location.
 * Returns null if not found.
 */
private LocalDocPkgInfo scanDoc(File docFolder) {
    // Can we find some properties?
    Properties props = parseProperties(new File(docFolder, SdkConstants.FN_SOURCE_PROP));
    MajorRevision rev = PackageParserUtils.getPropertyMajor(props, PkgProps.PKG_REVISION);
    if (rev == null) {
        return null;
    }

    try {
        AndroidVersion vers = new AndroidVersion(props);
        LocalDocPkgInfo info = new LocalDocPkgInfo(this, docFolder, props, vers, rev);

        // To start with, a doc folder should have an "index.html" to be acceptable.
        // We don't actually check the content of the file.
        if (!mFileOp.isFile(new File(docFolder, "index.html"))) {
            info.appendLoadError("Missing index.html");
        }
        return info;

    } catch (AndroidVersionException e) {
        return null; // skip invalid or missing android version.
    }
}
 
Example #9
Source File: PlatformLoader.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private synchronized void init(@NonNull ILogger logger) {
    if (mSdkInfo == null) {
        String host;
        if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
            host = "darwin-x86";
        } else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
            host = "linux-x86";
        } else {
            throw new IllegalStateException(
                    "Windows is not supported for platform development");
        }

        mSdkInfo = new SdkInfo(
                new File(mTreeLocation, "out/host/" + host + "/framework/annotations.jar")  );
    }
}
 
Example #10
Source File: KotlinResourcePsiElementFinder.java    From intellij with Apache License 2.0 6 votes vote down vote up
/** Checks if `expression` matches an expected R.abc.xyz pattern. */
private static boolean isResourceExpression(PsiElement expression) {
  if (!(expression instanceof KtQualifiedExpression)) {
    return false;
  }

  KtQualifiedExpression qualifiedExpression = (KtQualifiedExpression) expression;
  // qualifier should be `R.abc` which is also a `KtQualifiedExpression`
  PsiElement qualifier = qualifiedExpression.getReceiverExpression();
  if (!(qualifier instanceof KtQualifiedExpression)) {
    return false;
  }

  KtQualifiedExpression qualifierExpression = (KtQualifiedExpression) qualifier;
  // rClassExpression should be `R`
  PsiElement rClassExpression = qualifierExpression.getReceiverExpression();
  // rTypeExpression should be `abc`
  PsiElement rTypeExpression = qualifierExpression.getSelectorExpression();

  return rTypeExpression != null
      && SdkConstants.R_CLASS.equals(rClassExpression.getText())
      && ResourceType.fromClassName(rTypeExpression.getText()) != null;
}
 
Example #11
Source File: DeviceManager.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private boolean isDevicesExtra(@NonNull File item) {
    File properties = new File(item, SdkConstants.FN_SOURCE_PROP);
    try {
        BufferedReader propertiesReader = new BufferedReader(new FileReader(properties));
        try {
            String line;
            while ((line = propertiesReader.readLine()) != null) {
                Matcher m = PATH_PROPERTY_PATTERN.matcher(line);
                if (m.matches()) {
                    return true;
                }
            }
        } finally {
            propertiesReader.close();
        }
    } catch (IOException ignore) {
    }
    return false;
}
 
Example #12
Source File: OrphanXmlElement.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public OrphanXmlElement(@NonNull Element xml) {

        mXml = Preconditions.checkNotNull(xml);
        NodeTypes nodeType;
        String elementName = mXml.getNodeName();
        // this is bit more complicated than it should be. Look first if there is a namespace
        // prefix in the name, most elements don't. If they do, however, strip it off if it is the
        // android prefix, but if it's custom namespace prefix, classify the node as CUSTOM.
        int indexOfColon = elementName.indexOf(':');
        if (indexOfColon != -1) {
            String androidPrefix = XmlUtils.lookupNamespacePrefix(xml, SdkConstants.ANDROID_URI);
            if (androidPrefix.equals(elementName.substring(0, indexOfColon))) {
                nodeType = NodeTypes.fromXmlSimpleName(elementName.substring(indexOfColon + 1));
            } else {
                nodeType = NodeTypes.CUSTOM;
            }
        } else {
            nodeType = NodeTypes.fromXmlSimpleName(elementName);
        }
        mType = nodeType;
    }
 
Example #13
Source File: AarLibrary.java    From intellij with Apache License 2.0 6 votes vote down vote up
/** Get path to res folder according to CLASSES root of modifiable model */
@Nullable
public PathString getResFolder(Project project) {
  Library aarLibrary =
      ProjectLibraryTable.getInstance(project)
          .getLibraryByName(this.key.getIntelliJLibraryName());
  if (aarLibrary != null) {
    VirtualFile[] files = aarLibrary.getFiles(OrderRootType.CLASSES);
    for (VirtualFile file : files) {
      if (file.isDirectory() && SdkConstants.FD_RES.equals(file.getName())) {
        return new PathString(file.getPath());
      }
    }
  }
  return null;
}
 
Example #14
Source File: AndroidManifestParser.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the instrumentation node.
 *
 * @param attributes the attributes for the instrumentation node.
 */
private void processInstrumentationNode(Attributes attributes) {
    // lets get the class name, and check it if required.
    String instrumentationName = getAttributeValue(attributes,
            AndroidManifest.ATTRIBUTE_NAME,
            true /* hasNamespace */);
    if (instrumentationName != null) {
        String instrClassName
                = combinePackageAndClassName(mManifestData.mPackage, instrumentationName);
        String targetPackage = getAttributeValue(attributes,
                AndroidManifest.ATTRIBUTE_TARGET_PACKAGE,
                true /* hasNamespace */);
        mManifestData.mInstrumentations.add(
                new Instrumentation(instrClassName, targetPackage));
        mManifestData.mKeepClasses.add(
                new ManifestData.KeepClass(
                        instrClassName, null, AndroidManifest.NODE_INSTRUMENTATION));
        if (mErrorHandler != null) {
            mErrorHandler.checkClass(mLocator, instrClassName,
                    SdkConstants.CLASS_INSTRUMENTATION, true /* testVisibility */);
        }
    }
}
 
Example #15
Source File: FolderConfiguration.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the folder configuration as a unique key
 */
@NonNull
public String getUniqueKey() {
  StringBuilder result = new StringBuilder(100);

  for (ResourceQualifier qualifier : mQualifiers) {
    if (qualifier != null) {
      String segment = qualifier.getFolderSegment();
      if (segment != null && !segment.isEmpty()) {
        result.append(SdkConstants.RES_QUALIFIER_SEP);
        result.append(segment);
      }
    }
  }

  return result.toString();
}
 
Example #16
Source File: PlatformTarget.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public File getDefaultSkin() {
    // only one skin? easy.
    if (mSkins.length == 1) {
        return mSkins[0];
    }

    // look for the skin name in the platform props
    String skinName = mProperties.get(SdkConstants.PROP_SDK_DEFAULT_SKIN);
    if (skinName == null) {
        // otherwise try to find a good default.
        if (mVersion.getApiLevel() >= 4) {
            // at this time, this is the default skin for all older platforms that had 2+ skins.
            skinName = "WVGA800";                                       //$NON-NLS-1$
        } else {
            skinName = "HVGA"; // this is for 1.5 and earlier.          //$NON-NLS-1$
        }
    }

    return new File(getFile(IAndroidTarget.SKINS), skinName);
}
 
Example #17
Source File: RenderScriptProcessor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void build(@NonNull CommandLineLauncher launcher)
        throws IOException, InterruptedException {

    // get the env var
    Map<String, String> env = Maps.newHashMap();
    if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
        env.put("DYLD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    } else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
        env.put("LD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    }

    doMainCompilation(launcher, env);

    if (mSupportMode) {
        createSupportFiles(launcher, env);
    }
}
 
Example #18
Source File: AwbApkPackageTask.java    From atlas with Apache License 2.0 6 votes vote down vote up
static File copyJavaResourcesOnly(File destinationFolder, File zip64File) throws IOException {
    File cacheDir = new File(destinationFolder, ZIP_64_COPY_DIR);
    File copiedZip = new File(cacheDir, zip64File.getName());
    FileUtils.mkdirs(copiedZip.getParentFile());

    try (ZipFile inFile = new ZipFile(zip64File);
         ZipOutputStream outFile =
                 new ZipOutputStream(
                         new BufferedOutputStream(new FileOutputStream(copiedZip)))) {

        Enumeration<? extends ZipEntry> entries = inFile.entries();
        while (entries.hasMoreElements()) {
            ZipEntry zipEntry = entries.nextElement();
            if (!zipEntry.getName().endsWith(SdkConstants.DOT_CLASS)) {
                outFile.putNextEntry(new ZipEntry(zipEntry.getName()));
                try {
                    ByteStreams.copy(
                            new BufferedInputStream(inFile.getInputStream(zipEntry)), outFile);
                } finally {
                    outFile.closeEntry();
                }
            }
        }
    }
    return copiedZip;
}
 
Example #19
Source File: DeviceManager.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private boolean isDevicesExtra(@NonNull File item) {
    File properties = new File(item, SdkConstants.FN_SOURCE_PROP);
    try {
        BufferedReader propertiesReader = new BufferedReader(new FileReader(properties));
        try {
            String line;
            while ((line = propertiesReader.readLine()) != null) {
                Matcher m = PATH_PROPERTY_PATTERN.matcher(line);
                if (m.matches()) {
                    return true;
                }
            }
        } finally {
            propertiesReader.close();
        }
    } catch (IOException ignore) {
    }
    return false;
}
 
Example #20
Source File: LocalDirInfo.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new immutable {@link LocalDirInfo}.
 *
 * @param fileOp The {@link FileOp} to use for all file-based interactions.
 * @param dir The platform/addon directory of the target. It should be a directory.
 */
public LocalDirInfo(@NonNull IFileOp fileOp, @NonNull File dir) {
    mFileOp = fileOp;
    mDir = dir;
    mDirModifiedTS = mFileOp.lastModified(dir);

    // Capture some info about the source.properties file if it exists.
    // We use propsModifiedTS == 0 to mean there is no props file.
    long propsChecksum = 0;
    long propsModifiedTS = 0;
    File props = new File(dir, SdkConstants.FN_SOURCE_PROP);
    if (mFileOp.isFile(props)) {
        propsModifiedTS = mFileOp.lastModified(props);
        propsChecksum = getFileChecksum(props);
    }
    mPropsModifiedTS = propsModifiedTS;
    mPropsChecksum = propsChecksum;
    mDirChecksum = getDirChecksum(mDir);
}
 
Example #21
Source File: PreValidator.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Validate an xml declaration with 'tools:node="removeAll" annotation. There should not
 * be any other attribute declaration on this element.
 */
private static void validateRemoveAllOperation(MergingReport.Builder mergingReport,
        XmlElement element) {

    NamedNodeMap attributes = element.getXml().getAttributes();
    if (attributes.getLength() > 1) {
        List<String> extraAttributeNames = new ArrayList<String>();
        for (int i = 0; i < attributes.getLength(); i++) {
            Node item = attributes.item(i);
            if (!(SdkConstants.TOOLS_URI.equals(item.getNamespaceURI()) &&
                    NodeOperationType.NODE_LOCAL_NAME.equals(item.getLocalName()))) {
                extraAttributeNames.add(item.getNodeName());
            }
        }
        String message = String.format(
                "Element %1$s at %2$s annotated with 'tools:node=\"removeAll\"' cannot "
                        + "have other attributes : %3$s",
                element.getId(),
                element.printPosition(),
                Joiner.on(',').join(extraAttributeNames)
        );
        element.addMessage(mergingReport, ERROR, message);
    }
}
 
Example #22
Source File: PlatformPackage.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Computes a potential installation folder if an archive of this package were
 * to be installed right away in the given SDK root.
 * <p/>
 * A platform package is typically installed in SDK/platforms/android-"version".
 * However if we can find a different directory under SDK/platform that already
 * has this platform version installed, we'll use that one.
 *
 * @param osSdkRoot The OS path of the SDK root folder.
 * @param sdkManager An existing SDK manager to list current platforms and addons.
 * @return A new {@link File} corresponding to the directory to use to install this package.
 */
@Override
public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) {

    // First find if this platform is already installed. If so, reuse the same directory.
    for (IAndroidTarget target : sdkManager.getTargets()) {
        if (target.isPlatform() && target.getVersion().equals(mVersion)) {
            return new File(target.getLocation());
        }
    }

    File platforms = new File(osSdkRoot, SdkConstants.FD_PLATFORMS);
    File folder = new File(platforms,
            String.format("android-%s", getAndroidVersion().getApiString())); //$NON-NLS-1$

    return folder;
}
 
Example #23
Source File: FolderConfiguration.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the name of a folder with the configuration.
 */
@NonNull
public String getFolderName(@NonNull ResourceFolderType folder) {
    StringBuilder result = new StringBuilder(folder.getName());

    for (ResourceQualifier qualifier : mQualifiers) {
        if (qualifier != null) {
            String segment = qualifier.getFolderSegment();
            if (segment != null && !segment.isEmpty()) {
                result.append(SdkConstants.RES_QUALIFIER_SEP);
                result.append(segment);
            }
        }
    }

    return result.toString();
}
 
Example #24
Source File: ResourceFile.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
void addExtraAttributes(Document document, Node node, String namespaceUri) {
    NodeUtils.addAttribute(document, node, namespaceUri, ATTR_QUALIFIER,
            getQualifiers());

    if (getType() == FileType.GENERATED_FILES) {
        NodeUtils.addAttribute(document, node, namespaceUri, SdkConstants.ATTR_PREPROCESSING, "true");
    }
}
 
Example #25
Source File: ManifestMerger2.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private static XmlElement createOrGetUseSdk(
        ActionRecorder actionRecorder, XmlDocument document) {

    Element manifest = document.getXml().getDocumentElement();
    NodeList usesSdks = manifest
            .getElementsByTagName(ManifestModel.NodeTypes.USES_SDK.toXmlName());
    if (usesSdks.getLength() == 0) {
        usesSdks = manifest
                .getElementsByTagNameNS(
                        SdkConstants.ANDROID_URI,
                        ManifestModel.NodeTypes.USES_SDK.toXmlName());
    }
    if (usesSdks.getLength() == 0) {
        // create it first.
        Element useSdk = manifest.getOwnerDocument().createElement(
                ManifestModel.NodeTypes.USES_SDK.toXmlName());
        manifest.appendChild(useSdk);
        XmlElement xmlElement = new XmlElement(useSdk, document);
        Actions.NodeRecord nodeRecord = new Actions.NodeRecord(
                Actions.ActionType.INJECTED,
                new Actions.ActionLocation(xmlElement.getSourceLocation(),
                        PositionImpl.UNKNOWN),
                xmlElement.getId(),
                "use-sdk injection requested",
                NodeOperationType.STRICT);
        actionRecorder.recordNodeAction(xmlElement, nodeRecord);
        return xmlElement;
    } else {
        return new XmlElement((Element) usesSdks.item(0), document);
    }
}
 
Example #26
Source File: ResourceUsageAnalyzer.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/** Look through binary/unknown files looking for resource URLs */
private void tokenizeUnknownBinary(@NonNull File file) {
    try {
        if (sAndroidResBytes == null) {
            sAndroidResBytes = ANDROID_RES.getBytes(SdkConstants.UTF_8);
        }
        byte[] bytes = Files.toByteArray(file);
        int index = 0;
        while (index != -1) {
            index = indexOf(bytes, sAndroidResBytes, index);
            if (index != -1) {
                index += sAndroidResBytes.length;

                // Find the end of the URL
                int begin = index;
                int end = begin;
                for (; end < bytes.length; end++) {
                    byte c = bytes[end];
                    if (c != '/' && !Character.isJavaIdentifierPart((char)c)) {
                        // android_res/raw/my_drawable.png => @raw/my_drawable
                        String url = "@" + new String(bytes, begin, end - begin, UTF_8);
                        markReachable(getResourceFromUrl(url));
                        break;
                    }
                }
            }
        }
    } catch (IOException e) {
        // Ignore
    }
}
 
Example #27
Source File: LocalSdkParser.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Find any directory in the /extras/vendors/path folders for extra packages.
 * This isn't a recursive search.
 */
private void scanExtras(SdkManager sdkManager,
        HashSet<File> visited,
        ArrayList<Package> packages,
        ILogger log) {
    File root = new File(sdkManager.getLocation(), SdkConstants.FD_EXTRAS);

    for (File vendor : listFilesNonNull(root)) {
        if (vendor.isDirectory()) {
            scanExtrasDirectory(vendor.getAbsolutePath(), visited, packages, log);
        }
    }
}
 
Example #28
Source File: MavenCoordinatesImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
MavenCoordinatesImpl(String groupId, String artifactId, String version, String packaging,
                     String classifier) {
    this.groupId = groupId;
    this.artifactId = artifactId;
    this.version = version;
    this.packaging = packaging != null ? packaging : SdkConstants.EXT_JAR;
    this.classifier = classifier;
}
 
Example #29
Source File: AvdInfo.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@NonNull
public String getCpuArch() {
    String cpuArch = mProperties.get(AvdManager.AVD_INI_CPU_ARCH);
    if (cpuArch != null) {
        return cpuArch;
    }

    // legacy
    return SdkConstants.CPU_ARCH_ARM;
}
 
Example #30
Source File: AndroidManifest.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns an {@link IAbstractFile} object representing the manifest for the given project.
 *
 * @param projectFolder The project containing the manifest file.
 * @return An IAbstractFile object pointing to the manifest or null if the manifest
 *         is missing.
 */
public static IAbstractFile getManifest(IAbstractFolder projectFolder) {
    IAbstractFile file = projectFolder.getFile(SdkConstants.FN_ANDROID_MANIFEST_XML);
    if (file != null && file.exists()) {
        return file;
    }

    return null;
}