for ( IAndroidTarget target: targetManager.getTargets( progressIndicator ) ) if ( target.isPlatform() )
if ( t.isPlatform() && apiLevel.equals( t.getVersionName() ) )
@Override public int compareTo(@NonNull IAndroidTarget o) { int res = getVersion().compareTo(o.getVersion()); if (res != 0) { return res; } return o.isPlatform() ? 0 : -1; }
@Nullable @Override public IAndroidTarget getCompileTarget(@NonNull Project project) { IAndroidTarget compileTarget = super.getCompileTarget(project); if (compileTarget == null) { IAndroidTarget[] targets = getTargets(); for (int i = targets.length - 1; i >= 0; i--) { IAndroidTarget target = targets[i]; if (target.isPlatform()) { return target; } } } return compileTarget; }
@Nullable @Override public IAndroidTarget getCompileTarget(@NonNull Project project) { IAndroidTarget compileTarget = super.getCompileTarget(project); if (compileTarget == null) { IAndroidTarget[] targets = getTargets(); for (int i = targets.length - 1; i >= 0; i--) { IAndroidTarget target = targets[i]; if (target.isPlatform()) { return target; } } } return compileTarget; }
/** * Returns the highest known API level. * * @return the highest known API level */ public int getHighestKnownApiLevel() { int max = SdkVersionInfo.HIGHEST_KNOWN_STABLE_API; for (IAndroidTarget target : getTargets()) { if (target.isPlatform()) { int api = target.getVersion().getApiLevel(); if (api > max && !target.getVersion().isPreview()) { max = api; } } } return max; }
@Override public int compareTo(@NonNull IAndroidTarget target) { // quick check. if (this == target) { return 0; } int versionDiff = getVersion().compareTo(target.getVersion()); // only if the versions are the same do we care about platform/add-ons. if (versionDiff == 0) { // platforms go before add-ons. if (target.isPlatform()) { return +1; } else { AddonTarget targetAddOn = (AddonTarget) target; // both are add-ons of the same version. Compare per vendor then by name int vendorDiff = getVendor().compareTo(targetAddOn.getVendor()); if (vendorDiff == 0) { return getName().compareTo(targetAddOn.getName()); } else { return vendorDiff; } } } return versionDiff; }
/** * Returns the compile target to use for the given project * * @param project the project in question * * @return the compile target to use to build the given project */ @Nullable public IAndroidTarget getCompileTarget(@NonNull Project project) { int buildSdk = project.getBuildSdk(); IAndroidTarget[] targets = getTargets(); for (int i = targets.length - 1; i >= 0; i--) { IAndroidTarget target = targets[i]; if (target.isPlatform() && target.getVersion().getApiLevel() == buildSdk) { return target; } } return null; }
for (int i = targets.length - 1; i >= 0; i--) { IAndroidTarget target = targets[i]; if (target.isPlatform()) { AndroidVersion version = target.getVersion(); if (version.isPreview() && apiOrPreviewName.equalsIgnoreCase(version.getCodename())) {
/** * Returns the hash string for a given target (add-on or platform.) * * @param target A non-null target. * @return A non-null hash string uniquely representing this target. */ public static String getTargetHashString(@NonNull IAndroidTarget target) { if (target.isPlatform()) { return getPlatformHashString(target.getVersion()); } else { return getAddonHashString( target.getVendor(), target.getName(), target.getVersion()); } }
if (!target.isPlatform()) { final List<IAndroidTarget.OptionalLibrary> addonLibs = target.getAdditionalLibraries();
if (!target.isPlatform()) { target = target.getParent();