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

HOTWO nugetSpec and list of files? #74

Closed
gigi81 opened this issue Aug 21, 2019 · 1 comment
Closed

HOTWO nugetSpec and list of files? #74

gigi81 opened this issue Aug 21, 2019 · 1 comment

Comments

@gigi81
Copy link

gigi81 commented Aug 21, 2019

I'm trying to get a list of files into the nuspec, using the syntax '*.txt' but I cannot make it work:

nugetSpec {
    nuspec = [
        metadata: [
            id:             project.package,
            version:        project.version,
            description:    project.description,
            authors:        project.authors
        ],
        files: [
            { file (src: '*.txt', target: 'content') },
        ]
    ]
}

I'm getting error:
Cannot create a package that has no dependencies nor content.

I tried also using project.files('.txt') instead of '.txt' but I'm getting the error:
File not found: 'file collection'.

Thanks

@gigi81
Copy link
Author

gigi81 commented Aug 22, 2019

So putting together info from other issues, I came up with this that works for me... maybe it can help somebody else:

nugetSpec {
    nuspec {
        metadata() {
            delegate.authors project.authors
            delegate.id project.package
        }
        files() {
            def filesXmlNode = delegate;
            project.fileTree(dir: '.', include:['*.txt']).each { filesXmlNode.file(src: it, target: 'content') }
        }
    }
}

@gigi81 gigi81 closed this as completed Aug 22, 2019
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

No branches or pull requests

1 participant