com.android.build.gradle.internal.ExtraModelInfo Java Examples
The following examples show how to use
com.android.build.gradle.internal.ExtraModelInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransformReplacer.java From atlas with Apache License 2.0 | 5 votes |
public void replaceDexTransform(AppVariantContext appVariantContext, BaseVariantOutput vod) { List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType( variantContext, DexTransform.class); DefaultDexOptions dexOptions = appVariantContext.getAppExtension().getDexOptions(); DexingType dexingType = appVariantContext.getScope().getDexingType(); DexByteCodeConverterHook dexByteCodeConverterHook = new DexByteCodeConverterHook(variantContext , variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)) , LoggerWrapper.getLogger(DexByteCodeConverterHook.class) , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo() , new GradleJavaProcessExecutor(appVariantContext.getProject()) , appVariantContext.getProject().getLogger().isEnabled(LogLevel.INFO) , new ExtraModelInfo(appVariantContext.getScope().getGlobalScope().getProjectOptions(), appVariantContext.getProject().getLogger())); for (TransformTask transformTask : baseTransforms) { DexTransform newTransform = new DexTransform(dexOptions , dexingType , false , appVariantContext.getProject().files(variantContext.getScope().getMainDexListFile()) , verifyNotNull(appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo(), "Target Info not set.") , dexByteCodeConverterHook , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter() , variantContext.getScope().getMinSdkVersion().getFeatureLevel()); ReflectUtils.updateField(transformTask, "transform", newTransform); } }
Example #2
Source File: AtlasBaseTaskManager.java From atlas with Apache License 2.0 | 5 votes |
public AtlasBaseTaskManager(AtlasBuilder androidBuilder, T androidExtension, Project project, AtlasExtension atlasExtension) { this.tAndroidBuilder = androidBuilder; this.androidExtension = androidExtension; this.project = project; this.tasks = new TaskContainerAdaptor(project.getTasks()); this.atlasExtension = atlasExtension; this.logger = new LoggerWrapper(Logging.getLogger(AtlasBaseTaskManager.class)); this.extraModelInfo = new ExtraModelInfo(new ProjectOptions(project), Logging.getLogger(AtlasBaseTaskManager.class)); //this.dependencyManager = new DependencyManager(androidExtension, project, atlasExtension); }
Example #3
Source File: AppExtension.java From javaide with GNU General Public License v3.0 | 5 votes |
public AppExtension(@NonNull ProjectInternal project, @NonNull Instantiator instantiator, @NonNull AndroidBuilder androidBuilder, @NonNull SdkHandler sdkHandler, @NonNull NamedDomainObjectContainer<BuildType> buildTypes, @NonNull NamedDomainObjectContainer<ProductFlavor> productFlavors, @NonNull NamedDomainObjectContainer<SigningConfig> signingConfigs, @NonNull ExtraModelInfo extraModelInfo, boolean isLibrary) { super(project, instantiator, androidBuilder, sdkHandler, buildTypes, productFlavors, signingConfigs, extraModelInfo, isLibrary); }
Example #4
Source File: BaseComponentModelPlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
@Model(ANDROID_BUILDER) public AndroidBuilder createAndroidBuilder(Project project, ExtraModelInfo extraModelInfo) { String creator = "Android Gradle"; ILogger logger = new LoggerWrapper(project.getLogger()); return new AndroidBuilder(project.equals(project.getRootProject()) ? project.getName() : project.getPath(), creator, new GradleProcessExecutor(project), new GradleJavaProcessExecutor(project), extraModelInfo, logger, project.getLogger().isEnabled(LogLevel.INFO)); }
Example #5
Source File: BaseComponentModelPlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
public void createAndroidComponents( ComponentSpecContainer androidSpecs, ServiceRegistry serviceRegistry, AndroidConfig androidExtension, com.android.build.gradle.AndroidConfig adaptedModel, @Path("android.buildTypes") ModelMap<BuildType> buildTypes, @Path("android.productFlavors") ModelMap<ProductFlavor> productFlavors, @Path("android.signingConfigs") ModelMap<SigningConfig> signingConfigs, VariantFactory variantFactory, TaskManager taskManager, Project project, AndroidBuilder androidBuilder, SdkHandler sdkHandler, ExtraModelInfo extraModelInfo, @Path("isApplication") Boolean isApplication) { Instantiator instantiator = serviceRegistry.get(Instantiator.class); // check if the target has been set. TargetInfo targetInfo = androidBuilder.getTargetInfo(); if (targetInfo == null) { sdkHandler.initTarget(androidExtension.getCompileSdkVersion(), androidExtension.getBuildToolsRevision(), androidExtension.getLibraryRequests(), androidBuilder); } VariantManager variantManager = new VariantManager(project, androidBuilder, adaptedModel, variantFactory, taskManager, instantiator); for (BuildType buildType : buildTypes.values()) { variantManager.addBuildType(new BuildTypeAdaptor(buildType)); } for (ProductFlavor productFlavor : productFlavors.values()) { variantManager.addProductFlavor(new ProductFlavorAdaptor(productFlavor)); } DefaultAndroidComponentSpec spec = (DefaultAndroidComponentSpec) androidSpecs.get(COMPONENT_NAME); spec.setExtension(androidExtension); spec.setVariantManager(variantManager); }
Example #6
Source File: BasePlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
protected void configureProject() { extraModelInfo = new ExtraModelInfo(project, isLibrary()); sdkHandler = new SdkHandler(project, getLogger()); androidBuilder = new AndroidBuilder( project == project.getRootProject() ? project.getName() : project.getPath(), "Android Gradle Java N-IDE", new GradleProcessExecutor(project), new GradleJavaProcessExecutor(project), extraModelInfo, getLogger(), isVerbose()); // project.getPlugins().apply(JavaBasePlugin.class); // call back on execution. This is called after the whole build is done (not // after the current project is done). // This is will be called for each (android) projects though, so this should support // being called 2+ times. project.getGradle().getTaskGraph().addTaskExecutionGraphListener( new TaskExecutionGraphListener() { @Override public void graphPopulated(TaskExecutionGraph taskGraph) { for (Task task : taskGraph.getAllTasks()) { if (task instanceof PreDex) { PreDexCache.getCache().load( new File(project.getRootProject().getBuildDir(), FD_INTERMEDIATES + "/dex-cache/cache.xml")); break; } } } }); }
Example #7
Source File: ModelBuilder.java From javaide with GNU General Public License v3.0 | 5 votes |
public ModelBuilder( @NonNull AndroidBuilder androidBuilder, @NonNull VariantManager variantManager, @NonNull TaskManager taskManager, @NonNull AndroidConfig config, @NonNull ExtraModelInfo extraModelInfo, boolean isLibrary) { this.androidBuilder = androidBuilder; this.config = config; this.extraModelInfo = extraModelInfo; this.variantManager = variantManager; this.taskManager = taskManager; this.isLibrary = isLibrary; }
Example #8
Source File: LibraryExtension.java From javaide with GNU General Public License v3.0 | 5 votes |
public LibraryExtension(@NonNull ProjectInternal project, @NonNull Instantiator instantiator, @NonNull AndroidBuilder androidBuilder, @NonNull SdkHandler sdkHandler, @NonNull NamedDomainObjectContainer<BuildType> buildTypes, @NonNull NamedDomainObjectContainer<ProductFlavor> productFlavors, @NonNull NamedDomainObjectContainer<SigningConfig> signingConfigs, @NonNull ExtraModelInfo extraModelInfo, boolean isLibrary) { super(project, instantiator, androidBuilder, sdkHandler, buildTypes, productFlavors, signingConfigs, extraModelInfo, isLibrary); }
Example #9
Source File: AndroidExtension.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
public AndroidExtension(Project project, ToolingModelBuilderRegistry registry) { this.project = project; this.extraModelInfo = new ExtraModelInfo(new ProjectOptions(project), project.getLogger()); this.signingConfig = project.getExtensions().create("signingConfig", SigningConfig.class, "signing"); this.packagingOptions = project.getExtensions().create("packagingOptions", PackagingOptions.class); this.dexOptions = project.getExtensions().create("dexOptions", DexOptions.class, extraModelInfo); try { this.buildCache = FileCache.getInstanceWithMultiProcessLocking(new File(AndroidLocation.getFolder(), "build-cache")); } catch (AndroidLocation.AndroidLocationException e) { throw new RuntimeException(e); } LoggerWrapper loggerWrapper = new LoggerWrapper(project.getLogger()); this.sdkHandler = new SdkHandler(project, loggerWrapper); this.androidBuilder = new AndroidBuilder( project == project.getRootProject() ? project.getName() : project.getPath(), "JavaFX Mobile", new GradleProcessExecutor(project), new GradleJavaProcessExecutor(project), extraModelInfo, loggerWrapper, false); this.androidTaskRegistry = new AndroidTaskRegistry(); this.taskFactory = new TaskContainerAdaptor(project.getTasks()); installDirectory = new File(project.getBuildDir(), "javafxports/android"); project.getLogger().info("Android install directory: " + installDirectory); temporaryDirectory = new File(project.getBuildDir(), "javafxports/tmp/android"); project.getLogger().info("Android temporary output directory: " + temporaryDirectory); resourcesDirectory = new File(temporaryDirectory, "resources"); resourcesDirectory.mkdirs(); project.getLogger().info("Resources directory: " + resourcesDirectory); multidexOutputDirectory = new File(temporaryDirectory, "multi-dex"); multidexOutputDirectory.mkdirs(); project.getLogger().info("Multi-dex output directory: " + multidexOutputDirectory); dexOutputDirectory = new File(temporaryDirectory, "dex"); dexOutputDirectory.mkdirs(); project.getLogger().info("Dex output directory: " + dexOutputDirectory); }
Example #10
Source File: AndroidExtension.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ExtraModelInfo getExtraModelInfo() { return extraModelInfo; }
Example #11
Source File: JFXMobileAppExtension.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
public JFXMobileAppExtension(Project project, ProjectOptions projectOptions, Instantiator instantiator, AndroidBuilder androidBuilder, SdkHandler sdkHandler, ExtraModelInfo modelInfo) { super(project, projectOptions, instantiator, androidBuilder, sdkHandler, null, null, null, null, modelInfo); }
Example #12
Source File: AwbGenerator.java From atlas with Apache License 2.0 | 4 votes |
public AwbBundle createAwbBundle(LibVariantContext libVariantContext) throws IOException { String variantName = libVariantContext.getVariantName(); AtlasDependencyTree libDependencyTree = AtlasBuildContext.libDependencyTrees.get(variantName); //TODO 2.3 if (null == libDependencyTree) { libDependencyTree = new AtlasDepTreeParser(libVariantContext.getProject(), new ExtraModelInfo(new ProjectOptions(libVariantContext.getProject()),null), new HashSet<>()) .parseDependencyTree(libVariantContext.getVariantDependency()); AtlasBuildContext.libDependencyTrees.put(variantName, libDependencyTree); } Project project = libVariantContext.getProject(); String groupName = (String)project.getGroup(); String name = ""; String version = (String)project.getVersion(); if (project.hasProperty("archivesBaseName")) { name = (String)project.getProperties().get("archivesBaseName"); } else { name = project.getName(); } File explodedDir = project.file( project.getBuildDir().getAbsolutePath() + "/" + FD_INTERMEDIATES + "/exploded-awb/" + computeArtifactPath( groupName, name, version)); FileUtils.deleteDirectory(explodedDir); MavenCoordinates mavenCoordinates = new MavenCoordinatesImpl(groupName, name, version, "awb", ""); ResolvedDependencyInfo resolvedDependencyInfo = new ResolvedDependencyInfo(groupName, name, version, "awb"); resolvedDependencyInfo.setVariantName(libVariantContext.getVariantName()); AwbBundle awbBundle = new AwbBundle(resolvedDependencyInfo, DependencyConvertUtils .toAndroidLibrary(mavenCoordinates, libVariantContext.getBundleTask().getArchivePath(), explodedDir)); awbBundle.getSoLibraries().addAll(libDependencyTree.getMainBundle().getSoLibraries()); awbBundle.getAndroidLibraries().addAll(libDependencyTree.getMainBundle().getAndroidLibraries()); awbBundle.getJavaLibraries().addAll(libDependencyTree.getMainBundle().getJavaLibraries()); return awbBundle; }
Example #13
Source File: AtlasDepTreeParser.java From atlas with Apache License 2.0 | 4 votes |
public AtlasDepTreeParser(@NonNull Project project, @NonNull ExtraModelInfo extraModelInfo, Set<String> awbs) { this.project = project; this.extraModelInfo = extraModelInfo; this.awbs =awbs; // this.apDependencies = apDependencies; }
Example #14
Source File: BaseComponentModelPlugin.java From javaide with GNU General Public License v3.0 | 4 votes |
@Model(EXTRA_MODEL_INFO) public ExtraModelInfo createExtraModelInfo( Project project, @NonNull @Path("isApplication") Boolean isApplication) { return new ExtraModelInfo(project, isApplication); }
Example #15
Source File: BaseExtension.java From javaide with GNU General Public License v3.0 | 4 votes |
BaseExtension( @NonNull final ProjectInternal project, @NonNull Instantiator instantiator, @NonNull AndroidBuilder androidBuilder, @NonNull SdkHandler sdkHandler, @NonNull NamedDomainObjectContainer<BuildType> buildTypes, @NonNull NamedDomainObjectContainer<ProductFlavor> productFlavors, @NonNull NamedDomainObjectContainer<SigningConfig> signingConfigs, @NonNull ExtraModelInfo extraModelInfo, final boolean isLibrary) { this.androidBuilder = androidBuilder; this.sdkHandler = sdkHandler; this.buildTypes = buildTypes; //noinspection unchecked this.productFlavors = (NamedDomainObjectContainer) productFlavors; this.signingConfigs = signingConfigs; this.extraModelInfo = extraModelInfo; this.project = project; logger = Logging.getLogger(this.getClass()); defaultConfig = instantiator.newInstance(ProductFlavor.class, BuilderConstants.MAIN, project, instantiator, project.getLogger()); aaptOptions = instantiator.newInstance(AaptOptions.class); dexOptions = instantiator.newInstance(DexOptions.class); lintOptions = instantiator.newInstance(LintOptions.class); compileOptions = instantiator.newInstance(CompileOptions.class); packagingOptions = instantiator.newInstance(PackagingOptions.class); preprocessingOptions = instantiator.newInstance(PreprocessingOptions.class); splits = instantiator.newInstance(Splits.class, instantiator); sourceSetsContainer = project.container(AndroidSourceSet.class, new AndroidSourceSetFactory(instantiator, project, isLibrary)); sourceSetsContainer.whenObjectAdded(new Action<AndroidSourceSet>() { @Override public void execute(AndroidSourceSet sourceSet) { ConfigurationContainer configurations = project.getConfigurations(); createConfiguration( configurations, sourceSet.getCompileConfigurationName(), "Classpath for compiling the " + sourceSet.getName() + " sources."); String packageConfigDescription; if (isLibrary) { packageConfigDescription = "Classpath only used when publishing '" + sourceSet.getName() + "'."; } else { packageConfigDescription = "Classpath packaged with the compiled '" + sourceSet.getName() + "' classes."; } createConfiguration( configurations, sourceSet.getPackageConfigurationName(), packageConfigDescription); createConfiguration( configurations, sourceSet.getProvidedConfigurationName(), "Classpath for only compiling the " + sourceSet.getName() + " sources."); createConfiguration( configurations, sourceSet.getWearAppConfigurationName(), "Link to a wear app to embed for object '" + sourceSet.getName() + "'."); sourceSet.setRoot(String.format("src/%s", sourceSet.getName())); } }); sourceSetsContainer.create(defaultConfig.getName()); }
Example #16
Source File: AtlasConfigurationHelper.java From atlas with Apache License 2.0 | 3 votes |
public void configDependencies(File awbConfigFile) { Set<String> awbs = getAwbs(awbConfigFile); AtlasDependencyManager atlasDependencyManager = new AtlasDependencyManager(project, new ExtraModelInfo(new ProjectOptions(project), project.getLogger()),awbs); VariantManager variantManager = getVariantManager(); if (variantManager!=null) { variantManager.getVariantScopes().stream().forEach(variantScope -> atlasDependencyManager.resolveDependencies(variantScope.getVariantDependencies())); } }