Java Code Examples for org.gradle.api.tasks.TaskAction
The following examples show how to use
org.gradle.api.tasks.TaskAction. These examples are extracted from open source projects.
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 Project: scaffold-clean-architecture Source File: ValidateStructureTask.java License: MIT License | 6 votes |
@TaskAction public void validateStructureTask() throws IOException, CleanException { String packageName = FileUtils.readProperties(getProject().getProjectDir().getPath(), "package"); logger.lifecycle("Clean Architecture plugin version: {}", Utils.getVersionPlugin()); logger.lifecycle("Project Package: {}", packageName); if (!validateModelLayer()) { throw new CleanException("the model layer is invalid"); } if (!validateUseCaseLayer()) { throw new CleanException("the use case layer is invalid"); } if (!validateEntryPointLayer()) { throw new CleanException("the entry point layer is invalid"); } if (!validateDrivenAdapterLayer()) { throw new CleanException("the driven adapter layer is invalid"); } logger.lifecycle("The project is valid"); }
Example 2
Source Project: playframework Source File: JavaScriptMinify.java License: Apache License 2.0 | 6 votes |
@TaskAction void compileJavaScriptSources() { StaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs()); cleaner.addDirToClean(destinationDir.get().getAsFile()); cleaner.execute(); MinifyFileVisitor visitor = new MinifyFileVisitor(); getSource().visit(visitor); JavaScriptCompileSpec spec = new DefaultJavaScriptCompileSpec(visitor.relativeFiles, destinationDir.get().getAsFile()); workerExecutor.submit(JavaScriptMinifyRunnable.class, workerConfiguration -> { workerConfiguration.setIsolationMode(IsolationMode.PROCESS); workerConfiguration.forkOptions(options -> options.jvmArgs("-XX:MaxMetaspaceSize=256m")); workerConfiguration.params(spec); workerConfiguration.classpath(compilerClasspath); workerConfiguration.setDisplayName("Minifying JavaScript source files"); }); workerExecutor.await(); }
Example 3
Source Project: synopsys-detect Source File: GenerateDocsTask.java License: Apache License 2.0 | 6 votes |
@TaskAction public void generateDocs() throws IOException, TemplateException, IntegrationException { final Project project = getProject(); final File file = new File("synopsys-detect-" + project.getVersion() + "-help.json"); final Reader reader = new FileReader(file); final HelpJsonData helpJson = new Gson().fromJson(reader, HelpJsonData.class); final File outputDir = project.file("docs/generated"); final File troubleshootingDir = new File(outputDir, "advanced/troubleshooting"); FileUtils.deleteDirectory(outputDir); troubleshootingDir.mkdirs(); final TemplateProvider templateProvider = new TemplateProvider(project.file("docs/templates"), project.getVersion().toString()); createFromFreemarker(templateProvider, troubleshootingDir, "exit-codes", new ExitCodePage(helpJson.getExitCodes())); handleDetectors(templateProvider, outputDir, helpJson); handleProperties(templateProvider, outputDir, helpJson); handleContent(outputDir, templateProvider); }
Example 4
Source Project: client-gradle-plugin Source File: ClientNativePackage.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
@TaskAction public void action() { getProject().getLogger().info("ClientNativePackage action"); boolean result; try { SubstrateDispatcher dispatcher = new ConfigBuild(project).createSubstrateDispatcher(); result = dispatcher.nativePackage(); } catch (Exception e) { throw new GradleException("Failed to package", e); } if (!result) { throw new GradleException("Packaging failed"); } }
Example 5
Source Project: client-gradle-plugin Source File: ClientNativeLink.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
@TaskAction public void action() { getProject().getLogger().info("ClientNativeLink action"); boolean result; try { SubstrateDispatcher dispatcher = new ConfigBuild(project).createSubstrateDispatcher(); result = dispatcher.nativeLink(); } catch (Exception e) { throw new GradleException("Failed to link", e); } if (!result) { throw new GradleException("Linking failed"); } }
Example 6
Source Project: quarkus Source File: QuarkusAddExtension.java License: Apache License 2.0 | 6 votes |
@TaskAction public void addExtension() { Set<String> extensionsSet = getExtensionsToAdd() .stream() .flatMap(ext -> stream(ext.split(","))) .map(String::trim) .collect(toSet()); try { new AddExtensions(getQuarkusProject()) .extensions(extensionsSet) .execute(); } catch (Exception e) { throw new GradleException("Failed to add extensions " + getExtensionsToAdd(), e); } }
Example 7
Source Project: spring-javaformat Source File: CheckTask.java License: Apache License 2.0 | 6 votes |
@TaskAction public void checkFormatting() throws IOException, InterruptedException { List<File> problems = formatFiles().filter(FileEdit::hasEdits).map(FileEdit::getFile) .collect(Collectors.toList()); this.reportLocation.getParentFile().mkdirs(); if (!problems.isEmpty()) { StringBuilder message = new StringBuilder("Formatting violations found in the following files:\n"); problems.stream().forEach((f) -> message.append(" * " + getProject().relativePath(f) + "\n")); message.append("\nRun `format` to fix."); Files.write(this.reportLocation.toPath(), Collections.singletonList(message.toString()), StandardOpenOption.CREATE); throw new GradleException(message.toString()); } else { this.reportLocation.createNewFile(); } }
Example 8
Source Project: pushfish-android Source File: Wrapper.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction void generate() { File jarFileDestination = getJarFile(); File unixScript = getScriptFile(); FileResolver resolver = getFileLookup().getFileResolver(unixScript.getParentFile()); String jarFileRelativePath = resolver.resolveAsRelativePath(jarFileDestination); writeProperties(getPropertiesFile()); URL jarFileSource = Wrapper.class.getResource("/gradle-wrapper.jar"); if (jarFileSource == null) { throw new GradleException("Cannot locate wrapper JAR resource."); } GFileUtils.copyURLToFile(jarFileSource, jarFileDestination); StartScriptGenerator generator = new StartScriptGenerator(); generator.setApplicationName("Gradle"); generator.setMainClassName(GradleWrapperMain.class.getName()); generator.setClasspath(WrapUtil.toList(jarFileRelativePath)); generator.setOptsEnvironmentVar("GRADLE_OPTS"); generator.setExitEnvironmentVar("GRADLE_EXIT_CONSOLE"); generator.setAppNameSystemProperty("org.gradle.appname"); generator.setScriptRelPath(unixScript.getName()); generator.generateUnixScript(unixScript); generator.generateWindowsScript(getBatchScript()); }
Example 9
Source Project: pushfish-android Source File: ScalaCompile.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction protected void compile() { checkScalaClasspathIsNonEmpty(); DefaultScalaJavaJointCompileSpec spec = new DefaultScalaJavaJointCompileSpec(); spec.setSource(getSource()); spec.setDestinationDir(getDestinationDir()); spec.setWorkingDir(getProject().getProjectDir()); spec.setTempDir(getTemporaryDir()); spec.setClasspath(getClasspath()); spec.setScalaClasspath(getScalaClasspath()); spec.setZincClasspath(getZincClasspath()); spec.setSourceCompatibility(getSourceCompatibility()); spec.setTargetCompatibility(getTargetCompatibility()); spec.setCompileOptions(compileOptions); spec.setScalaCompileOptions(scalaCompileOptions); if (!scalaCompileOptions.isUseAnt()) { configureIncrementalCompilation(spec); } getCompiler(spec).execute(spec); }
Example 10
Source Project: jig Source File: VerifyJigEnvironmentTask.java License: Apache License 2.0 | 6 votes |
@TaskAction void verify() { try { GraphvizCmdLineEngine graphvizCmdLineEngine = new GraphvizCmdLineEngine(); GraphvizjView.confirmInstalledGraphviz(graphvizCmdLineEngine); } catch(RuntimeException e) { Logger logger = getLogger(); logger.warn("-- JIG ERROR -----------------------------------------------"); logger.warn("+ 実行可能なGraphvizが見つけられませんでした。"); logger.warn("+ dotにPATHが通っているか確認してください。"); logger.warn("+ JIGはダイアグラムの出力にGraphvizを使用しています。"); logger.warn("+ "); logger.warn("+ Graphvizは以下から入手できます。"); logger.warn("+ https://www.graphviz.org/"); logger.warn("------------------------------------------------------------"); throw e; } }
Example 11
Source Project: pushfish-android Source File: GenerateIvyDescriptor.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction public void doGenerate() { IvyModuleDescriptorSpecInternal descriptorInternal = toIvyModuleDescriptorInternal(getDescriptor()); IvyDescriptorFileGenerator ivyGenerator = new IvyDescriptorFileGenerator(descriptorInternal.getProjectIdentity()); ivyGenerator.setStatus(descriptorInternal.getStatus()); ivyGenerator.setBranch(descriptorInternal.getBranch()); ivyGenerator.setExtraInfo(descriptorInternal.getExtraInfo().asMap()); for (IvyConfiguration ivyConfiguration : descriptorInternal.getConfigurations()) { ivyGenerator.addConfiguration(ivyConfiguration); } for (IvyArtifact ivyArtifact : descriptorInternal.getArtifacts()) { ivyGenerator.addArtifact(ivyArtifact); } for (IvyDependencyInternal ivyDependency : descriptorInternal.getDependencies()) { ivyGenerator.addDependency(ivyDependency); } ivyGenerator.withXml(descriptorInternal.getXmlAction()).writeTo(getDestination()); }
Example 12
Source Project: pushfish-android Source File: GeneratorTask.java License: BSD 2-Clause "Simplified" License | 6 votes |
@SuppressWarnings("UnusedDeclaration") @TaskAction void generate() { File inputFile = getInputFile(); if (inputFile != null && inputFile.exists()) { try { domainObject = generator.read(inputFile); } catch (RuntimeException e) { throw new GradleException(String.format("Cannot parse file '%s'.\n" + " Perhaps this file was tinkered with? In that case try delete this file and then retry.", inputFile), e); } } else { domainObject = generator.defaultInstance(); } beforeConfigured.execute(domainObject); generator.configure(domainObject); afterConfigured.execute(domainObject); generator.write(domainObject, getOutputFile()); }
Example 13
Source Project: pushfish-android Source File: Wrapper.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction void generate() { File jarFileDestination = getJarFile(); File unixScript = getScriptFile(); FileResolver resolver = getServices().get(FileLookup.class).getFileResolver(unixScript.getParentFile()); String jarFileRelativePath = resolver.resolveAsRelativePath(jarFileDestination); writeProperties(getPropertiesFile()); URL jarFileSource = Wrapper.class.getResource("/gradle-wrapper.jar"); if (jarFileSource == null) { throw new GradleException("Cannot locate wrapper JAR resource."); } GFileUtils.copyURLToFile(jarFileSource, jarFileDestination); StartScriptGenerator generator = new StartScriptGenerator(); generator.setApplicationName("Gradle"); generator.setMainClassName(GradleWrapperMain.class.getName()); generator.setClasspath(WrapUtil.toList(jarFileRelativePath)); generator.setOptsEnvironmentVar("GRADLE_OPTS"); generator.setExitEnvironmentVar("GRADLE_EXIT_CONSOLE"); generator.setAppNameSystemProperty("org.gradle.appname"); generator.setScriptRelPath(unixScript.getName()); generator.generateUnixScript(unixScript); generator.generateWindowsScript(getBatchScript()); }
Example 14
Source Project: playframework Source File: PlayRun.java License: Apache License 2.0 | 6 votes |
@TaskAction public void run() { String deploymentId = getPath(); DeploymentRegistry deploymentRegistry = getDeploymentRegistry(); PlayApplicationDeploymentHandle deploymentHandle = deploymentRegistry.get(deploymentId, PlayApplicationDeploymentHandle.class); if (deploymentHandle == null) { PlayRunSpec spec = new DefaultPlayRunSpec(runtimeClasspath, changingClasspath, applicationJar.getAsFile().get(), assetsJar.getAsFile().get(), assetsDirs, workingDir.get().getAsFile(), getForkOptions(), getHttpPort().get()); PlayApplicationRunner playApplicationRunner = PlayApplicationRunnerFactory.create(platform.get(), getWorkerProcessFactory(), getClasspathFingerprinter()); deploymentHandle = deploymentRegistry.start(deploymentId, DeploymentRegistry.ChangeBehavior.BLOCK, PlayApplicationDeploymentHandle.class, spec, playApplicationRunner); InetSocketAddress playAppAddress = deploymentHandle.getPlayAppAddress(); String playUrl = "http://localhost:" + playAppAddress.getPort() + "/"; LOGGER.warn("Running Play App ({}) at {}", getPath(), playUrl); } }
Example 15
Source Project: pushfish-android Source File: AbstractReportTask.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction public void generate() { try { ReportRenderer renderer = getRenderer(); File outputFile = getOutputFile(); if (outputFile != null) { renderer.setOutputFile(outputFile); } else { renderer.setOutput(getServices().get(StyledTextOutputFactory.class).create(getClass())); } Set<Project> projects = new TreeSet<Project>(getProjects()); for (Project project : projects) { renderer.startProject(project); generate(project); renderer.completeProject(project); } renderer.complete(); } catch (IOException e) { throw new UncheckedIOException(e); } }
Example 16
Source Project: pushfish-android Source File: GenerateIvyDescriptor.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction public void doGenerate() { IvyModuleDescriptorInternal descriptorInternal = toIvyModuleDescriptorInternal(getDescriptor()); IvyDescriptorFileGenerator ivyGenerator = new IvyDescriptorFileGenerator(descriptorInternal.getProjectIdentity()); ivyGenerator.setStatus(descriptorInternal.getStatus()); for (IvyConfiguration ivyConfiguration : descriptorInternal.getConfigurations()) { ivyGenerator.addConfiguration(ivyConfiguration); } for (IvyArtifact ivyArtifact : descriptorInternal.getArtifacts()) { ivyGenerator.addArtifact(ivyArtifact); } for (IvyDependencyInternal ivyDependency : descriptorInternal.getDependencies()) { ivyGenerator.addDependency(ivyDependency); } ivyGenerator.withXml(descriptorInternal.getXmlAction()).writeTo(getDestination()); }
Example 17
Source Project: pushfish-android Source File: GeneratorTask.java License: BSD 2-Clause "Simplified" License | 6 votes |
@SuppressWarnings("UnusedDeclaration") @TaskAction void generate() { File inputFile = getInputFile(); if (inputFile != null && inputFile.exists()) { try { domainObject = generator.read(inputFile); } catch (RuntimeException e) { throw new GradleException(String.format("Cannot parse file '%s'.\n" + " Perhaps this file was tinkered with? In that case try delete this file and then retry.", inputFile), e); } } else { domainObject = generator.defaultInstance(); } beforeConfigured.execute(domainObject); generator.configure(domainObject); afterConfigured.execute(domainObject); generator.write(domainObject, getOutputFile()); }
Example 18
Source Project: pushfish-android Source File: GroovyCompile.java License: BSD 2-Clause "Simplified" License | 6 votes |
@TaskAction protected void compile() { checkGroovyClasspathIsNonEmpty(); DefaultGroovyJavaJointCompileSpec spec = new DefaultGroovyJavaJointCompileSpec(); spec.setSource(getSource()); spec.setDestinationDir(getDestinationDir()); spec.setClasspath(getClasspath()); spec.setSourceCompatibility(getSourceCompatibility()); spec.setTargetCompatibility(getTargetCompatibility()); spec.setGroovyClasspath(getGroovyClasspath()); spec.setCompileOptions(compileOptions); spec.setGroovyCompileOptions(groovyCompileOptions); if (spec.getGroovyCompileOptions().getStubDir() == null) { File dir = tempFileProvider.newTemporaryFile("groovy-java-stubs"); GFileUtils.mkdirs(dir); spec.getGroovyCompileOptions().setStubDir(dir); } WorkResult result = compiler.execute(spec); setDidWork(result.getDidWork()); }
Example 19
Source Project: swaggerhub-gradle-plugin Source File: DownloadTask.java License: Apache License 2.0 | 6 votes |
@TaskAction public void downloadDefinition() throws GradleException { SwaggerHubClient swaggerHubClient = new SwaggerHubClient(host, port, protocol, token); LOGGER.info("Downloading from " + host + ": api:" + api + ", owner:" + owner + ", version:" + version + ", format:" + format + ", outputFile:" + outputFile); SwaggerHubRequest swaggerHubRequest = new SwaggerHubRequest.Builder(api, owner, version) .format(format) .build(); try { String swaggerJson = swaggerHubClient.getDefinition(swaggerHubRequest); File file = new File(outputFile); setUpOutputDir(file); Files.write(Paths.get(outputFile), swaggerJson.getBytes(Charset.forName("UTF-8"))); } catch (IOException | GradleException e) { throw new GradleException(e.getMessage(), e); } }
Example 20
Source Project: javafxmobile-plugin Source File: DesugarTask.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Gradle's entry-point into this task. Determines whether or not it's possible to do this task * incrementally and calls either doIncrementalTaskAction() if an incremental build is possible, * and doFullTaskAction() if not. */ @TaskAction void taskAction(IncrementalTaskInputs inputs) throws Exception { initDesugarJar(getProject().getExtensions().findByType(JFXMobileExtension.class).getAndroidExtension().getBuildCache()); if (Files.notExists(inputDir.toPath())) { PathUtils.deleteIfExists(outputDir.toPath()); } else { processSingle(inputDir.toPath(), outputDir.toPath(), Collections.emptySet()); } waitableExecutor.waitForTasksWithQuickFail(true); processNonCachedOnes(getClasspath()); waitableExecutor.waitForTasksWithQuickFail(true); }
Example 21
Source Project: javafxmobile-plugin Source File: Retrolambda.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
@TaskAction public void action() { RetrolambdaExec exec = new RetrolambdaExec(getProject()); exec.setInputDir(getRetrolambdaInput()); exec.setOutputDir(getRetrolambdaOutput()); exec.setBytecodeVersion(50); if (getClasspath() == null || getClasspath().isEmpty()) { exec.setRetrolambdaClasspath(getProject().files(getRetrolambdaInput())); } else { exec.setRetrolambdaClasspath(getProject().files(getRetrolambdaInput(), getClasspath())); } exec.setDefaultMethods(true); exec.setJvmArgs(Collections.emptyList()); exec.exec(); }
Example 22
Source Project: scaffold-clean-architecture Source File: GenerateStructureTask.java License: MIT License | 5 votes |
@TaskAction public void generateStructureTask() throws IOException, CleanException { logger.lifecycle("Clean Architecture plugin version: {}", Utils.getVersionPlugin()); logger.lifecycle("Package: {}", packageName); logger.lifecycle("Project Type: {}", type); logger.lifecycle("Project Name: {}", name); builder.addParamPackage(packageName); builder.addParam("projectName", name); builder.addParam("reactive", type == ProjectType.REACTIVE); builder.addParam("jacoco", coverage == CoveragePlugin.JACOCO); builder.addParam("cobertura", coverage == CoveragePlugin.COBERTURA); builder.setupFromTemplate("structure"); builder.persist(); }
Example 23
Source Project: playframework Source File: TwirlCompile.java License: Apache License 2.0 | 5 votes |
@TaskAction void compile() { RelativeFileCollector relativeFileCollector = new RelativeFileCollector(); getSource().visit(relativeFileCollector); final TwirlCompileSpec spec = new DefaultTwirlCompileSpec(relativeFileCollector.relativeFiles, getOutputDirectory().get().getAsFile(), getDefaultImports().get(), userTemplateFormats.get(), additionalImports.get(), constructorAnnotations.get()); workerExecutor.submit(TwirlCompileRunnable.class, workerConfiguration -> { workerConfiguration.setIsolationMode(IsolationMode.PROCESS); workerConfiguration.forkOptions(options -> options.jvmArgs("-XX:MaxMetaspaceSize=256m")); workerConfiguration.params(spec, getCompiler()); workerConfiguration.classpath(twirlCompilerClasspath); workerConfiguration.setDisplayName("Generating Scala source from Twirl templates"); }); workerExecutor.await(); }
Example 24
Source Project: scaffold-clean-architecture Source File: GenerateEntryPointTask.java License: MIT License | 5 votes |
@TaskAction public void generateEntryPointTask() throws IOException, CleanException { if (type == null) { throw new IllegalArgumentException("No Entry Point is set, usage: gradle generateEntryPoint --type " + Utils.formatTaskOptions(getTypes())); } ModuleFactory moduleFactory = ModuleFactoryEntryPoint.getEntryPointFactory(type); logger.lifecycle("Clean Architecture plugin version: {}", Utils.getVersionPlugin()); logger.lifecycle("Entry Point type: {}", type); builder.addParam("task-param-name", name); moduleFactory.buildModule(builder); builder.persist(); }
Example 25
Source Project: scaffold-clean-architecture Source File: GenerateDrivenAdapterTask.java License: MIT License | 5 votes |
@TaskAction public void generateDrivenAdapterTask() throws IOException, CleanException { if (type == null) { throw new IllegalArgumentException("No Driven Adapter type is set, usage: gradle generateDrivenAdapter " + "--type " + Utils.formatTaskOptions(getTypes())); } ModuleFactory moduleFactory = ModuleFactoryDrivenAdapter.getDrivenAdapterFactory(type); logger.lifecycle("Clean Architecture plugin version: {}", Utils.getVersionPlugin()); logger.lifecycle("Driven Adapter type: {}", type); builder.addParam("task-param-name", name); builder.addParam("include-secret", secret == BooleanOption.TRUE); moduleFactory.buildModule(builder); builder.persist(); }
Example 26
Source Project: scaffold-clean-architecture Source File: GeneratePipelineTask.java License: MIT License | 5 votes |
@TaskAction public void generatePipelineTask() throws IOException, CleanException { if (type == null) { throw new IllegalArgumentException("No Pipeline type was set, usage: gradle generatePipeline --type " + Utils.formatTaskOptions(getTypes())); } ModuleFactory pipelineFactory = ModuleFactoryPipeline.getPipelineFactory(type); logger.lifecycle("Clean Architecture plugin version: {}", Utils.getVersionPlugin()); logger.lifecycle("Pipeline type: {}", type); pipelineFactory.buildModule(builder); builder.persist(); }
Example 27
Source Project: scaffold-clean-architecture Source File: DeleteModuleTask.java License: MIT License | 5 votes |
@TaskAction public void deleteModule() throws IOException { if (module == null || !getProject().getChildProjects().containsKey(module)) { throw new IllegalArgumentException("No valid module name is set, usage: gradle deleteModule --module " + Utils.formatTaskOptions(getModules())); } builder.deleteModule(module); builder.removeFromSettings(module); builder.removeDependencyFromModule("app-service", "implementation project(':" + module + "')"); builder.persist(); }
Example 28
Source Project: synopsys-detect Source File: UpdateArtifactoryPropertiesTask.java License: Apache License 2.0 | 5 votes |
@TaskAction public void updateArtifactoryProperties() { final String projectVersion = project.getVersion().toString(); final boolean isSnapshot = StringUtils.endsWith(projectVersion, "-SNAPSHOT"); if (isSnapshot || "true".equals(project.findProperty("qa.build"))) { logger.alwaysLog("For a snapshot or qa build, artifactory properties will not be updated."); } else { try { logger.alwaysLog("For a release build, an update of artifactory properties will be attempted."); final String artifactoryDeployerUsername = getExtensionProperty(Common.PROPERTY_ARTIFACTORY_DEPLOYER_USERNAME); final String artifactoryDeployerPassword = getExtensionProperty(Common.PROPERTY_ARTIFACTORY_DEPLOYER_PASSWORD); final String artifactoryDeploymentUrl = getExtensionProperty(Common.PROPERTY_DEPLOY_ARTIFACTORY_URL); final String artifactoryRepository = getExtensionProperty(Common.PROPERTY_ARTIFACTORY_REPO); final String artifactoryDownloadUrl = getExtensionProperty(Common.PROPERTY_DOWNLOAD_ARTIFACTORY_URL); final String artifactoryCredentials = String.format("%s:%s", artifactoryDeployerUsername, artifactoryDeployerPassword); final List<String> defaultCurlArgs = Arrays.asList("--silent", "--insecure", "--user", artifactoryCredentials, "--header", "Content-Type: application/json"); final Optional<ArtifactSearchResultElement> currentArtifact = findCurrentArtifact(defaultCurlArgs, artifactoryDeploymentUrl, artifactoryRepository); if (currentArtifact.isPresent()) { final String majorVersion = projectVersion.split("\\.")[0]; final String majorVersionPropertyKey = String.format("%s_%s", LATEST_PROPERTY_KEY, majorVersion); final String downloadUri = currentArtifact.get().getDownloadUri(); final String updatedDownloadUri = downloadUri.replace(artifactoryDeploymentUrl, artifactoryDownloadUrl); setArtifactoryProperty(defaultCurlArgs, artifactoryDeploymentUrl, artifactoryRepository, LATEST_PROPERTY_KEY, updatedDownloadUri); setArtifactoryProperty(defaultCurlArgs, artifactoryDeploymentUrl, artifactoryRepository, majorVersionPropertyKey, updatedDownloadUri); } else { logger.alwaysLog(String.format("Artifactory properties won't be updated since %s-%s was not found.", project.getName(), projectVersion)); } } catch (final ExecutableRunnerException e) { logger.alwaysLog(String.format("Manual corrections to the properties for %s-%s may be necessary.", project.getName(), projectVersion)); logger.error(String.format("Error correcting the artifactory properties: %s", e.getMessage()), e); } } }
Example 29
Source Project: quarkus Source File: QuarkusRemoveExtension.java License: Apache License 2.0 | 5 votes |
@TaskAction public void removeExtension() { Set<String> extensionsSet = getExtensionsToRemove() .stream() .flatMap(ext -> stream(ext.split(","))) .map(String::trim) .collect(toSet()); try { new RemoveExtensions(getQuarkusProject()) .extensions(extensionsSet) .execute(); } catch (Exception e) { throw new GradleException("Failed to remove extensions " + getExtensionsToRemove(), e); } }
Example 30
Source Project: client-gradle-plugin Source File: ClientNativeRun.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
@TaskAction public void action() { getProject().getLogger().info("ClientNativeRun action"); try { SubstrateDispatcher dispatcher = new ConfigBuild(project).createSubstrateDispatcher(); dispatcher.nativeRun(); } catch (Exception e) { e.printStackTrace(); } }