Skip to content

Commit

Permalink
submodule support, win update
Browse files Browse the repository at this point in the history
  • Loading branch information
dmkozh committed Jan 10, 2025
1 parent 7fd0678 commit d680aca
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Builds/VisualStudio/build_rust.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ if "%version%"=="" (
)

%set_linker_flags% & cd %project_dir%\src\rust\soroban\p21 & (set RUSTFLAGS=-Cmetadata=p21) & cargo +%version% build %release_profile% --package soroban-env-host --locked --target-dir %out_dir%\soroban-p21-target
%set_linker_flags% & cd %project_dir%\src\rust\soroban\p22 & (set RUSTFLAGS=-Cmetadata=p22) & cargo +%version% build %release_profile% --package soroban-env-host %features% --locked --target-dir %out_dir%\soroban-p22-target
cd %project_dir% & cargo +%version% rustc %release_profile% --package stellar-core --locked %features% --target-dir %out_dir%\target -- --extern soroban_env_host_p21=%out_dir%\soroban-p21-target\%2\libsoroban_env_host.rlib --extern soroban_env_host_p22=%out_dir%\soroban-p22-target\%2\libsoroban_env_host.rlib -L dependency=%out_dir%\soroban-p21-target\%2\deps -L dependency=%out_dir%\soroban-p22-target\%2\deps
%set_linker_flags% & cd %project_dir%\src\rust\soroban\p22 & (set RUSTFLAGS=-Cmetadata=p22) & cargo +%version% build %release_profile% --package soroban-env-host --locked --target-dir %out_dir%\soroban-p22-target
%set_linker_flags% & cd %project_dir%\src\rust\soroban\p23 & (set RUSTFLAGS=-Cmetadata=p23) & cargo +%version% build %release_profile% --package soroban-env-host --features next --locked --target-dir %out_dir%\soroban-p23-target
cd %project_dir% & cargo +%version% rustc %release_profile% --package stellar-core --locked %features% --target-dir %out_dir%\target -- --extern soroban_env_host_p21=%out_dir%\soroban-p21-target\%2\libsoroban_env_host.rlib --extern soroban_env_host_p22=%out_dir%\soroban-p22-target\%2\libsoroban_env_host.rlib --extern soroban_env_host_p23=%out_dir%\soroban-p23-target\%2\libsoroban_env_host.rlib -L dependency=%out_dir%\soroban-p21-target\%2\deps -L dependency=%out_dir%\soroban-p22-target\%2\deps -L dependency=%out_dir%\soroban-p23-target\%2\deps
5 changes: 3 additions & 2 deletions Builds/VisualStudio/stellar-core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,11 @@ exit /b 0
<ClCompile Include="..\..\src\catchup\ApplyLedgerWork.cpp" />
<ClCompile Include="..\..\src\catchup\AssumeStateWork.cpp" />
<ClCompile Include="..\..\src\catchup\CatchupConfiguration.cpp" />
<ClCompile Include="..\..\src\catchup\CatchupManagerImpl.cpp" />
<ClCompile Include="..\..\src\catchup\CatchupRange.cpp" />
<ClCompile Include="..\..\src\catchup\CatchupWork.cpp" />
<ClCompile Include="..\..\src\catchup\DownloadApplyTxsWork.cpp" />
<ClCompile Include="..\..\src\catchup\IndexBucketsWork.cpp" />
<ClCompile Include="..\..\src\catchup\LedgerApplyManagerImpl.cpp" />
<ClCompile Include="..\..\src\catchup\ReplayDebugMetaWork.cpp" />
<ClCompile Include="..\..\src\catchup\test\CatchupWorkTests.cpp" />
<ClCompile Include="..\..\src\catchup\VerifyLedgerChainWork.cpp" />
Expand Down Expand Up @@ -939,11 +939,12 @@ exit /b 0
<ClInclude Include="..\..\src\catchup\AssumeStateWork.h" />
<ClInclude Include="..\..\src\catchup\CatchupConfiguration.h" />
<ClInclude Include="..\..\src\catchup\CatchupManager.h" />
<ClInclude Include="..\..\src\catchup\CatchupManagerImpl.h" />
<ClInclude Include="..\..\src\catchup\CatchupRange.h" />
<ClInclude Include="..\..\src\catchup\CatchupWork.h" />
<ClInclude Include="..\..\src\catchup\DownloadApplyTxsWork.h" />
<ClInclude Include="..\..\src\catchup\IndexBucketsWork.h" />
<ClInclude Include="..\..\src\catchup\LedgerApplyManager.h" />
<ClInclude Include="..\..\src\catchup\LedgerApplyManagerImpl.h" />
<ClInclude Include="..\..\src\catchup\ReplayDebugMetaWork.h" />
<ClInclude Include="..\..\src\catchup\test\CatchupWorkTests.h" />
<ClInclude Include="..\..\src\catchup\VerifyLedgerChainWork.h" />
Expand Down
15 changes: 9 additions & 6 deletions Builds/VisualStudio/stellar-core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@
<ClCompile Include="..\..\src\catchup\CatchupConfiguration.cpp">
<Filter>catchup</Filter>
</ClCompile>
<ClCompile Include="..\..\src\catchup\CatchupManagerImpl.cpp">
<Filter>catchup</Filter>
</ClCompile>
<ClCompile Include="..\..\src\catchup\CatchupRange.cpp">
<Filter>catchup</Filter>
</ClCompile>
Expand Down Expand Up @@ -1365,6 +1362,9 @@
<ClCompile Include="..\..\src\ledger\test\InMemoryLedgerTxnRoot.cpp">
<Filter>ledger\tests</Filter>
</ClCompile>
<ClCompile Include="..\..\src\catchup\LedgerApplyManagerImpl.cpp">
<Filter>catchup</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\lib\util\cpptoml.h">
Expand Down Expand Up @@ -1829,9 +1829,6 @@
<ClInclude Include="..\..\src\catchup\CatchupManager.h">
<Filter>catchup</Filter>
</ClInclude>
<ClInclude Include="..\..\src\catchup\CatchupManagerImpl.h">
<Filter>catchup</Filter>
</ClInclude>
<ClInclude Include="..\..\src\catchup\CatchupRange.h">
<Filter>catchup</Filter>
</ClInclude>
Expand Down Expand Up @@ -2407,6 +2404,12 @@
<ClInclude Include="..\..\src\ledger\test\InMemoryLedgerTxnRoot.h">
<Filter>ledger\tests</Filter>
</ClInclude>
<ClInclude Include="..\..\src\catchup\LedgerApplyManager.h">
<Filter>catchup</Filter>
</ClInclude>
<ClInclude Include="..\..\src\catchup\LedgerApplyManagerImpl.h">
<Filter>catchup</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\AUTHORS" />
Expand Down
18 changes: 18 additions & 0 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,22 @@ use log::partition::TX;
// instance of it sees a different soroban. This is a bit of a hack and only
// works when the soroban versions all have a compatible _enough_ interface to
// all be called from "the same" contract.rs.
#[path = "."]
mod p23 {
pub(crate) extern crate soroban_env_host_p23;
pub(crate) use soroban_env_host_p23 as soroban_env_host;

pub(crate) mod contract;

// An adapter for some API breakage between p21 and p22.
pub(crate) const fn get_version_pre_release(v: &soroban_env_host::Version) -> u32 {
v.interface.pre_release
}

pub(crate) const fn get_version_protocol(v: &soroban_env_host::Version) -> u32 {
v.interface.protocol
}
}

#[path = "."]
mod p22 {
Expand Down Expand Up @@ -674,6 +690,7 @@ macro_rules! proto_versioned_functions_for_module {
const HOST_MODULES: &'static [HostModule] = &[
proto_versioned_functions_for_module!(p21),
proto_versioned_functions_for_module!(p22),
proto_versioned_functions_for_module!(p23),
];

fn get_host_module_for_protocol(
Expand Down Expand Up @@ -705,6 +722,7 @@ fn protocol_dispatches_as_expected() {
assert_eq!(get_host_module_for_protocol(20, 20).unwrap().max_proto, 21);
assert_eq!(get_host_module_for_protocol(21, 21).unwrap().max_proto, 21);
assert_eq!(get_host_module_for_protocol(22, 22).unwrap().max_proto, 22);
assert_eq!(get_host_module_for_protocol(23, 23).unwrap().max_proto, 23);

// No protocols past the max known.
let last_proto = HOST_MODULES.last().unwrap().max_proto;
Expand Down

0 comments on commit d680aca

Please sign in to comment.