本文整理汇总了Java中com.android.sdklib.BuildToolInfo类的典型用法代码示例。如果您正苦于以下问题:Java BuildToolInfo类的具体用法?Java BuildToolInfo怎么用?Java BuildToolInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildToolInfo类属于com.android.sdklib包,在下文中一共展示了BuildToolInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLegacyBuildTools
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
@NonNull
private BuildToolInfo createLegacyBuildTools(@NonNull LocalPlatformToolPkgInfo ptInfo) {
File platformTools = new File(getLocation(), SdkConstants.FD_PLATFORM_TOOLS);
File platformToolsLib = ptInfo.getLocalDir();
File platformToolsRs = new File(platformTools, SdkConstants.FN_FRAMEWORK_RENDERSCRIPT);
return new BuildToolInfo(
ptInfo.getDesc().getFullRevision(),
platformTools,
new File(platformTools, SdkConstants.FN_AAPT),
new File(platformTools, SdkConstants.FN_AIDL),
new File(platformTools, SdkConstants.FN_DX),
new File(platformToolsLib, SdkConstants.FN_DX_JAR),
new File(platformTools, SdkConstants.FN_RENDERSCRIPT),
new File(platformToolsRs, SdkConstants.FN_FRAMEWORK_INCLUDE),
new File(platformToolsRs, SdkConstants.FN_FRAMEWORK_INCLUDE_CLANG),
null,
null,
null,
null,
new File(platformTools, SdkConstants.FN_ZIPALIGN));
}
示例2: scanBuildTools
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
private void scanBuildTools(File collectionDir, Collection<LocalPkgInfo> outCollection) {
// The build-tool root folder contains a list of per-revision folders.
for (File buildToolDir : mFileOp.listFiles(collectionDir)) {
if (!shouldVisitDir(PkgType.PKG_BUILD_TOOLS, buildToolDir)) {
continue;
}
Properties props = parseProperties(new File(buildToolDir, SdkConstants.FN_SOURCE_PROP));
FullRevision rev = PackageParserUtils.getPropertyFull(props, PkgProps.PKG_REVISION);
if (rev == null) {
continue; // skip, no revision
}
BuildToolInfo btInfo = new BuildToolInfo(rev, buildToolDir);
LocalBuildToolPkgInfo pkgInfo =
new LocalBuildToolPkgInfo(this, buildToolDir, props, rev, btInfo);
outCollection.add(pkgInfo);
}
}
示例3: getTargetInfo
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
@Override
@NonNull
public TargetInfo getTargetInfo(
@NonNull String targetHash,
@NonNull FullRevision buildToolRevision,
@NonNull ILogger logger) {
init(logger);
IAndroidTarget target = mSdkManager.getTargetFromHashString(targetHash);
if (target == null) {
throw new IllegalStateException("failed to find target with hash string '" + targetHash + "' in: " + mSdkLocation);
}
BuildToolInfo buildToolInfo = mSdkManager.getBuildTool(buildToolRevision);
if (buildToolInfo == null) {
throw new IllegalStateException("failed to find Build Tools revision "
+ buildToolRevision.toString());
}
return new TargetInfo(target, buildToolInfo);
}
示例4: preDexLibrary
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Converts the bytecode to Dalvik format
* @param inputFile the input file
* @param outFile the output file or folder if multi-dex is enabled.
* @param multiDex whether multidex is enabled.
* @param dexOptions dex options
*
* @throws IOException
* @throws InterruptedException
* @throws ProcessException
*/
public void preDexLibrary(
@NonNull File inputFile,
@NonNull File outFile,
boolean multiDex,
@NonNull DexOptions dexOptions)
throws IOException, InterruptedException, ProcessException {
checkState(mTargetInfo != null,
"Cannot call preDexLibrary() before setTargetInfo() is called.");
BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools();
PreDexCache.getCache().preDexLibrary(
inputFile,
outFile,
multiDex,
dexOptions,
buildToolInfo,
mVerboseExec,
mJavaProcessExecutor,
mProcessOutputHandler);
}
示例5: convertLibraryToJack
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Converts the bytecode of a library to the jack format
* @param inputFile the input file
* @param outFile the location of the output classes.dex file
* @param dexOptions dex options
*
* @throws ProcessException
* @throws IOException
* @throws InterruptedException
*/
public void convertLibraryToJack(
@NonNull File inputFile,
@NonNull File outFile,
@NonNull DexOptions dexOptions)
throws ProcessException, IOException, InterruptedException {
checkState(mTargetInfo != null,
"Cannot call preJackLibrary() before setTargetInfo() is called.");
BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools();
JackConversionCache.getCache().convertLibrary(
inputFile,
outFile,
dexOptions,
buildToolInfo,
mVerboseExec,
mJavaProcessExecutor,
mProcessOutputHandler,
mLogger);
}
示例6: forVersion
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Load a built-tools version specific {@link ServiceLoader} helper.
* @param buildToolInfo the requested build-tools information
* @return an initialized {@link BuildToolsServiceLoader.BuildToolServiceLoader} to get
* instances of {@link ServiceLoader} from.
*/
@NonNull
public synchronized BuildToolServiceLoader forVersion(BuildToolInfo buildToolInfo) {
Optional<LoadedBuildTool> loadedBuildToolOptional =
findVersion(buildToolInfo.getRevision());
if (loadedBuildToolOptional.isPresent()) {
return loadedBuildToolOptional.get().serviceLoader;
}
LoadedBuildTool loadedBuildTool = new LoadedBuildTool(buildToolInfo.getRevision(),
new BuildToolServiceLoader(buildToolInfo));
loadedBuildTools.add(loadedBuildTool);
return loadedBuildTool.serviceLoader;
}
示例7: getBuildToolInfo
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Create a fake build tool info where the dx tool actually exists (even if it's not used).
*/
private static BuildToolInfo getBuildToolInfo() throws IOException {
File toolDir = Files.createTempDir();
// create a dx.jar file.
File dx = new File(toolDir, FN_DX_JAR);
Files.write("dx!", dx, Charsets.UTF_8);
return new BuildToolInfo(
new FullRevision(1),
toolDir,
new File(toolDir, FN_AAPT),
new File(toolDir, FN_AIDL),
new File(toolDir, FN_DX),
dx,
new File(toolDir, FN_RENDERSCRIPT),
new File(toolDir, "include"),
new File(toolDir, "clang-include"),
new File(toolDir, FN_BCC_COMPAT),
new File(toolDir, "arm-linux-androideabi-ld"),
new File(toolDir, "i686-linux-android-ld"),
new File(toolDir, "mipsel-linux-android-ld"),
new File(toolDir, FN_ZIPALIGN));
}
示例8: putSdkDependentParams
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Populate the given state with a set of variables that depend on the user's installed SDK. This method should
* be called early in the initialization of a wizard or path.
* Variables:
* Build Tools Version: Used to populate the project level build.gradle with the correct Gradle plugin version number
* If the required build tools version is not installed, a request is added for installation
* SDK Home: The location of the installed SDK
* @param state the state store to populate with the values stored in the SDK
*/
public static void putSdkDependentParams(@NotNull ScopedStateStore state) {
final AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
BuildToolInfo buildTool = sdkData != null ? sdkData.getLatestBuildTool() : null;
FullRevision minimumRequiredBuildToolVersion = FullRevision.parseRevision(SdkConstants.MIN_BUILD_TOOLS_VERSION);
if (buildTool != null && buildTool.getRevision().compareTo(minimumRequiredBuildToolVersion) >= 0) {
state.put(WizardConstants.BUILD_TOOLS_VERSION_KEY, buildTool.getRevision().toString());
} else {
// We need to install a new build tools version
state.listPush(WizardConstants.INSTALL_REQUESTS_KEY, PkgDesc.Builder.newBuildTool(minimumRequiredBuildToolVersion).create());
state.put(WizardConstants.BUILD_TOOLS_VERSION_KEY, minimumRequiredBuildToolVersion.toString());
}
if (sdkData != null) {
// Gradle expects a platform-neutral path
state.put(WizardConstants.SDK_HOME_KEY, FileUtil.toSystemIndependentName(sdkData.getPath()));
}
}
示例9: createNewProjectState
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
private static NewProjectWizardState createNewProjectState(boolean createWithProject, AndroidSdkData sdkData) {
final NewProjectWizardState values = new NewProjectWizardState();
assertNotNull(values);
Template.convertApisToInt(values.getParameters());
values.put(ATTR_CREATE_ACTIVITY, createWithProject);
values.put(ATTR_GRADLE_VERSION, GRADLE_LATEST_VERSION);
values.put(ATTR_GRADLE_PLUGIN_VERSION, GRADLE_PLUGIN_RECOMMENDED_VERSION);
values.put(ATTR_MODULE_NAME, "TestModule");
values.put(ATTR_PACKAGE_NAME, "test.pkg");
// TODO: Test the icon generator too
values.put(ATTR_CREATE_ICONS, false);
final BuildToolInfo buildTool = sdkData.getLatestBuildTool();
if (buildTool != null) {
values.put(ATTR_BUILD_TOOLS_VERSION, buildTool.getRevision().toString());
}
return values;
}
示例10: getZipAlign
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
@NotNull
public static String getZipAlign(@NotNull String sdkPath, @NotNull IAndroidTarget target) {
final BuildToolInfo buildToolInfo = target.getBuildToolInfo();
if (buildToolInfo != null) {
String path = null;
try {
path = buildToolInfo.getPath(BuildToolInfo.PathId.ZIP_ALIGN);
}
catch (Throwable ignored) {
}
if (path != null && new File(path).exists()) {
return path;
}
}
return sdkPath + File.separatorChar + toolPath(SdkConstants.FN_ZIPALIGN);
}
示例11: execute
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
@NotNull
public static Map<AndroidCompilerMessageKind, List<String>> execute(@NotNull IAndroidTarget target,
@NotNull String file,
@NotNull String outFile,
@NotNull String[] sourceRootPaths) throws IOException {
BuildToolInfo buildToolInfo = target.getBuildToolInfo();
if (buildToolInfo == null) {
return Collections.singletonMap(AndroidCompilerMessageKind.ERROR, Collections.singletonList("No Build Tools in the Android SDK."));
}
final List<String> commands = new ArrayList<String>();
final String frameworkAidlPath = target.getPath(IAndroidTarget.ANDROID_AIDL);
commands.add(buildToolInfo.getPath(BuildToolInfo.PathId.AIDL));
commands.add("-p" + frameworkAidlPath);
for (String path : sourceRootPaths) {
commands.add("-I" + path);
}
commands.add(file);
commands.add(outFile);
LOG.info(AndroidCommonUtils.command2string(commands));
return AndroidExecutionUtil.doExecute(ArrayUtil.toStringArray(commands));
}
示例12: getTargetInfo
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
@Override
public TargetInfo getTargetInfo() {
if (null == defaultBuilder.getTargetInfo()) {
return null;
}
if (!updateAapt && atlasExtension.getTBuildConfig().getUseCustomAapt()) {
super.setTargetInfo(defaultBuilder.getTargetInfo());
BuildToolInfo defaultBuildToolInfo = defaultBuilder.getTargetInfo().getBuildTools();
File customAaptFile = getAapt();
try {
Method method = defaultBuildToolInfo.getClass()
.getDeclaredMethod("add", PathId.class, File.class);
method.setAccessible(true);
method.invoke(defaultBuildToolInfo, PathId.AAPT, customAaptFile);
} catch (Throwable e) {
throw new GradleException(e.getMessage());
}
updateAapt = true;
}
return defaultBuilder.getTargetInfo();
}
示例13: AtlasAapt
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Creates a new entry point to the original {@code aapt}.
*
* @param processExecutor the executor for external processes
* @param processOutputHandler the handler to process the executed process' output
* @param buildToolInfo the build tools to use
* @param logger logger to use
* @param processMode the process mode to run {@code aapt} on
* @param cruncherProcesses if using build tools that support crunching processes, how many
* processes to use; if set to {@code 0}, the default number will be used
*/
public AtlasAapt(ProcessExecutor processExecutor,
ProcessOutputHandler processOutputHandler,
BuildToolInfo buildToolInfo,
ILogger logger,
PngProcessMode processMode,
int cruncherProcesses) {
super(processExecutor,
processOutputHandler,
buildToolInfo,
logger,
processMode,
cruncherProcesses);
}
示例14: LocalBuildToolPkgInfo
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
public LocalBuildToolPkgInfo(@NonNull LocalSdk localSdk,
@NonNull File localDir,
@NonNull Properties sourceProps,
@NonNull FullRevision revision,
@Nullable BuildToolInfo btInfo) {
super(localSdk, localDir, sourceProps);
mDesc = PkgDesc.Builder.newBuildTool(revision).create();
mBuildToolInfo = btInfo;
}
示例15: getBuildTool
import com.android.sdklib.BuildToolInfo; //导入依赖的package包/类
/**
* Returns the {@link BuildToolInfo} for the given revision.
*
* @param revision The requested revision.
* @return A {@link BuildToolInfo}. Can be null if {@code revision} is null or is
* not part of the known set returned by {@code getPkgsInfos(PkgType.PKG_BUILD_TOOLS)}.
*/
@Nullable
public BuildToolInfo getBuildTool(@Nullable FullRevision revision) {
LocalPkgInfo pkg = getPkgInfo(PkgType.PKG_BUILD_TOOLS, revision);
if (pkg instanceof LocalBuildToolPkgInfo) {
return ((LocalBuildToolPkgInfo) pkg).getBuildToolInfo();
}
return null;
}