com.android.sdklib.BuildToolInfo Java Examples
The following examples show how to use
com.android.sdklib.BuildToolInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlatformLoader.java From javaide with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public TargetInfo getTargetInfo(@NonNull String targetHash, @NonNull FullRevision buildToolRevision, @NonNull ILogger logger) { init(logger); IAndroidTarget androidTarget = new FakeAndroidTarget(mTreeLocation.getPath(), targetHash); File hostTools = getHostToolsFolder(); BuildToolInfo buildToolInfo = new BuildToolInfo( buildToolRevision, mTreeLocation, new File(hostTools, FN_AAPT), new File(hostTools, FN_AIDL), new File(mTreeLocation, "prebuilts/sdk/tools/dx"), new File(mTreeLocation, "prebuilts/sdk/tools/lib/dx.jar"), new File(hostTools, FN_BCC_COMPAT), new File(hostTools, "arm-linux-androideabi-ld"), new File(hostTools, "i686-linux-android-ld"), new File(hostTools, "mipsel-linux-android-ld"), new File(hostTools, FN_ZIPALIGN)); return new TargetInfo(androidTarget, buildToolInfo); }
Example #2
Source File: DefaultSdkLoader.java From javaide with GNU General Public License v3.0 | 6 votes |
@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); }
Example #3
Source File: LocalSdk.java From javaide with GNU General Public License v3.0 | 6 votes |
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); // } FullRevision rev = new FullRevision(26); BuildToolInfo btInfo = new BuildToolInfo(rev, mSdkRoot); LocalBuildToolPkgInfo pkgInfo = new LocalBuildToolPkgInfo(this, mSdkRoot, new Properties(), rev, btInfo); outCollection.add(pkgInfo); }
Example #4
Source File: LocalSdk.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@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)); }
Example #5
Source File: LocalSdk.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
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); } }
Example #6
Source File: LocalSdk.java From javaide with GNU General Public License v3.0 | 6 votes |
@NonNull private BuildToolInfo createLegacyBuildTools(@NonNull LocalPlatformToolPkgInfo ptInfo) { File platformTools = new File(getLocation(), SdkConstants.FD_PLATFORM_TOOLS); File platformToolsLib = ptInfo.getLocalDir(); 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), null, null, null, null, new File(platformTools, SdkConstants.FN_ZIPALIGN)); }
Example #7
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * 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, @NonNull ProcessOutputHandler processOutputHandler) 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, processOutputHandler); }
Example #8
Source File: AtlasBuilder.java From atlas with Apache License 2.0 | 6 votes |
/** * Get the custom buildToolInfo * * @param targetInfo * @return */ public void updateAapt(PathId pathId) { if (null == defaultBuilder.getTargetInfo()) { return; } 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, customAaptFile); } catch (Throwable e) { throw new GradleException(e.getMessage()); } }
Example #9
Source File: LocalBuildToolPkgInfo.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
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; }
Example #10
Source File: LocalSdk.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the highest build-tool revision known, or null if there are are no build-tools. * <p/> * If no specific build-tool package is installed but the platform-tools is lower than 17, * then this creates and returns a "legacy" built-tool package using platform-tools. * (We only split build-tools out of platform-tools starting with revision 17, * before they were both the same thing.) * * @return The highest build-tool revision known, or null. */ @Nullable public BuildToolInfo getLatestBuildTool() { if (mLegacyBuildTools != null) { return mLegacyBuildTools; } LocalPkgInfo[] pkgs = getPkgsInfos(PkgType.PKG_BUILD_TOOLS); if (pkgs.length == 0) { LocalPkgInfo ptPkg = getPkgInfo(PkgType.PKG_PLATFORM_TOOLS); if (ptPkg instanceof LocalPlatformToolPkgInfo && ptPkg.getDesc().getFullRevision().compareTo(new FullRevision(17)) < 0) { // older SDK, create a compatible build-tools mLegacyBuildTools = createLegacyBuildTools((LocalPlatformToolPkgInfo) ptPkg); return mLegacyBuildTools; } return null; } assert pkgs.length > 0; // Note: the pkgs come from a TreeMultimap so they should already be sorted. // Just in case, sort them again. Arrays.sort(pkgs); // LocalBuildToolPkgInfo's comparator sorts on its FullRevision so we just // need to take the latest element. LocalPkgInfo pkg = pkgs[pkgs.length - 1]; if (pkg instanceof LocalBuildToolPkgInfo) { return ((LocalBuildToolPkgInfo) pkg).getBuildToolInfo(); } return null; }
Example #11
Source File: LocalSdk.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #12
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns an {@link PngCruncher} using aapt underneath * * @return an PngCruncher object */ @NonNull public PngCruncher getAaptCruncher(ProcessOutputHandler processOutputHandler) { checkState(mTargetInfo != null, "Cannot call getAaptCruncher() before setTargetInfo() is called."); return new AaptCruncher( mTargetInfo.getBuildTools().getPath(BuildToolInfo.PathId.AAPT), mProcessExecutor, processOutputHandler); }
Example #13
Source File: LocalBuildToolPkgInfo.java From javaide with GNU General Public License v3.0 | 5 votes |
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; }
Example #14
Source File: BaseTask.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the BuildToolInfo. * * @throws IllegalStateException if androidBuilder.targetInfo has not been set, */ @NonNull protected BuildToolInfo getBuildTools() { TargetInfo targetInfo = getBuilder().getTargetInfo(); Preconditions.checkState(targetInfo != null, "androidBuilder.targetInfo required for task '%s'.", getName()); return targetInfo.getBuildTools(); }
Example #15
Source File: MergeResources.java From javaide with GNU General Public License v3.0 | 5 votes |
private PngCruncher getCruncher() { if (getUseNewCruncher()) { return QueuedCruncher.Builder.INSTANCE.newCruncher( getBuilder().getTargetInfo().getBuildTools().getPath( BuildToolInfo.PathId.AAPT), getILogger()); } return getBuilder().getAaptCruncher(new LoggedProcessOutputHandler(getBuilder().getLogger())); }
Example #16
Source File: TargetInfo.java From javaide with GNU General Public License v3.0 | 5 votes |
TargetInfo( @NonNull IAndroidTarget target, @NonNull BuildToolInfo buildToolInfo) { mTarget = target; mBuildToolInfo = buildToolInfo; }
Example #17
Source File: AtlasAapt.java From atlas with Apache License 2.0 | 5 votes |
/** * 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); }
Example #18
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Compiles the given aidl file. * * @param aidlFile the AIDL file to compile * @param sourceOutputDir the output dir in which to generate the source code * @param importFolders all the import folders, including the source folders. * @param dependencyFileProcessor the dependencyFileProcessor to record the dependencies * of the compilation. * @throws IOException * @throws InterruptedException * @throws LoggedErrorException */ public void compileAidlFile(@NonNull File sourceFolder, @NonNull File aidlFile, @NonNull File sourceOutputDir, @Nullable File parcelableOutputDir, @NonNull List<File> importFolders, @Nullable DependencyFileProcessor dependencyFileProcessor, @NonNull ProcessOutputHandler processOutputHandler) throws IOException, InterruptedException, LoggedErrorException, ProcessException { checkNotNull(aidlFile, "aidlFile cannot be null."); checkNotNull(sourceOutputDir, "sourceOutputDir cannot be null."); checkNotNull(importFolders, "importFolders cannot be null."); checkState(mTargetInfo != null, "Cannot call compileAidlFile() before setTargetInfo() is called."); IAndroidTarget target = mTargetInfo.getTarget(); BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools(); String aidl = buildToolInfo.getPath(BuildToolInfo.PathId.AIDL); if (aidl == null || !new File(aidl).isFile()) { throw new IllegalStateException("aidl is missing"); } AidlProcessor processor = new AidlProcessor( aidl, target.getPath(IAndroidTarget.ANDROID_AIDL), importFolders, sourceOutputDir, parcelableOutputDir, dependencyFileProcessor != null ? dependencyFileProcessor : sNoOpDependencyFileProcessor, mProcessExecutor, processOutputHandler); processor.processFile(sourceFolder, aidlFile); }
Example #19
Source File: MergeResources.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Aapt makeAapt( BuildToolInfo buildToolInfo, AaptGeneration aaptGeneration, AndroidBuilder builder, boolean crunchPng, MergingLog blameLog) { ProcessOutputHandler teeOutputHandler = new TeeProcessOutputHandler( blameLog != null ? new ParsingProcessOutputHandler( new ToolOutputParser( aaptGeneration == AaptGeneration.AAPT_V1 ? new AaptOutputParser() : new Aapt2OutputParser(), builder.getLogger()), new MergingLogRewriter(blameLog::find, builder.getErrorReporter())) : new LoggedProcessOutputHandler( new AaptGradleFactory.FilteringLogger(builder.getLogger())), new LoggedProcessOutputHandler(new AaptGradleFactory.FilteringLogger(builder.getLogger()))); return new AaptV1( builder.getProcessExecutor(), teeOutputHandler, buildToolInfo, new AaptGradleFactory.FilteringLogger(builder.getLogger()), crunchPng ? AaptV1.PngProcessMode.ALL : AaptV1.PngProcessMode.NO_CRUNCH, 0); }
Example #20
Source File: RenderScriptProcessor.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
private File createSupportObjFile( @NonNull File bcFile, @NonNull Abi abi, @NonNull String objName, @NonNull CommandLineLauncher launcher, @NonNull Map<String, String> env) throws IOException, InterruptedException { // make sure the dest folder exist File abiFolder = new File(mObjOutputDir, abi.mDevice); if (!abiFolder.isDirectory() && !abiFolder.mkdirs()) { throw new IOException("Unable to create dir " + abiFolder.getAbsolutePath()); } File exe = new File(mBuildToolInfo.getPath(BuildToolInfo.PathId.BCC_COMPAT)); List<String> args = Lists.newArrayListWithExpectedSize(10); args.add("-O" + Integer.toString(mOptimLevel)); File outFile = new File(abiFolder, objName); args.add("-o"); args.add(outFile.getAbsolutePath()); args.add("-fPIC"); args.add("-shared"); args.add("-rt-path"); args.add(mLibClCore.get(abi.mDevice).getAbsolutePath()); args.add("-mtriple"); args.add(abi.mToolchain); args.add(bcFile.getAbsolutePath()); launcher.launch(exe, args, env); return outFile; }
Example #21
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 5 votes |
public Set<String> createMainDexList( @NonNull File allClassesJarFile, @NonNull File jarOfRoots) throws ProcessException { BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools(); ProcessInfoBuilder builder = new ProcessInfoBuilder(); String dx = buildToolInfo.getPath(BuildToolInfo.PathId.DX_JAR); if (dx == null || !new File(dx).isFile()) { throw new IllegalStateException("dx.jar is missing"); } builder.setClasspath(dx); builder.setMain("com.android.multidex.ClassReferenceListBuilder"); builder.addArgs(jarOfRoots.getAbsolutePath()); builder.addArgs(allClassesJarFile.getAbsolutePath()); CachedProcessOutputHandler processOutputHandler = new CachedProcessOutputHandler(); mJavaProcessExecutor.execute(builder.createJavaProcess(), processOutputHandler) .rethrowFailure() .assertNormalExitValue(); String content = processOutputHandler.getProcessOutput().getStandardOutputAsString(); return Sets.newHashSet(Splitter.on('\n').split(content)); }
Example #22
Source File: RenderScriptProcessor.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public RenderScriptProcessor( @NonNull List<File> inputs, @NonNull List<File> importFolders, @NonNull File buildFolder, @NonNull File sourceOutputDir, @NonNull File resOutputDir, @NonNull File objOutputDir, @NonNull File libOutputDir, @NonNull BuildToolInfo buildToolInfo, int targetApi, boolean debugBuild, int optimLevel, boolean supportMode) { mInputs = inputs; mImportFolders = importFolders; mBuildFolder = buildFolder; mSourceOutputDir = sourceOutputDir; mResOutputDir = resOutputDir; mObjOutputDir = objOutputDir; mLibOutputDir = libOutputDir; mBuildToolInfo = buildToolInfo; mTargetApi = targetApi; mDebugBuild = debugBuild; mOptimLevel = optimLevel; mSupportMode = supportMode; if (supportMode) { File rs = new File(mBuildToolInfo.getLocation(), "renderscript"); mRsLib = new File(rs, "lib"); File bcFolder = new File(mRsLib, "bc"); for (Abi abi : ABIS) { mLibClCore.put(abi.mDevice, new File(bcFolder, abi.mDevice + File.separatorChar + "libclcore.bc")); } } else { mRsLib = null; } }
Example #23
Source File: RenderScriptProcessor.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
Abi(@NonNull String device, @NonNull String toolchain, @NonNull BuildToolInfo.PathId linker, @NonNull String... linkerArgs) { mDevice = device; mToolchain = toolchain; mLinker = linker; mLinkerArgs = linkerArgs; }
Example #24
Source File: LocalSdk.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Returns the highest build-tool revision known, or null if there are are no build-tools. * <p/> * If no specific build-tool package is installed but the platform-tools is lower than 17, * then this creates and returns a "legacy" built-tool package using platform-tools. * (We only split build-tools out of platform-tools starting with revision 17, * before they were both the same thing.) * * @return The highest build-tool revision known, or null. */ @Nullable public BuildToolInfo getLatestBuildTool() { if (mLegacyBuildTools != null) { return mLegacyBuildTools; } LocalPkgInfo[] pkgs = getPkgsInfos(PkgType.PKG_BUILD_TOOLS); if (pkgs.length == 0) { LocalPkgInfo ptPkg = getPkgInfo(PkgType.PKG_PLATFORM_TOOLS); if (ptPkg instanceof LocalPlatformToolPkgInfo && ptPkg.getDesc().getFullRevision().compareTo(new FullRevision(17)) < 0) { // older SDK, create a compatible build-tools mLegacyBuildTools = createLegacyBuildTools((LocalPlatformToolPkgInfo) ptPkg); return mLegacyBuildTools; } return null; } assert pkgs.length > 0; // Note: the pkgs come from a TreeMultimap so they should already be sorted. // Just in case, sort them again. Arrays.sort(pkgs); // LocalBuildToolPkgInfo's comparator sorts on its FullRevision so we just // need to take the latest element. LocalPkgInfo pkg = pkgs[pkgs.length - 1]; if (pkg instanceof LocalBuildToolPkgInfo) { return ((LocalBuildToolPkgInfo) pkg).getBuildToolInfo(); } return null; }
Example #25
Source File: LocalSdk.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * 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; }
Example #26
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Compiles all the aidl files found in the given source folders. * * @param sourceFolders all the source folders to find files to compile * @param sourceOutputDir the output dir in which to generate the source code * @param importFolders import folders * @param dependencyFileProcessor the dependencyFileProcessor to record the dependencies * of the compilation. * @throws IOException * @throws InterruptedException * @throws LoggedErrorException */ public void compileAllAidlFiles(@NonNull List<File> sourceFolders, @NonNull File sourceOutputDir, @Nullable File parcelableOutputDir, @NonNull List<File> importFolders, @Nullable DependencyFileProcessor dependencyFileProcessor, @NonNull ProcessOutputHandler processOutputHandler) throws IOException, InterruptedException, LoggedErrorException, ProcessException { checkNotNull(sourceFolders, "sourceFolders cannot be null."); checkNotNull(sourceOutputDir, "sourceOutputDir cannot be null."); checkNotNull(importFolders, "importFolders cannot be null."); checkState(mTargetInfo != null, "Cannot call compileAllAidlFiles() before setTargetInfo() is called."); IAndroidTarget target = mTargetInfo.getTarget(); BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools(); String aidl = buildToolInfo.getPath(BuildToolInfo.PathId.AIDL); if (aidl == null || !new File(aidl).isFile()) { throw new IllegalStateException("aidl is missing"); } List<File> fullImportList = Lists.newArrayListWithCapacity( sourceFolders.size() + importFolders.size()); fullImportList.addAll(sourceFolders); fullImportList.addAll(importFolders); AidlProcessor processor = new AidlProcessor( aidl, target.getPath(IAndroidTarget.ANDROID_AIDL), fullImportList, sourceOutputDir, parcelableOutputDir, dependencyFileProcessor != null ? dependencyFileProcessor : sNoOpDependencyFileProcessor, mProcessExecutor, processOutputHandler); SourceSearcher searcher = new SourceSearcher(sourceFolders, "aidl"); searcher.setUseExecutor(true); searcher.search(processor); }
Example #27
Source File: BuildToolsServiceLoader.java From javaide with GNU General Public License v3.0 | 4 votes |
private BuildToolServiceLoader(BuildToolInfo buildToolInfo) { this.buildToolInfo = buildToolInfo; }
Example #28
Source File: DexProcessBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull public JavaProcessInfo build( @NonNull BuildToolInfo buildToolInfo, @NonNull DexOptions dexOptions) throws ProcessException { checkState( !mMultiDex || buildToolInfo.getRevision().compareTo(MIN_MULTIDEX_BUILD_TOOLS_REV) >= 0, "Multi dex requires Build Tools " + MIN_MULTIDEX_BUILD_TOOLS_REV.toString() + " / Current: " + buildToolInfo.getRevision().toShortString()); ProcessInfoBuilder builder = new ProcessInfoBuilder(); builder.addEnvironments(mEnvironment); String dx = buildToolInfo.getPath(BuildToolInfo.PathId.DX_JAR); if (dx == null || !new File(dx).isFile()) { throw new IllegalStateException("dx.jar is missing"); } builder.setClasspath(dx); builder.setMain("com.android.dx.command.Main"); builder.addArgs("--dex"); if (mVerbose) { builder.addArgs("--verbose"); } if (mIncremental) { builder.addArgs("--incremental", "--no-strict"); } if (mNoOptimize) { builder.addArgs("--no-optimize"); } // only change thread count is build tools is 22.0.2+ if (buildToolInfo.getRevision().compareTo(MIN_MULTI_THREADED_DEX_BUILD_TOOLS_REV) >= 0) { Integer threadCount = dexOptions.getThreadCount(); if (threadCount == null) { builder.addArgs("--num-threads=4"); } else { builder.addArgs("--num-threads=" + threadCount); } } if (mMultiDex) { builder.addArgs("--multi-dex"); if (mMainDexList != null ) { builder.addArgs("--main-dex-list", mMainDexList.getAbsolutePath()); } } if (mAdditionalParams != null) { for (String arg : mAdditionalParams) { builder.addArgs(arg); } } builder.addArgs("--output", mOutputFile.getAbsolutePath()); // input builder.addArgs(getFilesToAdd(buildToolInfo)); return builder.createJavaProcess(); }
Example #29
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull public File getDxJar() { checkState(mTargetInfo != null, "Cannot call getDxJar() before setTargetInfo() is called."); return new File(mTargetInfo.getBuildTools().getPath(BuildToolInfo.PathId.DX_JAR)); }
Example #30
Source File: AndroidBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * 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 the dex options * @param buildToolInfo the build tools info * @param verbose verbose flag * @param processExecutor the java process executor * @return the list of generated files. * @throws ProcessException */ @NonNull public static ImmutableList<File> preDexLibrary( @NonNull File inputFile, @NonNull File outFile, boolean multiDex, @NonNull DexOptions dexOptions, @NonNull BuildToolInfo buildToolInfo, boolean verbose, @NonNull JavaProcessExecutor processExecutor, @NonNull ProcessOutputHandler processOutputHandler) throws ProcessException { checkNotNull(inputFile, "inputFile cannot be null."); checkNotNull(outFile, "outFile cannot be null."); checkNotNull(dexOptions, "dexOptions cannot be null."); try { if (!checkLibraryClassesJar(inputFile)) { return ImmutableList.of(); } } catch (IOException e) { throw new RuntimeException("Exception while checking library jar", e); } DexProcessBuilder builder = new DexProcessBuilder(outFile); builder.setVerbose(verbose) .setMultiDex(multiDex) .addInput(inputFile); JavaProcessInfo javaProcessInfo = builder.build(buildToolInfo, dexOptions); ProcessResult result = processExecutor.execute(javaProcessInfo, processOutputHandler); result.rethrowFailure().assertNormalExitValue(); if (multiDex) { File[] files = outFile.listFiles(new FilenameFilter() { @Override public boolean accept(File file, String name) { return name.endsWith(DOT_DEX); } }); if (files == null || files.length == 0) { throw new RuntimeException("No dex files created at " + outFile.getAbsolutePath()); } return ImmutableList.copyOf(files); } else { return ImmutableList.of(outFile); } }