Class SenchaUtils


  • public class SenchaUtils
    extends Object
    • Method Detail

      • getSenchaPackageName

        public static String getSenchaPackageName​(String groupId,
                                                  String artifactId)
      • getSenchaPackageName

        public static String getSenchaPackageName​(@Nonnull
                                                  org.apache.maven.project.MavenProject project)
      • getSenchaVersionForMavenVersion

        public static String getSenchaVersionForMavenVersion​(String version)
      • getDependencyByRef

        @Nullable
        public static org.apache.maven.model.Dependency getDependencyByRef​(@Nonnull
                                                                           org.apache.maven.project.MavenProject project,
                                                                           @Nullable
                                                                           String ref)
      • absolutizeToModuleWithPlaceholder

        public static String absolutizeToModuleWithPlaceholder​(String packageType,
                                                               String relativePath)
        Generates an absolute path to the module dir for the given relative path using a placeholder.
        Parameters:
        packageType - the Maven project's packaging type
        relativePath - the path relative to the Sencha module
        Returns:
        path prefixed with a placeholder and a separator to have an absolute path
      • absolutizeWithPlaceholder

        public static String absolutizeWithPlaceholder​(String placeholder,
                                                       String relativePath)
        Generates an absolute path to the module dir for the given relative path using a placeholder.
        Parameters:
        placeholder - the placeholder, e.g. "${workspace.dir}"
        relativePath - the path relative to the Sencha module
        Returns:
        path prefixed with a placeholder and a separator to have an absolute path
      • getObjectMapper

        public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      • isRequiredSenchaDependency

        public static boolean isRequiredSenchaDependency​(@Nonnull
                                                         org.apache.maven.model.Dependency dependency,
                                                         boolean includeTestDependencies)
      • isRequiredSenchaDependency

        public static boolean isRequiredSenchaDependency​(@Nonnull
                                                         org.apache.maven.model.Dependency dependency,
                                                         boolean includeTestDependencies,
                                                         boolean includeProvidedDependencies)
      • isSenchaDependency

        public static boolean isSenchaDependency​(@Nonnull
                                                 org.apache.maven.model.Dependency dependency)
      • isSenchaDependency

        public static boolean isSenchaDependency​(@Nonnull
                                                 String type)
      • doesSenchaAppExist

        public static boolean doesSenchaAppExist​(File directory)
      • getPackagesPath

        public static String getPackagesPath​(org.apache.maven.project.MavenProject project)
      • generateSenchaAppFromTemplate

        public static void generateSenchaAppFromTemplate​(File workingDirectory,
                                                         String appName,
                                                         String applicationClass,
                                                         String toolkit,
                                                         org.apache.maven.plugin.logging.Log log,
                                                         String logLevel,
                                                         String senchaJvmArgs)
                                                  throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • generateSenchaTestAppFromTemplate

        public static void generateSenchaTestAppFromTemplate​(File workingDirectory,
                                                             org.apache.maven.project.MavenProject project,
                                                             String appName,
                                                             String testSuite,
                                                             String toolkit,
                                                             org.apache.maven.plugin.logging.Log log,
                                                             String logLevel,
                                                             String senchaJvmArgs)
                                                      throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • addSwitchFullIfCmd6_5

        public static void addSwitchFullIfCmd6_5​(List<String> arguments)
                                          throws org.apache.maven.plugin.MojoExecutionException
        Special case: Sencha Cmd 6.5 made a breaking change in "generate workspace/app", and to restore the original behavior, we have to specify the new parameter "--full" (which Cmd < 6.5 prompts with an error).
        Parameters:
        arguments - the arguments list to add "--full" to if Sencha Cmd version is 6.5 or higher
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if Sencha Cmd version cannot be determined
      • createSenchaCfg

        public static void createSenchaCfg​(Path senchaCfgSource,
                                           Path senchaCfgTarget,
                                           Map<String,​Object> properties)
                                    throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • configureDefaults

        public static void configureDefaults​(SenchaConfigBuilder configBuilder,
                                             String defaultsFileName)
                                      throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • extractPkg

        public static void extractPkg​(File archive,
                                      File targetDir)
                               throws org.apache.maven.plugin.MojoExecutionException
        Unfortunately, we need to implement our own extractor because the maven unarchiver is unable to strip a given path prefix from the entry paths
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • baseDir

        public static File baseDir​(org.apache.maven.execution.MavenSession mavenSession)
      • remotePackagesDir

        public static File remotePackagesDir​(org.apache.maven.execution.MavenSession mavenSession)