Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.2-jdk11'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	build.gradle.kts
  • Loading branch information
v1nc3n4 committed May 30, 2021
2 parents 3c8bb84 + 412e3f5 commit 27e17eb
Show file tree
Hide file tree
Showing 53 changed files with 916 additions and 569 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Hi,
- OS: [e.g. Ubuntu 18.04.1, Windows 10 Pro, Mac OS X]
- JDK: [e.g. Oracle JDK 11 64 bits]
- Gradle: [e.g. Gradle 6.8]
- Frontend Gradle plugin: [e.g. 5.1.0 JDK 11]
- Frontend Gradle plugin: [e.g. 5.2.0 JDK 11]

Settings in `build.gradle[.kts]` file:
```groovy
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2 align="center">Frontend Gradle plugin - Integrated <a href="https://nodejs.org/" title="Node.js">Node.js</a>, <a href="https://www.npmjs.com/" title="npm">npm</a>, <a href="https://yarnpkg.com/" title="Yarn">Yarn</a> builds</h2>
<p align="center">
<a href="https://github.com/siouan/frontend-gradle-plugin/releases/tag/v5.1.0"><img src="https://img.shields.io/badge/Latest%20release-5.1.0-blue.svg" alt="Latest release 5.1.0"/></a>
<a href="https://github.com/siouan/frontend-gradle-plugin/releases/tag/v5.2.0"><img src="https://img.shields.io/badge/Latest%20release-5.2.0-blue.svg" alt="Latest release 5.2.0"/></a>
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-green.svg" alt="License Apache 2.0"/></a>
<br/>
<a href="https://github.com/siouan/frontend-gradle-plugin/actions/workflows/build.yml"><img src="https://github.com/siouan/frontend-gradle-plugin/actions/workflows/build.yml/badge.svg?branch=master" alt="Build status"/></a>
Expand Down Expand Up @@ -48,6 +48,7 @@ With their feedback, plugin improvement is possible. Special thanks to:
@[ckosloski](https://github.com/ckosloski),
@[davidkron](https://github.com/davidkron),
@[fdw](https://github.com/fdw),
@[joschi](https://github.com/joschi),
@[jorgheymans](https://github.com/jorgheymans),
@[ludik0](https://github.com/ludik0),
@[mike-howell](https://github.com/mike-howell),
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ sonarqube {
property("sonar.organization", "siouan")
property("sonar.projectKey", "siouan_frontend-gradle-plugin")
property("sonar.projectName", "frontend-gradle-plugin")
property("sonar.projectVersion", "5.1.0")
property("sonar.projectVersion", "5.2.0")

property("sonar.links.homepage", "https://github.com/siouan/frontend-gradle-plugin")
property("sonar.links.ci", "https://travis-ci.com/siouan/frontend-gradle-plugin")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id 'org.siouan.frontend-jdk11' version '5.1.0'
id 'org.siouan.frontend-jdk11' version '5.2.0'
}
repositories {
gradlePluginPortal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'io.spring.dependency-management'
}

version '5.1.0'
version '5.2.0'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-projects-war-application/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginManagement {
id 'war'
id 'org.springframework.boot' version '2.4.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.siouan.frontend-jdk11' version '5.1.0'
id 'org.siouan.frontend-jdk11' version '5.2.0'
}
repositories {
gradlePluginPortal()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id 'org.siouan.frontend-jdk11' version '5.1.0'
id 'org.siouan.frontend-jdk11' version '5.2.0'
}
repositories {
gradlePluginPortal()
Expand Down
2 changes: 1 addition & 1 deletion examples/single-project-application/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id 'org.siouan.frontend-jdk11' version '5.1.0'
id 'org.siouan.frontend-jdk11' version '5.2.0'
}
repositories {
gradlePluginPortal()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fgpArtifactId=frontend-gradle-plugin-jdk11
fgpGroup=org.siouan
fgpVersion=5.1.0
fgpVersion=5.2.0
fgpDisplayName=Frontend Gradle plugin
fgpDescription=Build frontend applications with Node, NPM, Yarn: distribution management, configurable tasks (build, test, publish), additional types, support of NPX.
fgpPluginId=org.siouan.frontend-jdk11
Expand Down
2 changes: 1 addition & 1 deletion site/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.siouan.frontend-jdk11") version "5.0.1"
id("org.siouan.frontend-jdk11") version "5.1.0"
}

frontend {
Expand Down
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "frontend-gradle-plugin-site",
"description": "Frontend Gradle plugin's official site",
"license": "Apache-2.0",
"version": "5.1.0",
"version": "5.2.0",
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
Expand Down
20 changes: 10 additions & 10 deletions site/src/pages/getting-started.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<fgp-sub-title>Requirements</fgp-sub-title>
<ul>
<li><fgp-gradle-link /> 5.1+</li>
<li><fgp-gradle-link /> 6.1+</li>
<li>JDK 8+ 64 bits</li>
<li>
The plugin is built and tested on Linux, Mac OS, Windows (see the list of build environments used in
Expand All @@ -23,7 +23,7 @@
Starting from release <fgp-repo-link path="/releases/tag/v3.0.1">3.0.1</fgp-repo-link>, ID
<fgp-code>org.siouan.frontend</fgp-code> and classpath
<fgp-code>org.siouan:frontend-gradle-plugin:&lt;version></fgp-code> are deprecated. If you are already using
the plugin, we recommend <fgp-repo-link path="/releases/tag/v5.1.0">upgrading</fgp-repo-link> to the latest
the plugin, we recommend <fgp-repo-link path="/releases/tag/v5.2.0">upgrading</fgp-repo-link> to the latest
release as soon as possible.
</fgp-info>
<ol>
Expand All @@ -41,17 +41,17 @@
<template v-slot:groovy>
<pre><fgp-code>plugins {
<fgp-code-comment>// For JDK 11+</fgp-code-comment>
id 'org.siouan.frontend-jdk11' version '5.1.0'
id 'org.siouan.frontend-jdk11' version '5.2.0'
<fgp-code-comment>// For JDK 8+</fgp-code-comment>
id 'org.siouan.frontend-jdk8' version '5.1.0'
id 'org.siouan.frontend-jdk8' version '5.2.0'
}</fgp-code></pre>
</template>
<template v-slot:kotlin>
<pre><fgp-code>plugins {
<fgp-code-comment>// For JDK 11+</fgp-code-comment>
id("org.siouan.frontend-jdk11") version "5.1.0"
id("org.siouan.frontend-jdk11") version "5.2.0"
<fgp-code-comment>// For JDK 8+</fgp-code-comment>
id("org.siouan.frontend-jdk8") version "5.1.0"
id("org.siouan.frontend-jdk8") version "5.2.0"
}</fgp-code></pre>
</template>
</fgp-gradle-scripts>
Expand All @@ -70,9 +70,9 @@
}
dependencies {
<fgp-code-comment>// For JDK 11+</fgp-code-comment>
classpath 'org.siouan:frontend-gradle-plugin-jdk11:5.1.0'
classpath 'org.siouan:frontend-gradle-plugin-jdk11:5.2.0'
<fgp-code-comment>// For JDK 8+</fgp-code-comment>
classpath 'org.siouan:frontend-gradle-plugin-jdk8:5.1.0'
classpath 'org.siouan:frontend-gradle-plugin-jdk8:5.2.0'
}
}

Expand All @@ -88,9 +88,9 @@ apply plugin: 'org.siouan.frontend-jdk8'</fgp-code></pre>
}
dependencies {
<fgp-code-comment>// For JDK 11+</fgp-code-comment>
classpath("org.siouan:frontend-gradle-plugin-jdk11:5.1.0")
classpath("org.siouan:frontend-gradle-plugin-jdk11:5.2.0")
<fgp-code-comment>// For JDK 8+</fgp-code-comment>
classpath("org.siouan:frontend-gradle-plugin-jdk8:5.1.0")
classpath("org.siouan:frontend-gradle-plugin-jdk8:5.2.0")
}
}

Expand Down
6 changes: 3 additions & 3 deletions site/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
- Integrated <fgp-nodejs-link />, <fgp-npm-link />, <fgp-yarn-link /> builds
</small>
<fgp-image-link
href="https://github.com/siouan/frontend-gradle-plugin/releases/tag/v5.1.0"
src="https://img.shields.io/badge/Latest%20release-5.1.0-blue.svg"
alt="Latest release 5.1.0"
href="https://github.com/siouan/frontend-gradle-plugin/releases/tag/v5.2.0"
src="https://img.shields.io/badge/Latest%20release-5.2.0-blue.svg"
alt="Latest release 5.2.0"
class="ml-1"
/>
</fgp-main-title>
Expand Down
10 changes: 5 additions & 5 deletions site/src/static/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://siouan.github.io/frontend-gradle-plugin/</loc>
<lastmod>2021-05-02</lastmod>
<lastmod>2021-05-30</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://siouan.github.io/frontend-gradle-plugin/getting-started/</loc>
<lastmod>2021-05-02</lastmod>
<lastmod>2021-05-30</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://siouan.github.io/frontend-gradle-plugin/configuration/</loc>
<lastmod>2021-05-02</lastmod>
<lastmod>2021-05-30</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://siouan.github.io/frontend-gradle-plugin/node-npm-npx-yarn-tasks/</loc>
<lastmod>2021-05-02</lastmod>
<lastmod>2021-05-30</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://siouan.github.io/frontend-gradle-plugin/faqs/</loc>
<lastmod>2021-05-02</lastmod>
<lastmod>2021-05-30</lastmod>
<changefreq>weekly</changefreq>
</url>
</urlset>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public final class GradleHelper {

private static final String MINIMAL_GRADLE_VERSION = "5.1";
private static final String MINIMAL_GRADLE_VERSION = "6.1";

private GradleHelper() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package org.siouan.frontendgradleplugin;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.function.BiPredicate;
import javax.annotation.Nonnull;

import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
Expand All @@ -16,20 +12,18 @@
import org.gradle.api.tasks.TaskContainer;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.language.base.plugins.LifecycleBasePlugin;
import org.siouan.frontendgradleplugin.domain.model.Environment;
import org.siouan.frontendgradleplugin.domain.model.Platform;
import org.siouan.frontendgradleplugin.domain.model.SystemProxySettings;
import org.siouan.frontendgradleplugin.domain.util.SystemUtils;
import org.siouan.frontendgradleplugin.infrastructure.BeanRegistry;
import org.siouan.frontendgradleplugin.infrastructure.BeanRegistryException;
import org.siouan.frontendgradleplugin.domain.model.SystemSettingsProvider;
import org.siouan.frontendgradleplugin.infrastructure.Beans;
import org.siouan.frontendgradleplugin.infrastructure.gradle.AssembleTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.CheckTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.CleanTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.FrontendExtension;
import org.siouan.frontendgradleplugin.infrastructure.gradle.GradleSettings;
import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallDependenciesTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.NodeInstallTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.PublishTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.SystemExtension;
import org.siouan.frontendgradleplugin.infrastructure.gradle.SystemSettingsProviderImpl;
import org.siouan.frontendgradleplugin.infrastructure.gradle.TaskLoggerConfigurer;
import org.siouan.frontendgradleplugin.infrastructure.gradle.YarnInstallTask;
import org.siouan.frontendgradleplugin.infrastructure.gradle.adapter.GradleLoggerAdapter;
Expand Down Expand Up @@ -77,29 +71,29 @@ public class FrontendGradlePlugin implements Plugin<Project> {
public static final String PUBLISH_TASK_NAME = "publishFrontend";

/**
* Name of the task that installs a Node.js distribution.
* Default port for the proxy server handling HTTP requests.
*/
public static final String DEFAULT_NODE_INSTALL_DIRNAME = "node";
public static final int DEFAULT_HTTP_PROXY_PORT = 80;

/**
* URL pattern used to download the Node.js distribution.
* Default port for the proxy server handling HTTPS requests.
*/
public static final String DEFAULT_NODE_DISTRIBUTION_URL_PATH_PATTERN = "vVERSION/node-vVERSION-ARCH.TYPE";
public static final int DEFAULT_HTTPS_PROXY_PORT = 443;

/**
* URL pattern used to download the Node.js distribution.
* Name of the task that installs a Node.js distribution.
*/
public static final String DEFAULT_NODE_DISTRIBUTION_URL_ROOT = "https://nodejs.org/dist/";
public static final String DEFAULT_NODE_INSTALL_DIRNAME = "node";

/**
* Default port for the proxy server handling HTTP requests.
* URL pattern used to download the Node.js distribution.
*/
public static final int DEFAULT_HTTP_PROXY_PORT = 80;
public static final String DEFAULT_NODE_DISTRIBUTION_URL_PATH_PATTERN = "vVERSION/node-vVERSION-ARCH.TYPE";

/**
* Default port for the proxy server handling HTTPS requests.
* URL pattern used to download the Node.js distribution.
*/
public static final int DEFAULT_HTTPS_PROXY_PORT = 443;
public static final String DEFAULT_NODE_DISTRIBUTION_URL_ROOT = "https://nodejs.org/dist/";

/**
* URL pattern used to download the Yarn distribution.
Expand Down Expand Up @@ -162,17 +156,11 @@ public void apply(final Project project) {
project.getPluginManager().apply(BasePlugin.class);
project.getPluginManager().apply(PublishingPlugin.class);

final Path nodejsHomePath = getEnvironmentVariable(NODEJS_HOME_ENV_VAR).map(Paths::get).orElse(null);
final Path yarnHomePath = getEnvironmentVariable(YARN_HOME_ENV_VAR).map(Paths::get).orElse(null);
final SystemProxySettings systemProxySettings = new SystemProxySettings(SystemUtils.getHttpProxyHost(),
SystemUtils.getHttpProxyPort().orElse(DEFAULT_HTTP_PROXY_PORT), SystemUtils.getHttpsProxyHost(),
SystemUtils.getHttpsProxyPort().orElse(DEFAULT_HTTPS_PROXY_PORT), SystemUtils.getNonProxyHosts());
final Platform platform = new Platform(SystemUtils.getSystemJvmArch(), SystemUtils.getSystemOsName(),
new Environment(nodejsHomePath, yarnHomePath));
final SystemExtension systemExtension = new SystemExtension(project.getProviders());

final FrontendExtension extension = project
.getExtensions()
.create(EXTENSION_NAME, FrontendExtension.class, project);
.create(EXTENSION_NAME, FrontendExtension.class, project.getObjects());

extension.getNodeDistributionProvided().convention(false);
extension.getNodeDistributionUrlRoot().convention(DEFAULT_NODE_DISTRIBUTION_URL_ROOT);
Expand All @@ -193,6 +181,22 @@ public void apply(final Project project) {
extension.getHttpsProxyPort().convention(DEFAULT_HTTPS_PROXY_PORT);
extension.getVerboseModeEnabled().convention(false);

final SystemSettingsProvider systemSettingsProvider = new SystemSettingsProviderImpl(systemExtension,
DEFAULT_HTTP_PROXY_PORT, DEFAULT_HTTPS_PROXY_PORT);
final GradleSettings gradleSettings = new GradleSettings(project.getLogging().getLevel(),
project.getGradle().getStartParameter().getLogLevel());
final String beanRegistryId = Beans.getBeanRegistryId(project.getLayout().getProjectDirectory().toString());
Beans.initBeanRegistry(beanRegistryId);
Beans.registerBean(beanRegistryId, extension);
Beans.registerBean(beanRegistryId, systemSettingsProvider);
Beans.registerBean(beanRegistryId, gradleSettings);
Beans.registerBean(beanRegistryId, GradleLoggerAdapter.class);
Beans.registerBean(beanRegistryId, TaskLoggerConfigurer.class);
Beans.registerBean(beanRegistryId, FileManagerImpl.class);
Beans.registerBean(beanRegistryId, ChannelProviderImpl.class);
Beans.registerBean(beanRegistryId, ArchiverProviderImpl.class);
Beans.registerBean(beanRegistryId, HttpClientProviderImpl.class);

final TaskContainer taskContainer = project.getTasks();
taskContainer.register(NODE_INSTALL_TASK_NAME, NodeInstallTask.class,
task -> configureNodeInstallTask(task, extension));
Expand All @@ -215,24 +219,6 @@ public void apply(final Project project) {
configureDependency(taskContainer, PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME, PUBLISH_TASK_NAME,
PublishTask.class);

final String beanRegistryId = project.getPath();
Beans.initBeanRegistry(beanRegistryId);
Beans.registerBean(beanRegistryId, systemProxySettings);
Beans.registerBean(beanRegistryId, platform);
Beans.registerBean(beanRegistryId, GradleLoggerAdapter.class);
Beans.registerBean(beanRegistryId, FileManagerImpl.class);
Beans.registerBean(beanRegistryId, ChannelProviderImpl.class);
Beans.registerBean(beanRegistryId, ArchiverProviderImpl.class);
Beans.registerBean(beanRegistryId, HttpClientProviderImpl.class);
try {
project
.getGradle()
.addListener(new TaskLoggerConfigurer(Beans.getBean(beanRegistryId, BeanRegistry.class), extension));
project.getLogger().debug("Platform: {}", Beans.getBean(beanRegistryId, Platform.class));
} catch (final BeanRegistryException e) {
throw new GradleException("Cannot get instance of bean registry", e);
}

project.afterEvaluate(p -> finalizeExtension(extension));
}

Expand Down Expand Up @@ -469,15 +455,4 @@ private <T extends Task, D extends Task> boolean canDependOn(final T task,
final TaskProvider<D> dependsOnTaskProvider, final BiPredicate<T, D> condition) {
return dependsOnTaskProvider.isPresent() && condition.test(task, dependsOnTaskProvider.get());
}

/**
* Gets the value of an environment variable.
*
* @param variableName Variable name.
* @return Variable value.
*/
@Nonnull
private Optional<String> getEnvironmentVariable(@Nonnull final String variableName) {
return Optional.ofNullable(System.getenv(variableName)).filter(value -> !value.trim().isEmpty());
}
}
Loading

0 comments on commit 27e17eb

Please sign in to comment.