Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into issues/close_opened…
Browse files Browse the repository at this point in the history
…_streams
  • Loading branch information
Artur- committed Dec 8, 2021
2 parents 475ac92 + b7c3b9f commit 0a593d2
Show file tree
Hide file tree
Showing 31 changed files with 685 additions and 318 deletions.
66 changes: 41 additions & 25 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.0'
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: stCarolas/[email protected]
with:
maven-version: 3.8.3
- name: Show Versions
run: |
uname -a
id
pwd
type java && java -version
type mvn && mvn -version
type node && node --version
type npm && npm --version
- name: Set flow version and Generate module lists
run: |
# run 3 maven process at the same time and wait for them, saves half minute
mvn -B -q -DnewVersion=999.99-SNAPSHOT versions:set -T 1C &
P1=$!
mvn help:evaluate -Dexpression=project.modules -DskipTests -Prun-tests \
Expand All @@ -26,14 +36,20 @@ jobs:
| grep "<\/string>" \
| sed -e 's, *<string>\(.*\)</string>,flow-tests/\1,g' \
| grep -v "test-ccdm$" \
| grep -v "test-pwa" \
| grep -v "test-root-context" \
| grep -v "test-root-ui-context" \
| grep -v "test-mixed/pom-pnpm-production" \
| grep -v "test-mixed/pom-npm-production" \
| sort > it.modules &
P3=$!
wait $P1 $P2 $P3
- name: Compile and Install Flow
run: |
mvn install -B -am -DskipTests -T 2C
# exclude gradle plugin not needed until gradle tests
cmd="mvn install -B -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
# run twice if fails, it might be multithread failure
eval $cmd -T 2C -q || eval $cmd
- name: Save workspace
run: |
mv ~/.m2/ .
Expand All @@ -48,18 +64,15 @@ jobs:
fail-fast: false
matrix:
modules:
- 'flow-client,fusion-endpoint,flow-jandex'
- 'flow-server,flow-data,flow,flow-bom,vaadin-dev-server,flow-component-demo-helpers,flow-dnd,flow-html-components,flow-html-components-testbench,flow-lit-template,flow-plugins,flow-polymer-template,flow-push,flow-server-production-mode,flow-test-generic,flow-test-util'
- 'flow-client,fusion-endpoint,flow-jandex,flow-plugins/flow-plugin-base,flow-plugins/flow-maven-plugin,flow-plugins/flow-gradle-plugin'
- 'flow-server,flow-data,flow,flow-bom,vaadin-dev-server,flow-component-demo-helpers,flow-dnd,flow-html-components,flow-html-components-testbench,flow-lit-template,flow-polymer-template,flow-push,flow-server-production-mode,flow-test-generic,flow-test-util'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: stCarolas/[email protected]
with:
maven-version: 3.8.3
- uses: actions/download-artifact@v2
with:
name: saved-workspace
Expand All @@ -69,7 +82,7 @@ jobs:
rm -rf ~/.m2 && mv -f .m2 ~/
- name: Unit Test
run: |
mvn -B verify -fae \
mvn -B verify -fae -T 1C \
-Dsurefire.rerunFailingTestsCount=2 \
-pl ${{ matrix.modules }}
- uses: actions/upload-artifact@v2
Expand All @@ -84,29 +97,26 @@ jobs:
matrix:
parallelism: [6]
current: [0, 1, 2, 3, 4, 5,
'test-ccdm',
'test-root-ui-context',
'test-ccdm,test-mixed/pom-pnpm-production.xml,test-pwa',
'test-root-ui-context,test-mixed/pom-npm-production.xml,test-pwa/pom-production.xml',
'test-root-context:0',
'test-root-context:1',
'test-root-context:2'
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set up Maven
uses: stCarolas/[email protected]
- uses: browser-actions/setup-chrome@latest
with:
maven-version: 3.8.3
- name: Install Chrome
run: |
sudo apt-get update
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y -f ./google-chrome-stable_current_amd64.deb
chrome-version: stable
- uses: nanasess/setup-chromedriver@master
- uses: actions/download-artifact@v2
with:
Expand All @@ -129,25 +139,26 @@ jobs:
N=`echo "${{matrix.current}}" | cut -d : -f2`
H=`find $M/src/test -name "*IT.java" | xargs basename -s .java`
C=`echo "$H" | wc -l`
J=`echo "$C / $MAX + 1" | bc`
J=`echo "$C / $MAX" | bc`
I=`echo "$J * $N + 1" | bc`
T=`echo "$H" | tail +$I | head -$J`
A=`echo "$T" | grep ... | tr '\n' ',' | sed -e 's/,$//'`
A="-pl $M -Dit.test=$A -Dfailsafe.forkCount=4"
;;
*test*)
M="flow-tests/${{matrix.current}}"
M=`echo "flow-tests/${{matrix.current}}" | sed -e 's|,|,flow-tests/|g'`
A="-pl $M -Dfailsafe.forkCount=4"
;;
*)
P="${{matrix.parallelism}}"
N="${{matrix.current}}"
H=`cat it.modules`
C=`echo "$H" | wc -l`
J=`echo "$C / $P + 1" | bc`
J=`echo "$C / $P" | bc`
I=`echo "$J * $N + 1" | bc`
M=`echo "$H" | tail +$I | head -$J`
A="-pl "`echo "$M" | grep ... | tr '\n' ',' | sed -e 's/,$//'`
A=`echo "$M" | grep ... | tr '\n' ',' | sed -e 's/,$//'`
[ -n "$A" ] && A="-pl $A"
;;
esac
echo "MODULES:"
Expand Down Expand Up @@ -192,10 +203,15 @@ jobs:
with:
name: test-reports
- name: Publish Unit Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action/composite@v1
with:
files: "**/target/*-reports/TEST*.xml"
- uses: geekyeggo/delete-artifact@v1
with:
name: saved-workspace
- name: The Build has Failed
if: ${{ failure() || cancelled() }}
run: exit 1
- name: The Build has Succeeded
if: ${{ success() }}
run: exit 0
63 changes: 26 additions & 37 deletions flow-plugins/flow-gradle-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
central repo is done within platform final releases.
</description>

