/** * Returns the complete path for <code>framework.aidl</code>, based on this SDK. * * @return the complete path as a <code>String</code>, including the filename. */ public String getPathForFrameworkAidl() { return androidTarget.getPath( IAndroidTarget.ANDROID_AIDL ); }
for ( IAndroidTarget target: targetManager.getTargets( progressIndicator ) ) if ( target.isPlatform() ) || target.getVersion().getApiLevel() > latestTarget.getVersion().getApiLevel() ) platformDirectory = new File ( latestTarget.getLocation() ); platformDirectory = new File( androidTarget.getLocation() );
BuildToolInfo buildToolInfo = androidTarget.getBuildToolInfo(); if ( buildToolInfo != null )
/** * Resolves the android.jar from this SDK. * * @return a <code>File</code> pointing to the android.jar file. * @throws org.apache.maven.plugin.MojoExecutionException * if the file can not be resolved. */ public File getAndroidJar() throws MojoExecutionException { final String androidJarPath = androidTarget.getPath( IAndroidTarget.ANDROID_JAR ); if ( androidJarPath == null ) { throw new MojoExecutionException( "No AndroidJar found for " + androidTarget.getLocation() ); } return new File ( androidJarPath ); }
if ( target != null && target.getLocation() != null ) if ( t.isPlatform() && apiLevel.equals( t.getVersionName() ) )
/** * 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; }
@NonNull public static ImmutableList<File> computeFullBootClasspath( @NonNull IAndroidTarget target, @NonNull File annotationsJar) { Preconditions.checkNotNull(target); Preconditions.checkNotNull(annotationsJar); ImmutableList.Builder<File> classpath = ImmutableList.builder(); for (String p : target.getBootClasspath()) { classpath.add(new File(p)); } // add additional libraries if any List<IAndroidTarget.OptionalLibrary> libs = target.getAdditionalLibraries(); for (IAndroidTarget.OptionalLibrary lib : libs) { File jar = lib.getJar(); Verify.verify(jar != null, "Jar missing from additional library %s.", lib.getName()); classpath.add(jar); } // add optional libraries if any List<IAndroidTarget.OptionalLibrary> optionalLibraries = target.getOptionalLibraries(); for (IAndroidTarget.OptionalLibrary lib : optionalLibraries) { File jar = lib.getJar(); Verify.verify(jar != null, "Jar missing from optional library %s.", lib.getName()); classpath.add(jar); } // add annotations.jar if needed. if (target.getVersion().getApiLevel() <= 15) { classpath.add(annotationsJar); } return classpath.build(); }
/** * Returns whether the compilation target is a preview. */ public boolean isPreviewTarget() { checkState(mTargetInfo != null, "Cannot call isTargetAPreview() before setTargetInfo() is called."); return mTargetInfo.getTarget().getVersion().isPreview(); }
/** * 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()); } }
builder.addArgs("-I", target.getPath(IAndroidTarget.ANDROID_JAR)); if (!target.isPlatform()) { final List<IAndroidTarget.OptionalLibrary> addonLibs = target.getAdditionalLibraries();
if (!target.isPlatform()) { target = target.getParent(); builder.addArgs("APP_PLATFORM=" + target.hashString());
@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; }
@NonNull @Override public List<String> getBootClasspath() { return mBasePlatform.getBootClasspath(); }
@NonNull @Override public List<OptionalLibrary> getOptionalLibraries() { return mBasePlatform.getOptionalLibraries(); }
@Override public String getVersionName() { return mBasePlatform.getVersionName(); }
@Override public int compareTo(@NonNull IAndroidTarget o) { int res = getVersion().compareTo(o.getVersion()); if (res != 0) { return res; } return o.isPlatform() ? 0 : -1; }
List<File> classpath = Lists.newArrayList(); for (String p : target.getBootClasspath()) { classpath.add(new File(p)); List<IAndroidTarget.OptionalLibrary> libs = target.getAdditionalLibraries(); for (IAndroidTarget.OptionalLibrary lib : libs) { List<IAndroidTarget.OptionalLibrary> optionalLibraries = target.getOptionalLibraries(); for (IAndroidTarget.OptionalLibrary lib : optionalLibraries) { if (target.getVersion().getApiLevel() <= 15) { classpath.add(annotationsJar);
public String getTargetCodename() { checkState(mTargetInfo != null, "Cannot call getTargetCodename() before setTargetInfo() is called."); return mTargetInfo.getTarget().getVersion().getCodename(); }
@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; }
@NonNull @Override public ImmutableList<File> getInstantRunBootClasspath() { IAndroidTarget target = externalBuildContext.getAndroidBuilder().getTarget(); ImmutableList.Builder<File> fileListBuilder = ImmutableList.builder(); if (target != null) { for (String classpathElement : target.getBootClasspath()) { fileListBuilder.add(new File(classpathElement)); } } return fileListBuilder.build(); }