Code Monkey home page Code Monkey logo

Comments (6)

frankbarbarino avatar frankbarbarino commented on August 20, 2024

Looking at the source, it looks like I can specify a csprojPath file. But again, it is unsuccessful.
For the version and metadata, the plugin prefers the spec file over the project and the project over the csproj. But again, my nuspec just has $version$ for a version. It is filled in by the project. Even if I manually set and overwrte this as the callfire-api-client-csharp project did, it seems to be looking for all the toher metadata attributes in the nuspe - all of which are templated $x$

Instead of using the version of the project or the version of the
nugetPack{ csprojPath = file("${project.name}.csproj") }

from gradle-nuget-plugin.

gluck avatar gluck commented on August 20, 2024

I struggle to understand what you're trying to do sorry.
Maybe you can try running gradle with -i/--info so you'll see which nuget command-line is being executed for pack, and let us know what you'd like instead, maybe that'll be clearer ?

Good luck.

from gradle-nuget-plugin.

timotei avatar timotei commented on August 20, 2024

How is the spec data filled in by the project? Do you have a runtime .targets file which does the logic? I'm pretty sure this will generate a temporary/intermediate .nuspec, otherwise you'll never be able to generate the final .nupkg if there's not real data in the .nuspec, no? What I mean is, AFAIK nuget doesn't combine info from the .csproj to interpolate the values you mention in the .nuspec.

from gradle-nuget-plugin.

frankbarbarino avatar frankbarbarino commented on August 20, 2024

I THOUGHT that is exactly what it was doing - nuget was having the project
fill the spec fields $id$ $title$ $description$ $version$ $author$... or
possibly not using the spec at all and just using the projects attributes.
Not sure. I have very little experience in the non-java domain, I was
sort of thrown into this task. What I do know is I cannot use the plugin
to pack or push, but I can call nuget directly passing in the project file
and it will pack and push. (having to do an extra back flip to get the
version from the AssemblyInfo.cs)
ext['nugetExecutable'] =
"${project.gradle.gradleUserHomeDir}/caches/nuget/${project.extensions.nuget.version}/NuGet.exe"
project.version = getVersion()
ext['nugetPackage'] = "${nugetOutputDir}/${project.name
}.${project.version}.nupkg"
task pack(type:Exec, dependsOn: ['msbuild', 'copyRelease', 'prepack']) {
workingDir "${projectDir}"
executable = "${nugetExecutable}"
args = [
"pack",
"${projectDir}/${project.name}.csproj",
"-OutputDirectory", "${nugetOutputDir}",
"-NonInteractive",
"-Verbosity", "normal"
]
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}
task push(type:Exec, dependsOn:'pack') {
workingDir "${projectDir}"
executable = "${nugetExecutable}"
args = [
"push", "${nugetPackage}",
"-Source", "${ARTIFACTORY_PUBLISHING_REPO}",
"-ApiKey", 'ArtifactorySnapshot',
"-ConfigFile", "${projectDir}/../../NuGet.Config",
"-NonInteractive",
"-Verbosity", "normal"
]
}
def getVersion() {
def ver = ''
def regex = ~/[assembly: AssemblyVersion("(.*)")]/
def matcher = regex.matcher(new File(project.assemblyInfo).text)
while(matcher.find()) {
ver = matcher.group(1)
}
project.version = ver
return ver
}
If nuget can do it, it would be nice if the plugin could as well.

Not exactly sure, but looking at the code it would seem it might if it
didn't pass the -Version when passed a csproj instead of a spec and if it
didn't try to check the spec meta data version first when a csproj file was
passed and recognize a spec file was not supplied.
Thinking about it, not sure why you would want to pass a version to nuget
anyway if the version is already either in the spec or in the csproj?
Help says -Version will override the nuspec version, which doesn't seem
like a good idea unless its being done for build automation. But it
basically negates having an AssemblyInfo->AssemblyVersion AND negates
having the spec file version. Possibly nice if someone really wanted that
behavior, but not in the general case.

On Wed, Oct 26, 2016 at 5:27 AM, Timotei Dolean [email protected]
wrote:

How is the spec data filled in by the project? Do you have a runtime
.targets file which does the logic? I'm pretty sure this will generate a
temporary/intermediate .nuspec, otherwise you'll never be able to generate
the final .nupkg if there's not real data in the .nuspec, no? What I mean
is, AFAIK nuget doesn't combine info from the .csproj to interpolate the
values you mention in the .nuspec.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#51 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIaeHtOJ90MrewiFgG_XYi-hMAd8td8Pks5q3x0MgaJpZM4KgSkX
.

from gradle-nuget-plugin.

frankbarbarino avatar frankbarbarino commented on August 20, 2024

FYI: confirmed the spec meta data is being populated from the AssemblyInfo.cs attributes.

from gradle-nuget-plugin.

ngyukman avatar ngyukman commented on August 20, 2024

nuspec data can be defined in build.gradle already

from gradle-nuget-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.