コード例 #1
0
 @Nullable
 private String getOldPlatformToolsFolderPath() {
   String platformLocation;
   if (myWrapee.isPlatform()) {
     platformLocation = myWrapee.getLocation();
   } else {
     IAndroidTarget parent = myWrapee.getParent();
     platformLocation = parent != null ? parent.getLocation() : null;
   }
   if (platformLocation == null) {
     return null;
   }
   return platformLocation + SdkConstants.FD_TOOLS + File.separator;
 }
コード例 #2
0
 @Override
 public String getLocation() {
   return myWrapee.getLocation();
 }
コード例 #3
0
  private boolean loadLibrary(@NotNull IAndroidTarget target)
      throws RenderingException, IOException {
    final String layoutLibJarPath = 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 = 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 = 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 SimpleLogger logger = new SimpleLogger(LOG);

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

    myResources = loadPlatformResources(new File(resFolder.getPath()), logger);

    final Map<String, String> buildPropMap =
        ProjectProperties.parsePropertyFile(new BufferingFileWrapper(buildProp), logger);
    return myLibrary.init(buildPropMap, new File(fontFolder.getPath()), myEnumMap, logger);
  }