Skip to content

Commit

Permalink
OOTB Service-Based rewrite rules should be exported (#86)
Browse files Browse the repository at this point in the history
* Allow for extending OOTB Service-based Rules
* Need to downgrade invoker plugin due to incompatibility issues.
* Make rules available in OSGi manifest
  • Loading branch information
bstopp authored Nov 23, 2021
1 parent 0f7785a commit 27b352b
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ updates:
versions: ["1.x"]
- dependency-name: "org.osgi.service.log"
versions: ["1.x"]
- dependency-name: "maven-invoker"
versions: ["2.x"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javadocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: maven

- name: Build JavaDocs
run: mvn -U clean install -Pgenerate-site-javadoc
run: mvn -U clean verify -Pgenerate-site-javadoc,aemCloudService

- name: Commit JavaDocs
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
cache: maven

- name: Maven Verify
run: mvn -U clean install
run: mvn -U clean verify

- name: Generate Release Changelog
id: generate-release-changelog
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
cache: maven

- name: Maven Verify
run: mvn clean install -P${{ matrix.profile }}
run: mvn clean verify -P${{ matrix.profile }}

- name: Upload Release Artifacts
id: upload-release-artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache: maven

- name: Build & Test with Maven
run: mvn -U clean install -P${{ matrix.profile }}
run: mvn -U clean verify -P${{ matrix.profile }}

- name: Upload CodeCov
uses: codecov/codecov-action@v2.1.0
Expand Down
18 changes: 18 additions & 0 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
</plugin>
</plugins>
</build>
<!--expose rule for extension-->
<!--release-->
<!--video-->
<!--documentation links and release-->

<!-- ====================================================================== -->
<!-- P R O F I L E S -->
Expand Down Expand Up @@ -107,6 +111,20 @@
</embeddeds>
</configuration>
</plugin>
<plugin>
<groupId>com.adobe.aem</groupId>
<artifactId>aemanalyser-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>analyse-project</id>
<phase>verify</phase>
<goals>
<goal>project-analyse</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.component.impl.rule;
package com.adobe.aem.modernize.component.rule;

/*-
* #%L
Expand Down Expand Up @@ -48,7 +48,6 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.commons.osgi.PropertiesUtil;

import com.adobe.aem.modernize.RewriteException;
import com.adobe.aem.modernize.component.ComponentRewriteRule;
Expand All @@ -65,7 +64,6 @@
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.osgi.service.metatype.annotations.Option;
import org.osgi.util.converter.Converters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@org.osgi.annotation.versioning.Version("2.0.0")
package com.adobe.aem.modernize.component.rule;

/*-
* #%L
* AEM Modernize Tools - Core
* %%
* Copyright (C) 2019 - 2021 Adobe Inc.
* %%
* Licensed 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.
* #L%
*/

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.structure.impl.rule;
package com.adobe.aem.modernize.structure.rule;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@org.osgi.annotation.versioning.Version("2.0.0")
package com.adobe.aem.modernize.structure.rule;

/*-
* #%L
* AEM Modernize Tools - Core
* %%
* Copyright (C) 2019 - 2021 Adobe Inc.
* %%
* Licensed 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.
* #L%
*/

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.component.impl.rule;
package com.adobe.aem.modernize.component.rule;

/*-
* #%L
Expand Down Expand Up @@ -44,7 +44,7 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import static com.adobe.aem.modernize.component.impl.rule.ColumnControlRewriteRule.*;
import static com.adobe.aem.modernize.component.rule.ColumnControlRewriteRule.*;
import static org.junit.jupiter.api.Assertions.*;

@ExtendWith(SlingContextExtension.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.component.impl.rule;
package com.adobe.aem.modernize.component.rule;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.component.impl.rule;
package com.adobe.aem.modernize.component.rule;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import com.adobe.aem.modernize.structure.StructureRewriteRule;
import com.adobe.aem.modernize.structure.StructureRewriteRuleService;
import com.adobe.aem.modernize.structure.impl.StructureRewriteRuleServiceImpl;
import com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule;
import com.adobe.aem.modernize.structure.rule.PageRewriteRule;
import com.day.cq.wcm.api.NameConstants;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.PageManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.adobe.aem.modernize.MockRule;
import com.adobe.aem.modernize.rule.RewriteRule;
import com.adobe.aem.modernize.structure.StructureRewriteRuleService;
import com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule;
import com.adobe.aem.modernize.structure.rule.PageRewriteRule;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.wcm.testing.mock.aem.junit5.AemContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.adobe.aem.modernize.structure.impl.rule;
package com.adobe.aem.modernize.structure.rule;

/*-
* #%L
Expand Down Expand Up @@ -42,7 +42,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import static com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule.*;
import static com.adobe.aem.modernize.structure.rule.PageRewriteRule.*;
import static org.junit.jupiter.api.Assertions.*;

@ExtendWith(AemContextExtension.class)
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/resources/job/full-job-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"/var/aem-modernize/rules/policy/extraLargeTitle"
],
"templateRules": [
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule"
"com.adobe.aem.modernize.structure.rule.PageRewriteRule"
],
"buckets": {
"bucket0": {
Expand All @@ -42,7 +42,7 @@
"/var/aem-modernize/rules/policy/extraLargeTitle"
],
"templateRules": [
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule"
"com.adobe.aem.modernize.structure.rule.PageRewriteRule"
],
"buckets": {
"bucket0": {
Expand Down
8 changes: 4 additions & 4 deletions core/src/test/resources/job/structure-job-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"sourceRoot": "/content/test",
"targetRoot": "/content/newpath/with/extra/tokens",
"templateRules": [
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule.first-page",
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule.second-page"
"com.adobe.aem.modernize.structure.rule.PageRewriteRule.first-page",
"com.adobe.aem.modernize.structure.rule.PageRewriteRule.second-page"
],
"buckets": {
"bucket0": {
Expand All @@ -31,8 +31,8 @@
"componentRules": [],
"policyRules": [],
"templateRules": [
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule.first-page",
"com.adobe.aem.modernize.structure.impl.rule.PageRewriteRule.second-page"
"com.adobe.aem.modernize.structure.rule.PageRewriteRule.first-page",
"com.adobe.aem.modernize.structure.rule.PageRewriteRule.second-page"
],
"buckets": {
"bucket0": {
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<vault.user>admin</vault.user>
<vault.password>admin</vault.password>

<aemanalyser.version>1.2.2</aemanalyser.version>
<bnd.version>6.0.0</bnd.version>
<slf4j.version>1.7.32</slf4j.version>
<jmockit.version>1.49</jmockit.version>
Expand Down Expand Up @@ -210,7 +211,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>3.1.0</version>
<version>2.2</version> <!-- Freeze until 3.0.0 of Maven Release Plugin is GA -->
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
Expand Down Expand Up @@ -355,6 +356,13 @@ Bundle-DocURL:
</dependency>
</dependencies>
</plugin>
<!-- AEM Analyser Plugin -->
<plugin>
<groupId>com.adobe.aem</groupId>
<artifactId>aemanalyser-maven-plugin</artifactId>
<version>${aemanalyser.version}</version>
<extensions>true</extensions>
</plugin>
<!-- Content Package Plugin -->
<plugin>
<groupId>com.day.jcr.vault</groupId>
Expand Down

0 comments on commit 27b352b

Please sign in to comment.