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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer #322

Merged
merged 8 commits into from
Dec 21, 2017
Merged

Composer #322

merged 8 commits into from
Dec 21, 2017

Conversation

Bakual
Copy link
Contributor

@Bakual Bakual commented Dec 19, 2017

@infograf768 Can you test if that works?
It would add the Joomla/Github package from Composer and load it through the composer autoloader.
I haven't tested it yet myself, just threw this together 馃槃

I did it using a second composer.json file because we need the classes in the component directory.

@infograf768
Copy link
Contributor

Needs some small changes to use in 3.x.
require_once JPATH_ADMINISTRATOR . '/components/com_localise/vendor/autoload.php';
to be added in models/fields/releases.php

For 4.0 we will need to completely refactor the component as I have many errors.

@Bakual
Copy link
Contributor Author

Bakual commented Dec 19, 2017

Added the autoloader to JFormFieldReleases.
As for 4.0, many changes can already be done in J3.x. It will raise the minimum required Joomla version to J3.8 thought.

@Bakual
Copy link
Contributor Author

Bakual commented Dec 19, 2017

There is something I dislike about this way. Due to how composer works, it will load all dependencies of Joomla/Github as well. But those are already present in the Joomla CMS vendor folder. So we're duplicating those classes here;:

    "ircmaxell/password-compat": "v1.0.4",
    "joomla/compat": "1.2.0",
    "joomla/registry": "1.5.2",
    "joomla/string": "1.4.1",
    "joomla/uri": "1.1.1",
    "joomla/utilities": "1.4.1",
    "symfony/polyfill-php55": "v1.6.0"

From reading, it should be possible to declare those in a "provide" block in the composer.json file, however I couldn't make it work so composer wouldn't pull those classes in.

@infograf768
Copy link
Contributor

As for 4.0, many changes can already be done in J3.x. It will raise the minimum required Joomla version to J3.8 thought.

Indeed, we could add an alert. Looking into it now.

There is something I dislike about this way. Due to how composer works, it will load all dependencies of Joomla/Github as well.

That is over my skills but I see that the new vendor folder is a huge 1,8 Mb on disk... for 211 items...

@infograf768
Copy link
Contributor

infograf768 commented Dec 20, 2017

I guess missing in patch the vendor folder in localise.xml.
<folder>vendor</folder>

@Bakual
Copy link
Contributor Author

Bakual commented Dec 20, 2017

True, I have to add that folder into the XML.
And yes, the dependencies of the GitHub are crazy. Technically it would be no issue since most of them are already in Joomla available, but if we have to ship it as part of com_localise due to the way composer works, it pretty much makes composer unuseable for our needs. I'll ask around if someone knows a solution to this.

@Bakual
Copy link
Contributor Author

Bakual commented Dec 20, 2017

Added the vendor folder to the XML.

@Bakual
Copy link
Contributor Author

Bakual commented Dec 20, 2017

@infograf768 Figured it out with some help. Now it only contains the stuff which isn't already in Joomla.

@infograf768
Copy link
Contributor

infograf768 commented Dec 21, 2017

Test looks OK here on 3.8.4
vendor folder went down
Size: 918聽053 bytes (1,1 MB on disk) for 113 items

@infograf768
Copy link
Contributor

Note

Figured it out with some help

may I suggest to post somewhere a tutorial as this would be extremely useful for 3rd party devs?

@infograf768 infograf768 merged commit 7799bc4 into joomla-projects:develop Dec 21, 2017
@infograf768
Copy link
Contributor

Thanks. Will now take care of min version.

@Bakual Bakual deleted the Composer branch December 21, 2017 11:48
@Bakual
Copy link
Contributor Author

Bakual commented Dec 21, 2017

may I suggest to post somewhere a tutorial as this would be extremely useful for 3rd party devs?

I wouldn't know where to do that so it would be found by developers. Basically it would be this lines in the composer.json:

"replace": {
"ircmaxell/password-compat": "*",
"joomla/compat": "*",
"joomla/registry": "*",
"joomla/string": "*",
"joomla/uri": "*",
"joomla/utilities": "*",
"symfony/polyfill-php55": "*"
}

Now composer will not install the mentioned packages as dependencies. It's a hack but works.

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.

None yet

2 participants