@@ -131,86 +131,6 @@ class BuildUtility(logger: ManagedLogger) {
131
131
logger info s " Successfully copied $successCounter / ${allJarFiles.length} plugins to target ' ${pluginTargetFolder.getPath}'! "
132
132
}
133
133
134
- /**
135
- * Creates a new plugin. Interactive command using the console.
136
- *
137
- * @param pluginFolderNames All folder names, containing plugin source code. Defined in build.sbt.
138
- */
139
- def createPluginTask (pluginFolderNames : List [String ]): Unit = {
140
- withTaskInfo(" CREATE PLUGIN" ) {
141
-
142
- // Plugin folders have to be defined in the build.sbt file first
143
- if (pluginFolderNames.isEmpty) {
144
- println(" Before creating a new plugin, please define at least one plugin source folder in the build.sbt file." )
145
- logger warn " Aborting task without plugin creation."
146
-
147
- } else {
148
- println(" Welcome to the \" create plugin\" -wizard. Please specify name, version and plugin source folder." )
149
-
150
- // Plugin name
151
- val name = BuildUtility .askForInput(
152
- " Please specify the name of the plugin. Do only use characters allowed for directories and files of your OS." ,
153
- " Plugin name" ,
154
- repeatIfEmpty = true
155
- )
156
-
157
- // Plugin version (default: 0.1)
158
- var version = BuildUtility .askForInput(
159
- " Please specify the version of the plugin. Just press enter for version \" 0.1\" ." ,
160
- " Plugin version" ,
161
- repeatIfEmpty = false
162
- )
163
- if (version == " " ) version = " 0.1"
164
-
165
- // Plugin folder name (must be defined in build.sbt)
166
- var pluginFolderName = " "
167
- while (! pluginFolderNames.contains(pluginFolderName)) {
168
- pluginFolderName = BuildUtility .askForInput(
169
- s " Please specify the plugin source directory. Available directories: ${pluginFolderNames.mkString(" [" , " , " , " ]" )}" ,
170
- " Plugin source directory" ,
171
- repeatIfEmpty = true
172
- )
173
- }
174
-
175
- createPlugin(name, version, pluginFolderName)
176
- }
177
- }
178
- }
179
-
180
- private def withTaskInfo (taskName : String )(task : Unit ): Unit = BuildUtility .withTaskInfo(taskName, logger)(task)
181
-
182
- private def createPlugin (name : String , version : String , pluginFolderName : String ): Unit = {
183
- logger info s " Trying to create plugin $name (version $version) at plugin folder $pluginFolderName. "
184
-
185
- val pluginFolder = new File (pluginFolderName)
186
- if (! pluginFolder.exists()) {
187
- logger error " Plugin source folder does not exist. Aborting task without plugin creation."
188
-
189
- } else {
190
-
191
- val plugin = new Plugin (pluginFolderName, name)
192
-
193
- if (! plugin.createPluginFolder()) {
194
- logger error " Plugin does already exist. Aborting task without plugin creation."
195
- } else {
196
- logger info s " Created plugin ' $name' "
197
-
198
- if (plugin.createSrcFolder()) {
199
- logger info " Successfully created source folder."
200
- } else {
201
- logger warn " Unable to create source folder."
202
- }
203
-
204
- if (plugin.createSbtFile(version)) {
205
- logger info " Successfully created plugins sbt file."
206
- } else {
207
- logger warn " Unable to create plugins sbt file."
208
- }
209
-
210
- }
211
- }
212
- }
213
-
214
134
def guiTask (guiProjectPath : String , cacheDir : File ): Unit = {
215
135
withTaskInfo(" BUILD GUI" ) {
216
136
val guiDir = new File (guiProjectPath)
@@ -234,13 +154,13 @@ class BuildUtility(logger: ManagedLogger) {
234
154
/**
235
155
* Download the dependencies of the gui using npm.
236
156
*
237
- * @param guiDir the directory of the gui.
157
+ * @param guiDir the directory of the gui.
238
158
* @param cacheDir a dir, where sbt can store files for caching in the "install" sub-dir.
239
159
* @return None, if a error occurs which will be displayed, otherwise the output directory with the built gui.
240
160
*/
241
161
private def installGuiDeps (guiDir : File , cacheDir : File ): Option [File ] = {
242
162
// Check buildGui for a explanation, it's almost the same.
243
-
163
+
244
164
val install = FileFunction .cached(new File (cacheDir, " install" ), FilesInfo .hash)(_ => {
245
165
246
166
logger info " Installing GUI dependencies."
@@ -266,8 +186,8 @@ class BuildUtility(logger: ManagedLogger) {
266
186
267
187
/**
268
188
* Builds the gui using npm.
269
- *
270
- * @param guiDir the directory of the gui.
189
+ *
190
+ * @param guiDir the directory of the gui.
271
191
* @param cacheDir a dir, where sbt can store files for caching in the "build" sub-dir.
272
192
* @return None, if a error occurs which will be displayed, otherwise the output directory with the built gui.
273
193
*/
@@ -326,25 +246,14 @@ class BuildUtility(logger: ManagedLogger) {
326
246
Set (f)
327
247
}
328
248
}
249
+
250
+ private def withTaskInfo (taskName : String )(task : Unit ): Unit = BuildUtility .withTaskInfo(taskName, logger)(task)
329
251
}
330
252
331
253
object BuildUtility {
332
254
333
255
def apply (logger : ManagedLogger ): BuildUtility = new BuildUtility (logger)
334
256
335
- private def askForInput (information : String , description : String , repeatIfEmpty : Boolean ): String = {
336
- println(information)
337
- print(s " $description > " )
338
-
339
- var input = scala.io.Source .fromInputStream(System .in).bufferedReader().readLine()
340
- println(" " )
341
-
342
- if (input == " " && repeatIfEmpty)
343
- input = askForInput(information, description, repeatIfEmpty)
344
-
345
- input
346
- }
347
-
348
257
/**
349
258
* This method can be used to create better readable sbt console output by declaring start and stop of a custom task.
350
259
*
0 commit comments