com.android.build.gradle.internal.CompileOptions Java Examples
The following examples show how to use
com.android.build.gradle.internal.CompileOptions.
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: VariantProcessor.java From Injector with Apache License 2.0 | 5 votes |
public void processVariant(InjectorExtension extension) { CompileOptions compileOptions = androidExtension.getCompileOptions(); sourceCompatibilityVersion = compileOptions.getSourceCompatibility(); targetCompatibilityVersion = compileOptions.getTargetCompatibility(); if (!androidArchiveLibraries.isEmpty()) { extractAARs(); processManifest(); processResourcesAndR(); processAssets(); processJniLibs(); } processProguardTxt(); createDexTask(extension); }
Example #2
Source File: JavaCompile.java From javaide with GNU General Public License v3.0 | 5 votes |
public JavaCompile() { CompileOptions compileOptions = getServices().get(ObjectFactory.class).newInstance(CompileOptions.class); this.compileOptions = compileOptions; CompilerForkUtils.doNotCacheIfForkingViaExecutable(compileOptions, getOutputs()); // this mimics the behavior of the Ant javac task (and therefore AntJavaCompiler), // which silently excludes files not ending in .java include("**/*.java"); }
Example #3
Source File: JavaCompileConfigAction.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void execute(final JavaCompile javacTask) { scope.getVariantData().javacTask = javacTask; javacTask.setSource(scope.getVariantData().getJavaSources()); ConventionMappingHelper.map(javacTask, "classpath", new Callable<FileCollection>() { @Override public FileCollection call() { FileCollection classpath = scope.getJavaClasspath(); Project project = scope.getGlobalScope().getProject(); return classpath; } }); javacTask.setDestinationDir(scope.getJavaOutputDir()); javacTask.setDependencyCacheDir(scope.getJavaDependencyCache()); CompileOptions compileOptions = scope.getGlobalScope().getExtension().getCompileOptions(); AbstractCompilesUtil.configureLanguageLevel( javacTask, compileOptions, scope.getGlobalScope().getExtension().getCompileSdkVersion() ); javacTask.getOptions().setEncoding(compileOptions.getEncoding()); javacTask.getOptions().setBootClasspath( Joiner.on(File.pathSeparator).join( scope.getGlobalScope().getAndroidBuilder().getBootClasspathAsStrings())); }
Example #4
Source File: AbstractCompilesUtil.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Determines the java language level to use and sets it on the given task and * {@link CompileOptions}. The latter is to propagate the information to Studio. */ public static void configureLanguageLevel( AbstractCompile compileTask, final CompileOptions compileOptions, String compileSdkVersion) { final AndroidVersion hash = AndroidTargetHash.getVersionFromHash(compileSdkVersion); Integer compileSdkLevel = (hash == null ? null : hash.getApiLevel()); JavaVersion javaVersionToUse; if (compileSdkLevel == null || (0 <= compileSdkLevel && compileSdkLevel <= 20)) { javaVersionToUse = JavaVersion.VERSION_1_6; } else { javaVersionToUse = JavaVersion.VERSION_1_7; } JavaVersion jdkVersion = JavaVersion.toVersion(System.getProperty("java.specification.version")); if (jdkVersion.compareTo(javaVersionToUse) < 0) { compileTask.getLogger().warn( "Default language level for compileSdkVersion '{}' is " + "{}, but the JDK used is {}, so the JDK language level will be used.", compileSdkVersion, javaVersionToUse, jdkVersion); javaVersionToUse = jdkVersion; } compileOptions.setDefaultJavaVersion(javaVersionToUse); compileTask.setSourceCompatibility(compileOptions.getSourceCompatibility().toString()); compileTask.setTargetCompatibility(compileOptions.getTargetCompatibility().toString()); }
Example #5
Source File: DefaultAndroidProject.java From javaide with GNU General Public License v3.0 | 5 votes |
DefaultAndroidProject( @NonNull String modelVersion, @NonNull String name, @NonNull Collection<String> flavorDimensions, @NonNull String compileTarget, @NonNull Collection<String> bootClasspath, @NonNull Collection<File> frameworkSource, @NonNull Collection<SigningConfig> signingConfigs, @NonNull AaptOptions aaptOptions, @NonNull Collection<ArtifactMetaData> extraArtifacts, @NonNull Collection<String> unresolvedDependencies, @NonNull Collection<SyncIssue> syncIssues, @NonNull CompileOptions compileOptions, @NonNull LintOptions lintOptions, @NonNull File buildFolder, @Nullable String resourcePrefix, boolean isLibrary, int apiVersion) { this.modelVersion = modelVersion; this.name = name; this.flavorDimensions = flavorDimensions; this.compileTarget = compileTarget; this.bootClasspath = bootClasspath; this.frameworkSource = frameworkSource; this.signingConfigs = signingConfigs; this.aaptOptions = aaptOptions; this.extraArtifacts = extraArtifacts; this.unresolvedDependencies = unresolvedDependencies; this.syncIssues = syncIssues; javaCompileOptions = new DefaultJavaCompileOptions(compileOptions); this.lintOptions = lintOptions; this.buildFolder = buildFolder; this.resourcePrefix = resourcePrefix; this.isLibrary = isLibrary; this.apiVersion = apiVersion; }
Example #6
Source File: DefaultJavaCompileOptions.java From javaide with GNU General Public License v3.0 | 4 votes |
DefaultJavaCompileOptions(@NonNull CompileOptions options) { sourceCompatibility = options.getSourceCompatibility().toString(); targetCompatibility = options.getTargetCompatibility().toString(); encoding = options.getEncoding(); }
Example #7
Source File: BaseExtension.java From javaide with GNU General Public License v3.0 | 4 votes |
BaseExtension( @NonNull final ProjectInternal project, @NonNull Instantiator instantiator, @NonNull AndroidBuilder androidBuilder, @NonNull SdkHandler sdkHandler, @NonNull NamedDomainObjectContainer<BuildType> buildTypes, @NonNull NamedDomainObjectContainer<ProductFlavor> productFlavors, @NonNull NamedDomainObjectContainer<SigningConfig> signingConfigs, @NonNull ExtraModelInfo extraModelInfo, final boolean isLibrary) { this.androidBuilder = androidBuilder; this.sdkHandler = sdkHandler; this.buildTypes = buildTypes; //noinspection unchecked this.productFlavors = (NamedDomainObjectContainer) productFlavors; this.signingConfigs = signingConfigs; this.extraModelInfo = extraModelInfo; this.project = project; logger = Logging.getLogger(this.getClass()); defaultConfig = instantiator.newInstance(ProductFlavor.class, BuilderConstants.MAIN, project, instantiator, project.getLogger()); aaptOptions = instantiator.newInstance(AaptOptions.class); dexOptions = instantiator.newInstance(DexOptions.class); lintOptions = instantiator.newInstance(LintOptions.class); compileOptions = instantiator.newInstance(CompileOptions.class); packagingOptions = instantiator.newInstance(PackagingOptions.class); preprocessingOptions = instantiator.newInstance(PreprocessingOptions.class); splits = instantiator.newInstance(Splits.class, instantiator); sourceSetsContainer = project.container(AndroidSourceSet.class, new AndroidSourceSetFactory(instantiator, project, isLibrary)); sourceSetsContainer.whenObjectAdded(new Action<AndroidSourceSet>() { @Override public void execute(AndroidSourceSet sourceSet) { ConfigurationContainer configurations = project.getConfigurations(); createConfiguration( configurations, sourceSet.getCompileConfigurationName(), "Classpath for compiling the " + sourceSet.getName() + " sources."); String packageConfigDescription; if (isLibrary) { packageConfigDescription = "Classpath only used when publishing '" + sourceSet.getName() + "'."; } else { packageConfigDescription = "Classpath packaged with the compiled '" + sourceSet.getName() + "' classes."; } createConfiguration( configurations, sourceSet.getPackageConfigurationName(), packageConfigDescription); createConfiguration( configurations, sourceSet.getProvidedConfigurationName(), "Classpath for only compiling the " + sourceSet.getName() + " sources."); createConfiguration( configurations, sourceSet.getWearAppConfigurationName(), "Link to a wear app to embed for object '" + sourceSet.getName() + "'."); sourceSet.setRoot(String.format("src/%s", sourceSet.getName())); } }); sourceSetsContainer.create(defaultConfig.getName()); }
Example #8
Source File: BaseExtension.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Configures compile options. */ public void compileOptions(Action<CompileOptions> action) { checkWritability(); action.execute(compileOptions); }
Example #9
Source File: BaseExtension.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * {@inheritDoc} */ @Override public CompileOptions getCompileOptions() { return compileOptions; }
Example #10
Source File: AndroidConfigAdaptor.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public CompileOptions getCompileOptions() { return model.getCompileOptions(); }
Example #11
Source File: JavaCompile.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Returns the compilation options. * * @return The compilation options. */ @Nested public CompileOptions getOptions() { return compileOptions; }
Example #12
Source File: AndroidConfig.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Compile options */ CompileOptions getCompileOptions();
Example #13
Source File: AndroidConfig.java From javaide with GNU General Public License v3.0 | votes |
/** * Compile options */ CompileOptions getCompileOptions();
Example #14
Source File: AndroidConfig.java From javaide with GNU General Public License v3.0 | votes |
void setCompileOptions(CompileOptions compileOptions);