-
Notifications
You must be signed in to change notification settings - Fork 5k
Add static library support for C++ language #3279
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
Conversation
c1057dd
to
31c4602
Compare
sharedLibrary("logger/build/lib/main/debug/shared/logger").assertExists() | ||
executable("app/build/exe/main/debug/shared/app").assertExists() | ||
installation("app/build/install/main/debug/shared").exec().out == app.expectedOutput | ||
file("app/build/install/main/debug/shared/lib").assertHasDescendants([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add something to the NativeInstallationFixture
to do this assertion, rather than duplicating knowledge of the layout in all of the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
result.assertTasksExecuted(compileAndLinkTasks(debug)) | ||
sharedLibrary("build/lib/main/debug/shared/hello").assertExists() | ||
staticLibrary("build/lib/main/debug/static/hello").assertDoesNotExist() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to be careful with 'does not exist' assertions in tests, these are unreliable unless we also verify 'exists' of the same thing somewhere else in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
mainMetadata.variant("releaseShared-link").availableAt.coords == "some.group:test_releaseShared:1.2" | ||
mainMetadata.variant("releaseShared-runtime").availableAt.coords == "some.group:test_releaseShared:1.2" | ||
|
||
assertSharedLibraryPublished(repo, 'debug') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want more modules, I think. The shared and static debug binaries should live in the debug module, and the shared and static release binaries should live in the release module.
* | ||
* @since 4.4 | ||
*/ | ||
CppExecutable getDebugStaticExecutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these don't make sense for applications, or at least, not many applications at all.
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.language.cpp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe should live somewhere more general than cpp
.
project.getComponents().add(application); | ||
project.getComponents().add(application.getDebugExecutable()); | ||
project.getComponents().add(application.getReleaseExecutable()); | ||
project.getComponents().add(application.getDebugStaticExecutable()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to add 'link everything statically' variants as a convention for applications. This (usually) doesn't make sense. That doesn't mean that this never happens, but for that situation we only need to make it possible to configure the build so that it will produce a 'link everything statically' variant, not the default.
} | ||
}); | ||
extension.getPublications().create("debug", MavenPublication.class, new Action<MavenPublication>() { | ||
extension.getPublications().create("debugShared", MavenPublication.class, new Action<MavenPublication>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want separate modules for (debug, release) x (shared, static) combination. I think we want a debug module that contains all the debug binaries, and a release module that contains all the release binaries.
} | ||
}); | ||
|
||
extension.getPublications().create("debugStatic", MavenPublication.class, new Action<MavenPublication>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we just want a debug module with all of the debug binaries in it, and a release module with all of the release binaries in it.
Closing this as abandon for now. |
Context
See gradle/gradle-native#160. This wraps up the work from the Montreal meetup.
Gradle Core Team Checklist