You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/06/22 05:05:24 UTC
[royale-compiler] branch develop updated: OrderSwitchesMojo. Need
to release compiler-build-tools with new mojo
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 4d325fb OrderSwitchesMojo. Need to release compiler-build-tools with new mojo
4d325fb is described below
commit 4d325fb2bd09797a0e6d58ace198e53e45c3f11d
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jun 21 22:04:51 2020 -0700
OrderSwitchesMojo. Need to release compiler-build-tools with new mojo
---
.../compiler/tools/annotate/OrderSwitchesMojo.java | 74 ++++++++++++
compiler/pom.xml | 87 +++++++------
pom.xml | 134 ++++++++++-----------
3 files changed, 191 insertions(+), 104 deletions(-)
diff --git a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/OrderSwitchesMojo.java b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/OrderSwitchesMojo.java
new file mode 100644
index 0000000..041ac33
--- /dev/null
+++ b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/OrderSwitchesMojo.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.royale.compiler.tools.annotate;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+
+import java.io.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Goal which orders switch statement in JFlex output.
+ */
+@Mojo(name="order-jflex-switches",defaultPhase = LifecyclePhase.PROCESS_SOURCES)
+public class OrderSwitchesMojo
+ extends AbstractMojo
+{
+ @Parameter
+ protected Set<String> includes = new HashSet<String>();
+
+ @Parameter
+ protected Set<String> excludes = new HashSet<String>();
+
+ @Parameter(defaultValue="${project.build.directory}/generated-sources")
+ private File directory;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ SuffixMapping mapping = new SuffixMapping("jflex", Collections.<String>emptySet());
+ SimpleSourceInclusionScanner scan = new SimpleSourceInclusionScanner(includes, excludes);
+ scan.addSourceMapping(mapping);
+
+ try {
+ Set<File> candidates = scan.getIncludedSources(directory, null);
+ for(File candidate : candidates) {
+ try {
+ OrderSwitches.processFile(candidate);
+ } catch(AnnotateClass.AnnotateClassDeleteException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } catch(AnnotateClass.AnnotateClassRenameException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+ }
+ } catch (InclusionScanException e) {
+ throw new MojoExecutionException("Error scanning files to be processed.", e);
+ }
+ }
+}
diff --git a/compiler/pom.xml b/compiler/pom.xml
index cf1c584..76df53a 100644
--- a/compiler/pom.xml
+++ b/compiler/pom.xml
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -82,8 +82,8 @@
</execution>
</executions>
</plugin>
- <!--
- Do all the JFlex code generation
+ <!--
+ Do all the JFlex code generation
-->
<plugin>
<groupId>de.jflex</groupId>
@@ -129,8 +129,8 @@
</execution>
</executions>
</plugin>
- <!--
- Do all the Antlr2 code generation
+ <!--
+ Do all the Antlr2 code generation
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -155,12 +155,12 @@
</dependencies>
</plugin>
- <!--
- The generation of the metadata-parser requires Antlr to
- load ImportMetadataTokenTypes.txt. Unfortunately Altlr
- looks in the current working directory. The only way to
- force it to work, is to start a new process with the
- working directory in the directory containing the file.
+ <!--
+ The generation of the metadata-parser requires Antlr to
+ load ImportMetadataTokenTypes.txt. Unfortunately Altlr
+ looks in the current working directory. The only way to
+ force it to work, is to start a new process with the
+ working directory in the directory containing the file.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -239,8 +239,8 @@
</executions>
</plugin>
- <!--
- Do all the JBurg code generation.
+ <!--
+ Do all the JBurg code generation.
-->
<plugin>
<groupId>net.sourceforge.jburg</groupId>
@@ -293,8 +293,8 @@
</dependencies>
</plugin>
- <!--
- Do all the Antlr3 code generation.
+ <!--
+ Do all the Antlr3 code generation.
-->
<plugin>
<groupId>org.antlr</groupId>
@@ -329,8 +329,8 @@
</executions>
</plugin>
- <!--
- Do all the custom processing with the royale build tools.
+ <!--
+ Do all the custom processing with the royale build tools.
-->
<plugin>
<groupId>org.apache.royale.compiler</groupId>
@@ -426,6 +426,19 @@
<goal>generate-problems-resource-bundle</goal>
</goals>
</execution>
+ <execution>
+ <id>order-jflex-switch-statements</id>
+ <goals>
+ <goal>order-jflex-switches</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>jflex/org/apache/royale/compiler/internal/parsing/as/RawASDocTokenizer.java</include>
+ <include>jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.java</include>
+ <include>jflex/org/apache/royale/compiler/internal/parsing/mxml/RawMXMLTokenizer.java</include>
+ </includes>
+ </configuration>
+ </execution>
</executions>
</plugin>
@@ -490,10 +503,10 @@
</build>
<profiles>
- <!--
- This profile adds one test, that relies on the original FDK being
- available as it compiles each project in the framework/projects
- directory. It requires some environment variables being set.
+ <!--
+ This profile adds one test, that relies on the original FDK being
+ available as it compiles each project in the framework/projects
+ directory. It requires some environment variables being set.
-->
<profile>
<id>option-with-flex-sdk-tests</id>
diff --git a/pom.xml b/pom.xml
index 9568ccb..45ed6ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -46,7 +46,7 @@
<project.reporting.outputencoding>UTF-8</project.reporting.outputencoding>
<maven.version>3.3.1</maven.version>
- <compiler-build-tools.version>1.2.0</compiler-build-tools.version>
+ <compiler-build-tools.version>1.2.1-SNAPSHOT</compiler-build-tools.version>
<compiler-jburg-types.version>1.1.0</compiler-jburg-types.version>
<flex.version>4.15.0</flex.version>
@@ -173,24 +173,24 @@
<exclude>**/.idea/**</exclude>
<!-- Ignore VSCode/Java project files -->
<exclude>**/.factorypath</exclude>
- <!--
- Exclude any eventually existing content of target directories.
- Some times when building with a bigger maven reactor and then
- with a smaller one, RAT will complain about stuff still in the
- target directories. We don't want that.
+ <!--
+ Exclude any eventually existing content of target directories.
+ Some times when building with a bigger maven reactor and then
+ with a smaller one, RAT will complain about stuff still in the
+ target directories. We don't want that.
-->
<exclude>**/target/**</exclude>
<exclude>**/release-dir/**</exclude>
<!-- Stuff an Ant build might have left behind. -->
<exclude>lib/**</exclude>
- <!--
- In case of an ANT based release the typedefs are included as a
- subdirectory. We need to exclude this directory from the compiler checks
- as the typedefs build will handle all content in that directory
+ <!--
+ In case of an ANT based release the typedefs are included as a
+ subdirectory. We need to exclude this directory from the compiler checks
+ as the typedefs build will handle all content in that directory
-->
<exclude>royale-typedefs/**</exclude>
- <!-- This file is used to get reproducible builds. See royale-maven-plugin/pom.xml
- for more info.
+ <!-- This file is used to get reproducible builds. See royale-maven-plugin/pom.xml
+ for more info.
-->
<exclude>**/src/main/sisu/javax.inject.Named</exclude>
</excludes>
@@ -230,9 +230,9 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
- <!--
- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Surefire plugin is executed.
+ <!--
+ Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Surefire plugin is executed.
-->
<execution>
<id>pre-unit-test</id>
@@ -242,16 +242,16 @@
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
- <!--
- Sets the name of the property containing the settings
- for JaCoCo runtime agent.
+ <!--
+ Sets the name of the property containing the settings
+ for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
- <!--
- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Failsafe plugin is executed.
+ <!--
+ Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Failsafe plugin is executed.
-->
<execution>
<id>pre-integration-test</id>
@@ -262,9 +262,9 @@
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
- <!--
- Sets the name of the property containing the settings
- for JaCoCo runtime agent.
+ <!--
+ Sets the name of the property containing the settings
+ for JaCoCo runtime agent.
-->
<propertyName>failsafeArgLine</propertyName>
</configuration>
@@ -287,12 +287,12 @@
<mavenLocalRepoDir>${settings.localRepository}</mavenLocalRepoDir>
<optionWithSwfEnabled>${option.withSwf.enabled}</optionWithSwfEnabled>
</systemPropertyVariables>
- <!--
- Currently some tests need this to be disabled,
- but actually this is a bug. For now I'll disable
- them to avoid problems during the maven migration.
- After this is finished, we should definitely fix
- the tests so assertions can be enabled.
+ <!--
+ Currently some tests need this to be disabled,
+ but actually this is a bug. For now I'll disable
+ them to avoid problems during the maven migration.
+ After this is finished, we should definitely fix
+ the tests so assertions can be enabled.
-->
<enableAssertions>false</enableAssertions>
</configuration>
@@ -341,9 +341,9 @@
</plugin>
<!-- This plugin cleans up the jars for anything that might cause problems for reproducible builds -->
- <!--
- Even if the core maven plugins currently would support doing this without, we would be required
- to set the line-separator and the Antlr3 plugin crashes if this is set to something non-default
+ <!--
+ Even if the core maven plugins currently would support doing this without, we would be required
+ to set the line-separator and the Antlr3 plugin crashes if this is set to something non-default
-->
<plugin>
<groupId>io.github.zlika</groupId>
@@ -642,8 +642,8 @@
</profile>
<profile>
- <!-- This profile is used to test against staged release artifacts.
- Be sure to clear out artifacts in the local repository before
+ <!-- This profile is used to test against staged release artifacts.
+ Be sure to clear out artifacts in the local repository before
and after using -->
<id>staged-releases</id>
<pluginRepositories>
@@ -654,9 +654,9 @@
</pluginRepositories>
</profile>
- <!--
- This profile enables the changes required to do releases on the Royale CI server.
- It should not be used otherwise.
+ <!--
+ This profile enables the changes required to do releases on the Royale CI server.
+ It should not be used otherwise.
-->
<profile>
<id>royale-release</id>
@@ -671,11 +671,11 @@
<repository>
<id>apache.releases.https</id>
<name>Apache Release Distribution Repository</name>
- <!--
- 'maven.multiModuleProjectDirectory' is a property introduced with maven 3.3.1 ...
- don't worry if your IDE is complaining.
- Also this will be set to the 'target/checkout' directory the output will be in
- 'target/local-release-dir'.
+ <!--
+ 'maven.multiModuleProjectDirectory' is a property introduced with maven 3.3.1 ...
+ don't worry if your IDE is complaining.
+ Also this will be set to the 'target/checkout' directory the output will be in
+ 'target/local-release-dir'.
-->
<url>file://${maven.multiModuleProjectDirectory}/../local-release-dir</url>
</repository>
@@ -751,8 +751,8 @@
<completionGoals>com.theoryinpractise:reproducible-maven-plugin:clear</completionGoals>
</configuration>
</plugin>
- <!--
- Create MD5 and SHA512 checksum files for the release artifacts.
+ <!--
+ Create MD5 and SHA512 checksum files for the release artifacts.
-->
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
@@ -783,11 +783,11 @@
</build>
</profile>
- <!--
- This profile is intended to help when having problems with Maven.
- When enabled, it automatically generates an "effective.pom" in the target directory.
- This version is the fully expanded version where all inherited configuration is in
- place and all variables are resolved and profile configuration is included.
+ <!--
+ This profile is intended to help when having problems with Maven.
+ When enabled, it automatically generates an "effective.pom" in the target directory.
+ This version is the fully expanded version where all inherited configuration is in
+ place and all variables are resolved and profile configuration is included.
-->
<profile>
<id>debug-pom</id>