当前位置: 首页>>代码示例>>Java>>正文


Java IAndroidTarget.getLocation方法代码示例

本文整理汇总了Java中com.android.sdklib.IAndroidTarget.getLocation方法的典型用法代码示例。如果您正苦于以下问题:Java IAndroidTarget.getLocation方法的具体用法?Java IAndroidTarget.getLocation怎么用?Java IAndroidTarget.getLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.sdklib.IAndroidTarget的用法示例。


在下文中一共展示了IAndroidTarget.getLocation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PlatformPackage

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@VisibleForTesting(visibility=Visibility.PRIVATE)
protected PlatformPackage(@Nullable SdkSource source,
                          @NonNull IAndroidTarget target,
                          @Nullable Properties props) {
    super(  source,                     //source
            props,                      //properties
            target.getRevision(),       //revision
            null,                       //license
            target.getDescription(),    //description
            null,                       //descUrl
            target.getLocation()        //archiveOsPath
            );

    mVersion = target.getVersion();
    mVersionName  = target.getVersionName();
    mLayoutlibVersion = new LayoutlibVersionMixin(props);
    mIncludedAbi = props == null ? null : props.getProperty(PkgProps.PLATFORM_INCLUDED_ABI);

    mPkgDesc = PkgDesc.Builder
            .newPlatform(mVersion,
                         (MajorRevision) getRevision(),
                         getMinToolsRevision())
            .setDescriptions(this)
            .create();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:26,代码来源:PlatformPackage.java

示例2: getInstallFolder

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:PlatformPackage.java

示例3: PlatformPackage

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@VisibleForTesting(visibility=Visibility.PRIVATE)
protected PlatformPackage(@Nullable SdkSource source,
                          @NonNull IAndroidTarget target,
                          @Nullable Properties props) {
    super(  source,                     //source
            props,                      //properties
            target.getRevision(),       //revision
            null,                       //license
            target.getDescription(),    //description
            null,                       //descUrl
            target.getLocation()        //archiveOsPath
            );

    mVersion = target.getVersion();
    mVersionName  = target.getVersionName();
    mLayoutlibVersion = new LayoutlibVersionMixin(props);
    mIncludedAbi = props == null ? null : props.getProperty(PkgProps.PLATFORM_INCLUDED_ABI);

    mPkgDesc = setDescriptions(PkgDesc.Builder
            .newPlatform(mVersion, (MajorRevision) getRevision(), getMinToolsRevision()))
            .create();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PlatformPackage.java

示例4: getInstallFolder

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * 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(getAndroidVersion())) {
      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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:RemotePlatformPkgInfo.java

示例5: getInstallFolder

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * Computes a potential installation folder if an archive of this package were
 * to be installed right away in the given SDK root.
 * <p/>
 * An add-on package is typically installed in SDK/add-ons/"addon-name"-"api-level".
 * The name needs to be sanitized to be acceptable as a directory name.
 * However if we can find a different directory under SDK/add-ons that already
 * has this add-ons 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) {
    File addons = new File(osSdkRoot, SdkConstants.FD_ADDONS);

    // First find if this add-on is already installed. If so, reuse the same directory.
    for (IAndroidTarget target : sdkManager.getTargets()) {
        if (!target.isPlatform() && target.getVersion().equals(mVersion)) {
            // Starting with addon-4.xsd, the addon source.properties differentiate
            // between ids and display strings. However the addon target which relies
            // on the manifest.ini does not so we need to cover both cases.
            // TODO fix when we get rid of manifest.ini for addons
            if ((target.getName().equals(getNameId()) &&
                 target.getVendor().equals(getVendorId())) ||
                (target.getName().equals(getDisplayName()) &&
                 target.getVendor().equals(getDisplayVendor()))) {
                return new File(target.getLocation());
            }
        }
    }

    // Compute a folder directory using the addon declared name and vendor strings.
    String name = encodeAddonName();

    for (int i = 0; i < 100; i++) {
        String name2 = i == 0 ? name : String.format("%s-%d", name, i); //$NON-NLS-1$
        File folder = new File(addons, name2);
        if (!folder.exists()) {
            return folder;
        }
    }

    // We shouldn't really get here. I mean, seriously, we tried hard enough.
    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:48,代码来源:AddonPackage.java

示例6: AndroidPlatformInfo

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
public AndroidPlatformInfo(AndroidSdk sdk, IAndroidTarget target) throws FileNotFoundException {
    this.platformFolder = new File(target.getLocation());
    this.platformName = target.getFullName();
    androidVersion = target.getVersion();
    hashString = target.hashString();
    this.sdk = sdk;
    update(target);

}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:10,代码来源:AndroidPlatformInfo.java

示例7: getInstallFolder

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * Computes a potential installation folder if an archive of this package were
 * to be installed right away in the given SDK root.
 * <p/>
 * An add-on package is typically installed in SDK/add-ons/"addon-name"-"api-level".
 * The name needs to be sanitized to be acceptable as a directory name.
 * However if we can find a different directory under SDK/add-ons that already
 * has this add-ons 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) {
  File addons = new File(osSdkRoot, SdkConstants.FD_ADDONS);

  IdDisplay name = ((IPkgDescAddon)getPkgDesc()).getName();
  IdDisplay vendor = getPkgDesc().getVendor();

  // First find if this add-on is already installed. If so, reuse the same directory.
  for (IAndroidTarget target : sdkManager.getTargets()) {
    if (!target.isPlatform() && target.getVersion().equals(getAndroidVersion())) {
      // Starting with addon-4.xsd, the addon source.properties differentiate
      // between ids and display strings. However the addon target which relies
      // on the manifest.ini does not so we need to cover both cases.
      // TODO fix when we get rid of manifest.ini for addons
      if ((target.getName().equals(name.getId()) && target.getVendor().equals(vendor.getId())) ||
          (target.getName().equals(name.getDisplay()) && target.getVendor().equals(vendor.getDisplay()))) {
        return new File(target.getLocation());
      }
    }
  }

  // Compute a folder directory using the addon declared name and vendor strings.
  String dir = encodeAddonName(name.getId(), vendor.getId(), getAndroidVersion());

  for (int i = 0; i < 100; i++) {
    String dir2 = i == 0 ? dir : String.format("%s-%d", dir, i); //$NON-NLS-1$
    File folder = new File(addons, dir2);
    if (!folder.exists()) {
      return folder;
    }
  }

  // We shouldn't really get here. I mean, seriously, we tried hard enough.
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:RemoteAddonPkgInfo.java

示例8: load

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@Nullable
public static LayoutLibrary load(@NotNull IAndroidTarget target,
                                 @NotNull Map<String, Map<String, Integer>> enumMap) throws RenderingException, IOException {
  final String layoutLibJarPath = FileUtil.toSystemIndependentName((target.getPath(IAndroidTarget.LAYOUT_LIB)));
  final VirtualFile layoutLibJar = LocalFileSystem.getInstance().findFileByPath(layoutLibJarPath);
  if (layoutLibJar == null || layoutLibJar.isDirectory()) {
    throw new RenderingException(AndroidBundle.message("android.file.not.exist.error", FileUtil.toSystemDependentName(layoutLibJarPath)));
  }

  final String resFolderPath = FileUtil.toSystemIndependentName((target.getPath(IAndroidTarget.RESOURCES)));
  final VirtualFile resFolder = LocalFileSystem.getInstance().findFileByPath(resFolderPath);
  if (resFolder == null || !resFolder.isDirectory()) {
    throw new RenderingException(
      AndroidBundle.message("android.directory.cannot.be.found.error", FileUtil.toSystemDependentName(resFolderPath)));
  }

  final String fontFolderPath = FileUtil.toSystemIndependentName((target.getPath(IAndroidTarget.FONTS)));
  final VirtualFile fontFolder = LocalFileSystem.getInstance().findFileByPath(fontFolderPath);
  if (fontFolder == null || !fontFolder.isDirectory()) {
    throw new RenderingException(
      AndroidBundle.message("android.directory.cannot.be.found.error", FileUtil.toSystemDependentName(fontFolderPath)));
  }

  final String platformFolderPath = target.isPlatform() ? target.getLocation() : target.getParent().getLocation();
  final File platformFolder = new File(platformFolderPath);
  if (!platformFolder.isDirectory()) {
    throw new RenderingException(
      AndroidBundle.message("android.directory.cannot.be.found.error", FileUtil.toSystemDependentName(platformFolderPath)));
  }

  final File buildProp = new File(platformFolder, SdkConstants.FN_BUILD_PROP);
  if (!buildProp.isFile()) {
    throw new RenderingException(
      AndroidBundle.message("android.file.not.exist.error", FileUtil.toSystemDependentName(buildProp.getPath())));
  }

  final ILogger logger = new LogWrapper(LOG);
  LayoutLibrary library = LayoutLibrary.load(layoutLibJar.getPath(), logger, ApplicationNamesInfo.getInstance().getFullProductName());
  if (library.getStatus() != LoadStatus.LOADED) {
    throw new RenderingException(library.getLoadMessage());
  }

  final Map<String, String> buildPropMap = ProjectProperties.parsePropertyFile(new BufferingFileWrapper(buildProp), logger);
  final LayoutLog layoutLog = new LayoutLogWrapper(LOG);
  if (library.init(buildPropMap, new File(fontFolder.getPath()), enumMap, layoutLog)) {
    return library;
  } else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:LayoutLibraryLoader.java

示例9: getPlatformDir

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@Nullable
private static VirtualFile getPlatformDir(@NotNull IAndroidTarget target) {
  String platformPath = target.isPlatform() ? target.getLocation() : target.getParent().getLocation();
  return LocalFileSystem.getInstance().refreshAndFindFileByPath(toSystemIndependentName((platformPath)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:AndroidSdkUtils.java


注:本文中的com.android.sdklib.IAndroidTarget.getLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。