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

LPS-115485 As a developer I can inject custom CSS variables declaring an OSGi component #21

Closed
wants to merge 8 commits into from

Conversation

wincent
Copy link

@wincent wincent commented Jun 16, 2020

Previously: https://github.com/wincent/liferay-portal/pull/354

Moving it here and will try to get a green ci:test:relevant run out of it.

cc @izaera

Original description follows:


This is a partial PR based on the original PoC https://github.com/jbalsas/liferay-portal/pull/2211. This implements the Frontend Infrastructure DynamicInclude part only, and provides tests for it.

Note that there's no way to test this from the GUI.


⚠️ This IMPORTANT CONVERSATION arised in the original PR, but because it is relevant I'm linking it here.

…lues

All instances of ScopedCSSVariablesProvider will be queried whenever a
page's HTML is rendered to gather all the ScopedCSSVariables that must
be injected in the page.

A ScopedCSSVariables object defines a set of CSS variable values tied to
a given CSS scope (f.e: :root, body, etc...)
…viders

This DynamicInclude renders all ScopedCSSVariables in the <head> tag of
the page's HTML right after the theme's CSS links are injected.
@wincent
Copy link
Author

wincent commented Jun 16, 2020

ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

To conserve resources, the PR Tester does not automatically run for every pull.

If your code changes were already tested in another pull, reference that pull in this pull so the test results can be analyzed.

If your pull was never tested, comment "ci:test" to run the PR Tester for this pull.

@wincent
Copy link
Author

wincent commented Jun 16, 2020

ci:test:relevant

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 4 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: ee8af6d3c052b2e98f267e2ca397582fa816f1a7

Sender Branch:

Branch Name: LPS-115485
Branch GIT ID: 2f9828c69c3d2041e238fde9d47f132f59e11113

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@brunobasto
Copy link

@izaera Maybe the OSGi API already takes care of this with the cardinality stuff, but let me ask: Is there a way for devs to specify some kind of priority in case they want to override variables already declared by some other previously deployed ScopedCSSVariablesProvider? By default I assume the order is not guaranteed or is the deployed order, right?

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 20 out of 20 jobs passed

❌ ci:test:relevant - 47 out of 49 jobs passed in 1 hour 21 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: ee8af6d3c052b2e98f267e2ca397582fa816f1a7

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: 1048e471849c8076c4823cc7dd4b82abffdac7c4

ci:test:stable - 20 out of 20 jobs PASSED
20 Successful Jobs:
ci:test:relevant - 47 out of 49 jobs PASSED
47 Successful Jobs:
For more details click here.

Failures unique to this pull:

  1. test-portal-acceptance-pullrequest-batch(master)/modules-unit-jdk8
    Job Results:

    58 Tests Passed.
    2 Tests Failed.

    1. AXIS_VARIABLE=0,label_exp=!master #360911
      1. ScopedCSSVariablesTopHeadDynamicIncludeTest.testIncludeWithMultipleProviders
        org.junit.ComparisonFailure: expected:<...a-track="temporary" [id="liferayCssVariablesCSS" ]type="text/css">
        :ro...> but was:<...a-track="temporary" []type="text/css">
        :ro...>
        	at org.junit.Assert.assertEquals(Assert.java:115)
        	at org.junit.Assert.assertEquals(Assert.java:144)
        	at com.liferay.frontend.css.variables.web.internal.servlet.taglib.ScopedCSSVariablesTopHeadDynamicIncludeTest.testIncludeWithMultipleProviders(ScopedCSSVariablesTopHeadDynamicIncludeTest.java:197)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        	at org.juni...
      2. ScopedCSSVariablesTopHeadDynamicIncludeTest.testInclude
        org.junit.ComparisonFailure: expected:<...a-track="temporary" [id="liferayCssVariablesCSS" ]type="text/css">
        :ro...> but was:<...a-track="temporary" []type="text/css">
        :ro...>
        	at org.junit.Assert.assertEquals(Assert.java:115)
        	at org.junit.Assert.assertEquals(Assert.java:144)
        	at com.liferay.frontend.css.variables.web.internal.servlet.taglib.ScopedCSSVariablesTopHeadDynamicIncludeTest.testInclude(ScopedCSSVariablesTopHeadDynamicIncludeTest.java:94)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        	at org.junit.runners.ParentRunner...

For upstream results, click here.

@wincent
Copy link
Author

