diff --git a/Blade.wiki b/Blade.wiki index 3f50add..d6dcd97 160000 --- a/Blade.wiki +++ b/Blade.wiki @@ -1 +1 @@ -Subproject commit 3f50add3973dc448f8d238ec85b878475e4f0ec7 +Subproject commit d6dcd97e1c7ffcc5397fee268511b2a1eb1d685a diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b6f6bf..668823f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Change Log ========== +Version 2.5.1 *(2016-12-26)* +---------------------------- + + * Change: Configuration file is now required + Version 2.5.0 *(2016-12-26)* ---------------------------- diff --git a/gradle.properties b/gradle.properties index 97d2960..5a4b33f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1536M LIB_GROUP_ID = eu.f3rog.blade ARTIFACT_ID = none -LIB_VERSION = 2.5.0 +LIB_VERSION = 2.5.1 LIB_VERSION_DESC = Android Library for Boilerplate Destruction diff --git a/plugin/src/main/groovy/eu/f3rog/blade/plugin/BladePlugin.groovy b/plugin/src/main/groovy/eu/f3rog/blade/plugin/BladePlugin.groovy index f8bc61d..ccf1a0a 100644 --- a/plugin/src/main/groovy/eu/f3rog/blade/plugin/BladePlugin.groovy +++ b/plugin/src/main/groovy/eu/f3rog/blade/plugin/BladePlugin.groovy @@ -16,7 +16,7 @@ public final class BladePlugin // non-debug by default public boolean debug = false // include all modules by default - public String[] modules = LIB_MODULES + public String[] modules = [] @Override public String toString() { @@ -28,10 +28,11 @@ public final class BladePlugin public static String ERROR_GRADLE_TOOLS_1_5_0_REQUIRED = "Blade plugin only supports android gradle plugin 1.5.0 or later!" public static String ERROR_ANDROID_PLUGIN_REQUIRED = "'com.android.application' or 'com.android.library' plugin required!" public static String ERROR_MODULE_DOES_NOT_EXIST = "Blade does not have module '%s'!" - public static String ERROR_APT_MISSING = "Apply apt plugin or update gradle plugin to >=2.2.0!" + public static String ERROR_APT_IS_MISSING = "Apply apt plugin or update gradle plugin to >=2.2.0!" + public static String ERROR_CONFIG_FILE_IS_MISSING = "Blade configuration file is missing! (more info here: https://github.com/FrantisekGazo/Blade/wiki#1-create-configuration-file)" public static String LIB_GROUP_ID = "eu.f3rog.blade" - public static String LIB_VERSION = "2.5.0" + public static String LIB_VERSION = "2.5.1" public static String LIB_CONFIG_FILE_NAME = "blade" public static String[] LIB_MODULES = ["arg", "extra", "mvp", "parcel", "state"] @@ -83,7 +84,7 @@ public final class BladePlugin } else if (hasAnnotationProcessorConfiguration) { return ['annotationProcessor', 'androidTestAnnotationProcessor'] } else { - throw new IllegalStateException(ERROR_APT_MISSING) + throw new IllegalStateException(ERROR_APT_IS_MISSING) } } @@ -122,6 +123,8 @@ public final class BladePlugin } else if (yamlConfigFile.exists()) { Yaml yaml = new Yaml() mConfig = yaml.loadAs(new FileInputStream(yamlConfigFile), BladeConfig.class) + } else { + throw new IllegalStateException(ERROR_CONFIG_FILE_IS_MISSING) } // check module names diff --git a/plugin/src/test/groovy/eu/f3rog/blade/plugin/BladePluginSpecification.groovy b/plugin/src/test/groovy/eu/f3rog/blade/plugin/BladePluginSpecification.groovy index 126bca9..29a1b08 100644 --- a/plugin/src/test/groovy/eu/f3rog/blade/plugin/BladePluginSpecification.groovy +++ b/plugin/src/test/groovy/eu/f3rog/blade/plugin/BladePluginSpecification.groovy @@ -124,12 +124,40 @@ final class BladePluginSpecification then: e != null - e.getMessage().contains(BladePlugin.ERROR_APT_MISSING) + e.getMessage().contains(BladePlugin.ERROR_APT_IS_MISSING) where: [gradleToolsVersion, gradleVersion, _, _, bladeFileType] << WHERE_DATA[0..1] + WHERE_DATA[3..4] } + @Unroll + def "fail without blade file - for #gradleToolsVersion"() { + given: + projectFolder.addGradleFile(new GradleConfig() + .classpaths([buildGradleClasspath(gradleToolsVersion)] + aptClasspath + [bladeClasspath]) + .plugins(["com.android.application"] + apt + ["blade"]) + ) + + when: + Exception e = null + try { + GradleRunner.create() + .withGradleVersion(gradleVersion) + .withProjectDir(projectFolder.root) + .withArguments(':build') + .build() + } catch (Exception ex) { + e = ex + } + + then: + e != null + e.getMessage().contains(BladePlugin.ERROR_CONFIG_FILE_IS_MISSING) + + where: + [gradleToolsVersion, gradleVersion, aptClasspath, apt, _] << WHERE_DATA[0..2] + } + @Unroll def "add correct dependencies - for #gradleToolsVersion, #bladeFileType"() { given: @@ -163,31 +191,6 @@ final class BladePluginSpecification [gradleToolsVersion, gradleVersion, aptClasspath, apt, bladeFileType] << WHERE_DATA } - @Unroll - def "build successfully without blade file - for #gradleToolsVersion"() { - given: - projectFolder.addGradleFile(new GradleConfig() - .classpaths([buildGradleClasspath(gradleToolsVersion)] + aptClasspath + [bladeClasspath]) - .plugins(["com.android.application"] + apt + ["blade"]) - .dependencies(["compile 'com.google.dagger:dagger:2.0.2'"]) // required for 'mvp' module - ) - - when: - BuildResult result = GradleRunner.create() - .withGradleVersion(gradleVersion) - .withProjectDir(projectFolder.root) - .withArguments(':build') - .build() - - then: - result.task(":build").outcome == SUCCESS - result.task(":transformClassesWithBladeForDebug").outcome == SUCCESS - result.task(":transformClassesWithBladeForRelease").outcome == SUCCESS - - where: - [gradleToolsVersion, gradleVersion, aptClasspath, apt, _] << WHERE_DATA[0..2] - } - @Unroll def "build successfully [EXTRA, arg] modules - for #gradleToolsVersion, #bladeFileType"() { given: