Class SenchaUtils
- java.lang.Object
-
- net.jangaroo.jooc.mvnplugin.sencha.SenchaUtils
-
public class SenchaUtils extends Object
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringabsolutizeToModuleWithPlaceholder(String packageType, String relativePath)Generates an absolute path to the module dir for the given relative path using a placeholder.static StringabsolutizeWithPlaceholder(String placeholder, String relativePath)Generates an absolute path to the module dir for the given relative path using a placeholder.static voidaddSwitchFullIfCmd6_5(List<String> arguments)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).static FilebaseDir(org.apache.maven.execution.MavenSession mavenSession)static voidconfigureDefaults(SenchaConfigBuilder configBuilder, String defaultsFileName)static voidcreateSenchaCfg(Path senchaCfgSource, Path senchaCfgTarget, Map<String,Object> properties)static booleandoesSenchaAppExist(File directory)static voidextractPkg(File archive, File targetDir)Unfortunately, we need to implement our own extractor because the maven unarchiver is unable to strip a given path prefix from the entry pathsstatic voidgenerateSenchaAppFromTemplate(File workingDirectory, String appName, String applicationClass, String toolkit, org.apache.maven.plugin.logging.Log log, String logLevel, String senchaJvmArgs)static voidgenerateSenchaTestAppFromTemplate(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)static Map<String,String>getClassMapping(File sourceDir, String extNamespace, File currentDir)static org.apache.maven.model.DependencygetDependencyByRef(org.apache.maven.project.MavenProject project, String ref)static com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()static StringgetPackagesPath(org.apache.maven.project.MavenProject project)static StringgetSenchaPackageName(String groupId, String artifactId)static StringgetSenchaPackageName(org.apache.maven.project.MavenProject project)static StringgetSenchaVersionForMavenVersion(String version)static booleanisRequiredSenchaDependency(org.apache.maven.model.Dependency dependency, boolean includeTestDependencies)static booleanisRequiredSenchaDependency(org.apache.maven.model.Dependency dependency, boolean includeTestDependencies, boolean includeProvidedDependencies)static booleanisSenchaDependency(String type)static booleanisSenchaDependency(org.apache.maven.model.Dependency dependency)static FileremotePackagesDir(org.apache.maven.execution.MavenSession mavenSession)static voidwriteFile(SenchaConfigBuilder configBuilder, String destinationFileDir, String destinationFileName, String comment, org.apache.maven.plugin.logging.Log log)
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
- See Also:
- Constant Field Values
-
APP_DIRECTORY_NAME
public static final String APP_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
TEST_APP_DIRECTORY_NAME
public static final String TEST_APP_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
EXT_DIRECTORY_NAME
public static final String EXT_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
PACKAGES_DIRECTORY_NAME
public static final String PACKAGES_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
APPS_DIRECTORY_NAME
public static final String APPS_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
LOCAL_PACKAGES_PATH
public static final String LOCAL_PACKAGES_PATH
- See Also:
- Constant Field Values
-
LOCAL_APPS_PATH
public static final String LOCAL_APPS_PATH
- See Also:
- Constant Field Values
-
APP_TARGET_DIRECTORY
public static final String APP_TARGET_DIRECTORY
- See Also:
- Constant Field Values
-
APPS_TARGET_DIRECTORY
public static final String APPS_TARGET_DIRECTORY
- See Also:
- Constant Field Values
-
SENCHA_LOCALE_PATH
public static final String SENCHA_LOCALE_PATH
The name of the folder of the generated module inside the packages folder of the module. Make sure that the name is not too long to avoid exceeding the max path length in windows. The old path length relative to the target folder was 43 chars: classes\META-INF\resources\joo\classes\com So to avoid compatiblity issues the max length for the path is: 43 - SENCHA_BASE_BATH.length - SENCHA_PACKAGES.length - SENCHA_PACKAGE_LOCAL.length - SENCHA_CLASS_PATH.length - 4 (Separator)- See Also:
- Constant Field Values
-
DEFAULT_LOCALE
public static final String DEFAULT_LOCALE
- See Also:
- Constant Field Values
-
SENCHA_RESOURCES_PATH
public static final String SENCHA_RESOURCES_PATH
- See Also:
- Constant Field Values
-
SENCHA_BUNDLED_RESOURCES_PATH
public static final String SENCHA_BUNDLED_RESOURCES_PATH
- See Also:
- Constant Field Values
-
PRODUCTION_PROFILE
public static final String PRODUCTION_PROFILE
- See Also:
- Constant Field Values
-
TESTING_PROFILE
public static final String TESTING_PROFILE
- See Also:
- Constant Field Values
-
DEVELOPMENT_PROFILE
public static final String DEVELOPMENT_PROFILE
- See Also:
- Constant Field Values
-
TOOLKIT_CLASSIC
public static final String TOOLKIT_CLASSIC
- See Also:
- Constant Field Values
-
SENCHA_DIRECTORYNAME
public static final String SENCHA_DIRECTORYNAME
- See Also:
- Constant Field Values
-
SENCHA_WORKSPACE_CONFIG
public static final String SENCHA_WORKSPACE_CONFIG
- See Also:
- Constant Field Values
-
SENCHA_PACKAGE_CONFIG
public static final String SENCHA_PACKAGE_CONFIG
- See Also:
- Constant Field Values
-
SENCHA_WORKSPACE_FILENAME
public static final String SENCHA_WORKSPACE_FILENAME
- See Also:
- Constant Field Values
-
SENCHA_PACKAGE_FILENAME
public static final String SENCHA_PACKAGE_FILENAME
- See Also:
- Constant Field Values
-
SENCHA_APP_FILENAME
public static final String SENCHA_APP_FILENAME
- See Also:
- Constant Field Values
-
PACKAGE_CONFIG_FILENAME
public static final String PACKAGE_CONFIG_FILENAME
- See Also:
- Constant Field Values
-
REQUIRED_CLASSES_FILENAME
public static final String REQUIRED_CLASSES_FILENAME
- See Also:
- Constant Field Values
-
DYNAMIC_PACKAGES_FILENAME
public static final String DYNAMIC_PACKAGES_FILENAME
- See Also:
- Constant Field Values
-
ADDITIONAL_PACKAGES_PATH
public static final String ADDITIONAL_PACKAGES_PATH
- See Also:
- Constant Field Values
-
APP_MANIFEST_FILENAME
public static final String APP_MANIFEST_FILENAME
- See Also:
- Constant Field Values
-
APP_MANIFEST_FRAGMENT_FILENAME
public static final String APP_MANIFEST_FRAGMENT_FILENAME
- See Also:
- Constant Field Values
-
APPS_FILENAME
public static final String APPS_FILENAME
- See Also:
- Constant Field Values
-
SENCHA_TEST_APP_TEMPLATE_ARTIFACT_ID
public static final String SENCHA_TEST_APP_TEMPLATE_ARTIFACT_ID
- See Also:
- Constant Field Values
-
SENCHA_APP_TEMPLATE_ARTIFACT_ID
public static final String SENCHA_APP_TEMPLATE_ARTIFACT_ID
- See Also:
- Constant Field Values
-
SENCHA_APP_TEMPLATE_GROUP_ID
public static final String SENCHA_APP_TEMPLATE_GROUP_ID
- See Also:
- Constant Field Values
-
AUTO_CONTENT_COMMENT
public static final String AUTO_CONTENT_COMMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 typerelativePath- 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)
-
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
-
writeFile
public static void writeFile(@Nonnull SenchaConfigBuilder configBuilder, @Nonnull String destinationFileDir, @Nonnull String destinationFileName, @Nullable String comment, org.apache.maven.plugin.logging.Log log) 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)
-
-