Skip to content

Commit 8454640

Browse files
author
Ravilla
committed
Pull and extract the content package set in distro.prop
1 parent 0285a8c commit 8454640

File tree

8 files changed

+1277
-1055
lines changed

8 files changed

+1277
-1055
lines changed
Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.openmrs.maven.plugins;
22

3+
import java.util.ArrayDeque;
4+
35
import org.apache.commons.lang.StringUtils;
46
import org.apache.maven.artifact.factory.ArtifactFactory;
57
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -12,11 +14,12 @@
1214
import org.apache.maven.plugins.annotations.Parameter;
1315
import org.apache.maven.project.MavenProject;
1416
import org.apache.maven.settings.Settings;
17+
import org.openmrs.maven.plugins.git.DefaultGitHelper;
18+
import org.openmrs.maven.plugins.git.GitHelper;
1519
import org.openmrs.maven.plugins.model.Server;
20+
import org.openmrs.maven.plugins.utility.ContentHelper;
1621
import org.openmrs.maven.plugins.utility.DefaultJira;
1722
import org.openmrs.maven.plugins.utility.DistroHelper;
18-
import org.openmrs.maven.plugins.git.DefaultGitHelper;
19-
import org.openmrs.maven.plugins.git.GitHelper;
2023
import org.openmrs.maven.plugins.utility.DockerHelper;
2124
import org.openmrs.maven.plugins.utility.Jira;
2225
import org.openmrs.maven.plugins.utility.ModuleInstaller;
@@ -27,116 +30,119 @@
2730
import org.openmrs.maven.plugins.utility.VersionsHelper;
2831
import org.openmrs.maven.plugins.utility.Wizard;
2932

30-
import java.util.ArrayDeque;
31-
3233
/**
3334
* Base class for all OpenMRS SDK Maven Mojos
3435
*/
3536
public abstract class AbstractTask extends AbstractMojo {
36-
37+
3738
/**
3839
* The project currently being build
3940
*/
4041
@Parameter(defaultValue = "${project}", readonly = true)
4142
MavenProject mavenProject;
42-
43+
4344
/**
4445
* The current Maven session.
4546
*/
4647
@Parameter(defaultValue = "${session}", readonly = true, required = true)
4748
MavenSession mavenSession;
48-
49+
4950
/**
5051
* The Maven Settings
5152
*/
5253
@Parameter(defaultValue = "${settings}", readonly = true)
5354
Settings settings;
54-
55+
5556
/**
5657
* test mode, if true disables interactive mode and uses batchAnswers, even if there is none
5758
*/
5859
@Parameter(defaultValue = "false", property = "testMode")
5960
boolean testMode;
60-
61+
6162
/**
6263
* path to openmrs directory
6364
*/
6465
@Parameter(property = "openMRSPath")
6566
String openMRSPath;
66-
67+
6768
/***
6869
* answers to use if not running in interactive mode
6970
*/
7071
@Parameter(property = "batchAnswers")
7172
ArrayDeque<String> batchAnswers;
72-
73+
7374
/**
7475
* stats
7576
*/
7677
@Parameter(defaultValue = "false", property = "stats")
7778
boolean stats;
78-
79-
/**
80-
* The artifact metadata source to use.
81-
*/
82-
@Component
83-
ArtifactMetadataSource artifactMetadataSource;
84-
85-
@Component
86-
ArtifactFactory artifactFactory;
87-
88-
/**
89-
* The Maven BuildPluginManager component.
90-
*/
91-
@Component
92-
BuildPluginManager pluginManager;
93-
94-
@Component
95-
Wizard wizard;
96-
79+
80+
/**
81+
* The artifact metadata source to use.
82+
*/
83+
@Component
84+
ArtifactMetadataSource artifactMetadataSource;
85+
86+
@Component
87+
ArtifactFactory artifactFactory;
88+
89+
/**
90+
* The Maven BuildPluginManager component.
91+
*/
92+
@Component
93+
BuildPluginManager pluginManager;
94+
95+
@Component
96+
Wizard wizard;
97+
9798
/**
9899
* wizard for resolving artifact available versions
99100
*/
100101
VersionsHelper versionsHelper;
101-
102+
102103
/**
103104
* handles installing modules on server
104105
*/
105106
ModuleInstaller moduleInstaller;
106-
107+
107108
/**
108109
* handles distro-properties
109110
*/
110111
DistroHelper distroHelper;
111-
112+
112113
/**
113114
* handles OWAs
114115
*/
115116
OwaHelper owaHelper;
116-
117+
118+
/**
119+
* handles Contents
120+
*/
121+
ContentHelper contentHelper;
122+
117123
/**
118124
* installs SPAs
119125
*/
120126
SpaInstaller spaInstaller;
121-
127+
122128
/**
123129
* handles github and provides basic git utilities
124130
*/
125131
GitHelper gitHelper;
126-
132+
127133
/**
128134
* handles jira
129135
*/
130136
Jira jira;
131-
137+
132138
/**
133139
* handles docker
134140
*/
135141
DockerHelper dockerHelper;
136-
142+
137143
public AbstractTask() {
138144
}
139-
145+
140146
public AbstractTask(AbstractTask other) {
141147
this.mavenProject = other.mavenProject;
142148
this.mavenSession = other.mavenSession;
@@ -148,6 +154,7 @@ public AbstractTask(AbstractTask other) {
148154
this.versionsHelper = other.versionsHelper;
149155
this.distroHelper = other.distroHelper;
150156
this.owaHelper = other.owaHelper;
157+
this.contentHelper = other.contentHelper;
151158
this.spaInstaller = other.spaInstaller;
152159
this.gitHelper = other.gitHelper;
153160
this.dockerHelper = other.dockerHelper;
@@ -158,7 +165,7 @@ public AbstractTask(AbstractTask other) {
158165
this.stats = other.stats;
159166
initTask();
160167
}
161-
168+
162169
public void initTask() {
163170
if (jira == null) {
164171
jira = new DefaultJira();
@@ -178,6 +185,9 @@ public void initTask() {
178185
if (owaHelper == null) {
179186
owaHelper = new OwaHelper(mavenSession, mavenProject, pluginManager, wizard);
180187
}
188+
if (contentHelper == null) {
189+
contentHelper = new ContentHelper(mavenSession, mavenProject, pluginManager);
190+
}
181191
if (spaInstaller == null) {
182192
spaInstaller = new SpaInstaller(distroHelper, new NodeHelper(mavenProject, mavenSession, pluginManager));
183193
}
@@ -187,19 +197,19 @@ public void initTask() {
187197
if (StringUtils.isNotBlank(openMRSPath)) {
188198
Server.setServersPath(openMRSPath);
189199
}
190-
200+
191201
if ((batchAnswers != null && !batchAnswers.isEmpty()) || testMode) {
192202
wizard.setAnswers(batchAnswers);
193203
wizard.setInteractiveMode(false);
194204
}
195205
}
196-
206+
197207
@Override
198208
public void execute() throws MojoExecutionException, MojoFailureException {
199209
initTask();
200210
new StatsManager(wizard, mavenSession, stats).incrementGoalStats();
201211
executeTask();
202212
}
203-
204-
abstract public void executeTask() throws MojoExecutionException, MojoFailureException;
213+
214+
abstract public void executeTask() throws MojoExecutionException, MojoFailureException;
205215
}

0 commit comments

Comments
 (0)