本文整理汇总了Java中org.jetbrains.android.facet.AndroidFacet.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidFacet.getProperties方法的具体用法?Java AndroidFacet.getProperties怎么用?Java AndroidFacet.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.android.facet.AndroidFacet
的用法示例。
在下文中一共展示了AndroidFacet.getProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNamespaceKeyByResourcePackage
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static String getNamespaceKeyByResourcePackage(@NotNull AndroidFacet facet, @Nullable String resPackage) {
if (resPackage == null) {
if (facet.getProperties().LIBRARY_PROJECT || facet.isGradleProject()) {
return AUTO_URI;
}
Manifest manifest = facet.getManifest();
if (manifest != null) {
String aPackage = manifest.getPackage().getValue();
if (aPackage != null && aPackage.length() > 0) {
return URI_PREFIX + aPackage;
}
}
}
else if (resPackage.equals(SYSTEM_RESOURCE_PACKAGE)) {
return ANDROID_URI;
}
return null;
}
示例2: toRun
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static boolean toRun(@NotNull AndroidAutogeneratorMode mode, @NotNull AndroidFacet facet, boolean force) {
if (!supportsAutogeneration(facet)) {
return false;
}
if (!force && !facet.getProperties().ENABLE_SOURCES_AUTOGENERATION) {
return false;
}
switch (mode) {
case AAPT:
case AIDL:
case RENDERSCRIPT:
case BUILDCONFIG:
return true;
default:
LOG.error("Unknown autogenerator mode " + mode);
return false;
}
}
示例3: configureFacet
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void configureFacet(@NotNull AndroidFacet facet, @NotNull IdeaAndroidProject ideaAndroidProject) {
JpsAndroidModuleProperties facetState = facet.getProperties();
facetState.ALLOW_USER_CONFIGURATION = false;
AndroidProject delegate = ideaAndroidProject.getDelegate();
facetState.LIBRARY_PROJECT = delegate.isLibrary();
SourceProvider sourceProvider = delegate.getDefaultConfig().getSourceProvider();
syncSelectedVariantAndTestArtifact(facetState, ideaAndroidProject);
// This code needs to be modified soon. Read the TODO in getRelativePath
File moduleDirPath = ideaAndroidProject.getRootDirPath();
File manifestFile = sourceProvider.getManifestFile();
facetState.MANIFEST_FILE_RELATIVE_PATH = relativePath(moduleDirPath, manifestFile);
Collection<File> resDirs = sourceProvider.getResDirectories();
facetState.RES_FOLDER_RELATIVE_PATH = relativePath(moduleDirPath, resDirs);
Collection<File> assetsDirs = sourceProvider.getAssetsDirectories();
facetState.ASSETS_FOLDER_RELATIVE_PATH = relativePath(moduleDirPath, assetsDirs);
facet.setIdeaAndroidProject(ideaAndroidProject);
facet.syncSelectedVariantAndTestArtifact();
}
示例4: init
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public void init() {
if (myTargetFile != null) {
AndroidFacet facet = AndroidFacet.getInstance(myModule);
if (facet != null) {
Iterator<SourceProvider> sourceProvidersIter = IdeaSourceProvider.getSourceProvidersForFile(facet, myTargetFile, null).iterator();
if (sourceProvidersIter.hasNext()) {
SourceProvider provider = sourceProvidersIter.next();
File resDir = NewTemplateObjectWizard.findResDirectory(provider);
String path;
if (resDir == null) {
// No res dir exists, infer one
path = provider.getManifestFile().getParent() + facet.getProperties().RES_FOLDER_RELATIVE_PATH;
} else {
path = resDir.getPath();
}
myTemplateState.put(ATTR_OUTPUT_FOLDER, FileUtil.toSystemIndependentName(path));
}
}
}
setUpUiComponents();
}
示例5: testCustomizeModule
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public void testCustomizeModule() {
File rootDir = myAndroidProject.getRootDir();
VariantStub selectedVariant = myAndroidProject.getFirstVariant();
assertNotNull(selectedVariant);
String selectedVariantName = selectedVariant.getName();
IdeaAndroidProject project = new IdeaAndroidProject(GradleConstants.SYSTEM_ID, myAndroidProject.getName(), rootDir, myAndroidProject,
selectedVariantName, AndroidProject.ARTIFACT_ANDROID_TEST);
final IdeModifiableModelsProviderImpl modelsProvider = new IdeModifiableModelsProviderImpl(myProject);
try {
myCustomizer.customizeModule(myProject, myModule, modelsProvider, project);
modelsProvider.commit();
}
catch (Throwable t) {
modelsProvider.dispose();
ExceptionUtil.rethrowAllAsUnchecked(t);
}
// Verify that AndroidFacet was added and configured.
AndroidFacet facet = AndroidFacet.getInstance(myModule);
assertNotNull(facet);
assertSame(project, facet.getIdeaAndroidProject());
JpsAndroidModuleProperties facetState = facet.getProperties();
assertFalse(facetState.ALLOW_USER_CONFIGURATION);
}
示例6: getBuildVariantName
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public static String getBuildVariantName(Module module) {
//see com.android.tools.idea.gradle.variant.view.BuildVariantView; line:232
AndroidFacet androidFacet = AndroidFacet.getInstance(module);
JpsAndroidModuleProperties facetProperties = androidFacet.getProperties();
String variantName = facetProperties.SELECTED_BUILD_VARIANT;
return variantName;
}
示例7: isProGuardUsed
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static boolean isProGuardUsed(@NotNull Project project, @NotNull CompileScope scope) {
for (Module module : scope.getAffectedModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && facet.getProperties().RUN_PROGUARD) {
return true;
}
}
final String proguardCfgPathsStr = scope.getUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY);
if (proguardCfgPathsStr != null && proguardCfgPathsStr.length() > 0) {
return true;
}
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, scope, false);
for (Artifact artifact : artifacts) {
if (artifact.getArtifactType() instanceof AndroidApplicationArtifactType) {
final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());
if (properties instanceof AndroidApplicationArtifactProperties) {
final AndroidApplicationArtifactProperties p = (AndroidApplicationArtifactProperties)properties;
if (p.isRunProGuard()) {
return true;
}
}
}
}
return false;
}
示例8: getAaptManifestPackage
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static String getAaptManifestPackage(@NotNull AndroidFacet facet) {
if (facet.getProperties().USE_CUSTOM_MANIFEST_PACKAGE) {
return facet.getProperties().CUSTOM_MANIFEST_PACKAGE;
}
final Manifest manifest = facet.getManifest();
return manifest != null
? manifest.getPackage().getStringValue()
: null;
}
示例9: testFacetProperties1
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public void testFacetProperties1() throws Exception {
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = AndroidTestCase.getDefaultTestSdkPath();
try {
importProject(getPomContent("apk", "module", ""));
assertModules("module");
final Module module = getModule("module");
checkSdk(ModuleRootManager.getInstance(module).getSdk());
final AndroidFacet facet = AndroidFacet.getInstance(module);
assertNotNull(facet);
final JpsAndroidModuleProperties properties = facet.getProperties();
assertEquals(false, properties.LIBRARY_PROJECT);
assertEquals("/res", properties.RES_FOLDER_RELATIVE_PATH);
assertEquals(false, properties.USE_CUSTOM_APK_RESOURCE_FOLDER);
assertEquals("/AndroidManifest.xml", properties.MANIFEST_FILE_RELATIVE_PATH);
assertEquals(false, properties.USE_CUSTOM_COMPILER_MANIFEST);
assertEquals("", properties.CUSTOM_COMPILER_MANIFEST);
assertEquals("/libs", properties.LIBS_FOLDER_RELATIVE_PATH);
assertEquals("/assets", properties.ASSETS_FOLDER_RELATIVE_PATH);
assertEquals("/target/generated-sources/aidl", properties.GEN_FOLDER_RELATIVE_PATH_AIDL);
assertEquals("/target/generated-sources/r", properties.GEN_FOLDER_RELATIVE_PATH_APT);
assertEquals(false, properties.ENABLE_MANIFEST_MERGING);
assertFalse(AndroidDexCompilerConfiguration.getInstance(myProject).CORE_LIBRARY);
}
finally {
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = null;
}
}
示例10: testFacetProperties2
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public void testFacetProperties2() throws Exception {
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = AndroidTestCase.getDefaultTestSdkPath();
try {
importProject(getPomContent(
"apklib", "module",
"<mergeManifests>true</mergeManifests>" +
"<androidManifestFile>${project.build.directory}/manifest/AndroidManifest.xml</androidManifestFile>" +
"<resourceDirectory>${project.build.directory}/resources</resourceDirectory>" +
"<assetsDirectory>${project.build.directory}/assets</assetsDirectory>" +
"<nativeLibrariesDirectory>${project.build.directory}/nativeLibs</nativeLibrariesDirectory>" +
"<dexCoreLibrary>true</dexCoreLibrary>"));
assertModules("module");
final Module module = getModule("module");
checkSdk(ModuleRootManager.getInstance(module).getSdk());
final AndroidFacet facet = AndroidFacet.getInstance(module);
assertNotNull(facet);
final JpsAndroidModuleProperties properties = facet.getProperties();
assertEquals(true, properties.LIBRARY_PROJECT);
assertEquals("/target/resources", properties.RES_FOLDER_RELATIVE_PATH);
assertEquals(false, properties.USE_CUSTOM_APK_RESOURCE_FOLDER);
assertEquals("/target/manifest/AndroidManifest.xml", properties.MANIFEST_FILE_RELATIVE_PATH);
assertEquals(false, properties.USE_CUSTOM_COMPILER_MANIFEST);
assertEquals("", properties.CUSTOM_COMPILER_MANIFEST);
assertEquals("/target/nativeLibs", properties.LIBS_FOLDER_RELATIVE_PATH);
assertEquals("/target/assets", properties.ASSETS_FOLDER_RELATIVE_PATH);
assertEquals("/target/generated-sources/aidl", properties.GEN_FOLDER_RELATIVE_PATH_AIDL);
assertEquals("/target/generated-sources/r", properties.GEN_FOLDER_RELATIVE_PATH_APT);
assertEquals(true, properties.ENABLE_MANIFEST_MERGING);
assertTrue(AndroidDexCompilerConfiguration.getInstance(myProject).CORE_LIBRARY);
}
finally {
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = null;
}
}
示例11: createFacet
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@NotNull
private static AndroidFacet createFacet(@NotNull FacetManager facetManager, boolean library) {
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
JpsAndroidModuleProperties facetState = facet.getProperties();
facetState.ALLOW_USER_CONFIGURATION = false;
facetState.LIBRARY_PROJECT = library;
return facet;
}
示例12: configureFacet
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void configureFacet(AndroidFacet facet) {
JpsAndroidModuleProperties facetState = facet.getProperties();
facetState.ALLOW_USER_CONFIGURATION = false;
facetState.PROJECT_TYPE = AndroidProject.PROJECT_TYPE_LIBRARY;
facetState.MANIFEST_FILE_RELATIVE_PATH = "";
facetState.RES_FOLDER_RELATIVE_PATH = "";
facetState.ASSETS_FOLDER_RELATIVE_PATH = "";
facetState.ENABLE_SOURCES_AUTOGENERATION = false;
}
示例13: reimportFacet
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Override
protected void reimportFacet(IdeModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter rootModel,
AndroidFacet facet,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
MavenProjectChanges changes,
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
configurePaths(facet, mavenProject);
facet.getProperties().ENABLE_MANIFEST_MERGING = Boolean.parseBoolean(findConfigValue(mavenProject, "mergeManifests"));
facet.getProperties().COMPILE_CUSTOM_GENERATED_SOURCES = false;
configureAndroidPlatform(facet, mavenProject, modelsProvider);
final Project project = module.getProject();
importExternalAndroidLibDependencies(project, rootModel, modelsProvider, mavenTree, mavenProject, mavenProjectToModuleName,
postTasks);
if (hasAndroidLibDependencies(mavenProject) &&
MavenProjectsManager.getInstance(project).getImportingSettings().isUseMavenOutput()) {
// IDEA's apklibs building model is different from Maven's one, so we cannot use the same
rootModel.useModuleOutput(mavenProject.getBuildDirectory() + "/idea-classes",
mavenProject.getBuildDirectory() + "/idea-test-classes");
}
project.putUserData(DELETE_OBSOLETE_MODULE_TASK_KEY, Boolean.TRUE);
postTasks.add(new MyDeleteObsoleteApklibModulesTask(project));
// exclude folders where Maven generates sources if gen source roots were changed by user manually
final AndroidFacetConfiguration defaultConfig = new AndroidFacetConfiguration();
AndroidMavenProviderImpl.setPathsToDefault(mavenProject, module, defaultConfig);
if (!defaultConfig.getState().GEN_FOLDER_RELATIVE_PATH_APT.equals(
facet.getProperties().GEN_FOLDER_RELATIVE_PATH_APT)) {
final String rPath = mavenProject.getGeneratedSourcesDirectory(false) + "/r";
rootModel.unregisterAll(rPath, false, true);
rootModel.addExcludedFolder(rPath);
}
if (!defaultConfig.getState().GEN_FOLDER_RELATIVE_PATH_AIDL.equals(
facet.getProperties().GEN_FOLDER_RELATIVE_PATH_AIDL)) {
final String aidlPath = mavenProject.getGeneratedSourcesDirectory(false) + "/aidl";
rootModel.unregisterAll(aidlPath, false, true);
rootModel.addExcludedFolder(aidlPath);
}
if (facet.getProperties().LIBRARY_PROJECT) {
removeAttachedJarDependency(modelsProvider, mavenTree, mavenProject);
}
}
示例14: _init
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Override
public void _init() {
if (myInited) return;
final AndroidFacet facet = myWizard.getFacet();
Module module = facet.getModule();
PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
String lastModule = properties.getValue(ChooseModuleStep.MODULE_PROPERTY);
String lastApkPath = properties.getValue(getApkPathPropertyName());
if (lastApkPath != null && module.getName().equals(lastModule)) {
myApkPathField.setText(FileUtil.toSystemDependentName(lastApkPath));
}
else {
String contentRootPath = getContentRootPath(module);
if (contentRootPath != null) {
String defaultPath = FileUtil.toSystemDependentName(contentRootPath + "/" + module.getName() + ".apk");
myApkPathField.setText(defaultPath);
}
}
final String runProguardPropValue = properties.getValue(RUN_PROGUARD_PROPERTY);
boolean selected;
if (runProguardPropValue != null) {
selected = Boolean.parseBoolean(runProguardPropValue);
}
else {
selected = facet.getProperties().RUN_PROGUARD;
}
myProguardCheckBox.setSelected(selected);
myProGuardConfigFilesPanel.setEnabled(selected);
final String proguardCfgPathsStr = properties.getValue(PROGUARD_CFG_PATHS_PROPERTY);
final String[] proguardCfgPaths = proguardCfgPathsStr != null
? parseAndCheckProguardCfgPaths(proguardCfgPathsStr)
: null;
if (proguardCfgPaths != null && proguardCfgPaths.length > 0) {
myProGuardConfigFilesPanel.setOsPaths(Arrays.asList(proguardCfgPaths));
}
else {
final AndroidFacetConfiguration configuration = facet.getConfiguration();
if (configuration.getState().RUN_PROGUARD) {
myProGuardConfigFilesPanel.setUrls(facet.getProperties().myProGuardCfgFiles);
}
else {
final List<String> urls = new ArrayList<String>();
urls.add(AndroidCommonUtils.PROGUARD_SYSTEM_CFG_FILE_URL);
final Pair<VirtualFile, Boolean> pair = AndroidCompileUtil.getDefaultProguardConfigFile(facet);
if (pair != null) {
urls.add(pair.getFirst().getUrl());
}
myProGuardConfigFilesPanel.setUrls(urls);
}
}
myInited = true;
}
示例15: getBuildTargetScopes
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter,
@NotNull Project project, boolean forceBuild) {
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID) || Projects.isGradleProject(project)) {
return Collections.emptyList();
}
final List<String> appTargetIds = new ArrayList<String>();
final List<String> libTargetIds = new ArrayList<String>();
final List<String> allTargetIds = new ArrayList<String>();
final List<String> manifestMergingTargetIds = new ArrayList<String>();
final boolean fullBuild = AndroidCompileUtil.isFullBuild(baseScope);
for (Module module : baseScope.getAffectedModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
continue;
}
allTargetIds.add(module.getName());
if (fullBuild) {
if (facet.isLibraryProject()) {
libTargetIds.add(module.getName());
}
else {
if (facet.getProperties().ENABLE_MANIFEST_MERGING) {
manifestMergingTargetIds.add(module.getName());
}
appTargetIds.add(module.getName());
}
}
}
final List<TargetTypeBuildScope> result = new ArrayList<TargetTypeBuildScope>();
result.add(CmdlineProtoUtil.createTargetsScope(
AndroidCommonUtils.MANIFEST_MERGING_BUILD_TARGET_TYPE_ID, manifestMergingTargetIds, forceBuild));
if (fullBuild && !isProGuardUsed(project, baseScope)) {
result.add(CmdlineProtoUtil.createTargetsScope(
AndroidCommonUtils.PRE_DEX_BUILD_TARGET_TYPE_ID, Collections.singletonList("only"), forceBuild));
}
result.addAll(Arrays.asList(
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.AAR_DEPS_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.DEX_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_CACHING_BUILD_TARGET_ID, allTargetIds, forceBuild),
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_PACKAGING_BUILD_TARGET_ID, appTargetIds, forceBuild),
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.PACKAGING_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.LIBRARY_PACKAGING_BUILD_TARGET_ID, libTargetIds, forceBuild)));
return result;
}