Skip to content
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

Replace Guava with Cactoos #1222

Closed
wants to merge 36 commits into from
Closed

Replace Guava with Cactoos #1222

wants to merge 36 commits into from

Conversation

filfreire
Copy link
Contributor

@filfreire filfreire commented Nov 28, 2017

@yegor256 kindly CR

This PR is for issue #1199

@yegor256 some notes:
Dependency is not completely removed, still pending are the includes (about 4) mentioned on these issues in Cactoos:

@0crat
Copy link
Collaborator

0crat commented Nov 28, 2017

@yegor256 please, pay attention to this pull request

@0crat
Copy link
Collaborator

0crat commented Nov 28, 2017

Job gh:yegor256/rultor#1222 is in scope.

@filfreire filfreire changed the title Replace Guava with Cactoos #1199 Replace Guava with Cactoos Nov 28, 2017
@@ -502,6 +507,14 @@
</execution>
</executions>
</plugin>
<plugin>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yegor256 FYI, had to add this since Cactoos uses lambda expressions.

indexes.toArray(new Integer[indexes.size()])
).intValue();
// @checkstyle IllegalCatchCheck (1 line)
} catch (final Throwable ex) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire use UncheckedScalar instead

new MapEntry<String, String>("since", format.format(prev)),
new MapEntry<String, String>("until", format.format(current))
);
final List<RepoCommit.Smart> commits = new ListOf<>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire better use SolidList instead

.put("until", format.format(current))
.build();
final List<RepoCommit.Smart> commits = Lists.newArrayList(
final Map<String, String> params = new MapOf<String, String>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire better use SolidMap instead

return input.toLowerCase(Locale.ENGLISH);
}
}
final List<String> logins = new ListOf<>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire use SolidList instead

