-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing the gradle plugin #92
Comments
@bbaudry @tdurieux
Also, if you allow me, then I want to update my timeline here ie. I will start working on the Gradle plugin from now and only after successfully completing this task, I will discuss with you my approach to the next GSoC task. So this is my documented plan for the plugin task (as I mentioned in my proposal). Thank you. |
Hello, could you try to explain by message first? I am a busy week I am not sure that we will find a time for a meeting. |
Ok, no problem, |
Hello @bbaudry @tdurieux Thank you |
Perfect! |
Hello @bbaudry @tdurieux
Problem:
What I tried to solve this problem:
If you got the problem then please suggest to me some solutions regarding this. NOTE: To test the plugin results again use the method that I mentioned in my PR #93 Thank you |
From what I understand copyDependenciesLocally take the classpath and copy all the jar into a specific folder. It does not seem to be something that is hard to recreate. You can already get the classpath and then you can just copy everything that is in the classpath into a specific folder. Is there a reason why you could not do this? |
The only reason behind this was, I didn't know that it takes classpath. Thank you |
Hello, @tdurieux @bbaudry, Thank you |
No worry, I hope that the damage was not too big. Ping me when you think that your PR is ready. |
Hello @tdurieux
I think up to now the plugin is working fine and I think now I should move forward to make it configurable. Thank you |
Hello @tdurieux @bbaudry Thank you |
Are you trying to do be able to add optional properties to the plugin, like: https://github.com/riiid/gradle-github-plugin/tree/63be285ea8de3be6d65d86462c5e1ed09ea1a1e1? This project is relatively simple you can follow what they are doing, the properties are registered here: https://github.com/riiid/gradle-github-plugin/blob/63be285ea8de3be6d65d86462c5e1ed09ea1a1e1/src/main/groovy/co/riiid/gradle/GithubPlugin.groovy#L11 and defined here: https://github.com/riiid/gradle-github-plugin/blob/63be285ea8de3be6d65d86462c5e1ed09ea1a1e1/src/main/groovy/co/riiid/gradle/GithubExtension.groovy Does it help you? Side note: when I am struggling with a specific task that I expect someone already did, I look on github for projects or API usage. Generally, it helps me to solve my problem. |
This side note helps me a lot. Thank you |
Hii @tdurieux @bbaudry But, now I have tried so many different different ways to add parameters, but nothing has worked as I expected. So, please suggest to me something that I can do here. Thank you |
I am not sure to understand what is exactly the problem: if you setup your class package se.kth.depclean;
import java.util.Locale;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.tasks.TaskAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class depcleanGradleTask extends DefaultTask {
public static final Logger log = LoggerFactory.getLogger(depcleanGradleTask.class);
boolean isIgnoreTest = false;
@TaskAction
public void printDependencies() {
System.out.println("isIgnoreTest: " + isIgnoreTest);
log.info("Debloating starts...".toUpperCase(Locale.ROOT));
Action<Project> defaultAction = new depcleanGradleAction();
getProject().allprojects(defaultAction);
log.info("Debloating ends.".toUpperCase(Locale.ROOT));
}
} and in buildscript{
repositories {
mavenLocal()
repositories { flatDir name: 'libs', dirs: "../../../../build/libs" }
dependencies{
classpath 'se.kth.castor:depclean-gradle-plugin:1.0-SNAPSHOT'
}
}
}
plugins {
id 'java'
id 'maven-publish'
}
apply plugin: 'se.kth.castor.depclean-gradle-plugin'
debloat.isIgnoreTest = true
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.2'
}
group = 'org.foo.bar'
version = '1.0.0-SNAPSHOT'
description = 'foobar'
//java.sourceCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
} and you execute the debloat plugin on Does it help you? |
Hii @tdurieux
And this is the result exactly as I expected.
I have seen some projects on Github which use both ways. Thank you |
It looks perfectly fine to me to use the way you described. |
Hello @tdurieux @bbaudry
Also since I am heading towards the end of this task, I want to end it professionally, so please suggest to me the default task name that I should use for the plugin like in maven we use this long command One more thing, I have not implemented some extra configuration similar to PR #93 is completely open for review. Thank you |
creating the pom should be extremely fast, I don't see a reason why it would be slow, for the JSON, it depends of the size of the project. it can potentially take a lot of time for big projects. |
Yes please add a parameter for debloat the Gradle build file and one to generate the Json file.
On Jul 10, 2021 07:45, ABHAY SINGH ***@***.***> wrote:
Then for now should I add a parameter for debloated-build.gradle or not?
And also for .json?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#92 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABKRWYCSY7V3OFKLR2SEABTTW7M6VANCNFSM45RS6PPQ>.
|
Hii @tdurieux
So what we can do is that instead of creating a whole new build.gradle file, we can just create a debloated-dependencies.gradle file using Also, its generation will be very fast as we will be dealing only with the dependencies section of the project. If I will able to conquer all the problems then this way of creating this parameter will definitely work. Thank you |
Hii @tdurieux @bbaudry, Thank you |
Hello, @tdurieux @bbaudry, Waiting for your fast response... |
What are you trying to achieve with |
I want to generate the complete dependency tree of the project which can be done using the cmd |
Hello @tdurieux @bbaudry But finally, with the help of one of my friends, we found a way to add module tests to CI. Also, I want to update you that my final semester exams are over (22 - 25) and I am getting a 10 day leave from college, so I will be providing as maximum as possible hours to the project. 😄 👍🏽 Best Abhay |
Hii @tdurieux @bbaudry You can review the modified tests and workflow files. |
Hii @bbaudry @tdurieux Until then I will be carrying on with some more debugging and testing. 😃 |
Hello everyone , I am Amisha pursuing Btech in computer Science I am looking to work on this project can anyone tell me how to start ? @ABHAY0O7 can you please guide me? |
Hello @tdurieux @bbaudry
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] abhayPlugin [pom]
[INFO] abhay-module-1 [jar]
[INFO] abhay-module-2 [jar]
[INFO] abhay-module-3 [jar]
[INFO]
[INFO] -----------------------< org.abhay:abhayPlugin >------------------------
[INFO] Building abhayPlugin 1.0-SNAPSHOT [1/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhayPlugin ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[INFO] Skipping because packaging type pom.
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-1 >----------------------
[INFO] Building abhay-module-1 1.0-SNAPSHOT [2/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-1 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [0]:
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [0]:
POTENTIALLY UNUSED DIRECT DEPENDENCIES [0]:
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [0]:
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-2 >----------------------
[INFO] Building abhay-module-2 1.0-SNAPSHOT [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-2 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [1]:
com.fasterxml.jackson.core:jackson-core:2.12.2:compile (size unknown)
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [0]:
POTENTIALLY UNUSED DIRECT DEPENDENCIES [3]:
commons-codec:commons-codec:1.15:compile (size unknown)
com.jcabi:jcabi-manifests:1.1:compile (size unknown)
commons-io:commons-io:2.8.0:compile (size unknown)
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [2]:
org.slf4j:slf4j-api:1.7.5:compile (size unknown)
com.jcabi:jcabi-log:0.14:compile (size unknown)
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-3 >----------------------
[INFO] Building abhay-module-3 1.0-SNAPSHOT [4/4]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Could not transfer metadata org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from/to example-repo (C:\Users\ABHAY SINGH/.m2/repository): Cannot access C:\Users\ABHAY SINGH/.m2/repository with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] Failure to transfer org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from C:\Users\ABHAY SINGH/.m2/repository was cached in the local repository, resolution will not be reattempted until the update interval of example-repo has elapsed or updates are forced. Original error: Could not transfer metadata org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from/to example-repo (C:\Users\ABHAY SINGH/.m2/repository): Cannot access C:\Users\ABHAY SINGH/.m2/repository with type default using the available connector factories: BasicRepositoryConnectorFactory
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-3 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [1]:
org.abhay:abhay-module-2:1.0-SNAPSHOT:compile (size unknown)
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [3]:
commons-codec:commons-codec:1.15:compile (size unknown)
com.fasterxml.jackson.core:jackson-core:2.12.2:compile (size unknown)
com.jcabi:jcabi-manifests:1.1:compile (size unknown)
POTENTIALLY UNUSED DIRECT DEPENDENCIES [0]:
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [3]:
org.slf4j:slf4j-api:1.7.5:compile (size unknown)
com.jcabi:jcabi-log:0.14:compile (size unknown)
commons-io:commons-io:2.8.0:compile (size unknown)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for abhayPlugin 1.0-SNAPSHOT:
[INFO]
[INFO] abhayPlugin ........................................ SUCCESS [ 0.878 s]
[INFO] abhay-module-1 ..................................... SUCCESS [ 1.306 s]
[INFO] abhay-module-2 ..................................... SUCCESS [ 1.285 s]
[INFO] abhay-module-3 ..................................... SUCCESS [ 1.249 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.841 s
[INFO] Finished at: 2021-08-12T17:17:08+05:30
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] abhayPlugin [pom]
[INFO] abhay-module-1 [jar]
[INFO] abhay-module-2 [jar]
[INFO] abhay-module-3 [jar]
[INFO]
[INFO] -----------------------< org.abhay:abhayPlugin >------------------------
[INFO] Building abhayPlugin 1.0-SNAPSHOT [1/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhayPlugin ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[INFO] Skipping because packaging type pom.
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-1 >----------------------
[INFO] Building abhay-module-1 1.0-SNAPSHOT [2/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-1 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [0]:
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [0]:
POTENTIALLY UNUSED DIRECT DEPENDENCIES [0]:
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [0]:
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-2 >----------------------
[INFO] Building abhay-module-2 1.0-SNAPSHOT [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-2 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [1]:
com.fasterxml.jackson.core:jackson-core:2.12.2:compile (size unknown)
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [0]:
POTENTIALLY UNUSED DIRECT DEPENDENCIES [3]:
commons-codec:commons-codec:1.15:compile (size unknown)
com.jcabi:jcabi-manifests:1.1:compile (size unknown)
commons-io:commons-io:2.8.0:compile (size unknown)
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [2]:
org.slf4j:slf4j-api:1.7.5:compile (size unknown)
com.jcabi:jcabi-log:0.14:compile (size unknown)
[INFO]
[INFO] ----------------------< org.abhay:abhay-module-3 >----------------------
[INFO] Building abhay-module-3 1.0-SNAPSHOT [4/4]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Could not transfer metadata org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from/to example-repo (C:\Users\ABHAY SINGH/.m2/repository): Cannot access C:\Users\ABHAY SINGH/.m2/repository with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] Failure to transfer org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from C:\Users\ABHAY SINGH/.m2/repository was cached in the local repository, resolution will not be reattempted until the update interval of example-repo has elapsed or updates are forced. Original error: Could not transfer metadata org.abhay:abhay-module-2:1.0-SNAPSHOT/maven-metadata.xml from/to example-repo (C:\Users\ABHAY SINGH/.m2/repository): Cannot access C:\Users\ABHAY SINGH/.m2/repository with type default using the available connector factories: BasicRepositoryConnectorFactory
[INFO]
[INFO] --- depclean-maven-plugin:2.0.2-SNAPSHOT:depclean (default-cli) @ abhay-module-3 ---
-------------------------------------------------------
[INFO] Starting DepClean dependency analysis
[WARNING] Dependencies were not copied locally
-------------------------------------------------------
D E P C L E A N A N A L Y S I S R E S U L T S
-------------------------------------------------------
USED DIRECT DEPENDENCIES [1]:
org.abhay:abhay-module-2:1.0-SNAPSHOT:compile (size unknown)
USED INHERITED DEPENDENCIES [0]:
USED TRANSITIVE DEPENDENCIES [3]:
commons-codec:commons-codec:1.15:compile (size unknown)
com.fasterxml.jackson.core:jackson-core:2.12.2:compile (size unknown)
com.jcabi:jcabi-manifests:1.1:compile (size unknown)
POTENTIALLY UNUSED DIRECT DEPENDENCIES [0]:
POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]:
POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [3]:
org.slf4j:slf4j-api:1.7.5:compile (size unknown)
com.jcabi:jcabi-log:0.14:compile (size unknown)
commons-io:commons-io:2.8.0:compile (size unknown)
-------------------------------------------------------
[INFO] DEPENDENT MODULES FOUND
Due to dependent modules, the debloated result of some dependencies from previous modules has been changed now.
The dependency-module details of such dependencies with the new results are as follows :
1) ModuleCoordinates : org.abhay:abhay-module-2:1.0-SNAPSHOT
DependencyCoordinates : com.jcabi:jcabi-manifests:1.1:compile
OldType : unusedDirect
NewType : usedDirect
2) ModuleCoordinates : org.abhay:abhay-module-2:1.0-SNAPSHOT
DependencyCoordinates : commons-codec:commons-codec:1.15:compile
OldType : unusedDirect
NewType : usedDirect
-------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for abhayPlugin 1.0-SNAPSHOT:
[INFO]
[INFO] abhayPlugin ........................................ SUCCESS [ 0.878 s]
[INFO] abhay-module-1 ..................................... SUCCESS [ 1.306 s]
[INFO] abhay-module-2 ..................................... SUCCESS [ 1.285 s]
[INFO] abhay-module-3 ..................................... SUCCESS [ 1.249 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.841 s
[INFO] Finished at: 2021-08-12T17:17:08+05:30
[INFO] ------------------------------------------------------------------------
The implementation of the above feature is here #101. You can review it and provide me the feedback as soon as possible. Thank you |
Nice idea. |
Sorry to say, but to my knowledge, this is not possible and actually, this was the whole problem for me, just think, if I have a way of adding the summary report at the end of the build, then instead of the summary report, I will prefer the bulk analysis of the result of all modules generated by depclean and then the problem of multi-module analysis would never arrive, but the things didn't work this way. I had already spent a lot of time researching this. How do they work? Also, I think the only solution to it is inside the maven reactor codebase because the work performed by the reactor can only be possible by the bulk analysis of modules, not individual analysis. Unfortunately, I didn't find the codebase and logic behind the working of the maven reactor, but I am researching this, and maybe in the future I will be able to implement this summary report too. 😄 Until then I will try to add some new tests. 👨🏽💻 Thank you |
And if you don't mind, please answer her too. |
Hello @tdurieux @bbaudry Thank you |
It would be great if you help me . |
Sorry @ABHAY0O7, I was on holiday without my laptop. I am reviewing and merging your PRs. |
Hello @Amishakumari544, |
@ABHAY0O7 can you implement a test harness for the gralde plugin, using the small gradle projects that you initiated with issue #91?
The text was updated successfully, but these errors were encountered: