com.android.ide.common.internal.WaitableExecutor Java Examples

The following examples show how to use com.android.ide.common.internal.WaitableExecutor. 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: AtlasDesugarTransform.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasDesugarTransform(AppVariantOutputContext appVariantOutputContext,
                             @NonNull Supplier<List<File>> androidJarClasspath,
                             @NonNull List<Path> compilationBootclasspath,
                             @Nullable FileCache userCache,
                             int minSdk,
                             @NonNull JavaProcessExecutor executor,
                             boolean verbose,
                             boolean enableGradleWorkers,
                             @NonNull Path tmpDir) {
    this.appVariantOutputContext = appVariantOutputContext;
    this.androidJarClasspath = androidJarClasspath;
    this.compilationBootclasspath = compilationBootclasspath;
    this.userCache = userCache;
    this.minSdk = minSdk;
    this.executor = executor;
    this.waitableExecutor = WaitableExecutor.useGlobalSharedThreadPool();
    this.verbose = verbose;
    this.enableGradleWorkers = enableGradleWorkers;
    this.tmpDir = tmpDir;
}
 
Example #2
Source File: AtlasDexArchiveBuilderTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasDexArchiveBuilderTransform(AppVariantContext variantContext, VariantOutput variantOutput,
                                       @NonNull DexOptions dexOptions,
                                       @NonNull ErrorReporter errorReporter,
                                       @Nullable FileCache userLevelCache,
                                       int minSdkVersion,
                                       @NonNull DexerTool dexer,
                                       boolean useGradleWorkers,
                                       @Nullable Integer inBufferSize,
                                       @Nullable Integer outBufferSize,
                                       boolean isDebuggable) {

    this.variantContext = variantContext;
    this.variantOutput = (BaseVariantOutput) variantOutput;
    this.dexOptions = dexOptions;
    this.errorReporter = errorReporter;
    this.minSdkVersion = minSdkVersion;
    this.dexer = dexer;
    this.executor = WaitableExecutor.useGlobalSharedThreadPool();
    this.cacheHandler =
            new AtlasDexArchiveBuilderCacheHander(variantContext.getProject(),
                    userLevelCache, dexOptions, minSdkVersion, isDebuggable, dexer);
    this.useGradleWorkers = useGradleWorkers;
    this.inBufferSize =
            (inBufferSize == null ? DEFAULT_BUFFER_SIZE_IN_KB : inBufferSize) * 1024;
    this.outBufferSize =
            (outBufferSize == null ? DEFAULT_BUFFER_SIZE_IN_KB : outBufferSize) * 1024;
    this.isDebuggable = isDebuggable;

}
 
Example #3
Source File: AtlasMergeJavaResourcesTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasMergeJavaResourcesTransform(AppVariantOutputContext appVariantOutputContext, PackagingOptions packagingOptions, Set<? super QualifiedContent.Scope> mergeScopes, QualifiedContent.ContentType mergedType, String name, VariantScope variantScope) {
    super(packagingOptions, mergeScopes, mergedType, name, variantScope);
    this.packagingOptions = packagingOptions;
    this.name = name;
    this.mergeScopes = ImmutableSet.copyOf(mergeScopes);
    this.mergedType = ImmutableSet.of(mergedType);
    this.intermediateDir = variantScope.getIncrementalDir(
            variantScope.getFullVariantName() + "-" + name);
    waitableExecutor = WaitableExecutor.useGlobalSharedThreadPool();
    this.appVariantOutputContext = appVariantOutputContext;
    if (mergedType == QualifiedContent.DefaultContentType.RESOURCES) {
        acceptedPathsPredicate =
                path -> !path.endsWith(SdkConstants.DOT_CLASS)
                        && !path.endsWith(SdkConstants.DOT_NATIVE_LIBS);
    } else if (mergedType == ExtendedContentType.NATIVE_LIBS) {
        acceptedPathsPredicate =
                path -> {
                    Matcher m = JAR_ABI_PATTERN.matcher(path);

                    // if the ABI is accepted, check the 3rd segment
                    if (m.matches()) {
                        paths.add(path);
                        // remove the beginning of the path (lib/<abi>/)
                        String filename = path.substring(5 + m.group(1).length());
                        // and check the filename
                        return ABI_FILENAME_PATTERN.matcher(filename).matches() ||
                                SdkConstants.FN_GDBSERVER.equals(filename) ||
                                SdkConstants.FN_GDB_SETUP.equals(filename);
                    }

                    return false;

                };
    } else {
        throw new UnsupportedOperationException(
                "mergedType param must be RESOURCES or NATIVE_LIBS");
    }
}
 
Example #4
Source File: TaobaoInstantRunTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public TaobaoInstantRunTransform(AppVariantContext variantContext, AppVariantOutputContext variantOutputContext, WaitableExecutor executor, InstantRunVariantScope transformScope) {
    this.variantContext = variantContext;
    this.variantOutputContext = variantOutputContext;
    this.executor = executor;
    this.transformScope = transformScope;
    this.targetPlatformApi =
            DeploymentDevice.getDeploymentDeviceAndroidVersion(
                    transformScope.getGlobalScope().getProjectOptions());

    injectFailedFile = new File(variantContext.getProject().getBuildDir(), "outputs/warning-instrument-inject-error.properties");
    injectSuccessFile = new File(variantContext.getProject().getBuildDir(), "outputs/instrument.properties");

}
 
Example #5
Source File: SourceSearcher.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void setUseExecutor(boolean useExecutor) {
    if (useExecutor) {
        mExecutor = new WaitableExecutor<Void>();
    } else {
        mExecutor = null;
    }
}
 
Example #6
Source File: MergeWriter.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public MergeWriter(@NonNull File rootFolder) {
    mRootFolder = rootFolder;
    mExecutor = new WaitableExecutor<Void>();
}
 
Example #7
Source File: MergeWriter.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
@NonNull
protected WaitableExecutor<Void> getExecutor() {
    return mExecutor;
}
 
Example #8
Source File: MergeWriter.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public MergeWriter(@NonNull File rootFolder) {
    mRootFolder = rootFolder;
    mExecutor = new WaitableExecutor<Void>();
}
 
Example #9
Source File: MergeWriter.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
protected WaitableExecutor<Void> getExecutor() {
    return mExecutor;
}