1717
1818package com .icst .plugin .builder ;
1919
20+ import java .util .regex .Pattern ;
21+
2022import org .gradle .api .GradleException ;
2123import org .gradle .api .Project ;
2224import org .gradle .api .artifacts .Configuration ;
@@ -40,6 +42,12 @@ public static void configure(Project project) {
4042 throw new GradleException ("Please provide sdk version for building plugin for BlockIDLE" );
4143 }
4244
45+ if (!ext .getAppPluginClass ().isPresent ()) {
46+ throw new GradleException ("Please provide appPluginClass as entry point of plugin for BlockIDLE" );
47+ }
48+
49+ validateFqcn (ext .getAppPluginClass ().get (), "appPluginClass" );
50+
4351 String sdkVersion = ext .getSdkVersion ().get ();
4452
4553 project .getDependencies ().add (
@@ -52,4 +60,19 @@ public static void configure(Project project) {
5260 });
5361 }
5462
63+ private static final Pattern FQCN_PATTERN = Pattern .compile (
64+ "^[a-zA-Z_$][a-zA-Z\\ d_$]*(\\ .[a-zA-Z_$][a-zA-Z\\ d_$]*)+$" );
65+
66+ private static void validateFqcn (String value , String propertyName ) {
67+ if (value == null || value .isEmpty ()) {
68+ throw new GradleException (propertyName + " must not be empty" );
69+ }
70+
71+ if (!FQCN_PATTERN .matcher (value ).matches ()) {
72+ throw new GradleException (
73+ propertyName + " must be a fully qualified class name. " +
74+ "Example: com.example.MyPlugin" );
75+ }
76+ }
77+
5578}
0 commit comments