<properties>
<gradle.executable>./gradlew</gradle.executable>
</properties>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
Expand Down Expand Up @@ -55,34 +51,40 @@
</execution>
</executions>
</plugin>

<!-- execute Gradle command -->
<!-- run gradle tasks -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<groupId>codes.rafael.gradlemavenplugin</groupId>
<artifactId>gradle-maven-plugin</artifactId>
<version>1.0.10</version>
<configuration>
<gradleVersion>7.3</gradleVersion>
<tasks>
<task>clean</task>
<task>build</task>
<task>javadocJar</task>
</tasks>
<args>
<arg>-x</arg>
<arg>functionalTest</arg>
<arg>-S</arg>
</args>
</configuration>
<executions>
<execution>
<id>gradle</id>
<phase>prepare-package</phase>
<configuration>
<executable>${gradle.executable}</executable>
<arguments>
<argument>clean</argument>
<argument>build</argument>
<argument>javadocJar</argument>
<argument>-x</argument>
<argument>functionalTest</argument>
<argument>-S</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
<goal>invoke</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-tooling-api</artifactId>
<version>7.3-20210825160000+0000</version>
</dependency>
</dependencies>
</plugin>

<!-- copy generated JARs -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand Down Expand Up @@ -138,20 +140,7 @@
</execution>
</executions>
</plugin>

</plugins>
</build>

<profiles>
<profile>
<id>windows_profile</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<properties>
<gradle.executable>gradlew.bat</gradle.executable>
</properties>
</profile>
</profiles>
</project>
2 changes: 2 additions & 0 deletions flow-plugins/flow-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ public class BuildFrontendMojo extends FlowModeAbstractMojo

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
BuildFrontendUtil.updateBuildFile(this);

long start = System.nanoTime();

try {
Expand All @@ -130,6 +128,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}

BuildFrontendUtil.updateBuildFile(this);

long ms = (System.nanoTime() - start) / 1000000;
getLog().info("update-frontend took " + ms + "ms.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public class ReflectionsClassFinder implements ClassFinder {
* the list of urls for finding classes.
*/
public ReflectionsClassFinder(URL... urls) {
classLoader = new URLClassLoader(urls,
ReflectionsClassFinder.class.getClassLoader()); // NOSONAR
classLoader = new URLClassLoader(urls, null); // NOSONAR
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
.addClassLoaders(classLoader).setExpandSuperTypes(false)
.addUrls(urls);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,32 @@ public <T> T lookup(Class<T> serviceClass) {

@Override
public <T> List<T> lookupAll(Class<T> serviceClass) {
// only services declared in flow-server may be used here
assert serviceClass.getClassLoader()
.equals(LookupImpl.class.getClassLoader());
Set<Class<? extends T>> subTypes = classFinder
.getSubTypesOf(serviceClass);
Set<?> subTypes = classFinder
.getSubTypesOf(loadClassFromClassFindler(serviceClass));
List<T> result = new ArrayList<>(subTypes.size());
for (Class<? extends T> clazz : subTypes) {
if (!ReflectTools.isInstantiableService(clazz)) {
continue;
try {
for (Object clazz : subTypes) {
if (!ReflectTools.isInstantiableService((Class<?>) clazz)) {
continue;
}
Class<?> serviceType = serviceClass.getClassLoader()
.loadClass(((Class<?>) clazz).getName());
result.add(serviceClass
.cast(ReflectTools.createInstance(serviceType)));
}
result.add(serviceClass.cast(ReflectTools.createInstance(clazz)));
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Could not find service class", e);
}
return result;
}

private Class<?> loadClassFromClassFindler(Class<?> clz) {
try {
return classFinder.loadClass(clz.getName());
} catch (ClassNotFoundException e) {
throw new IllegalStateException(
"Could not load " + clz.getName() + " class", e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import static com.vaadin.flow.server.Constants.VAADIN_SERVLET_RESOURCES;
import static com.vaadin.flow.server.Constants.VAADIN_WEBAPP_RESOURCES;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_STATISTICS_JSON;
import static com.vaadin.flow.server.frontend.FrontendTools.INSTALL_NODE_LOCALLY;
import static java.lang.String.format;

/**
Expand Down Expand Up @@ -310,7 +311,6 @@ public class FrontendUtils {
*/
public static final String PARAM_TOKEN_FILE = "vaadin.frontend.token.file";

public static final String INSTALL_NODE_LOCALLY = "%n $ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion=\"v12.14.0\" ";
public static final String DISABLE_CHECK = "%nYou can disable the version check using -D%s=true";

private static final String NO_CONNECTION = "Webpack-dev-server couldn't be reached for %s.%n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,24 @@ public FrontendWebComponentGenerator(ClassFinder finder) {
*/
public Set<File> generateWebComponents(File outputDirectory,
ThemeDefinition theme) {
Set<Class<?>> exporterRelatedClasses = new HashSet<>();
finder.getSubTypesOf(WebComponentExporter.class)
.forEach(exporterRelatedClasses::add);
finder.getSubTypesOf(WebComponentExporterFactory.class)
.forEach(exporterRelatedClasses::add);
final String themeName = theme == null ? "" : theme.getName();
return WebComponentModulesWriter.DirectoryWriter
.generateWebComponentsToDirectory(exporterRelatedClasses,
outputDirectory, false, themeName);
try {
final Class<?> writerClass = finder
.loadClass(WebComponentModulesWriter.class.getName());
Set<Class<?>> exporterRelatedClasses = new HashSet<>();
finder.getSubTypesOf(WebComponentExporter.class.getName())
.forEach(exporterRelatedClasses::add);
finder.getSubTypesOf(WebComponentExporterFactory.class.getName())
.forEach(exporterRelatedClasses::add);
final String themeName = theme == null ? "" : theme.getName();
return WebComponentModulesWriter.DirectoryWriter
.generateWebComponentsToDirectory(writerClass,
exporterRelatedClasses, outputDirectory, false,
themeName);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(
"Unable to locate a required class using custom class "
+ "loader",
e);
}
}
}
Loading

0 comments on commit 0a593d2

Please sign in to comment.