Git Product home page Git Product logo

Comments (4)

liyujiang-gzu avatar liyujiang-gzu commented on August 30, 2024

combuild.isRegisterCompoAuto配置为false的时候,不配置applicationName项目就会构建失败:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ComponentShare:transformClassesWithComponentCodeForDebug'.
> you should set applicationName in combuild
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
...
Caused by: java.lang.RuntimeException: you should set applicationName in combuild
	at com.dd.buildgradle.ComCodeTransform.getRealApplicationName(ComCodeTransform.groovy:133)
	at com.dd.buildgradle.ComCodeTransform.transform(ComCodeTransform.groovy:24)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
	... 31 more

combuild.isRegisterCompoAuto配置为false的时候,IApplicationLike的实现类的RegisterCompManual注解不是必须要加的:

>>>> javassist.CtClassType@262c7fb2[public class xxx.browser.BrowserAppLike implements com.luojilab.component.componentlib.applicationlike.IApplicationLike,  fields= constructors=javassist.CtConstructor@7eacaec5[public BrowserAppLike ()V],  methods=javassist.CtMethod@119b79fc[public onCreate ()V], javassist.CtMethod@59c8eb42[public onStop ()V], ] **manual register?false**
Application is   runalone.BrowserApplication
ApplicationLike will be auto register: xxx.browser.BrowserAppLike
>>>
>>>
>>>
>>>
check isRegisterCompoAuto:  W:\xxx\build\intermediates\javac\debug\compileDebugJavaWithJavac\classes ; **isRegisterCompoAuto:false**

from jimu.

YummyLau avatar YummyLau commented on August 30, 2024

实际上我更倾向于 调试独立不耦合在组件内,无需走反射直接调试就好了。
可以参考 https://github.com/YummyLau/ComponentPlugin

from jimu.

liyujiang-gzu avatar liyujiang-gzu commented on August 30, 2024

实际上我更倾向于 调试独立不耦合在组件内,无需走反射直接调试就好了。
可以参考 https://github.com/YummyLau/ComponentPlugin

学习了,站在巨人的肩上走的更远

from jimu.

leobert-lan avatar leobert-lan commented on August 30, 2024

抱歉时隔两年才答复。

插件配置组件入口(applicationName)是最开始的方案,后来我参与了项目,个人认为方案中的一些做法虽然简单但不简便。所以计划尝试 利用Gradle Transformer 阶段扫描组件发现 取代 组件配置,出于个人精力受限,印象中整个计划没有全部做完,给大家带来了一些困扰。

  • applicationName 配置runalone时Application的入口,这一点没有变
  • combuild.isRegisterCompoAuto 意指:runalone时是否织入 ”组件的初始化代码“,但原始方案中,无法对加载顺序,加载时机做任何干涉。

为了解决这些问题,计划中分了几步:

  • 先建立排除机制,让指定的组件无法被自动加载,即添加 RegisterCompManual注解
  • 添加一个支持库,让组件的加载可被描述为 ”一系列存在依赖条件的任务“,按照任务图处理加载,这部分工作作为Maat项目单独发布了。这样IApplicationLike就是一个单纯的 注入点, 用于向加载任务中注入 ”组件初始化逻辑“
  • 废除 combuild.isRegisterCompoAuto 等机制,在前面的步骤完成后,我们可以激进的认为:”除了无须自动加载的组件,均可以被自动加载 “(当然,这个想法一定存在争议:是组件决定自己是否应该被加载,还是宿主决定是否自动加载组件)这一步尚未实施

from jimu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.