All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wisepersist.gradle.plugins.gwt.GwtCompile Maven / Gradle / Ivy

/**
 * Copyright (C) 2013-2017 Steffen Schaefer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.wisepersist.gradle.plugins.gwt;

import java.io.File;
import java.util.concurrent.Callable;

import org.gradle.api.internal.ConventionMapping;
import org.gradle.api.internal.IConventionAware;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.OutputDirectory;

/**
 * Task to run the GWT compiler for production quality output.
 */
@CacheableTask
public class GwtCompile extends AbstractGwtCompile {

	/** {@inheritDoc} */
	@Override
	@OutputDirectory
	public File getWar() {
		return super.getWar();
	}
	
	/** {@inheritDoc} */
	@Override
	protected boolean isDevTask() {
		return false;
	}
	
	protected void configure(final GwtCompileOptions options) {
		super.configure(options);
		
		ConventionMapping conventionMapping =((IConventionAware)this).getConventionMapping();
		conventionMapping.map("draftCompile", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDraftCompile();
			}
		});
		conventionMapping.map("compileReport", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getCompileReport();
			}
		});
		conventionMapping.map("compilerMetrics", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getCompilerMetrics();
			}
		});
		conventionMapping.map("validateOnly", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getValidateOnly();
			}
		});
		conventionMapping.map("disableGeneratingOnShards", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDisableGeneratingOnShards();
			}
		});
		conventionMapping.map("optimize", new Callable() {
			@Override
			public Integer call() throws Exception {
				return options.getOptimize();
			}
		});
		conventionMapping.map("disableAggressiveOptimization", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDisableAggressiveOptimization();
			}
		});
		conventionMapping.map("disableClassMetadata", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDisableClassMetadata();
			}
		});
		conventionMapping.map("disableCastChecking", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDisableCastChecking();
			}
		});
		conventionMapping.map("ea", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getEa();
			}
		});
		conventionMapping.map("disableRunAsync", new Callable() {
			@Override
			public Boolean call() throws Exception {
				return options.getDisableRunAsync();
			}
		});
		conventionMapping.map("style", new Callable