new ImmutableMap.Builder<String, String>()
.put("head_branch", "master")
.put(
new MapOf<String, String>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire you need SolidMap

@@ -64,8 +64,9 @@ public QnGithubIssue(final Question question) {
public Req understand(final Comment.Smart comment, final URI home)
throws IOException {
Req req = this.origin.understand(comment, home);
if (!Iterables.isEmpty(req.dirs())) {
final Directives dirs = new Directives().append(req.dirs());
final ListOf<Directive> reqDirs = new ListOf<>(req.dirs());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire SolidList here

.put("fork_branch", head.ref())
.put("head_branch", base.ref())
.put(
new MapOf<String, String>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire use SolidMap

@@ -83,7 +87,8 @@ public Req understand(final Comment.Smart comment, final URI home)
throws IOException {
final Map<String, String> map = QnParametrized.params(comment);
Req req = this.origin.understand(comment, home);
if (!Iterables.isEmpty(req.dirs())) {
final List<Directive> directives = new ListOf<>(req.dirs());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire SolidList here

new ImmutableMap.Builder<String, String>()
.put("head_branch", "master")
.put(
new MapOf<String, String>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire SolidMap is always better

final List<Talk> siblings = Lists.newArrayList(
Iterables.limit(
this.talks.siblings(repo, since), Tv.TWENTY
final ListOf<Talk> siblings = new ListOf<>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire SolidList here

@@ -68,15 +68,15 @@

@Override
public Response act(final Request req) {
final Iterable<Tick> ticks = this.pulse.ticks();
final ListOf<Tick> ticks = new ListOf<>(this.pulse.ticks());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filfreire SolidList here

@yegor256
Copy link
Owner

@filfreire looks cool, but there are some comments above. Pay attention, ListOf is very stupid, it touches the encapsulated list on every operation. SolidList caches it inside.

* Replaced MapOf with SolidMap
* Replaced ListOf with SolidList
* Other minor improvements
@filfreire
Copy link
Contributor Author

@yegor256 I submitted commits following-up your CR. Please review again. Thanks 👍

Btw only missing removals of guava are the ones described in
yegor256/cactoos#472 and yegor256/cactoos#476

@yegor256
Copy link
Owner

yegor256 commented Dec 1, 2017

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Dec 1, 2017

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Dec 1, 2017

@rultor merge

@filfreire @yegor256 Oops, I failed. You can see the full log here (spent 9min)

                 
Downloaded: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar (0 B at 0.0 KB/sec)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 135 source files to /home/r/repo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:46 min
[INFO] Finished at: 2017-12-01T19:43:08+00:00
[INFO] Final Memory: 59M/512M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project rultor: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project rultor: Fatal error compiling
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:836)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid target release: 1.8
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:172)
	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:825)
	... 23 more
Caused by: java.lang.IllegalArgumentException: invalid target release: 1.8
	at com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:88)
	at com.sun.tools.javac.main.RecognizedOptions$10.process(RecognizedOptions.java:359)
	at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:242)
	at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
	at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:123)
	... 25 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
container d2a2df1b63cb2f4474045dd70ccc9a32ac3aee222b9f2fcfe0b89f313f414f23 is dead
Fri Dec  1 20:44:20 CET 2017

@filfreire
Copy link
Contributor Author

@yegor256 I believe the error we got with the failed build is related with https://stackoverflow.com/questions/28291691/fatal-error-compiling-invalid-target-release-1-8-help-1

Do you know how we can fix this ? Should we set the JAVA_HOME variable on .rultor.yml?

@filfreire
Copy link
Contributor Author

@yegor256
Copy link
Owner

yegor256 commented Dec 4, 2017

@filfreire let's make a separate ticket and I will upgrade Travis and Rultor to Java 8

@filfreire
Copy link
Contributor Author

@yegor256 created "Upgrade Travis and Rultor to Java 8" #1225

@yegor256
Copy link
Owner

yegor256 commented Dec 5, 2017

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Dec 5, 2017

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jan 24, 2018

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Jan 24, 2018

@rultor merge

@filfreire @yegor256 Oops, I failed. You can see the full log here (spent 2min)

 * [new branch]      1238       -> fork/1238
 * [new branch]      583        -> fork/583
 * [new branch]      gh-pages   -> fork/gh-pages
 * [new branch]      master     -> fork/master
 * [new branch]      master-clean -> fork/master-clean
+ args=
+ '[' only == default ']'
+ '[' only == no ']'
+ '[' only == only ']'
+ args=' --ff-only'
+ export BRANCH=__rultor
+ BRANCH=__rultor
++ git show-branch __rultor
++ wc -l
+ '[' 0 -gt 0 ']'
+ git checkout -B __rultor fork/1199dev
Switched to a new branch '__rultor'
Branch __rultor set up to track remote branch 1199dev from fork.
+ git checkout -B master origin/master
Switched to and reset branch 'master'
Branch master set up to track remote branch master from origin.
Your branch is up-to-date with 'origin/master'.
+ '[' true == true ']'
+ git checkout __rultor
Switched to branch '__rultor'
Your branch is up-to-date with 'fork/1199dev'.
+ git rebase master
First, rewinding head to replay your work on top of it...
Applying:  #1199 refactor guava for cactoos - wip
Applying:  #1199 bump cactoos + IndexesRequests refactor
Applying:  #1199 refactor cactoos agents + dynamo + web
Applying:  #1199 refactor cactoos agents + dynamo
Applying:  #1199 - bump cactoos version
Applying:  #1199 - replaced guava Files usage
Applying:  #1199 - bump cactoos version
Applying:  #1199 - bump cactoos version
Applying:  #1199 - remove guava dependency on RqUser
Applying:  #1199 - cr improvements
Applying:  #1199 - fix javadoc link issue
Using index info to reconstruct a base tree...
M	src/main/java/com/rultor/agents/ecs/StartsECS.java
M	src/main/java/com/rultor/agents/github/CommitsLog.java
M	src/main/java/com/rultor/dynamo/DyTalk.java
Falling back to patching base and 3-way merge...
Auto-merging src/main/java/com/rultor/dynamo/DyTalk.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/dynamo/DyTalk.java
Auto-merging src/main/java/com/rultor/agents/github/CommitsLog.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/github/CommitsLog.java
Auto-merging src/main/java/com/rultor/agents/ecs/StartsECS.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/ecs/StartsECS.java
error: Failed to merge in the changes.
Patch failed at 0011  #1199 - fix javadoc link issue
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

'cid' file is absent, container wasn't started correctly

@filfreire
Copy link
Contributor Author

@yegor256 I've merged master latest changes into this branch again. Kindly re-try to merge.

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jan 29, 2018

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Jan 29, 2018

@rultor merge

@filfreire @yegor256 Oops, I failed. You can see the full log here (spent 2min)

 * [new branch]      1238       -> fork/1238
 * [new branch]      583        -> fork/583
 * [new branch]      gh-pages   -> fork/gh-pages
 * [new branch]      master     -> fork/master
 * [new branch]      master-clean -> fork/master-clean
+ args=
+ '[' only == default ']'
+ '[' only == no ']'
+ '[' only == only ']'
+ args=' --ff-only'
+ export BRANCH=__rultor
+ BRANCH=__rultor
++ git show-branch __rultor
++ wc -l
+ '[' 0 -gt 0 ']'
+ git checkout -B __rultor fork/1199dev
Switched to a new branch '__rultor'
Branch __rultor set up to track remote branch 1199dev from fork.
+ git checkout -B master origin/master
Switched to and reset branch 'master'
Branch master set up to track remote branch master from origin.
Your branch is up-to-date with 'origin/master'.
+ '[' true == true ']'
+ git checkout __rultor
Switched to branch '__rultor'
Your branch is up-to-date with 'fork/1199dev'.
+ git rebase master
First, rewinding head to replay your work on top of it...
Applying:  #1199 refactor guava for cactoos - wip
Applying:  #1199 bump cactoos + IndexesRequests refactor
Applying:  #1199 refactor cactoos agents + dynamo + web
Applying:  #1199 refactor cactoos agents + dynamo
Applying:  #1199 - bump cactoos version
Applying:  #1199 - replaced guava Files usage
Applying:  #1199 - bump cactoos version
Applying:  #1199 - bump cactoos version
Applying:  #1199 - remove guava dependency on RqUser
Applying:  #1199 - cr improvements
Applying:  #1199 - fix javadoc link issue
Using index info to reconstruct a base tree...
M	src/main/java/com/rultor/agents/ecs/StartsECS.java
M	src/main/java/com/rultor/agents/github/CommitsLog.java
M	src/main/java/com/rultor/dynamo/DyTalk.java
Falling back to patching base and 3-way merge...
Auto-merging src/main/java/com/rultor/dynamo/DyTalk.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/dynamo/DyTalk.java
Auto-merging src/main/java/com/rultor/agents/github/CommitsLog.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/github/CommitsLog.java
Auto-merging src/main/java/com/rultor/agents/ecs/StartsECS.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/ecs/StartsECS.java
error: Failed to merge in the changes.
Patch failed at 0011  #1199 - fix javadoc link issue
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

'cid' file is absent, container wasn't started correctly

@filfreire
Copy link
Contributor Author

@yegor256 let's try to merge 1 more time. This time I reproduced the steps rultor is trying to do and solved the rebasing issues. Also re-run maven qulice build locally.

@yegor256
Copy link
Owner

yegor256 commented Feb 7, 2018

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Feb 7, 2018

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Feb 7, 2018

@rultor merge

@filfreire @yegor256 Oops, I failed. You can see the full log here (spent 2min)

 * [new branch]      583        -> fork/583
 * [new branch]      gh-pages   -> fork/gh-pages
 * [new branch]      master     -> fork/master
 * [new branch]      master-clean -> fork/master-clean
 * [new branch]      master-for-1199 -> fork/master-for-1199
+ args=
+ '[' only == default ']'
+ '[' only == no ']'
+ '[' only == only ']'
+ args=' --ff-only'
+ export BRANCH=__rultor
+ BRANCH=__rultor
++ git show-branch __rultor
++ wc -l
+ '[' 0 -gt 0 ']'
+ git checkout -B __rultor fork/1199dev
Switched to a new branch '__rultor'
Branch __rultor set up to track remote branch 1199dev from fork.
+ git checkout -B master origin/master
Switched to and reset branch 'master'
Branch master set up to track remote branch master from origin.
Your branch is up-to-date with 'origin/master'.
+ '[' true == true ']'
+ git checkout __rultor
Switched to branch '__rultor'
Your branch is up-to-date with 'fork/1199dev'.
+ git rebase master
First, rewinding head to replay your work on top of it...
Applying:  #1199 refactor guava for cactoos - wip
Applying:  #1199 bump cactoos + IndexesRequests refactor
Applying:  #1199 refactor cactoos agents + dynamo + web
Applying:  #1199 refactor cactoos agents + dynamo
Applying:  #1199 - bump cactoos version
Applying:  #1199 - replaced guava Files usage
Applying:  #1199 - bump cactoos version
Applying:  #1199 - bump cactoos version
Applying:  #1199 - remove guava dependency on RqUser
Applying:  #1199 - cr improvements
Applying:  #1199 - fix javadoc link issue
Using index info to reconstruct a base tree...
M	src/main/java/com/rultor/agents/ecs/StartsECS.java
M	src/main/java/com/rultor/agents/github/CommitsLog.java
M	src/main/java/com/rultor/dynamo/DyTalk.java
Falling back to patching base and 3-way merge...
Auto-merging src/main/java/com/rultor/dynamo/DyTalk.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/dynamo/DyTalk.java
Auto-merging src/main/java/com/rultor/agents/github/CommitsLog.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/github/CommitsLog.java
Auto-merging src/main/java/com/rultor/agents/ecs/StartsECS.java
CONFLICT (content): Merge conflict in src/main/java/com/rultor/agents/ecs/StartsECS.java
error: Failed to merge in the changes.
Patch failed at 0011  #1199 - fix javadoc link issue
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

'cid' file is absent, container wasn't started correctly

@filfreire
Copy link
Contributor Author

filfreire commented Feb 17, 2018

@yegor256 I'm opening a new PR with these changes from a "clean branch", without those conflicts on merge.
The new PR is #1246

You can close this PR, please.

@yegor256
Copy link
Owner

@filfreire closed (you can close your PRs too)

@0crat
Copy link
Collaborator

0crat commented Feb 19, 2018

The job #1222 is now out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants