Search in sources :

Example 46 with TaskAction

use of org.gradle.api.tasks.TaskAction in project gradle by gradle.

the class AbstractLinkTask method link.

@TaskAction
public void link() {
    SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
    cleaner.setDestinationDir(getDestinationDirectory().get().getAsFile());
    cleaner.execute();
    if (getSource().isEmpty()) {
        setDidWork(cleaner.getDidWork());
        return;
    }
    LinkerSpec spec = createLinkerSpec();
    spec.setTargetPlatform(getTargetPlatform().get());
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getLinkedFile().get().getAsFile());
    spec.objectFiles(getSource());
    spec.libraries(getLibs());
    spec.args(getLinkerArgs().get());
    spec.setDebuggable(getDebuggable().get());
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);
    Compiler<LinkerSpec> compiler = createCompiler();
    compiler = BuildOperationLoggingCompilerDecorator.wrap(compiler);
    WorkResult result = compiler.execute(spec);
    setDidWork(result.getDidWork());
}
Also used : LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) WorkResult(org.gradle.api.tasks.WorkResult) SimpleStaleClassCleaner(org.gradle.language.base.internal.tasks.SimpleStaleClassCleaner) TaskAction(org.gradle.api.tasks.TaskAction)

Example 47 with TaskAction

use of org.gradle.api.tasks.TaskAction in project gradle by gradle.

the class ExtractSymbols method extractSymbols.

// TODO: Need to track version/implementation of symbol extraction tool.
@TaskAction
public void extractSymbols() {
    BuildOperationLogger operationLogger = getServices().get(BuildOperationLoggerFactory.class).newOperationLogger(getName(), getTemporaryDir());
    SymbolExtractorSpec spec = new DefaultSymbolExtractorSpec();
    spec.setBinaryFile(binaryFile.get().getAsFile());
    spec.setSymbolFile(symbolFile.get().getAsFile());
    spec.setOperationLogger(operationLogger);
    Compiler<SymbolExtractorSpec> symbolExtractor = createCompiler();
    symbolExtractor = BuildOperationLoggingCompilerDecorator.wrap(symbolExtractor);
    WorkResult result = symbolExtractor.execute(spec);
    setDidWork(result.getDidWork());
}
Also used : DefaultSymbolExtractorSpec(org.gradle.nativeplatform.internal.DefaultSymbolExtractorSpec) BuildOperationLoggerFactory(org.gradle.internal.operations.logging.BuildOperationLoggerFactory) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) WorkResult(org.gradle.api.tasks.WorkResult) SymbolExtractorSpec(org.gradle.nativeplatform.internal.SymbolExtractorSpec) DefaultSymbolExtractorSpec(org.gradle.nativeplatform.internal.DefaultSymbolExtractorSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 48 with TaskAction

use of org.gradle.api.tasks.TaskAction in project gradle by gradle.

the class PluginUnderTestMetadata method generate.

@TaskAction
public void generate() {
    Properties properties = new Properties();
    if (getPluginClasspath() != null && !getPluginClasspath().isEmpty()) {
        properties.setProperty(IMPLEMENTATION_CLASSPATH_PROP_KEY, implementationClasspath());
    }
    File outputFile = new File(getOutputDirectory(), METADATA_FILE_NAME);
    saveProperties(properties, outputFile);
}
Also used : Properties(java.util.Properties) File(java.io.File) TaskAction(org.gradle.api.tasks.TaskAction)

Example 49 with TaskAction

use of org.gradle.api.tasks.TaskAction in project gradle by gradle.

the class RunApplication method startApplication.

@TaskAction
public void startApplication() {
    DeploymentRegistry registry = getDeploymentRegistry();
    JavaApplicationHandle handle = registry.get(getPath(), JavaApplicationHandle.class);
    if (handle == null) {
        JavaExecHandleBuilder builder = getExecActionFactory().newJavaExec();
        builder.setClasspath(classpath);
        builder.setMain(mainClassName);
        builder.setArgs(arguments);
        registry.start(getPath(), changeBehavior, JavaApplicationHandle.class, builder);
    }
}
Also used : DeploymentRegistry(org.gradle.deployment.internal.DeploymentRegistry) JavaExecHandleBuilder(org.gradle.process.internal.JavaExecHandleBuilder) TaskAction(org.gradle.api.tasks.TaskAction)

Example 50 with TaskAction

use of org.gradle.api.tasks.TaskAction in project gradle by gradle.

the class CreateStartScripts method generate.

@TaskAction
public void generate() {
    StartScriptGenerator generator = new StartScriptGenerator(unixStartScriptGenerator, windowsStartScriptGenerator);
    generator.setApplicationName(getApplicationName());
    generator.setMainClassName(getMainClassName());
    generator.setDefaultJvmOpts(getDefaultJvmOpts());
    generator.setOptsEnvironmentVar(getOptsEnvironmentVar());
    generator.setExitEnvironmentVar(getExitEnvironmentVar());
    generator.setClasspath(getRelativeClasspath());
    generator.setScriptRelPath(getExecutableDir() + "/" + getUnixScript().getName());
    generator.generateUnixScript(getUnixScript());
    generator.generateWindowsScript(getWindowsScript());
}
Also used : UnixStartScriptGenerator(org.gradle.api.internal.plugins.UnixStartScriptGenerator) StartScriptGenerator(org.gradle.api.internal.plugins.StartScriptGenerator) WindowsStartScriptGenerator(org.gradle.api.internal.plugins.WindowsStartScriptGenerator) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

TaskAction (org.gradle.api.tasks.TaskAction)92 File (java.io.File)40 MtlBaseTaskAction (com.taobao.android.builder.tasks.manager.MtlBaseTaskAction)22 GradleException (org.gradle.api.GradleException)15 ArrayList (java.util.ArrayList)11 InputFile (org.gradle.api.tasks.InputFile)11 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)10 OutputFile (org.gradle.api.tasks.OutputFile)10 AndroidDependencyTree (com.taobao.android.builder.dependency.AndroidDependencyTree)9 IOException (java.io.IOException)8 Project (org.gradle.api.Project)8 WorkResult (org.gradle.api.tasks.WorkResult)8 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)8 ExecutorServicesHelper (com.taobao.android.builder.tools.concurrent.ExecutorServicesHelper)7 InvalidUserDataException (org.gradle.api.InvalidUserDataException)7 HashSet (java.util.HashSet)6 SoLibrary (com.taobao.android.builder.dependency.model.SoLibrary)5 AndroidLibrary (com.android.builder.model.AndroidLibrary)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4