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

Install target packages #14

Merged
merged 5 commits into from
Oct 9, 2024
Merged

Install target packages #14

merged 5 commits into from
Oct 9, 2024

Conversation

A2va
Copy link
Contributor

@A2va A2va commented Sep 15, 2024

I noticed that the target packages were not installed, like other so file, so I added that.
In addition, apart from the target file, no files are deleted in the _clean_artifacts function (cxx stl, ...).

@A2va
Copy link
Contributor Author

A2va commented Sep 29, 2024

@waruqi
I started working on using the install function with optional installdir and libdir.
But I'm confronted with a problem when changing arch, I thought of using something like:

local targets = _get_targets(...)
for _, arch in ipairs({"armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"}) do
	if abi_filters[arch] then
		options["arch"] = arch
		task.run("config", options)
	end
end

But since _get_targets calls project.target or project.ordertargets, the targets are loaded there.
So when running the config task it says project and targets may have been loaded early!
Do you have any idea to find a way around it ?

@waruqi
Copy link
Member

waruqi commented Oct 4, 2024

please do not run config task. gradle will call config task

@A2va
Copy link
Contributor Author

A2va commented Oct 4, 2024

Yes I know, but how to change arch without running the config task ?
The install function install the target (and the deps) only for current arch.

@A2va
Copy link
Contributor Author

A2va commented Oct 4, 2024

I think, I have found a solution.

import("private.action.require.register", {alias = "register_packages"})

local targets = _get_targets(...)
for _, arch in ipairs({"armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"}) do
	if abi_filters[arch] then
		config.set("arch", arch)
		register_packages()
	end
end

What do you think ?

@waruqi
Copy link
Member

waruqi commented Oct 5, 2024

maybe we can split it to gradle task for each arch.

@waruqi
Copy link
Member

waruqi commented Oct 5, 2024

We can add xmakeInstallForArmv7, xmakeInstallForXXX tasks to install so for each arch in xmakeInstall task.

like build task:

then modify install_artifacts.lua to only install single arch library.

@A2va
Copy link
Contributor Author

A2va commented Oct 5, 2024

Yes, that's exactly what I was thinking when I looked at the code.

@waruqi
Copy link
Member

waruqi commented Oct 8, 2024

Thanks, I will test it in these days.

if os.emptydir(installdir) then
os.tryrm(installdir)
-- clean cxxstl
local ndk_cxxstl = get_config("ndk_cxxstl")
Copy link
Member

Choose a reason for hiding this comment

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

ndk_cxxstl has been deprecated, please use runtimes.

    local ndk_cxxstl = get_config("runtimes") or get_config("ndk_cxxstl")

end
end

-- main entry
function main(libsdir, installdir, archs, ...)
function main(installdir, arch, clean, ...)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

then xmake l install_artfacts.lua --installdir=xxx --arch=xxx --clean

@waruqi waruqi merged commit b70538c into xmake-io:dev Oct 9, 2024
task.dependsOn("xmakeBuildFor" + forName)
}
}
def installTask = project.tasks.register("xmakeInstall", XMakeBuildTask, new Action<XMakeInstallTask>() {
Copy link
Member

Choose a reason for hiding this comment

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

XMakeBuildTask -> XMakeInstallTask

it will break, did you test it?

else
_clean_artifacts(installdir, targets, arch)
end
assert(not targets or #targets == 0, "no targets provided, make sure to have at least one shared target in your xmake.lua or to provide one")
Copy link
Member

Choose a reason for hiding this comment

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

and here it's always false.

@waruqi
Copy link
Member

waruqi commented Oct 9, 2024

I have fixed it.

@A2va A2va deleted the install-packages branch October 9, 2024 09:45
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.

2 participants