-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Made sure artifact is correctly versioned and this can be viewed by `--version` * Extended property resolver to add meta data class containing type and location info on serialization * Removed unused code
- Loading branch information
1 parent
247e996
commit d718e88
Showing
10 changed files
with
151 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,6 @@ jobs: | |
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '7.x' | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build | ||
- name: Get next release version (dry run) | ||
id: taggerDryRun | ||
uses: anothrNick/[email protected] | ||
|
@@ -32,18 +28,23 @@ jobs: | |
DRY_RUN: true | ||
- name: echo new tag | ||
run: | | ||
echo "The next tag version will be: ${{ steps.taggerDryRun.outputs.new_tag }}" | ||
export NEXT_VERSION=${{ steps.taggerDryRun.outputs.new_tag }} | ||
echo "The next tag version will be: $NEXT_VERSION" | ||
- name: echo tag | ||
run: | | ||
echo "The current tag is: ${{ steps.taggerDryRun.outputs.tag }}" | ||
echo "The current tag is: ${{ steps.taggerDryRun.outputs.tag }}" | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Compile | ||
run: ./build-with-version $NEXT_VERSION | ||
- name: Build | ||
run: | | ||
dotnet publish -c Release -r linux-x64 -o ./release/linux DotNetAstGen/DotNetAstGen.csproj | ||
dotnet publish -c Release -r linux-arm -o ./release/linux-arm DotNetAstGen/DotNetAstGen.csproj | ||
dotnet publish -c Release -r osx-x64 -o ./release/macos DotNetAstGen/DotNetAstGen.csproj | ||
dotnet publish -c Release -r osx-arm64 -o ./release/macos-arm DotNetAstGen/DotNetAstGen.csproj | ||
dotnet publish -c Release -r win-x64 -o ./release/win DotNetAstGen/DotNetAstGen.csproj | ||
dotnet publish -c Release -r win-arm -o ./release/win-arm DotNetAstGen/DotNetAstGen.csproj | ||
./publish-release.sh linux x64 | ||
./publish-release.sh linux arm | ||
./publish-release.sh osx x64 | ||
./publish-release.sh osx arm64 | ||
./publish-release.sh win x64 | ||
./publish-release.sh win arm | ||
- name: Rename | ||
run: | | ||
mv ./release/linux/DotNetAstGen dotnetastgen-linux | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,4 +477,5 @@ $RECYCLE.BIN/ | |
*.lnk | ||
|
||
.idea | ||
**/*.json | ||
**/*.json | ||
.ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Newtonsoft.Json.Serialization; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Newtonsoft.Json; | ||
|
||
namespace DotNetAstGen | ||
{ | ||
public class SyntaxMetaDataProvider : IValueProvider | ||
{ | ||
public object GetValue(object target) | ||
{ | ||
return target.GetType().IsAssignableTo(typeof(SyntaxNode)) | ||
? GetNodeMetadata((SyntaxNode)target) | ||
: new SyntaxMetaData(); | ||
} | ||
|
||
private static SyntaxMetaData GetNodeMetadata(SyntaxNode node) | ||
{ | ||
var span = node.SyntaxTree.GetLineSpan(node.Span); | ||
return new SyntaxMetaData( | ||
$"ast.{node.Kind()}", | ||
span.StartLinePosition.Line, | ||
span.EndLinePosition.Line, | ||
span.StartLinePosition.Character, | ||
span.EndLinePosition.Character | ||
); | ||
} | ||
|
||
public void SetValue(object target, object value) | ||
{ | ||
// ignore | ||
} | ||
|
||
public static JsonProperty CreateMetaDataProperty() | ||
{ | ||
return new JsonProperty | ||
{ | ||
PropertyName = "MetaData", | ||
PropertyType = typeof(SyntaxMetaData), | ||
DeclaringType = typeof(SyntaxNode), | ||
ValueProvider = new SyntaxMetaDataProvider(), | ||
AttributeProvider = null, | ||
Readable = true, | ||
Writable = false, | ||
ShouldSerialize = _ => true | ||
}; | ||
} | ||
} | ||
|
||
public class SyntaxMetaData | ||
{ | ||
public SyntaxMetaData() | ||
{ | ||
} | ||
|
||
public SyntaxMetaData(string kind, int lineStart, int lineEnd, int columnStart, int columnEnd) | ||
{ | ||
Kind = kind; | ||
LineStart = lineStart; | ||
LineEnd = lineEnd; | ||
ColumnStart = columnStart; | ||
ColumnEnd = columnEnd; | ||
} | ||
|
||
public string Kind { get; set; } = "ast.None"; | ||
public int LineStart { get; set; } = -1; | ||
public int LineEnd { get; set; } = -1; | ||
public int ColumnStart { get; set; } = -1; | ||
public int ColumnEnd { get; set; } = -1; | ||
|
||
public override string ToString() | ||
{ | ||
return JsonConvert.SerializeObject(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.