wincent commented Jun 16, 2020

On the other PR @john-co flagged one of the test failures as likely related, and indeed it does look that way. Assigning back to you @izaera to address.

@izaera
Copy link
Collaborator

izaera commented Jun 17, 2020

@izaera Maybe the OSGi API already takes care of this with the cardinality stuff, but let me ask: Is there a way for devs to specify some kind of priority in case they want to override variables already declared by some other previously deployed ScopedCSSVariablesProvider? By default I assume the order is not guaranteed or is the deployed order, right?

Good question. I think the service.ranking would be enough to define priority, but as it is done in this PR, there's no guaranteed order now.

Should I use service.ranking or does anyone think that we may need something more complex?

@jbalsas
Copy link

jbalsas commented Jun 17, 2020

I think service.ranking should do the trick

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 20 out of 20 jobs passed

❌ ci:test:relevant - 47 out of 49 jobs passed in 3 hours 18 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: ecb3c6255b7625cad9b94acff082ae101ec34742

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: 1eb935eac6911217dfe48eb2379d11fb23dd7f33

ci:test:stable - 20 out of 20 jobs PASSED
20 Successful Jobs:
ci:test:relevant - 47 out of 49 jobs PASSED
47 Successful Jobs:
For more details click here.

Failures unique to this pull:

  1. test-portal-acceptance-pullrequest-batch(master)/modules-unit-jdk8
    Job Results:

    0 Tests Passed.
    1 Test Failed.

    1. AXIS_VARIABLE=0,label_exp=!master #363230
           [exec] * What went wrong:
           [exec] Execution failed for task ':apps:frontend-css:frontend-css-variables-web:compileTestJava'.
           [exec] > Compilation failed; see the compiler error output for details.
           [exec] 
           [exec] * Try:
           [exec] Run with --info or --debug option to get more log output. Run with --scan to get full insights.
           [exec] 
           [exec] * Exception is:
           [exec] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':apps:frontend-css:frontend-css-variables-web:compileTestJava'.
           [exec] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
           [exec] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
           [exec] 	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
           [exec] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
           [exec] 	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
           [exec] 	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
           [exec] 	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
           [exec] 	at org.gradle.api.internal.tasks.execution.StartSnapshotTaskInputsBuildOperationTaskExecuter.execute(StartSnapshotTaskInputsBuildOperationTaskExecuter.java:62)
           [exec] 	at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
           [exec] 	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
           [exec] 	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
           [exec] 	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
           [exec] 	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
           [exec] 	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)

For upstream results, click here.

@jbalsas
Copy link

jbalsas commented Jun 22, 2020

Test still failing @izaera 😢

@izaera
Copy link
Collaborator

izaera commented Jun 23, 2020

It doesn't compile 😭

@izaera
Copy link
Collaborator

izaera commented Jun 23, 2020

ci:test:relevant

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 20 out of 20 jobs passed

✔️ ci:test:relevant - 49 out of 49 jobs passed in 1 hour 23 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d7b659d0c9f0278aae1e7b580e59e6ce90ffb59d

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: 1eb935eac6911217dfe48eb2379d11fb23dd7f33

ci:test:stable - 20 out of 20 jobs PASSED
20 Successful Jobs:
ci:test:relevant - 49 out of 49 jobs PASSED
49 Successful Jobs:
For more details click here.

@izaera
Copy link
Collaborator

izaera commented Jun 23, 2020

Forwarding this as discussed with @jbalsas in a slack conversation.

@izaera
Copy link
Collaborator

izaera commented Jun 23, 2020

ci:forward

@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:relevant
  •     ci:test:sf

The pull request will automatically be forwarded to the user brianchandotcom if the following test suites pass:

  •     ci:test:relevant
  •     ci:test:sf
  •     ci:test:stable

@liferay-continuous-integration
Copy link
Collaborator

Skipping previously passed test suites:
ci:test:relevant

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 3 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: ee8af6d3c052b2e98f267e2ca397582fa816f1a7

Sender Branch:

Branch Name: LPS-115485
Branch GIT ID: 248e439a6eda313be4666ef7a416c781ad5d97a5

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

All required test suite(s) passed.
Forwarding pullrequest to brianchandotcom.

@liferay-continuous-integration
Copy link
Collaborator

Pull request has been successfully forwarded to brianchandotcom#90496

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

Successfully merging this pull request may close these issues.

5 participants