Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Add repl.fsx
Browse files Browse the repository at this point in the history
  • Loading branch information
cannorin committed Jan 18, 2022
1 parent ca48f70 commit 450781a
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 71 deletions.
44 changes: 23 additions & 21 deletions CoreTweet.Tests/CoreTweet.Tests.csproj
@@ -1,21 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>CoreTweet.Tests</AssemblyName>
<TargetFrameworks>net45;net461;netcoreapp3.1;net5</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE;BENCH</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../CoreTweet/CoreTweet.csproj"/>
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>CoreTweet.Tests</AssemblyName>
<TargetFrameworks Condition="'$(Configuration)' != 'Repl'">net45;net461;netcoreapp3.1;net5</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Repl'">netstandard2.1</TargetFrameworks>
<OutputPath Condition="'$(Configuration)' == 'Repl'">..\Release\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE;BENCH</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../CoreTweet/CoreTweet.csproj"/>
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions CoreTweet.Tests/Program.cs
Expand Up @@ -54,11 +54,11 @@ public class Data
public string Bearer { get; set; }
}

static partial class ApiTests
public static partial class ApiTests
{
static string SettingPath = "tokens.xml";
static Tokens Tokens { get; set; }
static OAuth2Token ApponlyToken { get; set; }
public static Tokens Tokens { get; set; }
public static OAuth2Token ApponlyToken { get; set; }

public static void SetupTokens()
{
Expand Down
2 changes: 1 addition & 1 deletion CoreTweet/CoreTweet.csproj
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;net461;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
Expand Down
16 changes: 8 additions & 8 deletions RestApisGen/RestApisGen.csproj
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>
80 changes: 42 additions & 38 deletions build.proj
@@ -1,38 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">

<Import Project="Directory.Build.props" />

<Target Name="RestApi">
<Exec Command='dotnet run --project RestApisGen/RestApisGen.csproj' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Build" DependsOnTargets="RestApi">
<Exec Command='dotnet build CoreTweet/CoreTweet.csproj -c Release' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Pack" DependsOnTargets="RestApi">
<Exec Condition=" '$(VersionSuffix)' != '' " Command='dotnet pack CoreTweet/CoreTweet.csproj -c Release -o "$(NupkgsDir)" --version-suffix "$(VersionSuffix)" ' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Condition=" '$(VersionSuffix)' == '' " Command='dotnet pack CoreTweet/CoreTweet.csproj -c Release -o "$(NupkgsDir)" ' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<ItemGroup>
<TestTarget Include="net45"/>
<TestTarget Include="net461"/>
<TestTarget Include="netcoreapp3.1"/>
<TestTarget Include="net5"/>
</ItemGroup>

<Target Name="VSTest">
<Exec Command="dotnet run CoreTweet.Tests/CoreTweet.Tests.csproj -c Release --framework %(TestTarget.Identity)" WorkingDirectory="$(RepoRootDir)CoreTweet.Tests" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Docs" DependsOnTargets="RestApi">
<!-- TODO
<Exec Condition="$([MSBuild]::IsOSPlatform('Windows'))" Command="" WorkingDirectory="$(RepoRootDir)" />
-->
<Exec Condition="!$([MSBuild]::IsOSPlatform('Windows'))" Command="sed -i 's/^PROJECT_NUMBER.*/PROJECT_NUMBER = $(Version)/' $(RepoRootDir)Doxyfile" WorkingDirectory="$(RepoRootDir)" />
<Exec Command='doxygen' WorkingDirectory="$(RepoRootDir)" />
</Target>

</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">

<Import Project="Directory.Build.props" />

<Target Name="RestApi">
<Exec Command='dotnet run --project RestApisGen/RestApisGen.csproj' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Build" DependsOnTargets="RestApi">
<Exec Command='dotnet build CoreTweet/CoreTweet.csproj -c Release' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Pack" DependsOnTargets="RestApi">
<Exec Condition=" '$(VersionSuffix)' != '' " Command='dotnet pack CoreTweet/CoreTweet.csproj -c Release -o "$(NupkgsDir)" --version-suffix "$(VersionSuffix)" ' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Condition=" '$(VersionSuffix)' == '' " Command='dotnet pack CoreTweet/CoreTweet.csproj -c Release -o "$(NupkgsDir)" ' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<ItemGroup>
<TestTarget Include="net45"/>
<TestTarget Include="net461"/>
<TestTarget Include="netcoreapp3.1"/>
<TestTarget Include="net5"/>
</ItemGroup>

<Target Name="VSTest">
<Exec Command="dotnet run CoreTweet.Tests/CoreTweet.Tests.csproj -c Release --framework %(TestTarget.Identity)" WorkingDirectory="$(RepoRootDir)CoreTweet.Tests" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Repl" DependsOnTargets="Build">
<Exec Command="dotnet build CoreTweet.Tests/CoreTweet.Tests.csproj -c Repl" WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="Docs" DependsOnTargets="RestApi">
<!-- TODO
<Exec Condition="$([MSBuild]::IsOSPlatform('Windows'))" Command="" WorkingDirectory="$(RepoRootDir)" />
-->
<Exec Condition="!$([MSBuild]::IsOSPlatform('Windows'))" Command="sed -i 's/^PROJECT_NUMBER.*/PROJECT_NUMBER = $(Version)/' $(RepoRootDir)Doxyfile" WorkingDirectory="$(RepoRootDir)" />
<Exec Command='doxygen' WorkingDirectory="$(RepoRootDir)" />
</Target>

</Project>
19 changes: 19 additions & 0 deletions repl.fsx
@@ -0,0 +1,19 @@
open System
open System.Diagnostics

let _ =
use p = Process.Start("dotnet", "build build.proj -t:Repl")
p.WaitForExit()
if p.ExitCode <> 0 then
exit p.ExitCode

#r "nuget: Newtonsoft.Json, 12.0.3"
#r "Release/netstandard2.1/CoreTweet.dll"
#r "Release/netstandard2.1/CoreTweet.Tests.dll"

open CoreTweet

let _ = CoreTweet.Tests.ApiTests.SetupTokens()

let tokens = CoreTweet.Tests.ApiTests.Tokens
let apponly = CoreTweet.Tests.ApiTests.ApponlyToken

0 comments on commit 450781a

Please sign in to comment.