Add query to select all public declarations from target assemblies

This commit is contained in:
Tamas Vajk
2021-04-13 17:15:16 +02:00
parent bfa9bf33c0
commit 3f0a158b3c
2 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
/**
* Tool to generate C# stubs from a qltest snapshot.
*/
import csharp
import Stubs
/** All public declarations from assemblies. */
class AllExternalPublicDeclarations extends GeneratedDeclaration {
AllExternalPublicDeclarations() {
this.fromLibrary() and
this.(Modifiable).isEffectivelyPublic()
}
}
/** All framework assemblies. */
class NonTargetAssembly extends ExcludedAssembly {
NonTargetAssembly() {
exists(this.getFile().getAbsolutePath().indexOf("Microsoft.NETCore.App.Ref"))
}
}
select generatedCode()

View File

@@ -46,7 +46,7 @@ if not os.path.isdir(dbDir):
print("\nRunning query")
helpers.run_cmd(['codeql', 'query', 'run', os.path.join(
thisDir, 'MinimalStubsFromSource.ql'), '--database', dbDir, '--output', bqrsFile])
thisDir, 'AllStubsFromReference.ql'), '--database', dbDir, '--output', bqrsFile])
helpers.run_cmd(['codeql', 'bqrs', 'decode', bqrsFile, '--output',
outputFile, '--format=text', '--no-titles'])