убираем LogicPlugin
This commit is contained in:
20
build.gradle
20
build.gradle
@@ -4,7 +4,22 @@
|
||||
*/
|
||||
|
||||
import ru.dmitriymx.gradle.plugin.LibsPlugin
|
||||
import ru.dmitriymx.gradle.plugin.LogicPlugin
|
||||
|
||||
class Logic {
|
||||
private final Project project
|
||||
|
||||
Logic(Project project) {
|
||||
this.project = project
|
||||
}
|
||||
|
||||
String getProperty1(String propertyName1, String propertyName2) {
|
||||
return (String) (project.hasProperty(propertyName1) ? project.property(propertyName1) : project.property(propertyName2))
|
||||
}
|
||||
|
||||
String getProperty1(String propertyName) {
|
||||
return (String) (project.hasProperty(propertyName) ? project.property(propertyName) : null)
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
@@ -12,7 +27,8 @@ plugins {
|
||||
}
|
||||
|
||||
apply plugin: LibsPlugin
|
||||
apply plugin: LogicPlugin
|
||||
|
||||
def logic = new Logic(project)
|
||||
|
||||
project.group = logic.getProperty1('project.group')
|
||||
project.version = logic.getProperty1('project.version')
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package ru.dmitriymx.gradle.extention;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
|
||||
public class LogicExtention {
|
||||
private final Project project;
|
||||
|
||||
public LogicExtention(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getProperty1(String propertyName1, String propertyName2) {
|
||||
return (String) (project.hasProperty(propertyName1) ? project.property(propertyName1) : project.property(propertyName2));
|
||||
}
|
||||
|
||||
public String getProperty1(String propertyName) {
|
||||
return (String) (project.hasProperty(propertyName) ? project.property(propertyName) : null);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package ru.dmitriymx.gradle.plugin;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import ru.dmitriymx.gradle.extention.LogicExtention;
|
||||
|
||||
public class LogicPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getExtensions().create("logic", LogicExtention.class, project);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user