Skip to content

Commit

Permalink
Merge pull request #12 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
ricaun authored Feb 17, 2024
2 parents a7e8b6c + d86b544 commit 07f0827
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using ricaun.Nuke;
using ricaun.Nuke.Components;

class Build : NukeBuild, IPublishRevit, ITest
class Build : NukeBuild, IPublishRevit, ITest, IGitPreRelease
{
string IHazRevitPackageBuilder.Application => "Revit.App";
public static int Main() => Execute<Build>(x => x.From<IPublishRevit>().Build);
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.1.0] / 2024-02-17
### Features
- Support net core plugin.
### Added
- Add `CodeAnalysisCodeDom` to support net code.
- Update `CodeAnalysisCodeDomService` to work with multiple source code.
### Tests
- Test `GistGithubUtils` download string.
- Add `Newtonsoft.Json` to support `GistGithubUtils` download string.

## [1.0.6] / 2024-01-27
### Features
- Using `ricaun.Revit.UI.Tasks`
Expand Down Expand Up @@ -49,6 +59,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [x] AutoUpdater

[vNext]: ../../compare/1.0.0...HEAD
[1.1.0]: ../../compare/1.0.6...1.1.0
[1.0.6]: ../../compare/1.0.5...1.0.6
[1.0.5]: ../../compare/1.0.4...1.0.5
[1.0.4]: ../../compare/1.0.3...1.0.4
Expand Down
27 changes: 24 additions & 3 deletions RevitAddin.CommandLoader.Tests/CodeDom/CodeTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace RevitAddin.CommandLoader.Tests.CodeDom
public class CodeTester
{
const string code = """
using System;
public class Tests
{
public void Test() { }
Expand All @@ -13,16 +14,36 @@ public void Debug() { }
#endif
}
""";
public string Code => code;
const string code2 = """
using System;
public class Tests2
{
public void Test() { }
#if DEBUG
public void Debug() { }
#endif
}
""";
public string[] Code => new[] { code, code2 };
public string[] Defines => new[] { "DEBUG" };
public bool HasMethodTest(Assembly assembly)
{
var method = assembly.GetType("Tests").GetMethod("Test");
var method = assembly.GetType("Tests")?.GetMethod("Test");
return method is not null;
}
public bool HasMethodDebug(Assembly assembly)
{
var method = assembly.GetType("Tests").GetMethod("Debug");
var method = assembly.GetType("Tests")?.GetMethod("Debug");
return method is not null;
}
public bool HasMethodTest2(Assembly assembly)
{
var method = assembly.GetType("Tests2")?.GetMethod("Test");
return method is not null;
}
public bool HasMethodDebug2(Assembly assembly)
{
var method = assembly.GetType("Tests2")?.GetMethod("Debug");
return method is not null;
}
}
Expand Down
3 changes: 3 additions & 0 deletions RevitAddin.CommandLoader.Tests/CodeDomTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public void Test_ICodeDomService(ICodeDomService codeDomService)

Assert.IsTrue(CodeTester.HasMethodTest(assembly), "Test method not found.");
Assert.IsTrue(CodeTester.HasMethodDebug(assembly), "Debug method not found.");

Assert.IsTrue(CodeTester.HasMethodTest2(assembly), "Test method not found in the Tests2 class.");
Assert.IsTrue(CodeTester.HasMethodDebug2(assembly), "Debug method not found in the Tests2 class.");
}

[Test]
Expand Down
41 changes: 41 additions & 0 deletions RevitAddin.CommandLoader.Tests/GistGithubUtilsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using NUnit.Framework;
using RevitAddin.CommandLoader.Services;
using System;

namespace RevitAddin.CommandLoader.Tests
{
public class GistGithubUtilsTests
{
private const string GIST_SOURCE = "https://gist.github.com/ricaun/200a576c3baa45cba034ceedac1e708e";

[Test]
public void Test_TryGetGistFilesContent()
{
var hasGistContent = GistGithubUtils.TryGetGistFilesContent(GIST_SOURCE, out string[] contents);
Assert.IsTrue(hasGistContent, "Gist content not found.");
}

[Test]
public void Test_TryGetGistModel()
{
var hasGistContent = GistGithubUtils.TryGetGistModel(GIST_SOURCE, out var model);
Assert.IsTrue(hasGistContent, "Gist content not found.");
}

[Test]
public void Test_TryGetGistId()
{
var hasGistContent = GistGithubUtils.TryGetGistId(GIST_SOURCE, out var id);
Assert.IsTrue(hasGistContent, "Gist content not found.");
Console.WriteLine(id);
}

[Test]
public void Test_TryGetGistString()
{
var hasGistContent = GistGithubUtils.TryGetGistString(GIST_SOURCE, out string content);
Assert.IsTrue(hasGistContent, "Gist content not found.");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<LangVersion>Latest</LangVersion>
<Configurations>Debug 2017;2017;Debug 2021;2021</Configurations>
<Configurations>Debug 2017;2017;Debug 2021;2021;2025</Configurations>
</PropertyGroup>

<!-- RevitVersion -->
Expand Down Expand Up @@ -44,12 +44,18 @@
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
</When>
<When Condition="$(Configuration.Contains('2023'))">
<When Condition="$(Configuration.Contains('2024'))">
<PropertyGroup>
<RevitVersion>2023</RevitVersion>
<RevitVersion>2024</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
</When>
<When Condition="$(Configuration.Contains('2025'))">
<PropertyGroup>
<RevitVersion>2025</RevitVersion>
<TargetFramework>net8.0-windows</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<RevitVersion>2017</RevitVersion>
Expand All @@ -63,6 +69,13 @@
<DefineConstants>REVIT$(RevitVersion)</DefineConstants>
</PropertyGroup>

<!-- Net Core -->
<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<EnableDynamicLoading>true</EnableDynamicLoading>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateDependencyFile>false</GenerateDependencyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
Expand All @@ -77,4 +90,10 @@
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.*">
<NoWarn>NU1903</NoWarn>
</PackageReference>
</ItemGroup>

</Project>
9 changes: 8 additions & 1 deletion RevitAddin.CommandLoader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{E6
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitAddin.CommandLoader.Tests", "RevitAddin.CommandLoader.Tests\RevitAddin.CommandLoader.Tests.csproj", "{42C706AF-0255-4E98-A5A0-C043FA7B0496}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitAddin.CommandLoader.Tests", "RevitAddin.CommandLoader.Tests\RevitAddin.CommandLoader.Tests.csproj", "{42C706AF-0255-4E98-A5A0-C043FA7B0496}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2017|Any CPU = 2017|Any CPU
2021|Any CPU = 2021|Any CPU
2025|Any CPU = 2025|Any CPU
Debug 2017|Any CPU = Debug 2017|Any CPU
Debug 2021|Any CPU = Debug 2021|Any CPU
EndGlobalSection
Expand All @@ -28,18 +29,24 @@ Global
{82070359-36DA-4441-A59D-9018B6A8B348}.2017|Any CPU.Build.0 = 2017|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.2021|Any CPU.ActiveCfg = 2021|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.2021|Any CPU.Build.0 = 2021|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.2025|Any CPU.ActiveCfg = 2025|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.2025|Any CPU.Build.0 = 2025|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2017|Any CPU.ActiveCfg = Debug 2017|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2017|Any CPU.Build.0 = Debug 2017|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2021|Any CPU.ActiveCfg = Debug 2021|Any CPU
{82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2021|Any CPU.Build.0 = Debug 2021|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.2017|Any CPU.ActiveCfg = Release|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.2021|Any CPU.ActiveCfg = Release|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.2025|Any CPU.ActiveCfg = Debug|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.2025|Any CPU.Build.0 = Debug|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.Debug 2017|Any CPU.ActiveCfg = Debug|Any CPU
{34853418-411C-4B27-82AF-DDE5309AEE10}.Debug 2021|Any CPU.ActiveCfg = Debug|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2017|Any CPU.ActiveCfg = 2017|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2017|Any CPU.Build.0 = 2017|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2021|Any CPU.ActiveCfg = 2021|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2021|Any CPU.Build.0 = 2021|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2025|Any CPU.ActiveCfg = 2025|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.2025|Any CPU.Build.0 = 2025|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2017|Any CPU.ActiveCfg = Debug|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2017|Any CPU.Build.0 = Debug|Any CPU
{42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2021|Any CPU.ActiveCfg = Debug 2021|Any CPU
Expand Down
3 changes: 1 addition & 2 deletions RevitAddin.CommandLoader/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ public class App : IExternalApplication
private static UIControlledApplication UIControlledApplication;

private static RevitTaskService revitTaskService;
public static IRevitTask RevitTask { get; private set; }
public static IRevitTask RevitTask => revitTaskService;
public Result OnStartup(UIControlledApplication application)
{
revitTaskService = new RevitTaskService(application);
revitTaskService.Initialize();
RevitTask = new RevitTask(revitTaskService);

UIControlledApplication = application;
ribbonPanel = application.CreatePanel("CommandLoader");
Expand Down
45 changes: 39 additions & 6 deletions RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<Configurations>Debug 2017;2017;Debug 2021;2021</Configurations>
<Configurations>Debug 2017;2017;Debug 2021;2021;2025</Configurations>
</PropertyGroup>

<!-- RevitVersion -->
Expand Down Expand Up @@ -55,6 +55,18 @@
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
</When>
<When Condition="$(Configuration.Contains('2024'))">
<PropertyGroup>
<RevitVersion>2024</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
</When>
<When Condition="$(Configuration.Contains('2025'))">
<PropertyGroup>
<RevitVersion>2025</RevitVersion>
<TargetFramework>net8.0-windows</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<RevitVersion>2017</RevitVersion>
Expand All @@ -63,6 +75,13 @@
</Otherwise>
</Choose>

<!-- Net Core -->
<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<EnableDynamicLoading>true</EnableDynamicLoading>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateDependencyFile>false</GenerateDependencyFile>
</PropertyGroup>

<!-- Release -->
<PropertyGroup Condition="!$(Configuration.Contains('Debug'))">
<Optimize>true</Optimize>
Expand All @@ -89,7 +108,7 @@

<PropertyGroup>
<PackageId>RevitAddin.CommandLoader</PackageId>
<Version>1.0.6</Version>
<Version>1.1.0</Version>
<ProjectGuid>{82070359-36DA-4441-A59D-9018B6A8B348}</ProjectGuid>
</PropertyGroup>

Expand All @@ -115,9 +134,7 @@
<Copyright>Copyright © $(CopyrightYears) $(Company)</Copyright>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="ricaun.Revit.UI" Version="*" />
Expand Down Expand Up @@ -147,7 +164,23 @@
<PackageReference Include="Newtonsoft.Json" Version="9.*" IncludeAssets="build; compile" PrivateAssets="All">
<NoWarn>NU1903</NoWarn>
</PackageReference>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

<!-- Revit 2021-2024 -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
</ItemGroup>

<!-- Net Core -->
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="System.Drawing.Common" Version="*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

<!-- Revit 2025+ -->
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="System.CodeDom" Version="8.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 07f0827

Please sign in to comment.