Package com.android.sdklib.internal.repository.packages

Examples of com.android.sdklib.internal.repository.packages.Package


        HashSet<File> visited = new HashSet<File>();

        monitor.setProgressMax(11);

        File dir = null;
        Package pkg = null;

        if ((parseFilter & PARSE_DOCS) != 0) {
            dir = new File(osSdkRoot, SdkConstants.FD_DOCS);
            pkg = scanDoc(dir, monitor);
            if (pkg != null) {
                packages.add(pkg);
                visited.add(dir);
            }
        }
        monitor.incProgress(1);

        if ((parseFilter & PARSE_TOOLS) != 0) {
            dir = new File(osSdkRoot, SdkConstants.FD_TOOLS);
            pkg = scanTools(dir, monitor);
            if (pkg != null) {
                packages.add(pkg);
                visited.add(dir);
            }
        }
        monitor.incProgress(1);

        if ((parseFilter & PARSE_PLATFORM_TOOLS) != 0) {
            dir = new File(osSdkRoot, SdkConstants.FD_PLATFORM_TOOLS);
            pkg = scanPlatformTools(dir, monitor);
            if (pkg != null) {
                packages.add(pkg);
                visited.add(dir);
            }
        }
        monitor.incProgress(1);

        if ((parseFilter & PARSE_BUILD_TOOLS) != 0) {
            scanBuildTools(sdkManager, visited, packages, monitor);
        }
        monitor.incProgress(1);

        // for platforms, add-ons and samples, rely on the SdkManager parser
        if ((parseFilter & (PARSE_ADDONS | PARSE_PLATFORMS)) != 0) {
            File samplesRoot = new File(osSdkRoot, SdkConstants.FD_SAMPLES);

            for(IAndroidTarget target : sdkManager.getTargets()) {
                Properties props = parseProperties(new File(target.getLocation(),
                        SdkConstants.FN_SOURCE_PROP));

                try {
                    pkg = null;
                    if (target.isPlatform() && (parseFilter & PARSE_PLATFORMS) != 0) {
                        pkg = PlatformPackage.create(target, props);

                        if (samplesRoot.isDirectory()) {
                            // Get the samples dir for a platform if it is located in the new
                            // root /samples dir. We purposely ignore "old" samples that are
                            // located under the platform dir.
                            File samplesDir = new File(target.getPath(IAndroidTarget.SAMPLES));
                            if (samplesDir.exists() &&
                                    samplesDir.getParentFile().equals(samplesRoot)) {
                                Properties samplesProps = parseProperties(
                                        new File(samplesDir, SdkConstants.FN_SOURCE_PROP));
                                if (samplesProps != null) {
                                    Package pkg2 = SamplePackage.create(target, samplesProps);
                                    packages.add(pkg2);
                                }
                                visited.add(samplesDir);
                            }
                        }
                    } else if ((parseFilter & PARSE_ADDONS) != 0) {
                        pkg = AddonPackage.create(target, props);
                    }

                    if (pkg != null) {
                        for (ISystemImage systemImage : target.getSystemImages()) {
                            if (systemImage.getLocationType() == LocationType.IN_SYSTEM_IMAGE) {
                                File siDir = systemImage.getLocation();
                                if (siDir.isDirectory()) {
                                    Properties siProps = parseProperties(
                                            new File(siDir, SdkConstants.FN_SOURCE_PROP));
                                    Package pkg2 = new SystemImagePackage(
                                            target.getVersion(),
                                            0 /*rev*/,   // this will use the one from siProps
                                            systemImage.getAbiType(),
                                            siProps,
                                            siDir.getAbsolutePath());
View Full Code Here


        for (File dir : listFilesNonNull(root)) {
            if (dir.isDirectory() && !visited.contains(dir)) {
                Properties props = parseProperties(new File(dir, SdkConstants.FN_SOURCE_PROP));
                if (props != null) {
                    try {
                        Package pkg = ExtraPackage.create(
                                null,                       //source
                                props,                      //properties
                                null,                       //vendor
                                dir.getName(),              //path
                                0,                          //revision
View Full Code Here

        for (File dir : listFilesNonNull(root)) {
            if (dir.isDirectory() && !visited.contains(dir)) {
                Properties props = parseProperties(new File(dir, SdkConstants.FN_SOURCE_PROP));
                if (props != null) {
                    try {
                        Package pkg = SamplePackage.create(dir.getAbsolutePath(), props);
                        packages.add(pkg);
                        visited.add(dir);
                    } catch (Exception e) {
                        log.error(e, null);
                    }
View Full Code Here

                    parseProperties(new File(dir, SdkConstants.FN_SOURCE_PROP));

                Map<String, String> addonProps = infos.getFirst();
                String error = infos.getSecond();
                try {
                    Package pkg = AddonPackage.createBroken(dir.getAbsolutePath(),
                                                            sourceProps,
                                                            addonProps,
                                                            error);
                    packages.add(pkg);
                    visited.add(dir);
View Full Code Here

                }

                for (File propFile : propFiles) {
                    Properties props = parseProperties(propFile);
                    try {
                        Package pkg = SystemImagePackage.createBroken(propFile.getParentFile(),
                                                                      props);
                        packages.add(pkg);
                    } catch (Exception e) {
                        log.error(e, null);
                    }
View Full Code Here

                if (srcFiles != null && srcFiles.length > 0) {
                    Properties props =
                        parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP));

                    try {
                        Package pkg = SourcePackage.create(platformDir, props);
                        packages.add(pkg);
                    } catch (Exception e) {
                        log.error(e, null);
                    }
                }
View Full Code Here

            return null;
        }

        // Create our package. use the properties if we found any.
        try {
            Package pkg = ToolPackage.create(
                    null,                       //source
                    props,                      //properties
                    0,                          //revision
                    null,                       //license
                    "Tools",                    //description
View Full Code Here

            return null;
        }

        // Create our package. use the properties if we found any.
        try {
            Package pkg = PlatformToolPackage.create(
                    null,                           //source
                    props,                          //properties
                    0,                              //revision
                    null,                           //license
                    "Platform Tools",               //description
View Full Code Here

                if (srcFiles != null && srcFiles.length > 0) {
                    Properties props =
                        parseProperties(new File(buildToolDir, SdkConstants.FN_SOURCE_PROP));

                    try {
                        Package pkg = BuildToolPackage.create(buildToolDir, props);
                        packages.add(pkg);
                    } catch (Exception e) {
                        log.error(e, null);
                    }
                }
View Full Code Here

        // 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 (new File(docFolder, "index.html").isFile()) {
            try {
                Package pkg = DocPackage.create(
                        null,                       //source
                        props,                      //properties
                        0,                          //apiLevel
                        null,                       //codename
                        0,                          //revision
View Full Code Here

TOP

Related Classes of com.android.sdklib.internal.repository.packages.Package

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.